class Rss10Action extends Action
{
- # 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.
var $creators = array();
var $limit = DEFAULT_RSS_LIMIT;
* @see Action::__construct
*/
- function __construct($output='php://output', $indent=true)
+ function __construct($output='php://output', $indent=null)
{
parent::__construct($output, $indent);
}
if (common_config('site', 'private')) {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
- # This header makes basic auth go
+ // This header makes basic auth go
header('WWW-Authenticate: Basic realm="StatusNet RSS"');
- # If the user hits cancel -- bam!
+ // If the user hits cancel -- bam!
$this->show_basic_auth_error();
return;
} else {
$password = $_SERVER['PHP_AUTH_PW'];
if (!common_check_user($nickname, $password)) {
- # basic authentication failed
+ // basic authentication failed
list($proxy, $ip) = common_client_ip();
common_log(LOG_WARNING, "Failed RSS auth attempt, nickname = $nickname, proxy = $proxy, ip = $ip.");
if (count($this->notices)) {
foreach ($this->notices as $n) {
- $this->showItem($n);
+ try {
+ $this->showItem($n);
+ } catch (Exception $e) {
+ // log exceptions and continue
+ common_log(LOG_ERR, $e->getMessage());
+ continue;
+ }
}
}
function showItem($notice)
{
- $profile = Profile::staticGet($notice->profile_id);
+ $profile = $notice->getProfile();
$nurl = common_local_url('shownotice', array('notice' => $notice->id));
$creator_uri = common_profile_uri($profile);
$this->elementStart('item', array('rdf:about' => $notice->uri,
$attachments = $notice->attachments();
if($attachments){
foreach($attachments as $attachment){
- $enclosure=$attachment->getEnclosure();
- if ($enclosure) {
+ try {
+ $enclosure = $attachment->getEnclosure();
$attribs = array('rdf:resource' => $enclosure->url);
if ($enclosure->title) {
$attribs['dc:title'] = $enclosure->title;
$attribs['enc:type'] = $enclosure->mimetype;
}
$this->element('enc:enclosure', $attribs);
+ } catch (ServerException $e) {
+ // There was not enough metadata available
}
$this->element('sioc:links_to', array('rdf:resource'=>$attachment->url));
}