4 use Friendica\Database\DBM;
6 function lockview_content(App $a) {
8 $type = (($a->argc > 1) ? $a->argv[1] : 0);
9 if (is_numeric($type)) {
10 $item_id = intval($type);
13 $item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
19 if (!in_array($type, array('item','photo','event')))
22 $r = q("SELECT * FROM `%s` WHERE `id` = %d LIMIT 1",
26 if (! DBM::is_result($r)) {
31 call_hooks('lockview_content', $item);
33 if($item['uid'] != local_user()) {
34 echo t('Remote privacy information not available.') . '<br />';
39 if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid']))
40 && (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) {
42 echo t('Remote privacy information not available.') . '<br />';
46 $allowed_users = expand_acl($item['allow_cid']);
47 $allowed_groups = expand_acl($item['allow_gid']);
48 $deny_users = expand_acl($item['deny_cid']);
49 $deny_groups = expand_acl($item['deny_gid']);
51 $o = t('Visible to:') . '<br />';
54 if(count($allowed_groups)) {
55 $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
56 dbesc(implode(', ', $allowed_groups))
58 if (DBM::is_result($r))
60 $l[] = '<b>' . $rr['name'] . '</b>';
62 if(count($allowed_users)) {
63 $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
64 dbesc(implode(', ',$allowed_users))
66 if (DBM::is_result($r))
72 if(count($deny_groups)) {
73 $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
74 dbesc(implode(', ', $deny_groups))
76 if (DBM::is_result($r))
78 $l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
80 if(count($deny_users)) {
81 $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
82 dbesc(implode(', ',$deny_users))
84 if (DBM::is_result($r))
86 $l[] = '<strike>' . $rr['name'] . '</strike>';
90 echo $o . implode(', ', $l);