summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-12-16 08:15:18 +0100
committerAndrew Dolgov <[email protected]>2005-12-16 08:15:18 +0100
commit47c6c988d9fd6e043bb322c7c07e9bb35ffd6759 (patch)
tree2b5078cb9fc09e505329b1d2c9adf9cc6f97d926 /functions.php
parent855d0ecfda212ef36f35fff63e93dc8c6afd1126 (diff)
support for feed http auth
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/functions.php b/functions.php
index dbdc1ce69..5a4683bf9 100644
--- a/functions.php
+++ b/functions.php
@@ -169,17 +169,31 @@
return;
}
- $result = db_query($link, "SELECT update_interval
+ $result = db_query($link, "SELECT update_interval,auth_login,auth_pass
FROM ttrss_feeds WHERE id = '$feed'");
+ $auth_login = db_fetch_result($result, 0, "auth_login");
+ $auth_pass = db_fetch_result($result, 0, "auth_pass");
+
$update_interval = db_fetch_result($result, 0, "update_interval");
if ($update_interval < 0) { return; }
$feed = db_escape_string($feed);
+ $fetch_url = $feed_url;
+
+ if ($auth_login && $auth_pass) {
+ $url_parts = array();
+ preg_match("/(^[^:]*):\/\/(.*)/", $fetch_url, $url_parts);
+
+ if ($url_parts[1] && $url_parts[2]) {
+ $fetch_url = $url_parts[1] . "://$auth_login:$auth_pass@" . $url_parts[2];
+ }
+
+ }
error_reporting(0);
- $rss = fetch_rss($feed_url);
+ $rss = fetch_rss($fetch_url);
error_reporting (DEFAULT_ERROR_LEVEL);