some tweaks to items_fetch for the api
This commit is contained in:
parent
6911439f0e
commit
339a0f69c1
@ -1243,6 +1243,8 @@ require_once('include/items.php');
|
|||||||
|
|
||||||
$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 ";
|
||||||
|
|
||||||
|
//FIXME - this isn't yet implemented
|
||||||
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`,
|
||||||
@ -1263,23 +1265,20 @@ require_once('include/items.php');
|
|||||||
// intval($since_id),
|
// intval($since_id),
|
||||||
// intval($start), intval($count)
|
// intval($start), intval($count)
|
||||||
// );
|
// );
|
||||||
if ($user_info['self']==1) {
|
|
||||||
$r = items_fetch(array(
|
$arr = array(
|
||||||
'uid' => api_user(),
|
'uid' => api_user(),
|
||||||
'cid' => $user_info['id'],
|
'since_id' => $since_id,
|
||||||
'since_id' => $since_id,
|
'start' => $start,
|
||||||
'start' => $start,
|
'records' => $count);
|
||||||
'records' => $count,
|
|
||||||
'wall' => 1));
|
if ($user_info['self']==1)
|
||||||
}
|
$arr['wall'] = 1;
|
||||||
else {
|
else
|
||||||
$r = items_fetch(array(
|
$arr['cid'] = $user_info['id'];
|
||||||
'uid' => api_user(),
|
|
||||||
'cid' => $user_info['id'],
|
|
||||||
'since_id' => $since_id,
|
$r = items_fetch($arr,get_app()->get_channel(),get_observer_hash());
|
||||||
'start' => $start,
|
|
||||||
'records' => $count));
|
|
||||||
}
|
|
||||||
|
|
||||||
$ret = api_format_items($r,$user_info);
|
$ret = api_format_items($r,$user_info);
|
||||||
|
|
||||||
|
@ -3818,6 +3818,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(($client_mode & CLIENT_MODE_UPDATE) && (! ($client_mode & CLIENT_MODE_LOAD))) {
|
if(($client_mode & CLIENT_MODE_UPDATE) && (! ($client_mode & CLIENT_MODE_LOAD))) {
|
||||||
|
|
||||||
// only setup pagination on initial page view
|
// only setup pagination on initial page view
|
||||||
@ -3830,6 +3831,8 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||||||
$pager_sql = sprintf(" LIMIT %d, %d ",intval(get_app()->pager['start']), intval(get_app()->pager['itemspage']));
|
$pager_sql = sprintf(" LIMIT %d, %d ",intval(get_app()->pager['start']), intval(get_app()->pager['itemspage']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($arr['start']) && isset($arr['records']))
|
||||||
|
$pager_sql = sprintf(" LIMIT %d, %d ",intval($arr['start']), intval($arr['records']));
|
||||||
|
|
||||||
if(($arr['cmin'] != 0) || ($arr['cmax'] != 99)) {
|
if(($arr['cmin'] != 0) || ($arr['cmax'] != 99)) {
|
||||||
|
|
||||||
@ -3864,7 +3867,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||||||
$item_restrict = " AND item_restrict = 0 ";
|
$item_restrict = " AND item_restrict = 0 ";
|
||||||
|
|
||||||
|
|
||||||
if($arr['nouveau'] && ($client_mode & CLIENT_MODELOAD) && $channel) {
|
if($arr['nouveau'] && ($client_mode & CLIENT_MODE_LOAD) && $channel) {
|
||||||
// "New Item View" - show all items unthreaded in reverse created date order
|
// "New Item View" - show all items unthreaded in reverse created date order
|
||||||
|
|
||||||
$items = q("SELECT item.*, item.id AS item_id FROM item
|
$items = q("SELECT item.*, item.id AS item_id FROM item
|
||||||
@ -3889,7 +3892,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||||||
else
|
else
|
||||||
$ordering = "commented";
|
$ordering = "commented";
|
||||||
|
|
||||||
if(($client_mode & CLIENT_MODE_LOAD) || ($client_mode & CLIENT_MODE_NORMAL)) {
|
if(($client_mode & CLIENT_MODE_LOAD) || ($client_mode == CLIENT_MODE_NORMAL)) {
|
||||||
|
|
||||||
// Fetch a page full of parent items for this page
|
// Fetch a page full of parent items for this page
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user