diff options
author | friendica <info@friendica.com> | 2013-03-02 14:46:09 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-03-02 14:46:09 -0800 |
commit | 1aa7561a2ca63bd0989e94e9f62ae1e96e74b91d (patch) | |
tree | 838db7ec0073e5b2dc272cd170b4d210b74cac4e /mod | |
parent | 0bdab225dbe869a7334c376cd81df8446f863cff (diff) | |
download | volse-hubzilla-1aa7561a2ca63bd0989e94e9f62ae1e96e74b91d.tar.gz volse-hubzilla-1aa7561a2ca63bd0989e94e9f62ae1e96e74b91d.tar.bz2 volse-hubzilla-1aa7561a2ca63bd0989e94e9f62ae1e96e74b91d.zip |
improve mod/display for local users - use their own copy if possible
Diffstat (limited to 'mod')
-rw-r--r-- | mod/display.php | 34 |
1 files changed, 23 insertions, 11 deletions
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 { |