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