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