From 43532b74142cfabd0afbf250d052bff99b0d7ef2 Mon Sep 17 00:00:00 2001 From: Sebastian Egbers Date: Tue, 19 Jun 2012 16:15:19 +0200 Subject: [PATCH 1/2] added exclude_replies option to api call statuses/home_timeline. --- include/api.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/api.php b/include/api.php index 855e4efa3..a58dd20df 100644 --- a/include/api.php +++ b/include/api.php @@ -719,14 +719,18 @@ if ($page<0) $page=0; $since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0); $max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0); + $exclude_replies = (x($_REQUEST,'exclude_replies')?1:0); //$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0); $start = $page*$count; //$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false); + $sql_extra = ''; if ($max_id > 0) - $sql_extra = 'AND `item`.`id` <= '.intval($max_id); + $sql_extra .= ' AND `item`.`id` <= '.intval($max_id); + 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`, From eab3938471cd6d27b37be1b6f13dc4418c8ad020 Mon Sep 17 00:00:00 2001 From: Sebastian Egbers Date: Tue, 19 Jun 2012 16:27:23 +0200 Subject: [PATCH 2/2] added exclude_replies option to api call statuses/user_timeline. --- include/api.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/api.php b/include/api.php index a58dd20df..691543907 100644 --- a/include/api.php +++ b/include/api.php @@ -1065,11 +1065,14 @@ $page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0); if ($page<0) $page=0; $since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0); + $exclude_replies = (x($_REQUEST,'exclude_replies')?1:0); //$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0); $start = $page*$count; - if ($user_info['self']==1) $sql_extra = "AND `item`.`wall` = 1 "; + $sql_extra = ''; + 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`,