]> git.mxchange.org Git - friendica.git/blobdiff - mod/editpost.php
Merge pull request #10967 from annando/api
[friendica.git] / mod / editpost.php
index 8ef15208457afe333e785401e7fb788a74d17e68..cc72dbd3c2eddbd864b28250254b6467d96ce32d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -27,6 +27,7 @@ use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Post;
+use Friendica\Model\User;
 use Friendica\Util\Crypto;
 
 function editpost_content(App $a)
@@ -38,7 +39,7 @@ function editpost_content(App $a)
                return;
        }
 
-       $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
+       $post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0);
 
        if (!$post_id) {
                notice(DI::l10n()->t('Item not found'));
@@ -55,6 +56,8 @@ function editpost_content(App $a)
                return;
        }
 
+       $user = User::getById(local_user());
+
        $geotag = '';
 
        $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate("section_title.tpl"), [
@@ -65,7 +68,7 @@ function editpost_content(App $a)
        DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
                '$ispublic' => '&nbsp;', // DI::l10n()->t('Visible to <strong>everybody</strong>'),
                '$geotag' => $geotag,
-               '$nickname' => $a->user['nickname'],
+               '$nickname' => $a->getLoggedInUserNickname(),
                '$is_mobile' => DI::mode()->isMobile(),
        ]);
 
@@ -107,7 +110,7 @@ function editpost_content(App $a)
                '$posttype' => $item['post-type'],
                '$content' => undo_post_tagging($item['body']),
                '$post_id' => $post_id,
-               '$defloc' => $a->user['default-location'],
+               '$defloc' => $user['default-location'],
                '$visitor' => 'none',
                '$pvisit' => 'none',
                '$emailcc' => DI::l10n()->t('CC: email addresses'),
@@ -124,7 +127,6 @@ function editpost_content(App $a)
                '$profile_uid' => $_SESSION['uid'],
                '$preview' => DI::l10n()->t('Preview'),
                '$jotplugins' => $jotplugins,
-               '$sourceapp' => DI::l10n()->t($a->sourcename),
                '$cancel' => DI::l10n()->t('Cancel'),
                '$rand_num' => Crypto::randomDigits(12),