]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/scopingnoticestream.php
Merge branch 'nightly' into 'nightly'
[quix0rs-gnu-social.git] / lib / scopingnoticestream.php
index 9a101fa3ac03cd314f8e76ec3299ff077d1c354d..854903d33dee0414e5bab488052705afa08caa27 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); }
 
 /**
  * Class comment
@@ -49,16 +45,12 @@ class ScopingNoticeStream extends FilteringNoticeStream
 {
     protected $profile;
 
-    function __construct($upstream, $profile = -1)
+    function __construct(NoticeStream $upstream, Profile $scoped=null)
     {
         parent::__construct($upstream);
 
-        // Invalid but not null
-        if (is_int($profile) && $profile == -1) {
-            $profile = Profile::current();
-        }
-
-        $this->profile = $profile;
+        $this->profile = $scoped;   // legacy
+        $this->scoped = $scoped;
     }
 
     /**
@@ -69,9 +61,9 @@ class ScopingNoticeStream extends FilteringNoticeStream
      * @return boolean whether to include the notice
      */
 
-    function filter($notice)
+    protected function filter(Notice $notice)
     {
-        return $notice->inScope($this->profile);
+        return $notice->inScope($this->scoped);
     }
 
     function prefill($notices)
@@ -89,10 +81,9 @@ class ScopingNoticeStream extends FilteringNoticeStream
                 $pids[] = $profile->id;
             }
             
-            Memcached_DataObject::pivotGet('Profile_role',
-                                           'profile_id',
-                                           $pids,
-                                           array('role' => Profile_role::SILENCED));
+            Profile_role::pivotGet('profile_id',
+                                   $pids,
+                                   array('role' => Profile_role::SILENCED));
         }
     }
 }