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\Database\DBM;
13 function editpost_content(App $a) {
18 notice(L10n::t('Permission denied.') . EOL);
22 $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
25 notice(L10n::t('Item not found') . EOL);
29 $itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
34 if (! DBM::is_result($itm)) {
35 notice(L10n::t('Item not found') . EOL);
41 $o .= replace_macros(get_markup_template("section_title.tpl"),[
42 '$title' => L10n::t('Edit post')
45 $tpl = get_markup_template('jot-header.tpl');
46 $a->page['htmlhead'] .= replace_macros($tpl, [
47 '$baseurl' => System::baseUrl(),
48 '$ispublic' => ' ', // L10n::t('Visible to <strong>everybody</strong>'),
50 '$nickname' => $a->user['nickname']
53 $tpl = get_markup_template('jot-end.tpl');
54 $a->page['end'] .= replace_macros($tpl, [
55 '$baseurl' => System::baseUrl(),
56 '$ispublic' => ' ', // L10n::t('Visible to <strong>everybody</strong>'),
58 '$nickname' => $a->user['nickname']
62 $tpl = get_markup_template("jot.tpl");
64 if (strlen($itm['allow_cid']) || strlen($itm['allow_gid']) || strlen($itm['deny_cid']) || strlen($itm['deny_gid'])) {
67 $lockstate = 'unlock';
73 $mail_disabled = ((function_exists('imap_open') && (! Config::get('system','imap_disabled'))) ? 0 : 1);
75 $mail_enabled = false;
76 $pubmail_enabled = false;
78 if(! $mail_disabled) {
79 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
82 if (DBM::is_result($r)) {
84 if(intval($r[0]['pubmail']))
85 $pubmail_enabled = true;
89 // I don't think there's any need for the $jotnets when editing the post,
90 // and including them makes it difficult for the JS-free theme, so let's
92 /* if($mail_enabled) {
93 $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
94 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
95 . L10n::t("Post to Email") . '</div>';
100 Addon::callHooks('jot_tool', $jotplugins);
101 //Addon::callHooks('jot_networks', $jotnets);
104 //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
106 $o .= replace_macros($tpl,[
108 '$return_path' => $_SESSION['return_url'],
110 '$share' => L10n::t('Save'),
111 '$upload' => L10n::t('Upload photo'),
112 '$shortupload' => L10n::t('upload photo'),
113 '$attach' => L10n::t('Attach file'),
114 '$shortattach' => L10n::t('attach file'),
115 '$weblink' => L10n::t('Insert web link'),
116 '$shortweblink' => L10n::t('web link'),
117 '$video' => L10n::t('Insert video link'),
118 '$shortvideo' => L10n::t('video link'),
119 '$audio' => L10n::t('Insert audio link'),
120 '$shortaudio' => L10n::t('audio link'),
121 '$setloc' => L10n::t('Set your location'),
122 '$shortsetloc' => L10n::t('set location'),
123 '$noloc' => L10n::t('Clear browser location'),
124 '$shortnoloc' => L10n::t('clear location'),
125 '$wait' => L10n::t('Please wait'),
126 '$permset' => L10n::t('Permission settings'),
127 '$ptyp' => $itm[0]['type'],
128 '$content' => undo_post_tagging($itm[0]['body']),
129 '$post_id' => $post_id,
130 '$baseurl' => System::baseUrl(),
131 '$defloc' => $a->user['default-location'],
132 '$visitor' => 'none',
134 '$emailcc' => L10n::t('CC: email addresses'),
135 '$public' => L10n::t('Public post'),
136 '$jotnets' => $jotnets,
137 '$title' => htmlspecialchars($itm[0]['title']),
138 '$placeholdertitle' => L10n::t('Set title'),
139 '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
140 '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''),
141 '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
142 '$lockstate' => $lockstate,
143 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
144 '$bang' => ($lockstate === 'lock' ? '!' : ''),
145 '$profile_uid' => $_SESSION['uid'],
146 '$preview' => L10n::t('Preview'),
147 '$jotplugins' => $jotplugins,
148 '$sourceapp' => L10n::t($a->sourcename),
149 '$cancel' => L10n::t('Cancel'),
150 '$rand_num' => random_digits(12),
152 //jot nav tab (used in some themes)
153 '$message' => L10n::t('Message'),
154 '$browser' => L10n::t('Browser'),
155 '$shortpermset' => L10n::t('permissions'),