]> git.mxchange.org Git - friendica.git/blob - mod/editpost.php
Merge pull request #1630 from annando/1505-ostatus
[friendica.git] / mod / editpost.php
1 <?php
2
3 require_once('include/acl_selectors.php');
4
5 function editpost_content(&$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(! count($itm)) {
27                 notice( t('Item not found') . EOL);
28                 return;
29         }
30
31 /*      $plaintext = false;
32         if( local_user() && intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext') )
33                 $plaintext = true;*/
34         $plaintext = true;
35         if( local_user() && feature_enabled(local_user(),'richtext') )
36                 $plaintext = false;
37
38
39         $o .= replace_macros(get_markup_template("section_title.tpl"),array(
40                 '$title' => t('Edit post')
41         ));
42
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' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
48                 '$geotag' => $geotag,
49                 '$nickname' => $a->user['nickname']
50         ));
51
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' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
57                 '$geotag' => $geotag,
58                 '$nickname' => $a->user['nickname']
59         ));
60
61
62         $tpl = get_markup_template("jot.tpl");
63                 
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'])))))
65                 $lockstate = 'lock';
66         else
67                 $lockstate = 'unlock';
68
69         $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
70
71         $jotplugins = '';
72         $jotnets = '';
73
74         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
75
76         $mail_enabled = false;
77         $pubmail_enabled = false;
78
79         if(! $mail_disabled) {
80                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
81                         intval(local_user())
82                 );
83                 if(count($r)) {
84                         $mail_enabled = true;
85                         if(intval($r[0]['pubmail']))
86                                 $pubmail_enabled = true;
87                 }
88         }
89
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
92         // disable them
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>';
97         }*/
98                                         
99
100
101         call_hooks('jot_tool', $jotplugins);
102         //call_hooks('jot_networks', $jotnets);
103
104         
105         //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));      
106         
107
108         $o .= replace_macros($tpl,array(
109                 '$return_path' => $_SESSION['return_url'],
110                 '$action' => 'item',
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',
134                 '$pvisit' => '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)
152         ));
153
154         return $o;
155
156 }
157
158