]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/networkpublicnoticestream.php
FullNoticeStream selects all verbs.
[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 FullNoticeStream
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         self::filterVerbs($notice, $this->selectVerbs);
50
51         $ids = array();
52
53         if ($notice->find()) {
54             while ($notice->fetch()) {
55                 $ids[] = $notice->id;
56             }
57         }
58
59         $notice->free();
60         $notice = NULL;
61
62         return $ids;
63     }
64 }