]> git.mxchange.org Git - friendica.git/blobdiff - mod/display.php
Fix formatting and PHP notice in mod/photos
[friendica.git] / mod / display.php
index 31b6a13538b30b739d300d40358f9bd55ecf07a3..c124f48bb5e7d58622f1e3bb2fc80452cbf8163b 100644 (file)
@@ -52,8 +52,6 @@ function display_init(App $a) {
                        $r = dba::fetch_first("SELECT `id`, `parent`, `author-name`, `author-link`,
                                                `author-avatar`, `network`, `body`, `uid`, `owner-link`
                                FROM `item` WHERE `visible` AND NOT `deleted` AND NOT `moderated`
-                                       AND `allow_cid` = ''  AND `allow_gid` = ''
-                                       AND `deny_cid`  = '' AND `deny_gid`  = ''
                                        AND NOT `private` AND `uid` = 0
                                        AND `guid` = ? LIMIT 1", $a->argv[1]);
                }
@@ -67,8 +65,6 @@ function display_init(App $a) {
                $r = dba::fetch_first("SELECT `id`, `parent`, `author-name`, `author-link`,
                                        `author-avatar`, `network`, `body`, `uid`, `owner-link`
                        FROM `item` WHERE `visible` AND NOT `deleted` AND NOT `moderated`
-                               AND `allow_cid` = ''  AND `allow_gid` = ''
-                               AND `deny_cid`  = '' AND `deny_gid`  = ''
                                AND NOT `private` AND `uid` = 0
                                AND `id` = ? LIMIT 1", $a->argv[2]);
        }
@@ -197,16 +193,17 @@ function display_content(App $a, $update = false, $update_uid = 0) {
                return;
        }
 
-       require_once('include/security.php');
-       require_once('include/conversation.php');
-       require_once('include/acl_selectors.php');
+       require_once 'include/security.php';
+       require_once 'include/conversation.php';
+       require_once 'include/acl_selectors.php';
 
        $o = '';
 
        if ($update) {
                $item_id = $_REQUEST['item_id'];
-               $item = dba::select('item', ['uid'], ['id' => $item_id], ['limit' => 1]);
+               $item = dba::select('item', ['uid', 'parent'], ['id' => $item_id], ['limit' => 1]);
                $a->profile = array('uid' => intval($item['uid']), 'profile_uid' => intval($item['uid']));
+               $item_parent = $item['parent'];
        } else {
                $item_id = (($a->argc > 2) ? $a->argv[2] : 0);
 
@@ -226,8 +223,6 @@ function display_content(App $a, $update = false, $update_uid = 0) {
                        if ($item_parent == 0) {
                                $r = dba::fetch_first("SELECT `item`.`id`, `item`.`parent` FROM `item`
                                        WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
-                                               AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''
-                                               AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''
                                                AND NOT `item`.`private` AND `item`.`uid` = 0
                                                AND `item`.`guid` = ?", $a->argv[1]);
                                if (DBM::is_result($r)) {
@@ -266,7 +261,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
 
        $contact_id = 0;
 
-       if (is_array($_SESSION['remote'])) {
+       if (x($_SESSION, 'remote') && is_array($_SESSION['remote'])) {
                foreach ($_SESSION['remote'] as $v) {
                        if ($v['uid'] == $a->profile['uid']) {
                                $contact_id = $v['cid'];
@@ -300,7 +295,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
        }
        $is_owner = (local_user() && (in_array($a->profile['profile_uid'], [local_user(), 0])) ? true : false);
 
-       if ($a->profile['hidewall'] && !$is_owner && !$remote_contact) {
+       if (x($a->profile, 'hidewall') && !$is_owner && !$remote_contact) {
                notice(t('Access to this profile has been restricted.') . EOL);
                return;
        }
@@ -364,8 +359,8 @@ function display_content(App $a, $update = false, $update_uid = 0) {
        $o .= conversation($a, $items, 'display', $update_uid);
 
        // Preparing the meta header
-       require_once('include/bbcode.php');
-       require_once("include/html2plain.php");
+       require_once 'include/bbcode.php';
+       require_once 'include/html2plain.php';
        $description = trim(html2plain(bbcode($s[0]["body"], false, false), 0, true));
        $title = trim(html2plain(bbcode($s[0]["title"], false, false), 0, true));
        $author_name = $s[0]["author-name"];