Esempio n. 1
0
 static function getStream($tag, $offset = 0, $limit = 20)
 {
     $qry = 'SELECT notice.* ' . 'FROM notice JOIN notice_tag ON notice.id = notice_tag.notice_id ' . "WHERE notice_tag.tag = '%s' ";
     return Notice::getStream(sprintf($qry, $tag), 'notice_tag:notice_stream:' . common_keyize($tag), $offset, $limit);
 }
Esempio n. 2
0
 function getNotices($offset = 0, $limit = NOTICES_PER_PAGE, $since_id = 0, $before_id = 0)
 {
     $qry = 'SELECT * ' . 'FROM notice ' . 'WHERE profile_id = %d ';
     return Notice::getStream(sprintf($qry, $this->id), 'profile:notices:' . $this->id, $offset, $limit, $since_id, $before_id);
 }
Esempio n. 3
0
 function publicStream($offset = 0, $limit = 20, $since_id = 0, $before_id = 0, $since = null)
 {
     $parts = array();
     $qry = 'SELECT * FROM notice ';
     if (common_config('public', 'localonly')) {
         $parts[] = 'is_local = 1';
     } else {
         # -1 == blacklisted
         $parts[] = 'is_local != -1';
     }
     if ($parts) {
         $qry .= ' WHERE ' . implode(' AND ', $parts);
     }
     return Notice::getStream($qry, 'public', $offset, $limit, $since_id, $before_id, null, $since);
 }
Esempio n. 4
0
 function getNotices($offset, $limit)
 {
     $qry = 'SELECT notice.* ' . 'FROM notice JOIN group_inbox ON notice.id = group_inbox.notice_id ' . 'WHERE group_inbox.group_id = %d ';
     return Notice::getStream(sprintf($qry, $this->id), 'group:notices:' . $this->id, $offset, $limit);
 }
Esempio n. 5
0
 function noticesWithFriends($offset = 0, $limit = NOTICES_PER_PAGE, $since_id = 0, $before_id = 0, $since = null)
 {
     $enabled = common_config('inboxes', 'enabled');
     # Complicated code, depending on whether we support inboxes yet
     # XXX: make this go away when inboxes become mandatory
     if ($enabled === false || $enabled == 'transitional' && $this->inboxed == 0) {
         $qry = 'SELECT notice.* ' . 'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' . 'WHERE subscription.subscriber = %d ';
         $order = null;
     } else {
         if ($enabled === true || $enabled == 'transitional' && $this->inboxed == 1) {
             $qry = 'SELECT notice.* ' . 'FROM notice JOIN notice_inbox ON notice.id = notice_inbox.notice_id ' . 'WHERE notice_inbox.user_id = %d ';
             # NOTE: we override ORDER
             $order = null;
         }
     }
     return Notice::getStream(sprintf($qry, $this->id), 'user:notices_with_friends:' . $this->id, $offset, $limit, $since_id, $before_id, $order, $since);
 }