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