From: Michael Date: Wed, 20 Dec 2017 10:16:25 +0000 (+0000) Subject: Updating after post does now work X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=343f22e02fc9540f41c61c318c554505d730e699;p=friendica.git Updating after post does now work --- diff --git a/include/conversation.php b/include/conversation.php index f10279c333..daee67493b 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -611,9 +611,12 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { $page_template = get_markup_template("conversation.tpl"); if ($items && count($items)) { - // Currently disabled. This is a preparation for the ability to comment and share every public item. - // $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], array(NETWORK_OSTATUS, NETWORK_DIASPORA)); - $writable = false; + // Currently behind a config value. This allows the commenting and sharing of every public item. + if (Config::get('system', 'comment_public')) { + $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], array(NETWORK_OSTATUS, NETWORK_DIASPORA)); + } else { + $writable = false; + } if ($mode === 'network-new' || $mode === 'search' || $mode === 'community') { diff --git a/mod/display.php b/mod/display.php index 158523945a..012bc5e61a 100644 --- a/mod/display.php +++ b/mod/display.php @@ -205,9 +205,9 @@ function display_fetchauthor($a, $item) { return($profiledata); } -function display_content(App $a, $update = 0) { +function display_content(App $a, $update = false, $update_uid = 0) { - if ((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) { + if (Config::get('system','block_public') && !local_user() && !remote_user()) { notice(t('Public access denied.') . EOL); return; } @@ -227,7 +227,8 @@ function display_content(App $a, $update = 0) { if ($update) { $item_id = $_REQUEST['item_id']; - $a->profile = array('uid' => intval($update), 'profile_uid' => intval($update)); + $item = dba::select('item', ['uid'], ['id' => $item_id], ['limit' => 1]); + $a->profile = array('uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])); } else { $item_id = (($a->argc > 2) ? $a->argv[2] : 0); @@ -347,9 +348,9 @@ function display_content(App $a, $update = 0) { if (DBM::is_result($r)) { $a->page_contact = $r; } - $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false); + $is_owner = (local_user() && (local_user() == $a->profile['profile_uid']) ? true : false); - if ($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) { + if ($a->profile['hidewall'] && !$is_owner && !$remote_contact) { notice(t('Access to this profile has been restricted.') . EOL); return; } @@ -375,10 +376,9 @@ function display_content(App $a, $update = 0) { $sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups); if ($update) { - $r = dba::p("SELECT `id` FROM `item` WHERE `item`.`uid` = ? - AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = ?) + $r = dba::p("SELECT `id` FROM `item` WHERE + `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = ?) $sql_extra AND `unseen`", - $a->profile['uid'], $item_id ); @@ -429,7 +429,7 @@ function display_content(App $a, $update = 0) { if (!$update) { $o .= ""; } - $o .= conversation($a, $items, 'display', $update); + $o .= conversation($a, $items, 'display', $update_uid); // Preparing the meta header require_once('include/bbcode.php'); diff --git a/mod/update_display.php b/mod/update_display.php index 00109202ed..0fbb3f9428 100644 --- a/mod/update_display.php +++ b/mod/update_display.php @@ -15,7 +15,7 @@ function update_display_content(App $a) echo "\r\n"; echo "
"; - $text = display_content($a, $profile_uid); + $text = display_content($a, true, $profile_uid); $pattern = "/]*) src=\"([^\"]*)\"/"; $replace = "