From 1aa7561a2ca63bd0989e94e9f62ae1e96e74b91d Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 2 Mar 2013 14:46:09 -0800 Subject: improve mod/display for local users - use their own copy if possible --- mod/display.php | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'mod/display.php') diff --git a/mod/display.php b/mod/display.php index 3c2172c7d..5b9621c3f 100644 --- a/mod/display.php +++ b/mod/display.php @@ -93,17 +93,29 @@ function display_content(&$a, $update = 0, $load = false) { $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage'])); if($load) { - - $r = q("SELECT * from item - WHERE item_restrict = 0 - and uri = '%s' - AND ((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' - AND `item`.`deny_gid` = '' AND item_private = 0 ) - and uid in ( " . stream_perms_api_uids() . " )) - $sql_extra ) - group by uri limit 1", - dbesc($target_item['parent_uri']) - ); + $r = null; + if(local_user()) { + $r = q("SELECT * from item + WHERE item_restrict = 0 + and uid = %d + and uri = '%s' + limit 1", + intval(local_user()), + dbesc($target_item['parent_uri']) + ); + } + if($r === null) { + $r = q("SELECT * from item + WHERE item_restrict = 0 + and uri = '%s' + AND ((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' + AND `item`.`deny_gid` = '' AND item_private = 0 ) + and uid in ( " . stream_perms_api_uids() . " )) + $sql_extra ) + group by uri limit 1", + dbesc($target_item['parent_uri']) + ); + } } else { -- cgit v1.2.3