]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Post/Edit.php
Use the post language for the language detection / config for quality
[friendica.git] / src / Module / Post / Edit.php
index f89f73f0bde3e8495afe2c50be548c66a3790964..1505c301acf9b03473a8f93827d3cb64c57104b5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -76,14 +76,16 @@ class Edit extends BaseModule
                        $this->errorExit($this->t('Permission denied.'), HTTPException\UnauthorizedException::class);
                }
 
-               $postId = $this->parameters['post_id'];
+               $postId = $this->parameters['post_id'] ?? 0;
 
                if (empty($postId)) {
                        $this->errorExit($this->t('Post not found.'), HTTPException\BadRequestException::class);
                }
 
-               $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
-                                  'body', 'title', 'uri-id', 'wall', 'post-type', 'guid'];
+               $fields = [
+                       'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'gravity',
+                       'body', 'title', 'uri-id', 'wall', 'post-type', 'guid'
+               ];
 
                $item = Post::selectFirstForUser($this->session->getLocalUserId(), $fields, [
                        'id'  => $postId,
@@ -94,16 +96,15 @@ class Edit extends BaseModule
                        $this->errorExit($this->t('Post not found.'), HTTPException\BadRequestException::class);
                }
 
-               $user   = User::getById($this->session->getLocalUserId());
-               $geoTag = '';
+               $user = User::getById($this->session->getLocalUserId());
 
                $output = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
                        '$title' => $this->t('Edit post'),
                ]);
 
                $this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('jot-header.tpl'), [
-                       '$ispublic'  => '&nbsp;', // $this->t('Visible to <strong>everybody</strong>'),
-                       '$geotag'    => $geoTag,
+                       '$ispublic'  => '&nbsp;',
+                       '$geotag'    => '',
                        '$nickname'  => $this->app->getLoggedInUserNickname(),
                        '$is_mobile' => $this->mode->isMobile(),
                ]);
@@ -114,8 +115,10 @@ class Edit extends BaseModule
                        $lockstate = 'unlock';
                }
 
+               $item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
+               $item = Post\Media::addHTMLAttachmentToItem($item);
+
                $jotplugins = '';
-               $jotnets    = '';
 
                Hook::callAll('jot_tool', $jotplugins);
 
@@ -150,14 +153,13 @@ class Edit extends BaseModule
                        '$pvisit'              => 'none',
                        '$emailcc'             => $this->t('CC: email addresses'),
                        '$public'              => $this->t('Public post'),
-                       '$jotnets'             => $jotnets,
                        '$title'               => $item['title'],
                        '$placeholdertitle'    => $this->t('Set title'),
                        '$category'            => Post\Category::getCSVByURIId($item['uri-id'], $this->session->getLocalUserId(), Post\Category::CATEGORY),
                        '$placeholdercategory' => (Feature::isEnabled($this->session->getLocalUserId(), 'categories') ? $this->t("Categories \x28comma-separated list\x29") : ''),
                        '$emtitle'             => $this->t('Example: bob@example.com, mary@example.com'),
                        '$lockstate'           => $lockstate,
-                       '$acl'                 => '', // populate_acl((($group) ? $group_acl : $a->user)),
+                       '$acl'                 => '',
                        '$bang'                => ($lockstate === 'lock' ? '!' : ''),
                        '$profile_uid'         => $this->session->getLocalUserId(),
                        '$preview'             => $this->t('Preview'),
@@ -166,18 +168,19 @@ class Edit extends BaseModule
                        '$rand_num'            => Crypto::randomDigits(12),
 
                        // Formatting button labels
-                       '$edbold'              => $this->t('Bold'),
-                       '$editalic'            => $this->t('Italic'),
-                       '$eduline'             => $this->t('Underline'),
-                       '$edquote'             => $this->t('Quote'),
-                       '$edcode'              => $this->t('Code'),
-                       '$edurl'               => $this->t('Link'),
-                       '$edattach'            => $this->t('Link or Media'),
+                       '$edbold'   => $this->t('Bold'),
+                       '$editalic' => $this->t('Italic'),
+                       '$eduline'  => $this->t('Underline'),
+                       '$edquote'  => $this->t('Quote'),
+                       '$edemojis' => $this->t('Add emojis'),
+                       '$edcode'   => $this->t('Code'),
+                       '$edurl'    => $this->t('Link'),
+                       '$edattach' => $this->t('Link or Media'),
 
                        //jot nav tab (used in some themes)
-                       '$message'             => $this->t('Message'),
-                       '$browser'             => $this->t('Browser'),
-                       '$shortpermset'        => $this->t('Permissions'),
+                       '$message'      => $this->t('Message'),
+                       '$browser'      => $this->t('Browser'),
+                       '$shortpermset' => $this->t('Permissions'),
 
                        '$compose_link_title' => $this->t('Open Compose page'),
                ]);