]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/groupnoticestream.php
Merge branch 'doc-backup-restore-def-vals' into 'nightly'
[quix0rs-gnu-social.git] / lib / groupnoticestream.php
index 849dfeaaf5b9f09c43d5cafe2a16d49b2ebe9005..2d6e7b37cb4b6328b928e8d69ead7c631c4df739 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
-    // This check helps protect against security problems;
-    // your code file can't be executed directly from the web.
-    exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Stream of notices for a group
@@ -48,16 +44,13 @@ class GroupNoticeStream extends ScopingNoticeStream
 {
     var $group;
 
-    function __construct($group, $profile = -1)
+    function __construct($group, Profile $scoped=null)
     {
-        if (is_int($profile) && $profile == -1) {
-            $profile = Profile::current();
-        }
         $this->group = $group;
 
         parent::__construct(new CachingNoticeStream(new RawGroupNoticeStream($group),
                                                     'user_group:notice_ids:' . $group->id),
-                            $profile);
+                            $scoped);
     }
 
     function getNoticeIds($offset, $limit, $since_id, $max_id)
@@ -72,7 +65,7 @@ class GroupNoticeStream extends ScopingNoticeStream
     function getNotices($offset, $limit, $sinceId = null, $maxId = null)
     {
         if ($this->impossibleStream()) {
-            return array();
+            return new ArrayWrapper(array());
         } else {
             return parent::getNotices($offset, $limit, $sinceId, $maxId);
         }
@@ -81,7 +74,7 @@ class GroupNoticeStream extends ScopingNoticeStream
     function impossibleStream() 
     {
         if ($this->group->force_scope &&
-            (empty($this->profile) || !$this->profile->isMember($group))) {
+            (!$this->scoped instanceof Profile || $this->scoped->isMember($this->group))) {
             return true;
         }