Output If-Modified-Since header for all RSS 1.0 feeds (again)

This commit is contained in:
Zach Copley 2009-09-24 15:10:55 -07:00
parent 93b7e60115
commit e566219299
7 changed files with 47 additions and 28 deletions

View File

@ -68,6 +68,7 @@ class AllrssAction extends Rss10Action
$this->clientError(_('No such user.')); $this->clientError(_('No such user.'));
return false; return false;
} else { } else {
$this->notices = $this->getNotices($this->limit);
return true; return true;
} }
} }

View File

@ -74,6 +74,7 @@ class FavoritesrssAction extends Rss10Action
$this->clientError(_('No such user.')); $this->clientError(_('No such user.'));
return false; return false;
} else { } else {
$this->notices = $this->getNotices($this->limit);
return true; return true;
} }
} }

View File

@ -104,6 +104,7 @@ class groupRssAction extends Rss10Action
return false; return false;
} }
$this->notices = $this->getNotices($this->limit);
return true; return true;
} }

View File

@ -49,6 +49,20 @@ require_once INSTALLDIR.'/lib/rssaction.php';
*/ */
class PublicrssAction extends Rss10Action class PublicrssAction extends Rss10Action
{ {
/**
* Read arguments and initialize members
*
* @param array $args Arguments from $_REQUEST
* @return boolean success
*/
function prepare($args)
{
parent::prepare($args);
$this->notices = $this->getNotices($this->limit);
return true;
}
/** /**
* Initialization. * Initialization.
* *

View File

@ -38,6 +38,7 @@ class RepliesrssAction extends Rss10Action
$this->clientError(_('No such user.')); $this->clientError(_('No such user.'));
return false; return false;
} else { } else {
$this->notices = $this->getNotices($this->limit);
return true; return true;
} }
} }

View File

@ -25,7 +25,6 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
class UserrssAction extends Rss10Action class UserrssAction extends Rss10Action
{ {
var $user = null;
var $tag = null; var $tag = null;
function prepare($args) function prepare($args)
@ -39,6 +38,7 @@ class UserrssAction extends Rss10Action
$this->clientError(_('No such user.')); $this->clientError(_('No such user.'));
return false; return false;
} else { } else {
$this->notices = $this->getNotices($this->limit);
return true; return true;
} }
} }
@ -64,10 +64,10 @@ class UserrssAction extends Rss10Action
function getNotices($limit=0) function getNotices($limit=0)
{ {
$user = $this->user; $user = $this->user;
if (is_null($user)) { if (is_null($user)) {
common_debug('null user');
return null; return null;
} }
@ -75,6 +75,7 @@ class UserrssAction extends Rss10Action
$notices = array(); $notices = array();
while ($notice->fetch()) { while ($notice->fetch()) {
common_debug("notice");
$notices[] = clone($notice); $notices[] = clone($notice);
} }

View File

@ -78,25 +78,12 @@ class Rss10Action extends Action
function prepare($args) function prepare($args)
{ {
parent::prepare($args); parent::prepare($args);
$this->limit = (int) $this->trimmed('limit'); $this->limit = (int) $this->trimmed('limit');
if ($this->limit == 0) { if ($this->limit == 0) {
$this->limit = DEFAULT_RSS_LIMIT; $this->limit = DEFAULT_RSS_LIMIT;
} }
return true;
}
/**
* Handle a request
*
* @param array $args Arguments from $_REQUEST
*
* @return void
*/
function handle($args)
{
// Parent handling, including cache check
parent::handle($args);
if (common_config('site', 'private')) { if (common_config('site', 'private')) {
if (!isset($_SERVER['PHP_AUTH_USER'])) { if (!isset($_SERVER['PHP_AUTH_USER'])) {
@ -122,8 +109,21 @@ class Rss10Action extends Action
} }
} }
// Get the list of notices return true;
$this->notices = $this->getNotices($this->limit); }
/**
* Handle a request
*
* @param array $args Arguments from $_REQUEST
*
* @return void
*/
function handle($args)
{
// Parent handling, including cache check
parent::handle($args);
$this->showRss(); $this->showRss();
} }
@ -140,7 +140,7 @@ class Rss10Action extends Action
} }
/** /**
* Get the notices to output in this stream * Get the notices to output in this stream.
* *
* @return array an array of Notice objects sorted in reverse chron * @return array an array of Notice objects sorted in reverse chron
*/ */