]> git.mxchange.org Git - friendica.git/commitdiff
added exclude_replies option to api call statuses/home_timeline.
authorSebastian Egbers <sebastian@egbers.info>
Tue, 19 Jun 2012 14:15:19 +0000 (16:15 +0200)
committerSebastian Egbers <sebastian@egbers.info>
Tue, 19 Jun 2012 14:15:19 +0000 (16:15 +0200)
include/api.php

index 855e4efa3d16fa305f705d46b7dfa89f033bf52a..a58dd20dfaba67cf3fd13e200b46cac5329e0187 100644 (file)
                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`,