Merge pull request #697 from annando/master

API can now fetch posts from a single thread
This commit is contained in:
fabrixxm 2013-06-17 05:09:54 -07:00
commit e3bb058e9f
2 changed files with 22 additions and 4 deletions

View File

@ -741,8 +741,9 @@
if ($page<0) $page=0; if ($page<0) $page=0;
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0); $since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_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); //$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$exclude_replies = (x($_REQUEST,'exclude_replies')?1:0);
$conversation_id = (x($_REQUEST,'conversation_id')?$_REQUEST['conversation_id']:0);
$start = $page*$count; $start = $page*$count;
@ -753,6 +754,8 @@
$sql_extra .= ' AND `item`.`id` <= '.intval($max_id); $sql_extra .= ' AND `item`.`id` <= '.intval($max_id);
if ($exclude_replies > 0) if ($exclude_replies > 0)
$sql_extra .= ' AND `item`.`parent` = `item`.`id`'; $sql_extra .= ' AND `item`.`parent` = `item`.`id`';
if ($conversation_id > 0)
$sql_extra .= ' AND `item`.`parent` = '.intval($conversation_id);
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
@ -816,6 +819,8 @@
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0); $since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0); $max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
//$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0); //$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$exclude_replies = (x($_REQUEST,'exclude_replies')?1:0);
$conversation_id = (x($_REQUEST,'conversation_id')?$_REQUEST['conversation_id']:0);
$start = $page*$count; $start = $page*$count;
@ -823,6 +828,10 @@
if ($max_id > 0) 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`';
if ($conversation_id > 0)
$sql_extra .= ' AND `item`.`parent` = '.intval($conversation_id);
/*$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, /*$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
@ -1124,14 +1133,19 @@
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0); $page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
if ($page<0) $page=0; if ($page<0) $page=0;
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']: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); //$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
$exclude_replies = (x($_REQUEST,'exclude_replies')?1:0);
$conversation_id = (x($_REQUEST,'conversation_id')?$_REQUEST['conversation_id']:0);
$start = $page*$count; $start = $page*$count;
$sql_extra = ''; $sql_extra = '';
if ($user_info['self']==1) $sql_extra .= " AND `item`.`wall` = 1 "; if ($user_info['self']==1) $sql_extra .= " AND `item`.`wall` = 1 ";
if ($exclude_replies > 0) $sql_extra .= ' AND `item`.`parent` = `item`.`id`';
if ($exclude_replies > 0)
$sql_extra .= ' AND `item`.`parent` = `item`.`id`';
if ($conversation_id > 0)
$sql_extra .= ' AND `item`.`parent` = '.intval($conversation_id);
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,

View File

@ -100,6 +100,10 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
$items = array_reverse($items); $items = array_reverse($items);
foreach ($items as $single_conv) { foreach ($items as $single_conv) {
// identi.ca just changed the format of the activity streams. This is a quick fix.
if (@is_string($single_conv->object->id))
$single_conv->id = $single_conv->object->id;
if (@!$single_conv->id AND $single_conv->provider->url AND $single_conv->statusnet_notice_info->local_id) if (@!$single_conv->id AND $single_conv->provider->url AND $single_conv->statusnet_notice_info->local_id)
$single_conv->id = $single_conv->provider->url."notice/".$single_conv->statusnet_notice_info->local_id; $single_conv->id = $single_conv->provider->url."notice/".$single_conv->statusnet_notice_info->local_id;