]> git.mxchange.org Git - friendica.git/blob - mod/editpost.php
Merge branch 'master' of github.com:annando/friendica
[friendica.git] / mod / editpost.php
1 <?php
2
3 require_once('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')))
33                 $plaintext = true;
34
35
36         $o .= '<h2>' . t('Edit post') . '</h2>';
37
38         $tpl = get_markup_template('jot-header.tpl');
39         
40         $a->page['htmlhead'] .= replace_macros($tpl, array(
41                 '$baseurl' => $a->get_baseurl(),
42                 '$editselect' =>  (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
43                 '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
44                 '$geotag' => $geotag,
45                 '$nickname' => $a->user['nickname']
46         ));
47
48
49         $tpl = get_markup_template("jot.tpl");
50                 
51         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'])))))
52                 $lockstate = 'lock';
53         else
54                 $lockstate = 'unlock';
55
56         $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
57
58         $jotplugins = '';
59         $jotnets = '';
60
61         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
62
63         $mail_enabled = false;
64         $pubmail_enabled = false;
65
66         if(! $mail_disabled) {
67                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
68                         intval(local_user())
69                 );
70                 if(count($r)) {
71                         $mail_enabled = true;
72                         if(intval($r[0]['pubmail']))
73                                 $pubmail_enabled = true;
74                 }
75         }
76
77         if($mail_enabled) {
78        $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
79                 $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
80                 . t("Post to Email") . '</div>';
81         }
82                                         
83
84
85         call_hooks('jot_tool', $jotplugins);
86         call_hooks('jot_networks', $jotnets);
87
88         
89         //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));      
90         
91
92         $o .= replace_macros($tpl,array(
93                 '$return_path' => $_SESSION['return_url'],
94                 '$action' => 'item',
95                 '$share' => t('Edit'),
96                 '$upload' => t('Upload photo'),
97                 '$attach' => t('Attach file'),
98                 '$weblink' => t('Insert web link'),
99                 '$youtube' => t('Insert YouTube video'),
100                 '$video' => t('Insert Vorbis [.ogg] video'),
101                 '$audio' => t('Insert Vorbis [.ogg] audio'),
102                 '$setloc' => t('Set your location'),
103                 '$noloc' => t('Clear browser location'),
104                 '$wait' => t('Please wait'),
105                 '$permset' => t('Permission settings'),
106                 '$ptyp' => $itm[0]['type'],
107                 '$content' => undo_post_tagging($itm[0]['body']),
108                 '$post_id' => $post_id,
109                 '$baseurl' => $a->get_baseurl(),
110                 '$defloc' => $a->user['default-location'],
111                 '$visitor' => 'none',
112                 '$pvisit' => 'none',
113                 '$emailcc' => t('CC: email addresses'),
114                 '$public' => t('Public post'),
115                 '$jotnets' => $jotnets,
116                 '$title' => $itm[0]['title'],
117                 '$placeholdertitle' => t('Set title'),
118                 '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
119                 '$placeholdercategory' => t('Categories (comma-separated list)'),
120                 '$emtitle' => t('Example: bob@example.com, mary@example.com'),
121                 '$lockstate' => $lockstate,
122                 '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user), $celeb),
123                 '$bang' => (($group) ? '!' : ''),
124                 '$profile_uid' => $_SESSION['uid'],
125                 '$preview' => t('Preview'),
126                 '$jotplugins' => $jotplugins,
127         ));
128
129         return $o;
130
131 }
132
133