]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
Add Temporal::local() shorthand for Temporal::convert()
[friendica.git] / include / conversation.php
index af4bb0559efd752efa252f0535a447d6765c5dea..98cb1773b17bab23c3f869434a154bf9b34f802d 100644 (file)
@@ -2,6 +2,7 @@
 /**
  * @file include/conversation.php
  */
+
 use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
@@ -13,9 +14,10 @@ use Friendica\Core\System;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Profile;
-use Friendica\Object\Thread;
 use Friendica\Object\Post;
 use Friendica\Util\XML;
+use Friendica\Object\Thread;
+use Friendica\Util\Temporal;
 
 require_once "include/bbcode.php";
 require_once "include/acl_selectors.php";
@@ -578,9 +580,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
                                . " var profile_page = 1; </script>";
                }
        } elseif ($mode === 'community') {
-               if (!$community_readonly) {
-                       $items = community_add_items($items);
-               }
+               $items = community_add_items($items);
                $profile_owner = 0;
                if (!$update) {
                        $live_update_div = '<div id="live-community"></div>' . "\r\n"
@@ -614,33 +614,23 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
        $page_template = get_markup_template("conversation.tpl");
 
        if ($items && count($items)) {
-               $community_readonly = ($mode === 'community');
-
-               // Currently behind a config value. This allows the commenting and sharing of every public item.
-               if (Config::get('system', 'comment_public')) {
-                       if ($mode === 'community') {
-                               $community_readonly = false;
-                               $writable = true;
-                       } else {
-                               $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
-                       }
+               if ($mode === 'community') {
+                       $writable = true;
                } else {
-                       $writable = false;
+                       $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
                }
 
                if (!local_user()) {
                        $writable = false;
                }
 
-               if (in_array($mode, ['network-new', 'search', 'contact-posts']) || $community_readonly) {
+               if (in_array($mode, ['network-new', 'search', 'contact-posts'])) {
 
                        /*
                         * "New Item View" on network page or search page results
                         * - just loop through the items and format them minimally for display
                         */
 
-                       /// @TODO old lost code?
-                       // $tpl = get_markup_template('search_item.tpl');
                        $tpl = 'search_item.tpl';
 
                        foreach ($items as $item) {
@@ -800,7 +790,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
                                        'categories' => $categories,
                                        'folders' => $folders,
                                        'text' => strip_tags($body_e),
-                                       'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
+                                       'localtime' => Temporal::local($item['created'], 'r'),
                                        'ago' => (($item['app']) ? L10n::t('%s from %s', relative_date($item['created']),$item['app']) : relative_date($item['created'])),
                                        'location' => $location_e,
                                        'indent' => '',