API My wall posts

This commit is contained in:
Christian Vogeley 2014-01-25 03:50:47 +01:00
parent d341358afb
commit 6b3ea9dc14
2 changed files with 33 additions and 21 deletions

View File

@ -7,6 +7,7 @@ require_once("oauth.php");
require_once("html2plain.php"); require_once("html2plain.php");
require_once('include/security.php'); require_once('include/security.php');
require_once('include/photos.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 ($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`';
$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`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` // `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact` // FROM `item`, `contact`
WHERE `item`.`uid` = %d // WHERE `item`.`uid` = %d
AND `item`.`contact-id` = %d // AND `item`.`contact-id` = %d
AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 // AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
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 // AND `item`.`id`>%d
ORDER BY `item`.`received` DESC LIMIT %d ,%d ", // ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
intval(api_user()), // intval(api_user()),
intval($user_info['id']), // intval($user_info['id']),
intval($since_id), // intval($since_id),
intval($start), intval($count) // 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); $ret = api_format_items($r,$user_info);

View File

@ -3713,6 +3713,8 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$item_uids = ' true '; $item_uids = ' true ';
if ($arr['uid']) $uid= $arr['uid'];
if($channel) { if($channel) {
$uid = $channel['channel_id']; $uid = $channel['channel_id'];
$uidhash = $channel['channel_hash']; $uidhash = $channel['channel_hash'];