Rss10Action migrated to ManagedAction

This commit is contained in:
Mikael Nordfeldth 2015-07-09 23:14:23 +02:00
parent 06f60b57c1
commit b5b7a27f9b
2 changed files with 9 additions and 56 deletions

View File

@ -205,7 +205,7 @@ class Action extends HTMLOutputter // lawsuit
* *
* @return nothing * @return nothing
*/ */
function showPage() public function showPage()
{ {
if (GNUsocial::isAjax()) { if (GNUsocial::isAjax()) {
self::showAjax(); self::showAjax();

View File

@ -28,11 +28,11 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } if (!defined('GNUSOCIAL')) { exit(1); }
define('DEFAULT_RSS_LIMIT', 48); define('DEFAULT_RSS_LIMIT', 48);
class Rss10Action extends Action class Rss10Action extends ManagedAction
{ {
// This will contain the details of each feed item's author and be used to generate SIOC data. // This will contain the details of each feed item's author and be used to generate SIOC data.
@ -41,45 +41,14 @@ class Rss10Action extends Action
var $notices = null; var $notices = null;
var $tags_already_output = array(); var $tags_already_output = array();
/** public function isReadOnly($args)
* Constructor
*
* Just wraps the Action constructor.
*
* @param string $output URI to output to, default = stdout
* @param boolean $indent Whether to indent output, default true
*
* @see Action::__construct
*/
function __construct($output='php://output', $indent=null)
{
parent::__construct($output, $indent);
}
/**
* Do we need to write to the database?
*
* @return boolean true
*/
function isReadonly()
{ {
return true; return true;
} }
/** protected function doPreparation()
* Read arguments and initialize members
*
* @param array $args Arguments from $_REQUEST
* @return boolean success
*/
protected function prepare(array $args=array())
{ {
parent::prepare($args); $this->limit = $this->int('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;
@ -93,7 +62,7 @@ class Rss10Action extends Action
// If the user hits cancel -- bam! // If the user hits cancel -- bam!
$this->show_basic_auth_error(); $this->show_basic_auth_error();
return; // the above calls 'exit'
} else { } else {
$nickname = $_SERVER['PHP_AUTH_USER']; $nickname = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW']; $password = $_SERVER['PHP_AUTH_PW'];
@ -108,23 +77,6 @@ class Rss10Action extends Action
} }
} }
} }
return true;
}
/**
* Handle a request
*
* @param array $args Arguments from $_REQUEST
*
* @return void
*/
protected function handle()
{
// Parent handling, including cache check
parent::handle();
$this->showRss();
} }
function show_basic_auth_error() function show_basic_auth_error()
@ -137,6 +89,7 @@ class Rss10Action extends Action
$this->element('request', null, $_SERVER['REQUEST_URI']); $this->element('request', null, $_SERVER['REQUEST_URI']);
$this->elementEnd('hash'); $this->elementEnd('hash');
$this->endXML(); $this->endXML();
exit;
} }
/** /**
@ -170,7 +123,7 @@ class Rss10Action extends Action
return null; return null;
} }
function showRss() function showPage()
{ {
$this->initRss(); $this->initRss();
$this->showChannel(); $this->showChannel();