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 .= '<h2>' . t('Edit post') . '</h2>';
41 $tpl = get_markup_template('jot-header.tpl');
42 $a->page['htmlhead'] .= replace_macros($tpl, array(
43 '$baseurl' => $a->get_baseurl(),
44 '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
45 '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'),
47 '$nickname' => $a->user['nickname']
50 $tpl = get_markup_template('jot-end.tpl');
51 $a->page['end'] .= replace_macros($tpl, array(
52 '$baseurl' => $a->get_baseurl(),
53 '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
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';
67 $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
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",
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));
106 $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' => $a->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), $celeb),
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)