]> git.mxchange.org Git - friendica.git/blob - mod/lockview.php
show members of locked conversations
[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         $o = t('Visible to:') . '<br />';
26         $l = array();
27
28         if(count($allowed_groups)) {
29                 $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
30                         dbesc(implode(', ', $allowed_groups))
31                 );
32                 if(count($r))
33                         foreach($r as $rr) 
34                                 $l[] = '<b>' . $rr['name'] . '</b>';
35         }
36         if(count($allowed_users)) {
37                 $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
38                         dbesc(implode(', ',$allowed_users))
39                 );
40                 if(count($r))
41                         foreach($r as $rr) 
42                                 $l[] = $rr['name'];
43
44         }
45
46         if(count($deny_groups)) {
47                 $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
48                         dbesc(implode(', ', $deny_groups))
49                 );
50                 if(count($r))
51                         foreach($r as $rr) 
52                                 $l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
53         }
54         if(count($deny_users)) {
55                 $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
56                         dbesc(implode(', ',$deny_users))
57                 );
58                 if(count($r))
59                         foreach($r as $rr) 
60                                 $l[] = '<strike>' . $rr['name'] . '</strike>';
61
62         }
63
64         echo $o . implode(', ', $l);
65         killme();
66
67 }