From d341358afbf19622575fa36a632f9d40b39ae202 Mon Sep 17 00:00:00 2001 From: Christian Vogeley Date: Wed, 22 Jan 2014 23:15:42 +0100 Subject: Add $since_id to items_fetch --- include/items.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/items.php b/include/items.php index ea46df9bf..6e4f9f0d6 100755 --- a/include/items.php +++ b/include/items.php @@ -3718,7 +3718,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $uidhash = $channel['channel_hash']; $item_uids = " item.uid = " . intval($uid) . " "; } - + if($arr['star']) $sql_options .= " and (item_flags & " . intval(ITEM_STARRED) . ") "; @@ -3726,7 +3726,10 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $sql_options .= " and (item_flags & " . intval(ITEM_WALL) . ") "; $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ") $sql_options ) "; - + + if($arr['since_id']) + $sql_extra .= " and item.id > " . $since_id . " "; + if($arr['gid'] && $uid) { $r = q("SELECT * FROM `groups` WHERE id = %d AND uid = %d LIMIT 1", intval($arr['group']), -- cgit v1.2.3 From 6b3ea9dc141e668e4f88e20e864daf845b349995 Mon Sep 17 00:00:00 2001 From: Christian Vogeley Date: Sat, 25 Jan 2014 03:50:47 +0100 Subject: API My wall posts --- include/api.php | 46 ++++++++++++++++++++++++++++------------------ include/items.php | 8 +++++--- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/include/api.php b/include/api.php index 463d29cf8..8cb2c3152 100644 --- a/include/api.php +++ b/include/api.php @@ -7,6 +7,7 @@ require_once("oauth.php"); require_once("html2plain.php"); require_once('include/security.php'); require_once('include/photos.php'); +require_once('include/items.php'); /* * @@ -1244,24 +1245,33 @@ require_once('include/photos.php'); if ($user_info['self']==1) $sql_extra .= " AND `item`.`wall` = 1 "; if ($exclude_replies > 0) $sql_extra .= ' AND `item`.`parent` = `item`.`id`'; - $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, - `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`, - `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` - FROM `item`, `contact` - WHERE `item`.`uid` = %d - AND `item`.`contact-id` = %d - AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 - AND `contact`.`id` = `item`.`contact-id` - AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - $sql_extra - AND `item`.`id`>%d - ORDER BY `item`.`received` DESC LIMIT %d ,%d ", - intval(api_user()), - intval($user_info['id']), - intval($since_id), - intval($start), intval($count) - ); +// $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, +// `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, +// `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`, +// `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` +// FROM `item`, `contact` +// WHERE `item`.`uid` = %d +// AND `item`.`contact-id` = %d +// AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 +// AND `contact`.`id` = `item`.`contact-id` +// AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 +// $sql_extra +// AND `item`.`id`>%d +// ORDER BY `item`.`received` DESC LIMIT %d ,%d ", +// intval(api_user()), +// intval($user_info['id']), +// intval($since_id), +// intval($start), intval($count) +// ); + + $r = items_fetch(array( + 'uid' => api_user(), + 'cid' => $user_info['id'], + 'since_id' => $since_id, + 'start' => $start, + 'records' => $count, + 'wall' => 1)); + $ret = api_format_items($r,$user_info); diff --git a/include/items.php b/include/items.php index 6e4f9f0d6..3b2fd2eec 100755 --- a/include/items.php +++ b/include/items.php @@ -3712,7 +3712,9 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C $def_acl = ''; $item_uids = ' true '; - + + if ($arr['uid']) $uid= $arr['uid']; + if($channel) { $uid = $channel['channel_id']; $uidhash = $channel['channel_hash']; @@ -3724,7 +3726,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C if($arr['wall']) $sql_options .= " and (item_flags & " . intval(ITEM_WALL) . ") "; - + $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ") $sql_options ) "; if($arr['since_id']) @@ -3893,7 +3895,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C ORDER BY item.$ordering DESC $pager_sql ", intval(ABOOK_FLAG_BLOCKED) ); - + } else { // update -- cgit v1.2.3 From b71e855c5b8abc782c6890d4865ea62e2f72a804 Mon Sep 17 00:00:00 2001 From: Christian Vogeley Date: Sat, 25 Jan 2014 13:44:31 +0100 Subject: remove wall restriction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit original didn’t have that --- include/api.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/api.php b/include/api.php index 8cb2c3152..3ab0aad27 100644 --- a/include/api.php +++ b/include/api.php @@ -1269,8 +1269,7 @@ require_once('include/items.php'); 'cid' => $user_info['id'], 'since_id' => $since_id, 'start' => $start, - 'records' => $count, - 'wall' => 1)); + 'records' => $count)); $ret = api_format_items($r,$user_info); -- cgit v1.2.3 From a25b8c951ba7c1f2f43c56b136bcea9731c6ab32 Mon Sep 17 00:00:00 2001 From: Christian Vogeley Date: Sat, 25 Jan 2014 22:56:15 +0100 Subject: Check user_info['self] in api user_timeline --- include/api.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/api.php b/include/api.php index 3ab0aad27..8ceae7787 100644 --- a/include/api.php +++ b/include/api.php @@ -1263,15 +1263,24 @@ require_once('include/items.php'); // intval($since_id), // intval($start), intval($count) // ); - + if ($user_info['self']==1) { $r = items_fetch(array( 'uid' => api_user(), 'cid' => $user_info['id'], 'since_id' => $since_id, 'start' => $start, - 'records' => $count)); - - + 'records' => $count, + 'wall' => 1)); + } + else { + $r = items_fetch(array( + 'uid' => api_user(), + 'cid' => $user_info['id'], + 'since_id' => $since_id, + 'start' => $start, + 'records' => $count)); + } + $ret = api_format_items($r,$user_info); -- cgit v1.2.3