X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fconversation.php;h=daee67493bacf88f99db08276cea6c6b8744b0c0;hb=343f22e02fc9540f41c61c318c554505d730e699;hp=6dd1a473ec4f3625736e78cb91423c98e45a0b1e;hpb=d50d693fe30a2520e018b682bee1a6163845b463;p=friendica.git diff --git a/include/conversation.php b/include/conversation.php index 6dd1a473ec..daee67493b 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -15,12 +15,6 @@ use Friendica\Object\Post; require_once "include/bbcode.php"; require_once "include/acl_selectors.php"; -/* - * Note: the code in 'item_extract_images' and 'item_redir_and_replace_images' - * is identical to the code in mod/message.php for 'item_extract_images' and - * 'item_redir_and_replace_images' - */ -if (! function_exists('item_extract_images')) { function item_extract_images($body) { $saved_image = array(); @@ -62,9 +56,8 @@ function item_extract_images($body) { $new_body = $new_body . $orig_body; return array('body' => $new_body, 'images' => $saved_image); -}} +} -if (! function_exists('item_redir_and_replace_images')) { function item_redir_and_replace_images($body, $images, $cid) { $origbody = $body; @@ -104,7 +97,7 @@ function item_redir_and_replace_images($body, $images, $cid) { $cnt++; } return $newbody; -}} +} /** * Render actions localized @@ -486,7 +479,6 @@ function item_condition() { return "`item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`"; } -if (!function_exists('conversation')) { /** * "Render" a conversation or list of items for HTML display. * There are two major forms of display: @@ -505,7 +497,6 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { $ssl_state = ((local_user()) ? true : false); $profile_owner = 0; - $page_writeable = false; $live_update_div = ''; $arr_blocked = null; @@ -525,7 +516,6 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { if ($mode === 'network') { $profile_owner = local_user(); - $page_writeable = true; if (!$update) { /* * The special div is needed for liveUpdate to kick in for this page. @@ -553,7 +543,6 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { } } elseif ($mode === 'profile') { $profile_owner = $a->profile['profile_uid']; - $page_writeable = can_write_wall($a,$profile_owner); if (!$update) { $tab = notags(trim($_GET['tab'])); @@ -571,7 +560,6 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { } } elseif ($mode === 'notes') { $profile_owner = local_user(); - $page_writeable = true; if (!$update) { $live_update_div = '
' . "\r\n" . "\r\n"; @@ -625,6 +611,12 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { $page_template = get_markup_template("conversation.tpl"); if ($items && count($items)) { + // 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') { @@ -840,7 +832,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { // Normal View $page_template = get_markup_template("threaded_conversation.tpl"); - $conv = new Thread($mode, $preview); + $conv = new Thread($mode, $preview, $writable); /* * get all the topmost parents @@ -906,7 +898,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { )); return $o; -}} +} function best_link_url($item, &$sparkle, $url = '') { @@ -1036,7 +1028,6 @@ function item_photo_menu($item) { return $o; } -if (! function_exists('builtin_activity_puller')) { /** * @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.) * Increments the count of each matching activity and adds a link to the author as needed. @@ -1112,9 +1103,8 @@ function builtin_activity_puller($item, &$conv_responses) { return; } } -}} +} -if (! function_exists('format_like')) { /** * Format the vote text for a profile item * @param int $cnt = number of people who vote the item @@ -1205,7 +1195,7 @@ function format_like($cnt, array $arr, $type, $id) { $o .= $expanded; return $o; -}} +} function status_editor(App $a, $x, $notes_cid = 0, $popup = false) { $o = '';