5 require_once('include/acl_selectors.php');
7 function editpost_content(App $a) {
12 notice( t('Permission denied.') . EOL);
16 $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
19 notice( t('Item not found') . EOL);
23 $itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
28 if (! dbm::is_result($itm)) {
29 notice( t('Item not found') . EOL);
33 $o .= replace_macros(get_markup_template("section_title.tpl"),array(
34 '$title' => t('Edit post')
37 $tpl = get_markup_template('jot-header.tpl');
38 $a->page['htmlhead'] .= replace_macros($tpl, array(
39 '$baseurl' => App::get_baseurl(),
40 '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'),
42 '$nickname' => $a->user['nickname']
45 $tpl = get_markup_template('jot-end.tpl');
46 $a->page['end'] .= replace_macros($tpl, array(
47 '$baseurl' => App::get_baseurl(),
48 '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'),
50 '$nickname' => $a->user['nickname']
54 $tpl = get_markup_template("jot.tpl");
56 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'])))))
59 $lockstate = 'unlock';
64 $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
66 $mail_enabled = false;
67 $pubmail_enabled = false;
69 if(! $mail_disabled) {
70 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
73 if (dbm::is_result($r)) {
75 if(intval($r[0]['pubmail']))
76 $pubmail_enabled = true;
80 // I don't think there's any need for the $jotnets when editing the post,
81 // and including them makes it difficult for the JS-free theme, so let's
83 /* if($mail_enabled) {
84 $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
85 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
86 . t("Post to Email") . '</div>';
91 call_hooks('jot_tool', $jotplugins);
92 //call_hooks('jot_networks', $jotnets);
95 //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
97 $o .= replace_macros($tpl,array(
99 '$return_path' => $_SESSION['return_url'],
101 '$share' => t('Save'),
102 '$upload' => t('Upload photo'),
103 '$shortupload' => t('upload photo'),
104 '$attach' => t('Attach file'),
105 '$shortattach' => t('attach file'),
106 '$weblink' => t('Insert web link'),
107 '$shortweblink' => t('web link'),
108 '$video' => t('Insert video link'),
109 '$shortvideo' => t('video link'),
110 '$audio' => t('Insert audio link'),
111 '$shortaudio' => t('audio link'),
112 '$setloc' => t('Set your location'),
113 '$shortsetloc' => t('set location'),
114 '$noloc' => t('Clear browser location'),
115 '$shortnoloc' => t('clear location'),
116 '$wait' => t('Please wait'),
117 '$permset' => t('Permission settings'),
118 '$ptyp' => $itm[0]['type'],
119 '$content' => undo_post_tagging($itm[0]['body']),
120 '$post_id' => $post_id,
121 '$baseurl' => App::get_baseurl(),
122 '$defloc' => $a->user['default-location'],
123 '$visitor' => 'none',
125 '$emailcc' => t('CC: email addresses'),
126 '$public' => t('Public post'),
127 '$jotnets' => $jotnets,
128 '$title' => htmlspecialchars($itm[0]['title']),
129 '$placeholdertitle' => t('Set title'),
130 '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
131 '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
132 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
133 '$lockstate' => $lockstate,
134 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
135 '$bang' => (($group) ? '!' : ''),
136 '$profile_uid' => $_SESSION['uid'],
137 '$preview' => t('Preview'),
138 '$jotplugins' => $jotplugins,
139 '$sourceapp' => t($a->sourcename),
140 '$cancel' => t('Cancel'),
141 '$rand_num' => random_digits(12),
143 //jot nav tab (used in some themes)
144 '$message' => t('Message'),
145 '$browser' => t('Browser'),
146 '$shortpermset' => t('permissions'),