]> git.mxchange.org Git - friendica.git/blob - mod/editpost.php
Merge pull request #3119 from annando/1701-bugfix-events
[friendica.git] / mod / editpost.php
1 <?php
2
3 require_once('include/acl_selectors.php');
4
5 function editpost_content(App $a) {
6
7         $o = '';
8
9         if (! local_user()) {
10                 notice( t('Permission denied.') . EOL);
11                 return;
12         }
13
14         $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
15
16         if (! $post_id) {
17                 notice( t('Item not found') . EOL);
18                 return;
19         }
20
21         $itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
22                 intval($post_id),
23                 intval(local_user())
24         );
25
26         if (! dbm::is_result($itm)) {
27                 notice( t('Item not found') . EOL);
28                 return;
29         }
30
31         $o .= replace_macros(get_markup_template("section_title.tpl"),array(
32                 '$title' => t('Edit post')
33         ));
34
35         $tpl = get_markup_template('jot-header.tpl');
36         $a->page['htmlhead'] .= replace_macros($tpl, array(
37                 '$baseurl' => App::get_baseurl(),
38                 '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
39                 '$geotag' => $geotag,
40                 '$nickname' => $a->user['nickname']
41         ));
42
43         $tpl = get_markup_template('jot-end.tpl');
44         $a->page['end'] .= replace_macros($tpl, array(
45                 '$baseurl' => App::get_baseurl(),
46                 '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
47                 '$geotag' => $geotag,
48                 '$nickname' => $a->user['nickname']
49         ));
50
51
52         $tpl = get_markup_template("jot.tpl");
53
54         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'])))))
55                 $lockstate = 'lock';
56         else
57                 $lockstate = 'unlock';
58
59         $jotplugins = '';
60         $jotnets = '';
61
62         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
63
64         $mail_enabled = false;
65         $pubmail_enabled = false;
66
67         if(! $mail_disabled) {
68                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
69                         intval(local_user())
70                 );
71                 if (dbm::is_result($r)) {
72                         $mail_enabled = true;
73                         if(intval($r[0]['pubmail']))
74                                 $pubmail_enabled = true;
75                 }
76         }
77
78         // I don't think there's any need for the $jotnets when editing the post,
79         // and including them makes it difficult for the JS-free theme, so let's
80         // disable them
81 /*      if($mail_enabled) {
82        $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
83                 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
84                 . t("Post to Email") . '</div>';
85         }*/
86
87
88
89         call_hooks('jot_tool', $jotplugins);
90         //call_hooks('jot_networks', $jotnets);
91
92
93         //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
94
95         $o .= replace_macros($tpl,array(
96                 '$is_edit' => true,
97                 '$return_path' => $_SESSION['return_url'],
98                 '$action' => 'item',
99                 '$share' => t('Save'),
100                 '$upload' => t('Upload photo'),
101                 '$shortupload' => t('upload photo'),
102                 '$attach' => t('Attach file'),
103                 '$shortattach' => t('attach file'),
104                 '$weblink' => t('Insert web link'),
105                 '$shortweblink' => t('web link'),
106                 '$video' => t('Insert video link'),
107                 '$shortvideo' => t('video link'),
108                 '$audio' => t('Insert audio link'),
109                 '$shortaudio' => t('audio link'),
110                 '$setloc' => t('Set your location'),
111                 '$shortsetloc' => t('set location'),
112                 '$noloc' => t('Clear browser location'),
113                 '$shortnoloc' => t('clear location'),
114                 '$wait' => t('Please wait'),
115                 '$permset' => t('Permission settings'),
116                 '$ptyp' => $itm[0]['type'],
117                 '$content' => undo_post_tagging($itm[0]['body']),
118                 '$post_id' => $post_id,
119                 '$baseurl' => App::get_baseurl(),
120                 '$defloc' => $a->user['default-location'],
121                 '$visitor' => 'none',
122                 '$pvisit' => 'none',
123                 '$emailcc' => t('CC: email addresses'),
124                 '$public' => t('Public post'),
125                 '$jotnets' => $jotnets,
126                 '$title' => htmlspecialchars($itm[0]['title']),
127                 '$placeholdertitle' => t('Set title'),
128                 '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
129                 '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
130                 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
131                 '$lockstate' => $lockstate,
132                 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
133                 '$bang' => (($group) ? '!' : ''),
134                 '$profile_uid' => $_SESSION['uid'],
135                 '$preview' => t('Preview'),
136                 '$jotplugins' => $jotplugins,
137                 '$sourceapp' => t($a->sourcename),
138                 '$cancel' => t('Cancel'),
139                 '$rand_num' => random_digits(12),
140
141                 //jot nav tab (used in some themes)
142                 '$message' => t('Message'),
143                 '$browser' => t('Browser'),
144                 '$shortpermset' => t('permissions'),
145         ));
146
147         return $o;
148
149 }
150
151