]> git.mxchange.org Git - friendica.git/blob - mod/lockview.php
display the fact that a conversation is private without disclosing the details of...
[friendica.git] / mod / lockview.php
1 <?php
2
3
4 function lockview_content(&$a) {
5
6         $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
7         if(! $item_id)
8                 killme();
9
10         $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
11                 intval($item_id)
12         );
13         if(! count($r))
14                 killme();
15         $item = $r[0];
16         if($item['uid'] != local_user())
17                 killme();
18
19
20         $allowed_users = expand_acl($item['allow_cid']);
21         $allowed_groups = expand_acl($item['allow_gid']);
22         $deny_users = expand_acl($item['deny_cid']);
23         $deny_groups = expand_acl($item['deny_gid']);
24
25         if(($item['private']) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid'])) 
26                 && (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) {
27
28                 echo t('Remote privacy information not available.') . '<br />';
29                 killme();
30         }
31
32         $o = t('Visible to:') . '<br />';
33         $l = array();
34
35         if(count($allowed_groups)) {
36                 $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
37                         dbesc(implode(', ', $allowed_groups))
38                 );
39                 if(count($r))
40                         foreach($r as $rr) 
41                                 $l[] = '<b>' . $rr['name'] . '</b>';
42         }
43         if(count($allowed_users)) {
44                 $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
45                         dbesc(implode(', ',$allowed_users))
46                 );
47                 if(count($r))
48                         foreach($r as $rr) 
49                                 $l[] = $rr['name'];
50
51         }
52
53         if(count($deny_groups)) {
54                 $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
55                         dbesc(implode(', ', $deny_groups))
56                 );
57                 if(count($r))
58                         foreach($r as $rr) 
59                                 $l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
60         }
61         if(count($deny_users)) {
62                 $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
63                         dbesc(implode(', ',$deny_users))
64                 );
65                 if(count($r))
66                         foreach($r as $rr) 
67                                 $l[] = '<strike>' . $rr['name'] . '</strike>';
68
69         }
70
71         echo $o . implode(', ', $l);
72         killme();
73
74 }