3 * @file mod/editpost.php
6 use Friendica\Content\Feature;
7 use Friendica\Core\Addon;
8 use Friendica\Core\Config;
9 use Friendica\Core\L10n;
10 use Friendica\Core\System;
11 use Friendica\Model\Item;
12 use Friendica\Database\DBA;
14 function editpost_content(App $a)
19 notice(L10n::t('Permission denied.') . EOL);
23 $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
26 notice(L10n::t('Item not found') . EOL);
30 $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
31 'type', 'body', 'title', 'file', 'wall', 'post-type', 'guid'];
33 $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
35 if (!DBA::isResult($item)) {
36 notice(L10n::t('Item not found') . EOL);
42 $o .= replace_macros(get_markup_template("section_title.tpl"), [
43 '$title' => L10n::t('Edit post')
46 $tpl = get_markup_template('jot-header.tpl');
47 $a->page['htmlhead'] .= replace_macros($tpl, [
48 '$baseurl' => System::baseUrl(),
49 '$ispublic' => ' ', // L10n::t('Visible to <strong>everybody</strong>'),
51 '$nickname' => $a->user['nickname']
54 $tpl = get_markup_template("jot.tpl");
56 if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
59 $lockstate = 'unlock';
65 $mail_disabled = ((function_exists('imap_open') && !Config::get('system', 'imap_disabled')) ? 0 : 1);
67 $mail_enabled = false;
68 $pubmail_enabled = false;
70 if (!$mail_disabled) {
71 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
75 if (DBA::isResult($r)) {
78 if (intval($r[0]['pubmail'])) {
79 $pubmail_enabled = true;
84 Addon::callHooks('jot_tool', $jotplugins);
85 //Addon::callHooks('jot_networks', $jotnets);
87 $o .= replace_macros($tpl, [
89 '$return_path' => '/display/' . $item['guid'],
91 '$share' => L10n::t('Save'),
92 '$upload' => L10n::t('Upload photo'),
93 '$shortupload' => L10n::t('upload photo'),
94 '$attach' => L10n::t('Attach file'),
95 '$shortattach' => L10n::t('attach file'),
96 '$weblink' => L10n::t('Insert web link'),
97 '$shortweblink' => L10n::t('web link'),
98 '$video' => L10n::t('Insert video link'),
99 '$shortvideo' => L10n::t('video link'),
100 '$audio' => L10n::t('Insert audio link'),
101 '$shortaudio' => L10n::t('audio link'),
102 '$setloc' => L10n::t('Set your location'),
103 '$shortsetloc' => L10n::t('set location'),
104 '$noloc' => L10n::t('Clear browser location'),
105 '$shortnoloc' => L10n::t('clear location'),
106 '$wait' => L10n::t('Please wait'),
107 '$permset' => L10n::t('Permission settings'),
108 '$wall' => $item['wall'],
109 '$posttype' => $item['post-type'],
110 '$content' => undo_post_tagging($item['body']),
111 '$post_id' => $post_id,
112 '$baseurl' => System::baseUrl(),
113 '$defloc' => $a->user['default-location'],
114 '$visitor' => 'none',
116 '$emailcc' => L10n::t('CC: email addresses'),
117 '$public' => L10n::t('Public post'),
118 '$jotnets' => $jotnets,
119 '$title' => htmlspecialchars($item['title']),
120 '$placeholdertitle' => L10n::t('Set title'),
121 '$category' => file_tag_file_to_list($item['file'], 'category'),
122 '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''),
123 '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
124 '$lockstate' => $lockstate,
125 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
126 '$bang' => ($lockstate === 'lock' ? '!' : ''),
127 '$profile_uid' => $_SESSION['uid'],
128 '$preview' => L10n::t('Preview'),
129 '$jotplugins' => $jotplugins,
130 '$sourceapp' => L10n::t($a->sourcename),
131 '$cancel' => L10n::t('Cancel'),
132 '$rand_num' => random_digits(12),
134 //jot nav tab (used in some themes)
135 '$message' => L10n::t('Message'),
136 '$browser' => L10n::t('Browser'),
137 '$shortpermset' => L10n::t('permissions'),