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