diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-10-16 15:24:48 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-10-16 15:24:48 -0700 |
commit | e8882a516722b60e647af479b52f6593426bcfdd (patch) | |
tree | 34b7c1d2f13533fd893b66c95bc8d65a590724b6 | |
parent | 4f0490f26f7a0125c3dbcd64d2a1fccc2261fd25 (diff) | |
download | volse-hubzilla-e8882a516722b60e647af479b52f6593426bcfdd.tar.gz volse-hubzilla-e8882a516722b60e647af479b52f6593426bcfdd.tar.bz2 volse-hubzilla-e8882a516722b60e647af479b52f6593426bcfdd.zip |
remove one more Friendica table reference from the API
-rw-r--r-- | include/api.php | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/include/api.php b/include/api.php index d0449763b..16dbb569b 100644 --- a/include/api.php +++ b/include/api.php @@ -1487,7 +1487,7 @@ require_once('include/attach.php'); * */ -// FIXME + function api_statuses_mentions(&$a, $type){ if (api_user()===false) return false; @@ -1512,39 +1512,25 @@ require_once('include/attach.php'); $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); $diasp_url = str_replace('/channel/','/u/',$myurl); - if (get_config('system','use_fulltext_engine')) - $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where (MATCH(`author-link`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(`tag`) AGAINST ('".'"%s"'."' in boolean mode) or MATCH(tag) AGAINST ('".'"%s"'."' in boolean mode))) ", - dbesc(protect_sprintf($myurl)), - dbesc(protect_sprintf($myurl)), - dbesc(protect_sprintf($diasp_url)) - ); - else - $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` like '%s' or `tag` like '%s' or tag like '%s' )) ", - dbesc(protect_sprintf('%' . $myurl)), - dbesc(protect_sprintf('%' . $myurl . ']%')), - dbesc(protect_sprintf('%' . $diasp_url . ']%')) - ); - + $sql_extra .= " AND item_mentionsme = 1 "; if ($max_id > 0) - $sql_extra .= ' AND `item`.`id` <= '.intval($max_id); + $sql_extra .= " AND item.id <= " . intval($max_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`.`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($user_info['uid']), + require_once('include/security.php'); + $item_normal = item_normal(); + + $r = q("select * from item where uid = " . intval(api_user()) . " + $item_normal $sql_extra + AND id > %d group by mid + order by received desc LIMIT %d OFFSET %d ", intval($since_id), - intval($start), intval($count) + intval($count), + intval($start) ); + xchan_query($r,true); + + $ret = api_format_items($r,$user_info); |