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);
24 $return_url = (($a->argc > 2) ? base64_decode($a->argv[2]) : '');
27 notice(L10n::t('Item not found') . EOL);
31 // Fallback to SESSION return_path
32 if (empty($return_url)) {
33 $return_url = $_SESSION['return_url'];
36 $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
37 'type', 'body', 'title', 'file', 'wall', 'post-type'];
39 $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
41 if (!DBA::isResult($item)) {
42 notice(L10n::t('Item not found') . EOL);
48 $o .= replace_macros(get_markup_template("section_title.tpl"), [
49 '$title' => L10n::t('Edit post')
52 $tpl = get_markup_template('jot-header.tpl');
53 $a->page['htmlhead'] .= replace_macros($tpl, [
54 '$baseurl' => System::baseUrl(),
55 '$ispublic' => ' ', // L10n::t('Visible to <strong>everybody</strong>'),
57 '$nickname' => $a->user['nickname']
60 $tpl = get_markup_template("jot.tpl");
62 if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
65 $lockstate = 'unlock';
71 $mail_disabled = ((function_exists('imap_open') && !Config::get('system', 'imap_disabled')) ? 0 : 1);
73 $mail_enabled = false;
74 $pubmail_enabled = false;
76 if (!$mail_disabled) {
77 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
81 if (DBA::isResult($r)) {
84 if (intval($r[0]['pubmail'])) {
85 $pubmail_enabled = true;
90 Addon::callHooks('jot_tool', $jotplugins);
91 //Addon::callHooks('jot_networks', $jotnets);
93 $o .= replace_macros($tpl, [
95 '$return_path' => $return_url,
97 '$share' => L10n::t('Save'),
98 '$upload' => L10n::t('Upload photo'),
99 '$shortupload' => L10n::t('upload photo'),
100 '$attach' => L10n::t('Attach file'),
101 '$shortattach' => L10n::t('attach file'),
102 '$weblink' => L10n::t('Insert web link'),
103 '$shortweblink' => L10n::t('web link'),
104 '$video' => L10n::t('Insert video link'),
105 '$shortvideo' => L10n::t('video link'),
106 '$audio' => L10n::t('Insert audio link'),
107 '$shortaudio' => L10n::t('audio link'),
108 '$setloc' => L10n::t('Set your location'),
109 '$shortsetloc' => L10n::t('set location'),
110 '$noloc' => L10n::t('Clear browser location'),
111 '$shortnoloc' => L10n::t('clear location'),
112 '$wait' => L10n::t('Please wait'),
113 '$permset' => L10n::t('Permission settings'),
114 '$wall' => $item['wall'],
115 '$posttype' => $item['post-type'],
116 '$content' => undo_post_tagging($item['body']),
117 '$post_id' => $post_id,
118 '$baseurl' => System::baseUrl(),
119 '$defloc' => $a->user['default-location'],
120 '$visitor' => 'none',
122 '$emailcc' => L10n::t('CC: email addresses'),
123 '$public' => L10n::t('Public post'),
124 '$jotnets' => $jotnets,
125 '$title' => htmlspecialchars($item['title']),
126 '$placeholdertitle' => L10n::t('Set title'),
127 '$category' => file_tag_file_to_list($item['file'], 'category'),
128 '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''),
129 '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'),
130 '$lockstate' => $lockstate,
131 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
132 '$bang' => ($lockstate === 'lock' ? '!' : ''),
133 '$profile_uid' => $_SESSION['uid'],
134 '$preview' => L10n::t('Preview'),
135 '$jotplugins' => $jotplugins,
136 '$sourceapp' => L10n::t($a->sourcename),
137 '$cancel' => L10n::t('Cancel'),
138 '$rand_num' => random_digits(12),
140 //jot nav tab (used in some themes)
141 '$message' => L10n::t('Message'),
142 '$browser' => L10n::t('Browser'),
143 '$shortpermset' => L10n::t('permissions'),