4 use Friendica\Core\Config;
5 use Friendica\Core\System;
7 require_once('include/acl_selectors.php');
9 function editpost_content(App $a) {
14 notice( t('Permission denied.') . EOL);
18 $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
21 notice( t('Item not found') . EOL);
25 $itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
30 if (! dbm::is_result($itm)) {
31 notice( t('Item not found') . EOL);
35 $o .= replace_macros(get_markup_template("section_title.tpl"),array(
36 '$title' => t('Edit post')
39 $tpl = get_markup_template('jot-header.tpl');
40 $a->page['htmlhead'] .= replace_macros($tpl, array(
41 '$baseurl' => System::baseUrl(),
42 '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'),
44 '$nickname' => $a->user['nickname']
47 $tpl = get_markup_template('jot-end.tpl');
48 $a->page['end'] .= replace_macros($tpl, array(
49 '$baseurl' => System::baseUrl(),
50 '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'),
52 '$nickname' => $a->user['nickname']
56 $tpl = get_markup_template("jot.tpl");
58 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'])))))
61 $lockstate = 'unlock';
66 $mail_disabled = ((function_exists('imap_open') && (! Config::get('system','imap_disabled'))) ? 0 : 1);
68 $mail_enabled = false;
69 $pubmail_enabled = false;
71 if(! $mail_disabled) {
72 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
75 if (dbm::is_result($r)) {
77 if(intval($r[0]['pubmail']))
78 $pubmail_enabled = true;
82 // I don't think there's any need for the $jotnets when editing the post,
83 // and including them makes it difficult for the JS-free theme, so let's
85 /* if($mail_enabled) {
86 $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
87 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
88 . t("Post to Email") . '</div>';
93 call_hooks('jot_tool', $jotplugins);
94 //call_hooks('jot_networks', $jotnets);
97 //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
99 $o .= replace_macros($tpl,array(
101 '$return_path' => $_SESSION['return_url'],
103 '$share' => t('Save'),
104 '$upload' => t('Upload photo'),
105 '$shortupload' => t('upload photo'),
106 '$attach' => t('Attach file'),
107 '$shortattach' => t('attach file'),
108 '$weblink' => t('Insert web link'),
109 '$shortweblink' => t('web link'),
110 '$video' => t('Insert video link'),
111 '$shortvideo' => t('video link'),
112 '$audio' => t('Insert audio link'),
113 '$shortaudio' => t('audio link'),
114 '$setloc' => t('Set your location'),
115 '$shortsetloc' => t('set location'),
116 '$noloc' => t('Clear browser location'),
117 '$shortnoloc' => t('clear location'),
118 '$wait' => t('Please wait'),
119 '$permset' => t('Permission settings'),
120 '$ptyp' => $itm[0]['type'],
121 '$content' => undo_post_tagging($itm[0]['body']),
122 '$post_id' => $post_id,
123 '$baseurl' => System::baseUrl(),
124 '$defloc' => $a->user['default-location'],
125 '$visitor' => 'none',
127 '$emailcc' => t('CC: email addresses'),
128 '$public' => t('Public post'),
129 '$jotnets' => $jotnets,
130 '$title' => htmlspecialchars($itm[0]['title']),
131 '$placeholdertitle' => t('Set title'),
132 '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
133 '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
134 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
135 '$lockstate' => $lockstate,
136 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
137 '$bang' => (($group) ? '!' : ''),
138 '$profile_uid' => $_SESSION['uid'],
139 '$preview' => t('Preview'),
140 '$jotplugins' => $jotplugins,
141 '$sourceapp' => t($a->sourcename),
142 '$cancel' => t('Cancel'),
143 '$rand_num' => random_digits(12),
145 //jot nav tab (used in some themes)
146 '$message' => t('Message'),
147 '$browser' => t('Browser'),
148 '$shortpermset' => t('permissions'),