]> git.mxchange.org Git - friendica.git/blob - include/security.php
eradicate redundant get_uid function
[friendica.git] / include / security.php
1 <?php
2
3 function can_write_wall(&$a,$owner) {
4
5         if((! (local_user())) && (! (remote_user())))
6                 return false;
7                 $uid = local_user();
8
9         if(($uid) && ($uid == $owner)) {
10                 return true;
11                 }
12
13         $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` LEFT JOIN `user` on `user`.`uid` = `contact`.`uid` 
14                         WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 
15                         AND `readonly` = 0  AND ( `contact`.`rel` IN ( %d , %d ) OR `user`.`page-flags` = %d ) LIMIT 1",
16                         intval($owner),
17                         intval($_SESSION['visitor_id']),
18                         intval(REL_VIP),
19                         intval(REL_BUD),
20                         intval(PAGE_COMMUNITY)
21         );
22
23         if(count($r))
24                 return true;
25         return false;
26
27 }