]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fixes some non-defined variables in commit eb2f93a
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 28 Jul 2014 08:57:45 +0000 (10:57 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 28 Jul 2014 08:57:45 +0000 (10:57 +0200)
lib/activitystreamjsondocument.php
lib/atomnoticefeed.php
lib/atomusernoticefeed.php

index 767fb5dff734d61b10d4f5c56589db70ff5eef9e..0466045fef46c059a7e9a65c6bf2a4d47552e88e 100644 (file)
@@ -54,6 +54,7 @@ class ActivityStreamJSONDocument extends JSONActivityCollection
 
     /* The current authenticated user */
     protected $cur;
+    protected $scoped = null;
 
     /* Title of the document */
     protected $title;
@@ -75,7 +76,8 @@ class ActivityStreamJSONDocument extends JSONActivityCollection
     {
         parent::__construct($items, $url);
 
-        $this->cur = $cur;
+        $this->cur = $cur ?: common_current_user();
+        $this->scoped = !is_null($this->cur) ? $this->cur->getProfile() : null;
 
         /* Title of the JSON document */
         $this->title = $title;
@@ -138,10 +140,8 @@ class ActivityStreamJSONDocument extends JSONActivityCollection
 
     function addItemFromNotice($notice)
     {
-        $cur = empty($this->cur) ? common_current_user() : $this->cur;
-
-        $act          = $notice->asActivity($cur);
-        $act->extra[] = $notice->noticeInfo($cur->getProfile());
+        $act          = $notice->asActivity($this->scoped);
+        $act->extra[] = $notice->noticeInfo($this->scoped);
         array_push($this->items, $act->asArray());
         $this->count++;
     }
index b8821729185fa2eb800331b4b26c9d948d5e9c80..292bc97e8584ccfe0819bb93522d175051a5451d 100644 (file)
@@ -45,6 +45,7 @@ if (!defined('STATUSNET'))
 class AtomNoticeFeed extends Atom10Feed
 {
     var $cur;
+    protected $scoped=null;
 
     /**
      * Constructor - adds a bunch of XML namespaces we need in our
@@ -58,7 +59,8 @@ class AtomNoticeFeed extends Atom10Feed
     function __construct($cur = null, $indent = true) {
         parent::__construct($indent);
 
-        $this->cur = $cur;
+        $this->cur = $cur ?: common_current_user();
+        $this->scoped = !is_null($this->cur) ? $this->cur->getProfile() : null;
 
         // Feeds containing notice info use these namespaces
 
@@ -129,9 +131,7 @@ class AtomNoticeFeed extends Atom10Feed
             $source = $this->showSource();
             $author = $this->showAuthor();
 
-            $cur = empty($this->cur) ? common_current_user() : $this->cur;
-
-            $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur));
+            $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $this->scoped));
         } catch (Exception $e) {
             common_log(LOG_ERR, $e->getMessage());
             // we continue on exceptions
index d7f9b3d2337386f0bc5b770a0256a0b0c2d58deb..7b7f0a749f32910598d9b7c357b325422f95fdf3 100644 (file)
@@ -63,11 +63,8 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
             $profile = $user->getProfile();
 
             $ao = $profile->asActivityObject();
-
-            // quick fix until we start using Profile everywhere instead of User
-            $scoped = !is_null($cur) ? $cur->getProfile() : null;
-
-            array_push($ao->extra, $profile->profileInfo($scoped));
+            
+            array_push($ao->extra, $profile->profileInfo($this->scoped));
 
             $this->addAuthorRaw($ao->asString('author'));
         }