3 require_once('include/acl_selectors.php');
5 function editpost_content(&$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",
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' => $a->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' => $a->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';
69 $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
74 $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
76 $mail_enabled = false;
77 $pubmail_enabled = false;
79 if(! $mail_disabled) {
80 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
85 if(intval($r[0]['pubmail']))
86 $pubmail_enabled = true;
90 // I don't think there's any need for the $jotnets when editing the post,
91 // and including them makes it difficult for the JS-free theme, so let's
93 /* if($mail_enabled) {
94 $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
95 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
96 . t("Post to Email") . '</div>';
101 call_hooks('jot_tool', $jotplugins);
102 //call_hooks('jot_networks', $jotnets);
105 //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
108 $o .= replace_macros($tpl,array(
109 '$return_path' => $_SESSION['return_url'],
111 '$share' => t('Save'),
112 '$upload' => t('Upload photo'),
113 '$shortupload' => t('upload photo'),
114 '$attach' => t('Attach file'),
115 '$shortattach' => t('attach file'),
116 '$weblink' => t('Insert web link'),
117 '$shortweblink' => t('web link'),
118 '$video' => t('Insert video link'),
119 '$shortvideo' => t('video link'),
120 '$audio' => t('Insert audio link'),
121 '$shortaudio' => t('audio link'),
122 '$setloc' => t('Set your location'),
123 '$shortsetloc' => t('set location'),
124 '$noloc' => t('Clear browser location'),
125 '$shortnoloc' => t('clear location'),
126 '$wait' => t('Please wait'),
127 '$permset' => t('Permission settings'),
128 '$ptyp' => $itm[0]['type'],
129 '$content' => undo_post_tagging($itm[0]['body']),
130 '$post_id' => $post_id,
131 '$baseurl' => $a->get_baseurl(),
132 '$defloc' => $a->user['default-location'],
133 '$visitor' => 'none',
135 '$emailcc' => t('CC: email addresses'),
136 '$public' => t('Public post'),
137 '$jotnets' => $jotnets,
138 '$title' => htmlspecialchars($itm[0]['title']),
139 '$placeholdertitle' => t('Set title'),
140 '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
141 '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
142 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
143 '$lockstate' => $lockstate,
144 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user), $celeb),
145 '$bang' => (($group) ? '!' : ''),
146 '$profile_uid' => $_SESSION['uid'],
147 '$preview' => t('Preview'),
148 '$jotplugins' => $jotplugins,
149 '$sourceapp' => t($a->sourcename),
150 '$cancel' => t('Cancel'),
151 '$rand_num' => random_digits(12)