]> git.mxchange.org Git - friendica.git/blob - mod/editpost.php
Merge pull request #2132 from rabuzarus/0112_vier_css
[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         $jotplugins = '';
70         $jotnets = '';
71
72         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
73
74         $mail_enabled = false;
75         $pubmail_enabled = false;
76
77         if(! $mail_disabled) {
78                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
79                         intval(local_user())
80                 );
81                 if(count($r)) {
82                         $mail_enabled = true;
83                         if(intval($r[0]['pubmail']))
84                                 $pubmail_enabled = true;
85                 }
86         }
87
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
90         // disable them
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>';
95         }*/
96
97
98
99         call_hooks('jot_tool', $jotplugins);
100         //call_hooks('jot_networks', $jotnets);
101
102         
103         //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
104
105         $o .= replace_macros($tpl,array(
106                 '$return_path' => $_SESSION['return_url'],
107                 '$action' => 'item',
108                 '$share' => t('Save'),
109                 '$upload' => t('Upload photo'),
110                 '$shortupload' => t('upload photo'),
111                 '$attach' => t('Attach file'),
112                 '$shortattach' => t('attach file'),
113                 '$weblink' => t('Insert web link'),
114                 '$shortweblink' => t('web link'),
115                 '$video' => t('Insert video link'),
116                 '$shortvideo' => t('video link'),
117                 '$audio' => t('Insert audio link'),
118                 '$shortaudio' => t('audio link'),
119                 '$setloc' => t('Set your location'),
120                 '$shortsetloc' => t('set location'),
121                 '$noloc' => t('Clear browser location'),
122                 '$shortnoloc' => t('clear location'),
123                 '$wait' => t('Please wait'),
124                 '$permset' => t('Permission settings'),
125                 '$ptyp' => $itm[0]['type'],
126                 '$content' => undo_post_tagging($itm[0]['body']),
127                 '$post_id' => $post_id,
128                 '$baseurl' => $a->get_baseurl(),
129                 '$defloc' => $a->user['default-location'],
130                 '$visitor' => 'none',
131                 '$pvisit' => 'none',
132                 '$emailcc' => t('CC: email addresses'),
133                 '$public' => t('Public post'),
134                 '$jotnets' => $jotnets,
135                 '$title' => htmlspecialchars($itm[0]['title']),
136                 '$placeholdertitle' => t('Set title'),
137                 '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
138                 '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
139                 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
140                 '$lockstate' => $lockstate,
141                 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
142                 '$bang' => (($group) ? '!' : ''),
143                 '$profile_uid' => $_SESSION['uid'],
144                 '$preview' => t('Preview'),
145                 '$jotplugins' => $jotplugins,
146                 '$sourceapp' => t($a->sourcename),
147                 '$cancel' => t('Cancel'),
148                 '$rand_num' => random_digits(12)
149         ));
150
151         return $o;
152
153 }
154
155