]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Pass auth user into Atom feed generators (needed for outputting favorited status...
authorZach Copley <zach@status.net>
Thu, 27 May 2010 20:49:23 +0000 (13:49 -0700)
committerZach Copley <zach@status.net>
Thu, 27 May 2010 20:49:23 +0000 (13:49 -0700)
12 files changed:
actions/apitimelinefavorites.php
actions/apitimelinefriends.php
actions/apitimelinegroup.php
actions/apitimelinehome.php
actions/apitimelinementions.php
actions/apitimelinepublic.php
actions/apitimelineretweetsofme.php
actions/apitimelinetag.php
actions/apitimelineuser.php
lib/atomgroupnoticefeed.php
lib/atomnoticefeed.php
lib/atomusernoticefeed.php

index 79632447ef0782b1e9887a703e505efd0d60f054..a889b4918288dc35a9ff0722d1493231454e95af 100644 (file)
@@ -150,7 +150,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
 
             header('Content-Type: application/atom+xml; charset=utf-8');
 
-            $atom = new AtomNoticeFeed();
+            $atom = new AtomNoticeFeed($this->auth_user);
 
             $atom->setId($id);
             $atom->setTitle($title);
index ac350ab1b7a25acf8c5ee77dba5cd6269089670c..9c6ffcf9c53536c03ab6626e9b013398e50c904b 100644 (file)
@@ -152,7 +152,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
 
             header('Content-Type: application/atom+xml; charset=utf-8');
 
-            $atom = new AtomNoticeFeed();
+            $atom = new AtomNoticeFeed($this->auth_user);
 
             $atom->setId($id);
             $atom->setTitle($title);
index 56d1de094c5da37a12445f107151e66ced41af08..76fa74767e72bca6b75060465ab54395a86c1fab 100644 (file)
@@ -105,7 +105,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
     function showTimeline()
     {
         // We'll pull common formatting out of this for other formats
-        $atom = new AtomGroupNoticeFeed($this->group);
+        $atom = new AtomGroupNoticeFeed($this->group, $this->auth_user);
 
         $self = $this->getSelfUri();
 
index 1618c9923c8be7eb79b4c8bd2221afb982bca4b8..2a6b7bf5c17177bff76d4ee920f115d773011f2e 100644 (file)
@@ -151,7 +151,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
 
             header('Content-Type: application/atom+xml; charset=utf-8');
 
-            $atom = new AtomNoticeFeed();
+            $atom = new AtomNoticeFeed($this->auth_user);
 
             $atom->setId($id);
             $atom->setTitle($title);
index c3aec7c5afacb8dca1f6b971cd2d65d36cff9f1e..dc39122e570938c8fc34ad6a0849f2f589083f93 100644 (file)
@@ -151,7 +151,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
 
             header('Content-Type: application/atom+xml; charset=utf-8');
 
-            $atom = new AtomNoticeFeed();
+            $atom = new AtomNoticeFeed($this->auth_user);
 
             $atom->setId($id);
             $atom->setTitle($title);
index 9034614253d438b5566a1993c6b1da0182094b18..49062e603e3d81142c799d0c4ea6aea71bac3d5a 100644 (file)
@@ -130,7 +130,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
 
             header('Content-Type: application/atom+xml; charset=utf-8');
 
-            $atom = new AtomNoticeFeed();
+            $atom = new AtomNoticeFeed($this->auth_user);
 
             $atom->setId($id);
             $atom->setTitle($title);
index c77912fd0f24e209bed482232be7110eb7dd45be..ea922fc427121a039cf06d54b9a6716f35145618 100644 (file)
@@ -117,7 +117,7 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
 
             header('Content-Type: application/atom+xml; charset=utf-8');
 
-            $atom = new AtomNoticeFeed();
+            $atom = new AtomNoticeFeed($this->auth_user);
 
             $atom->setId($id);
             $atom->setTitle($title);
index fed1437ea805805a06ba4c3ba608aebbc952076d..c21b2270202719268d646ecfa1601b81d6a5fe78 100644 (file)
@@ -138,7 +138,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
 
             header('Content-Type: application/atom+xml; charset=utf-8');
 
-            $atom = new AtomNoticeFeed();
+            $atom = new AtomNoticeFeed($this->auth_user);
 
             $atom->setId($id);
             $atom->setTitle($title);
index 11431a82ca9231658ccf0ea8d82ec693905354e3..9ee6abaf54e7798f84c5b0ec495ab4a368d2bd1b 100644 (file)
@@ -115,7 +115,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
 
         // We'll use the shared params from the Atom stub
         // for other feed types.
-        $atom = new AtomUserNoticeFeed($this->user);
+        $atom = new AtomUserNoticeFeed($this->user, $this->auth_user);
 
         $link = common_local_url(
             'showstream',
index 08c1c707c578091a0d5eb7d67b0795d776b9f013..7934a4f9e5483ffcff4f17b249184f0860d13d92 100644 (file)
@@ -50,12 +50,13 @@ class AtomGroupNoticeFeed extends AtomNoticeFeed
      * Constructor
      *
      * @param Group   $group   the group for the feed
+     * @param User    $cur     the current authenticated user, if any
      * @param boolean $indent  flag to turn indenting on or off
      *
      * @return void
      */
-    function __construct($group, $indent = true) {
-        parent::__construct($indent);
+    function __construct($group, $cur = null, $indent = true) {
+        parent::__construct($cur, $indent);
         $this->group = $group;
 
         $title      = sprintf(_("%s timeline"), $group->nickname);
index 35a45118ce6525ed2f6ce52ba846e307e9d2a9af..ef44de4b6ce615bdafe4fc7e34f315ed06bceb01 100644 (file)
@@ -44,9 +44,22 @@ if (!defined('STATUSNET'))
  */
 class AtomNoticeFeed extends Atom10Feed
 {
-    function __construct($indent = true) {
+    var $cur;
+
+    /**
+     * 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;
+
         // Feeds containing notice info use these namespaces
 
         $this->addNamespace(
@@ -115,7 +128,7 @@ class AtomNoticeFeed extends Atom10Feed
         $source = $this->showSource();
         $author = $this->showAuthor();
 
-        $cur = common_current_user();
+        $cur = empty($this->cur) ? common_current_user() : $this->cur;
 
         $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur));
     }
index 428cc2de2f01192f46a212e97e398f97ba7afd5b..b569d937907d3f49f5be98665add1dbc811fdc28 100644 (file)
@@ -50,13 +50,14 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
      * Constructor
      *
      * @param User    $user    the user for the feed
+     * @param User    $cur     the current authenticated user, if any
      * @param boolean $indent  flag to turn indenting on or off
      *
      * @return void
      */
 
-    function __construct($user, $indent = true) {
-        parent::__construct($indent);
+    function __construct($user, $cur = null, $indent = true) {
+        parent::__construct($cur, $indent);
         $this->user = $user;
         if (!empty($user)) {
             $profile = $user->getProfile();