diff options
author | mac65 <mac65@mac65.com> | 2008-09-30 20:12:33 -0400 |
---|---|---|
committer | mac65 <mac65@mac65.com> | 2008-09-30 20:12:33 -0400 |
commit | c08a67094cb848e8bcd8f631aa44adf57a33b7ab (patch) | |
tree | d82c69fdf283483c455759ac6035d5fafaaef7d1 /classes/Notice.php | |
parent | 1c4f7722da90e8e8ce0489720ede223804885377 (diff) |
Add support for since_id and before_id to Twitter API. Ticket #540.
darcs-hash:20081001001233-e558a-3fcc269985050021ec9b44c052206c731cc4689d.gz
Diffstat (limited to 'classes/Notice.php')
-rw-r--r-- | classes/Notice.php | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index 7566136ce..cb153a2e5 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -308,12 +308,38 @@ class Notice extends Memcached_DataObject return $wrapper; } - function publicStream($offset=0, $limit=20) { + function publicStream($offset=0, $limit=20, $since_id=0, $before_id=0) { + $needAnd = FALSE; + $needWhere = TRUE; + $qry = 'SELECT * FROM notice '; if (common_config('public', 'localonly')) { $qry .= ' WHERE is_local = 1 '; + $needWhere = FALSE; + $needAnd = TRUE; + } + + // NOTE: since_id and before_id are extensions to Twitter API + if ($since_id > 0) { + if ($needWhere) + $qry .= ' WHERE '; + if ($needAnd) + $qry .= ' AND '; + $qry .= ' notice.id > ' . $since_id . ' '; + $needAnd = FALSE; + $needWhere = FALSE; + } + + if ($before_id > 0) { + if ($needWhere) + $qry .= ' WHERE '; + if ($needAnd) + $qry .= ' AND '; + $qry .= ' notice.id < ' . $before_id . ' '; + $needAnd = FALSE; + $needWhere = FALSE; } return Notice::getStream($qry, |