]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/networkpublicnoticestream.php
use none instead of unset
[quix0rs-gnu-social.git] / lib / networkpublicnoticestream.php
1 <?php
2
3 if (!defined('GNUSOCIAL')) { exit(1); } 
4
5 class NetworkPublicNoticeStream extends ScopingNoticeStream
6 {
7     function __construct(Profile $scoped=null)
8     {
9         parent::__construct(new CachingNoticeStream(new RawNetworkPublicNoticeStream(),
10                                                     'networkpublic'),
11                             $scoped);
12     }
13 }
14
15 /**
16  * Raw public stream
17  *
18  * @category  Stream
19  * @package   StatusNet
20  * @author    Evan Prodromou <evan@status.net>
21  * @copyright 2011 StatusNet, Inc.
22  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
23  * @link      http://status.net/
24  */
25
26 class RawNetworkPublicNoticeStream extends NoticeStream
27 {
28     function getNoticeIds($offset, $limit, $since_id, $max_id)
29     {
30         $notice = new Notice();
31
32         $notice->selectAdd(); // clears it
33         $notice->selectAdd('id');
34
35         $notice->orderBy('created DESC, id DESC');
36
37         if (!is_null($offset)) {
38             $notice->limit($offset, $limit);
39         }
40
41         $notice->whereAdd('is_local ='. Notice::REMOTE);
42         // -1 == blacklisted, -2 == gateway (i.e. Twitter)
43         $notice->whereAdd('is_local !='. Notice::LOCAL_NONPUBLIC);
44         $notice->whereAdd('is_local !='. Notice::GATEWAY);
45
46         Notice::addWhereSinceId($notice, $since_id);
47         Notice::addWhereMaxId($notice, $max_id);
48
49         if (!empty($this->selectVerbs)) {
50             $notice->whereAddIn('verb', $this->selectVerbs, $notice->columnType('verb'));
51         }
52
53         $ids = array();
54
55         if ($notice->find()) {
56             while ($notice->fetch()) {
57                 $ids[] = $notice->id;
58             }
59         }
60
61         $notice->free();
62         $notice = NULL;
63
64         return $ids;
65     }
66 }