3 require_once('include/acl_selectors.php');
5 function editpost_content(App &$a) {
10 notice( t('Permission denied.') . EOL);
14 $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
17 notice( t('Item not found') . EOL);
21 $itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
26 if (! dbm::is_result($itm)) {
27 notice( t('Item not found') . EOL);
31 /* $plaintext = false;
32 if( local_user() && intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext') )
35 if( local_user() && feature_enabled(local_user(),'richtext') )
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' => App::get_baseurl(),
46 '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
47 '$ispublic' => ' ', // 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, array(
54 '$baseurl' => App::get_baseurl(),
55 '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
56 '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'),
58 '$nickname' => $a->user['nickname']
62 $tpl = get_markup_template("jot.tpl");
64 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'])))))
67 $lockstate = 'unlock';
72 $mail_disabled = ((function_exists('imap_open') && (! get_config('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 (dbm::is_result($r)) {
83 if(intval($r[0]['pubmail']))
84 $pubmail_enabled = true;
88 // I don't think there's any need for the $jotnets when editing the post,
89 // and including them makes it difficult for the JS-free theme, so let's
91 /* if($mail_enabled) {
92 $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
93 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
94 . t("Post to Email") . '</div>';
99 call_hooks('jot_tool', $jotplugins);
100 //call_hooks('jot_networks', $jotnets);
103 //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
105 $o .= replace_macros($tpl,array(
107 '$return_path' => $_SESSION['return_url'],
109 '$share' => t('Save'),
110 '$upload' => t('Upload photo'),
111 '$shortupload' => t('upload photo'),
112 '$attach' => t('Attach file'),
113 '$shortattach' => t('attach file'),
114 '$weblink' => t('Insert web link'),
115 '$shortweblink' => t('web link'),
116 '$video' => t('Insert video link'),
117 '$shortvideo' => t('video link'),
118 '$audio' => t('Insert audio link'),
119 '$shortaudio' => t('audio link'),
120 '$setloc' => t('Set your location'),
121 '$shortsetloc' => t('set location'),
122 '$noloc' => t('Clear browser location'),
123 '$shortnoloc' => t('clear location'),
124 '$wait' => t('Please wait'),
125 '$permset' => t('Permission settings'),
126 '$ptyp' => $itm[0]['type'],
127 '$content' => undo_post_tagging($itm[0]['body']),
128 '$post_id' => $post_id,
129 '$baseurl' => App::get_baseurl(),
130 '$defloc' => $a->user['default-location'],
131 '$visitor' => 'none',
133 '$emailcc' => t('CC: email addresses'),
134 '$public' => t('Public post'),
135 '$jotnets' => $jotnets,
136 '$title' => htmlspecialchars($itm[0]['title']),
137 '$placeholdertitle' => t('Set title'),
138 '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
139 '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
140 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
141 '$lockstate' => $lockstate,
142 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
143 '$bang' => (($group) ? '!' : ''),
144 '$profile_uid' => $_SESSION['uid'],
145 '$preview' => t('Preview'),
146 '$jotplugins' => $jotplugins,
147 '$sourceapp' => t($a->sourcename),
148 '$cancel' => t('Cancel'),
149 '$rand_num' => random_digits(12),
151 //jot nav tab (used in some themes)
152 '$message' => t('Message'),
153 '$browser' => t('Browser'),
154 '$shortpermset' => t('permissions'),