aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-01-25 15:03:23 -0800
committerfriendica <info@friendica.com>2014-01-25 15:03:23 -0800
commit6911439f0e5bce19cdefb722378d695f5f7db65e (patch)
tree55b9bd893b214378fb721bb94b28698b4b840db8
parente68c01cc483eee6b9b04e208f75868f1fef91633 (diff)
parenta25b8c951ba7c1f2f43c56b136bcea9731c6ab32 (diff)
downloadvolse-hubzilla-6911439f0e5bce19cdefb722378d695f5f7db65e.tar.gz
volse-hubzilla-6911439f0e5bce19cdefb722378d695f5f7db65e.tar.bz2
volse-hubzilla-6911439f0e5bce19cdefb722378d695f5f7db65e.zip
Merge pull request #284 from cvogeley/master
API changes
-rw-r--r--include/api.php56
-rwxr-xr-xinclude/items.php15
2 files changed, 47 insertions, 24 deletions
diff --git a/include/api.php b/include/api.php
index e854012e5..45deb15d7 100644
--- a/include/api.php
+++ b/include/api.php
@@ -7,6 +7,7 @@ require_once("oauth.php");
require_once("html2plain.php");
require_once('include/security.php');
require_once('include/photos.php');
+require_once('include/items.php');
/*
*
@@ -1244,25 +1245,42 @@ require_once('include/photos.php');
if ($user_info['self']==1) $sql_extra .= " AND `item`.`wall` = 1 ";
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`,
- `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
- `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
- FROM `item`, `contact`
- WHERE `item`.`uid` = %d
- AND `item`.`contact-id` = %d
- AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
- AND `contact`.`id` = `item`.`contact-id`
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- $sql_extra
- AND `item`.`id`>%d
- ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
- intval(api_user()),
- intval($user_info['id']),
- intval($since_id),
- intval($start), intval($count)
- );
-
+// $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
+// `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
+// `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn_id`, `contact`.`self`,
+// `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
+// FROM `item`, `contact`
+// WHERE `item`.`uid` = %d
+// AND `item`.`contact-id` = %d
+// AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
+// AND `contact`.`id` = `item`.`contact-id`
+// AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+// $sql_extra
+// AND `item`.`id`>%d
+// ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
+// intval(api_user()),
+// intval($user_info['id']),
+// intval($since_id),
+// intval($start), intval($count)
+// );
+ if ($user_info['self']==1) {
+ $r = items_fetch(array(
+ 'uid' => api_user(),
+ 'cid' => $user_info['id'],
+ 'since_id' => $since_id,
+ 'start' => $start,
+ 'records' => $count,
+ 'wall' => 1));
+ }
+ else {
+ $r = items_fetch(array(
+ 'uid' => api_user(),
+ 'cid' => $user_info['id'],
+ 'since_id' => $since_id,
+ 'start' => $start,
+ 'records' => $count));
+ }
+
$ret = api_format_items($r,$user_info);
diff --git a/include/items.php b/include/items.php
index 12823c6f9..364ff9f3f 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3719,21 +3719,26 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$def_acl = '';
$item_uids = ' true ';
-
+
+ if ($arr['uid']) $uid= $arr['uid'];
+
if($channel) {
$uid = $channel['channel_id'];
$uidhash = $channel['channel_hash'];
$item_uids = " item.uid = " . intval($uid) . " ";
}
-
+
if($arr['star'])
$sql_options .= " and (item_flags & " . intval(ITEM_STARRED) . ") ";
if($arr['wall'])
$sql_options .= " and (item_flags & " . intval(ITEM_WALL) . ") ";
-
+
$sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ") $sql_options ) ";
-
+
+ if($arr['since_id'])
+ $sql_extra .= " and item.id > " . $since_id . " ";
+
if($arr['gid'] && $uid) {
$r = q("SELECT * FROM `groups` WHERE id = %d AND uid = %d LIMIT 1",
intval($arr['group']),
@@ -3897,7 +3902,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
ORDER BY item.$ordering DESC $pager_sql ",
intval(ABOOK_FLAG_BLOCKED)
);
-
+
}
else {
// update