X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fatomnoticefeed.php;h=292bc97e8584ccfe0819bb93522d175051a5451d;hb=4e26527447852f88d48bf40a4f208079fcb77a49;hp=35a45118ce6525ed2f6ce52ba846e307e9d2a9af;hpb=d9fddff5395e77287c4de0796fd072b3073f1eb9;p=quix0rs-gnu-social.git diff --git a/lib/atomnoticefeed.php b/lib/atomnoticefeed.php index 35a45118ce..292bc97e85 100644 --- a/lib/atomnoticefeed.php +++ b/lib/atomnoticefeed.php @@ -44,9 +44,24 @@ if (!defined('STATUSNET')) */ class AtomNoticeFeed extends Atom10Feed { - function __construct($indent = true) { + var $cur; + protected $scoped=null; + + /** + * Constructor - adds a bunch of XML namespaces we need in our + * notice-specific Atom feeds, and allows setting the current + * authenticated user (useful for API methods). + * + * @param User $cur the current authenticated user (optional) + * @param boolean $indent Whether to indent XML output + * + */ + function __construct($cur = null, $indent = true) { parent::__construct($indent); + $this->cur = $cur ?: common_current_user(); + $this->scoped = !is_null($this->cur) ? $this->cur->getProfile() : null; + // Feeds containing notice info use these namespaces $this->addNamespace( @@ -82,7 +97,7 @@ class AtomNoticeFeed extends Atom10Feed $this->addNamespace( 'statusnet', - 'http://status.net/ont/' + 'http://status.net/schema/api/1/' ); } @@ -112,12 +127,15 @@ class AtomNoticeFeed extends Atom10Feed */ function addEntryFromNotice($notice) { - $source = $this->showSource(); - $author = $this->showAuthor(); - - $cur = common_current_user(); - - $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur)); + try { + $source = $this->showSource(); + $author = $this->showAuthor(); + + $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $this->scoped)); + } catch (Exception $e) { + common_log(LOG_ERR, $e->getMessage()); + // we continue on exceptions + } } function showSource()