3 require_once('include/acl_selectors.php');
5 if(! function_exists('editpost_content')) {
6 function editpost_content(&$a) {
11 notice( t('Permission denied.') . EOL);
15 $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
18 notice( t('Item not found') . EOL);
22 $itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
28 notice( t('Item not found') . EOL);
32 /* $plaintext = false;
33 if( local_user() && intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext') )
36 if( local_user() && feature_enabled(local_user(),'richtext') )
40 $o .= replace_macros(get_markup_template("section_title.tpl"),array(
41 '$title' => t('Edit post')
44 $tpl = get_markup_template('jot-header.tpl');
45 $a->page['htmlhead'] .= replace_macros($tpl, array(
46 '$baseurl' => $a->get_baseurl(),
47 '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
48 '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'),
50 '$nickname' => $a->user['nickname']
53 $tpl = get_markup_template('jot-end.tpl');
54 $a->page['end'] .= replace_macros($tpl, array(
55 '$baseurl' => $a->get_baseurl(),
56 '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
57 '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'),
59 '$nickname' => $a->user['nickname']
63 $tpl = get_markup_template("jot.tpl");
65 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'])))))
68 $lockstate = 'unlock';
73 $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
75 $mail_enabled = false;
76 $pubmail_enabled = false;
78 if(! $mail_disabled) {
79 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
84 if(intval($r[0]['pubmail']))
85 $pubmail_enabled = true;
89 // I don't think there's any need for the $jotnets when editing the post,
90 // and including them makes it difficult for the JS-free theme, so let's
92 /* if($mail_enabled) {
93 $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
94 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
95 . t("Post to Email") . '</div>';
100 call_hooks('jot_tool', $jotplugins);
101 //call_hooks('jot_networks', $jotnets);
104 //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
106 $o .= replace_macros($tpl,array(
108 '$return_path' => $_SESSION['return_url'],
110 '$share' => t('Save'),
111 '$upload' => t('Upload photo'),
112 '$shortupload' => t('upload photo'),
113 '$attach' => t('Attach file'),
114 '$shortattach' => t('attach file'),
115 '$weblink' => t('Insert web link'),
116 '$shortweblink' => t('web link'),
117 '$video' => t('Insert video link'),
118 '$shortvideo' => t('video link'),
119 '$audio' => t('Insert audio link'),
120 '$shortaudio' => t('audio link'),
121 '$setloc' => t('Set your location'),
122 '$shortsetloc' => t('set location'),
123 '$noloc' => t('Clear browser location'),
124 '$shortnoloc' => t('clear location'),
125 '$wait' => t('Please wait'),
126 '$permset' => t('Permission settings'),
127 '$ptyp' => $itm[0]['type'],
128 '$content' => undo_post_tagging($itm[0]['body']),
129 '$post_id' => $post_id,
130 '$baseurl' => $a->get_baseurl(),
131 '$defloc' => $a->user['default-location'],
132 '$visitor' => 'none',
134 '$emailcc' => t('CC: email addresses'),
135 '$public' => t('Public post'),
136 '$jotnets' => $jotnets,
137 '$title' => htmlspecialchars($itm[0]['title']),
138 '$placeholdertitle' => t('Set title'),
139 '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
140 '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
141 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
142 '$lockstate' => $lockstate,
143 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
144 '$bang' => (($group) ? '!' : ''),
145 '$profile_uid' => $_SESSION['uid'],
146 '$preview' => t('Preview'),
147 '$jotplugins' => $jotplugins,
148 '$sourceapp' => t($a->sourcename),
149 '$cancel' => t('Cancel'),
150 '$rand_num' => random_digits(12)