API work. Identicurse compatiblity
This commit is contained in:
parent
5c78872940
commit
46dd2535df
1 changed files with 29 additions and 18 deletions
|
@ -353,11 +353,15 @@
|
||||||
return api_get_user($a,$a->contacts[$normalised]['id']);
|
return api_get_user($a,$a->contacts[$normalised]['id']);
|
||||||
}
|
}
|
||||||
// We don't know this person directly.
|
// We don't know this person directly.
|
||||||
|
|
||||||
|
list($nick, $name) = array_map("trim",explode("(",$item['author-name']));
|
||||||
|
$name=str_replace(")","",$name);
|
||||||
|
|
||||||
$ret = array(
|
$ret = array(
|
||||||
'uid' => 0,
|
'uid' => 0,
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'name' => $item['author-name'],
|
'name' => $name,
|
||||||
'screen_name' => $item['author_name'],
|
'screen_name' => $nick,
|
||||||
'location' => '', //$uinfo[0]['default-location'],
|
'location' => '', //$uinfo[0]['default-location'],
|
||||||
'profile_image_url' => $item['author-avatar'],
|
'profile_image_url' => $item['author-avatar'],
|
||||||
'url' => $item['author-link'],
|
'url' => $item['author-link'],
|
||||||
|
@ -386,7 +390,7 @@
|
||||||
'notifications' => false,
|
'notifications' => false,
|
||||||
'verified' => true, #XXX: fix me
|
'verified' => true, #XXX: fix me
|
||||||
'followers' => '', #XXX: fix me
|
'followers' => '', #XXX: fix me
|
||||||
#'status' => null
|
'status' => array()
|
||||||
);
|
);
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@ -608,18 +612,18 @@
|
||||||
*/
|
*/
|
||||||
function api_statuses_home_timeline(&$a, $type){
|
function api_statuses_home_timeline(&$a, $type){
|
||||||
if (local_user()===false) return false;
|
if (local_user()===false) return false;
|
||||||
|
|
||||||
$user_info = api_get_user($a);
|
$user_info = api_get_user($a);
|
||||||
// get last newtork messages
|
// get last newtork messages
|
||||||
// $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` ) ";
|
|
||||||
|
|
||||||
// params
|
// params
|
||||||
$count = (x($_GET,'count')?$_GET['count']:20);
|
$count = (x($_REQUEST,'count')?$_REQUEST['count']:20);
|
||||||
$page = (x($_GET,'page')?$_GET['page']:0);
|
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
|
||||||
|
if ($page<0) $page=0;
|
||||||
|
$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
|
||||||
|
|
||||||
$start = $page*$count;
|
$start = $page*$count;
|
||||||
|
|
||||||
|
|
||||||
$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`,
|
||||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||||
|
@ -630,8 +634,10 @@
|
||||||
AND `contact`.`id` = `item`.`contact-id`
|
AND `contact`.`id` = `item`.`contact-id`
|
||||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||||
$sql_extra
|
$sql_extra
|
||||||
|
AND `item`.`id`>%d
|
||||||
ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
|
ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
|
||||||
intval($user_info['uid']),
|
intval($user_info['uid']),
|
||||||
|
intval($since_id),
|
||||||
intval($start), intval($count)
|
intval($start), intval($count)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -657,11 +663,12 @@
|
||||||
|
|
||||||
$user_info = api_get_user($a);
|
$user_info = api_get_user($a);
|
||||||
// get last newtork messages
|
// get last newtork messages
|
||||||
// $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` ) ";
|
|
||||||
|
|
||||||
// params
|
// params
|
||||||
$count = (x($_GET,'count')?$_GET['count']:20);
|
$count = (x($_REQUEST,'count')?$_REQUEST['count']:20);
|
||||||
$page = (x($_GET,'page')?$_GET['page']:0);
|
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
|
||||||
|
if ($page<0) $page=0;
|
||||||
|
$since_id = 0;//$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
|
||||||
|
|
||||||
$start = $page*$count;
|
$start = $page*$count;
|
||||||
|
|
||||||
|
@ -677,8 +684,10 @@
|
||||||
AND `contact`.`id` = `item`.`contact-id`
|
AND `contact`.`id` = `item`.`contact-id`
|
||||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||||
$sql_extra
|
$sql_extra
|
||||||
|
AND `item`.`id`>%d
|
||||||
ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
|
ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
|
||||||
intval($user_info['uid']),
|
intval($user_info['uid']),
|
||||||
|
intval($since_id),
|
||||||
intval($start), intval($count)
|
intval($start), intval($count)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -703,10 +712,11 @@
|
||||||
|
|
||||||
$user_info = api_get_user($a);
|
$user_info = api_get_user($a);
|
||||||
// get last newtork messages
|
// get last newtork messages
|
||||||
// $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` ) ";
|
|
||||||
// params
|
// params
|
||||||
$count = (x($_GET,'count')?$_GET['count']:20);
|
$count = (x($_GET,'count')?$_GET['count']:20);
|
||||||
$page = (x($_GET,'page')?$_GET['page']:0);
|
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
|
||||||
|
if ($page<0) $page=0;
|
||||||
|
|
||||||
$start = $page*$count;
|
$start = $page*$count;
|
||||||
|
|
||||||
|
@ -755,8 +765,8 @@
|
||||||
$status_user = (($item['cid']==$user_info['id'])?$user_info: api_item_get_user($a,$item));
|
$status_user = (($item['cid']==$user_info['id'])?$user_info: api_item_get_user($a,$item));
|
||||||
$status = array(
|
$status = array(
|
||||||
'created_at'=> api_date($item['created']),
|
'created_at'=> api_date($item['created']),
|
||||||
'published' => datetime_convert('UTC','UTC',$item['created'],ATOM_TIME),
|
'published' => api_date($item['created']),
|
||||||
'updated' => datetime_convert('UTC','UTC',$item['edited'],ATOM_TIME),
|
'updated' => api_date($item['edited']),
|
||||||
'id' => intval($item['id']),
|
'id' => intval($item['id']),
|
||||||
'message_id' => $item['uri'],
|
'message_id' => $item['uri'],
|
||||||
'text' => strip_tags(bbcode($item['body'])),
|
'text' => strip_tags(bbcode($item['body'])),
|
||||||
|
@ -965,7 +975,7 @@
|
||||||
$item = $r[0];
|
$item = $r[0];
|
||||||
$ret=Array(
|
$ret=Array(
|
||||||
'id' => $item['id'],
|
'id' => $item['id'],
|
||||||
'created_at'=> datetime_convert('UTC','UTC',$item['created'],ATOM_TIME),
|
'created_at'=> api_date($item['created']),
|
||||||
'sender_id'=> $sender['id'] ,
|
'sender_id'=> $sender['id'] ,
|
||||||
'sender_screen_name'=> $sender['screen_name'],
|
'sender_screen_name'=> $sender['screen_name'],
|
||||||
'sender'=> $sender,
|
'sender'=> $sender,
|
||||||
|
@ -1001,7 +1011,8 @@
|
||||||
|
|
||||||
// params
|
// params
|
||||||
$count = (x($_GET,'count')?$_GET['count']:20);
|
$count = (x($_GET,'count')?$_GET['count']:20);
|
||||||
$page = (x($_GET,'page')?$_GET['page']:0);
|
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
|
||||||
|
if ($page<0) $page=0;
|
||||||
|
|
||||||
$start = $page*$count;
|
$start = $page*$count;
|
||||||
|
|
||||||
|
@ -1033,7 +1044,7 @@
|
||||||
|
|
||||||
$ret[]=Array(
|
$ret[]=Array(
|
||||||
'id' => $item['id'],
|
'id' => $item['id'],
|
||||||
'created_at'=> datetime_convert('UTC','UTC',$item['created'],ATOM_TIME),
|
'created_at'=> api_date($item['created']),
|
||||||
'sender_id'=> $sender['id'] ,
|
'sender_id'=> $sender['id'] ,
|
||||||
'sender_screen_name'=> $sender['screen_name'],
|
'sender_screen_name'=> $sender['screen_name'],
|
||||||
'sender'=> $sender,
|
'sender'=> $sender,
|
||||||
|
|
Loading…
Reference in a new issue