3 * @file mod/editpost.php
7 use Friendica\Content\Feature;
8 use Friendica\Core\Hook;
9 use Friendica\Core\L10n;
10 use Friendica\Core\Renderer;
11 use Friendica\Model\FileTag;
12 use Friendica\Model\Item;
13 use Friendica\Database\DBA;
14 use Friendica\Util\Crypto;
16 function editpost_content(App $a)
21 notice(L10n::t('Permission denied.') . EOL);
25 $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
28 notice(L10n::t('Item not found') . EOL);
32 $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
33 'type', 'body', 'title', 'file', 'wall', 'post-type', 'guid'];
35 $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
37 if (!DBA::isResult($item)) {
38 notice(L10n::t('Item not found') . EOL);
44 $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate("section_title.tpl"), [
45 '$title' => L10n::t('Edit post')
48 $tpl = Renderer::getMarkupTemplate('jot-header.tpl');
49 $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
50 '$ispublic' => ' ', // L10n::t('Visible to <strong>everybody</strong>'),
52 '$nickname' => $a->user['nickname']
55 if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
58 $lockstate = 'unlock';
64 Hook::callAll('jot_tool', $jotplugins);
66 $tpl = Renderer::getMarkupTemplate("jot.tpl");
67 $o .= Renderer::replaceMacros($tpl, [
69 '$return_path' => '/display/' . $item['guid'],
71 '$share' => L10n::t('Save'),
72 '$upload' => L10n::t('Upload photo'),
73 '$shortupload' => L10n::t('upload photo'),
74 '$attach' => L10n::t('Attach file'),
75 '$shortattach' => L10n::t('attach file'),
76 '$weblink' => L10n::t('Insert web link'),
77 '$shortweblink' => L10n::t('web link'),
78 '$video' => L10n::t('Insert video link'),
79 '$shortvideo' => L10n::t('video link'),
80 '$audio' => L10n::t('Insert audio link'),
81 '$shortaudio' => L10n::t('audio link'),
82 '$setloc' => L10n::t('Set your location'),
83 '$shortsetloc' => L10n::t('set location'),
84 '$noloc' => L10n::t('Clear browser location'),
85 '$shortnoloc' => L10n::t('clear location'),
86 '$wait' => L10n::t('Please wait'),
87 '$permset' => L10n::t('Permission settings'),
88 '$wall' => $item['wall'],
89 '$posttype' => $item['post-type'],
90 '$content' => undo_post_tagging($item['body']),
91 '$post_id' => $post_id,
92 '$defloc' => $a->user['default-location'],
95 '$emailcc' => L10n::t('CC: email addresses'),
96 '$public' => L10n::t('Public post'),
97 '$jotnets' => $jotnets,
98 '$title' => $item['title'],
99 '$placeholdertitle' => L10n::t('Set title'),
100 '$category' => FileTag::fileToList($item['file'], 'category'),
101 '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''),
102 '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
103 '$lockstate' => $lockstate,
104 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
105 '$bang' => ($lockstate === 'lock' ? '!' : ''),
106 '$profile_uid' => $_SESSION['uid'],
107 '$preview' => L10n::t('Preview'),
108 '$jotplugins' => $jotplugins,
109 '$sourceapp' => L10n::t($a->sourcename),
110 '$cancel' => L10n::t('Cancel'),
111 '$rand_num' => Crypto::randomDigits(12),
113 //jot nav tab (used in some themes)
114 '$message' => L10n::t('Message'),
115 '$browser' => L10n::t('Browser'),
116 '$shortpermset' => L10n::t('permissions'),