From: Craig Andrews Date: Thu, 23 Jul 2009 15:16:50 +0000 (-0400) Subject: Merge commit 'br3nda/0.8.x-tagrssfix' into 0.8.x X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=67e674773edc8de37ff542e8033b86c82593a3b9;p=quix0rs-gnu-social.git Merge commit 'br3nda/0.8.x-tagrssfix' into 0.8.x --- 67e674773edc8de37ff542e8033b86c82593a3b9 diff --cc lib/rssaction.php index 6c982705ef,23653e4062..0aca965664 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@@ -97,37 -97,8 +97,33 @@@ class Rss10Action extends Actio { // Parent handling, including cache check parent::handle($args); + + if (common_config('site', 'private')) { + if (!isset($_SERVER['PHP_AUTH_USER'])) { + + # This header makes basic auth go + header('WWW-Authenticate: Basic realm="Laconica RSS"'); + + # If the user hits cancel -- bam! + $this->show_basic_auth_error(); + return; + } else { + $nickname = $_SERVER['PHP_AUTH_USER']; + $password = $_SERVER['PHP_AUTH_PW']; + + if (!common_check_user($nickname, $password)) { + # basic authentication failed + list($proxy, $ip) = common_client_ip(); + + common_log(LOG_WARNING, "Failed RSS auth attempt, nickname = $nickname, proxy = $proxy, ip = $ip."); + $this->show_basic_auth_error(); + return; + } + } + } + // Get the list of notices - if (empty($this->tag)) { - $this->notices = $this->getNotices($this->limit); - } else { - $this->notices = $this->getTaggedNotices($this->tag, $this->limit); - } + $this->notices = $this->getNotices($this->limit); $this->showRss(); }