X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Feditpost.php;h=bec5d3449ef311b14928e616e97f2c919f955cf8;hb=4d3c0e1c57d3d4b3d23b53007b200e544d7e03e0;hp=209fbcf5ab8d9327a1c3f02fe32ec71372f86d92;hpb=f1e36eac7d6971b72956b24ba1a1615ca9179830;p=friendica.git diff --git a/mod/editpost.php b/mod/editpost.php index 209fbcf5ab..bec5d3449e 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -1,6 +1,6 @@ t('Permission denied.')); + if (!DI::userSession()->getLocalUserId()) { + DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); 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')); + DI::sysmsg()->addNotice(DI::l10n()->t('Item not found')); return; } $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', - 'type', 'body', 'title', 'file', 'wall', 'post-type', 'guid']; + 'body', 'title', 'uri-id', 'wall', 'post-type', 'guid']; - $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]); + $item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), $fields, ['id' => $post_id, 'uid' => DI::userSession()->getLocalUserId()]); if (!DBA::isResult($item)) { - notice(DI::l10n()->t('Item not found')); + DI::sysmsg()->addNotice(DI::l10n()->t('Item not found')); return; } + $user = User::getById(DI::userSession()->getLocalUserId()); + $geotag = ''; $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate("section_title.tpl"), [ @@ -66,7 +68,8 @@ function editpost_content(App $a) DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$ispublic' => ' ', // DI::l10n()->t('Visible to everybody'), '$geotag' => $geotag, - '$nickname' => $a->user['nickname'] + '$nickname' => $a->getLoggedInUserNickname(), + '$is_mobile' => DI::mode()->isMobile(), ]); if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) { @@ -80,7 +83,7 @@ function editpost_content(App $a) Hook::callAll('jot_tool', $jotplugins); - $tpl = Renderer::getMarkupTemplate("jot.tpl"); + $tpl = Renderer::getMarkupTemplate('jot.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$is_edit' => true, '$return_path' => '/display/' . $item['guid'], @@ -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'), @@ -115,8 +118,8 @@ function editpost_content(App $a) '$jotnets' => $jotnets, '$title' => $item['title'], '$placeholdertitle' => DI::l10n()->t('Set title'), - '$category' => FileTag::fileToList($item['file'], 'category'), - '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? DI::l10n()->t("Categories \x28comma-separated list\x29") : ''), + '$category' => Post\Category::getCSVByURIId($item['uri-id'], DI::userSession()->getLocalUserId(), Post\Category::CATEGORY), + '$placeholdercategory' => (Feature::isEnabled(DI::userSession()->getLocalUserId(),'categories') ? DI::l10n()->t("Categories \x28comma-separated list\x29") : ''), '$emtitle' => DI::l10n()->t('Example: bob@example.com, mary@example.com'), '$lockstate' => $lockstate, '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)), @@ -124,10 +127,18 @@ 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), + // Formatting button labels + '$edbold' => DI::l10n()->t('Bold'), + '$editalic' => DI::l10n()->t('Italic'), + '$eduline' => DI::l10n()->t('Underline'), + '$edquote' => DI::l10n()->t('Quote'), + '$edcode' => DI::l10n()->t('Code'), + '$edurl' => DI::l10n()->t('Link'), + '$edattach' => DI::l10n()->t('Link or Media'), + //jot nav tab (used in some themes) '$message' => DI::l10n()->t('Message'), '$browser' => DI::l10n()->t('Browser'),