]> git.mxchange.org Git - friendica.git/blob - mod/editpost.php
Merge pull request #3380 from fabrixxm/feature/frio/fixedaside2
[friendica.git] / mod / editpost.php
1 <?php
2
3 use Friendica\App;
4
5 require_once('include/acl_selectors.php');
6
7 function editpost_content(App $a) {
8
9         $o = '';
10
11         if (! local_user()) {
12                 notice( t('Permission denied.') . EOL);
13                 return;
14         }
15
16         $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
17
18         if (! $post_id) {
19                 notice( t('Item not found') . EOL);
20                 return;
21         }
22
23         $itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
24                 intval($post_id),
25                 intval(local_user())
26         );
27
28         if (! dbm::is_result($itm)) {
29                 notice( t('Item not found') . EOL);
30                 return;
31         }
32
33         $o .= replace_macros(get_markup_template("section_title.tpl"),array(
34                 '$title' => t('Edit post')
35         ));
36
37         $tpl = get_markup_template('jot-header.tpl');
38         $a->page['htmlhead'] .= replace_macros($tpl, array(
39                 '$baseurl' => App::get_baseurl(),
40                 '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
41                 '$geotag' => $geotag,
42                 '$nickname' => $a->user['nickname']
43         ));
44
45         $tpl = get_markup_template('jot-end.tpl');
46         $a->page['end'] .= replace_macros($tpl, array(
47                 '$baseurl' => App::get_baseurl(),
48                 '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
49                 '$geotag' => $geotag,
50                 '$nickname' => $a->user['nickname']
51         ));
52
53
54         $tpl = get_markup_template("jot.tpl");
55
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'])))))
57                 $lockstate = 'lock';
58         else
59                 $lockstate = 'unlock';
60
61         $jotplugins = '';
62         $jotnets = '';
63
64         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
65
66         $mail_enabled = false;
67         $pubmail_enabled = false;
68
69         if(! $mail_disabled) {
70                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
71                         intval(local_user())
72                 );
73                 if (dbm::is_result($r)) {
74                         $mail_enabled = true;
75                         if(intval($r[0]['pubmail']))
76                                 $pubmail_enabled = true;
77                 }
78         }
79
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
82         // disable them
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>';
87         }*/
88
89
90
91         call_hooks('jot_tool', $jotplugins);
92         //call_hooks('jot_networks', $jotnets);
93
94
95         //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
96
97         $o .= replace_macros($tpl,array(
98                 '$is_edit' => true,
99                 '$return_path' => $_SESSION['return_url'],
100                 '$action' => 'item',
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',
124                 '$pvisit' => '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),
142
143                 //jot nav tab (used in some themes)
144                 '$message' => t('Message'),
145                 '$browser' => t('Browser'),
146                 '$shortpermset' => t('permissions'),
147         ));
148
149         return $o;
150
151 }
152
153