]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
Properly structure X-XSS-Protection header
[quix0rs-gnu-social.git] / classes / Notice.php
index 87363158dd7bd9353ed06b07f27f087d1ec84488..650dca051b359727ec00cc64c8f44b07cd280a3e 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
  * StatusNet - the distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, StatusNet, Inc.
+ * Copyright (C) 2008-2011 StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -84,9 +84,14 @@ class Notice extends Memcached_DataObject
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
 
+       function multiGet($kc, $kvs, $skipNulls=true)
+       {
+               return Memcached_DataObject::multiGet('Notice', $kc, $kvs, $skipNulls);
+       }
+       
     /* Notice types */
     const LOCAL_PUBLIC    =  1;
-    const REMOTE_OMB      =  0;
+    const REMOTE          =  0;
     const LOCAL_NONPUBLIC = -1;
     const GATEWAY         = -2;
 
@@ -229,11 +234,11 @@ class Notice extends Memcached_DataObject
      *              string 'created' timestamp of notice; defaults to now
      *              int 'is_local' source/gateway ID, one of:
      *                  Notice::LOCAL_PUBLIC    - Local, ok to appear in public timeline
-     *                  Notice::REMOTE_OMB      - Sent from a remote OMB service;
+     *                  Notice::REMOTE          - Sent from a remote service;
      *                                            hide from public timeline but show in
      *                                            local "and friends" timelines
      *                  Notice::LOCAL_NONPUBLIC - Local, but hide from public timeline
-     *                  Notice::GATEWAY         - From another non-OMB service;
+     *                  Notice::GATEWAY         - From another non-OStatus service;
      *                                            will not appear in public views
      *              float 'lat' decimal latitude for geolocation
      *              float 'lon' decimal longitude for geolocation
@@ -448,7 +453,7 @@ class Notice extends Memcached_DataObject
             if (!empty($reply)) {
                 $notice->scope = $reply->scope;
             } else {
-                $notice->scope = common_config('notice', 'defaultscope');
+                $notice->scope = self::defaultScope();
             }
         } else {
             $notice->scope = $scope;
@@ -1856,7 +1861,11 @@ class Notice extends Memcached_DataObject
         } else {
             $idstr = $cache->get(Cache::key('notice:repeats:'.$this->id));
             if ($idstr !== false) {
-                $ids = explode(',', $idstr);
+               if (empty($idstr)) {
+                       $ids = array();
+               } else {
+                       $ids = explode(',', $idstr);
+               }
             } else {
                 $ids = $this->_repeatStreamDirect(100);
                 $cache->set(Cache::key('notice:repeats:'.$this->id), implode(',', $ids));
@@ -1885,18 +1894,7 @@ class Notice extends Memcached_DataObject
             $notice->limit(0, $limit);
         }
 
-        $ids = array();
-
-        if ($notice->find()) {
-            while ($notice->fetch()) {
-                $ids[] = $notice->id;
-            }
-        }
-
-        $notice->free();
-        $notice = NULL;
-
-        return $ids;
+        return $notice->fetchAll('id');
     }
 
     function locationOptions($lat, $lon, $location_id, $location_ns, $profile = null)
@@ -2469,5 +2467,18 @@ class Notice extends Memcached_DataObject
         $skip = array('_original', '_profile');
         return array_diff($vars, $skip);
     }
+    
+    static function defaultScope()
+    {
+       $scope = common_config('notice', 'defaultscope');
+       if (is_null($scope)) {
+               if (common_config('site', 'private')) {
+                       $scope = 1;
+               } else {
+                       $scope = 0;
+               }
+       }
+       return $scope;
+    }
 
 }