5 function lockview_content(App $a) {
7 $type = (($a->argc > 1) ? $a->argv[1] : 0);
8 if (is_numeric($type)) {
9 $item_id = intval($type);
12 $item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
18 if (!in_array($type, array('item','photo','event')))
21 $r = q("SELECT * FROM `%s` WHERE `id` = %d LIMIT 1",
25 if (! dbm::is_result($r)) {
30 call_hooks('lockview_content', $item);
32 if($item['uid'] != local_user()) {
33 echo t('Remote privacy information not available.') . '<br />';
38 if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid']))
39 && (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) {
41 echo t('Remote privacy information not available.') . '<br />';
45 $allowed_users = expand_acl($item['allow_cid']);
46 $allowed_groups = expand_acl($item['allow_gid']);
47 $deny_users = expand_acl($item['deny_cid']);
48 $deny_groups = expand_acl($item['deny_gid']);
50 $o = t('Visible to:') . '<br />';
53 if(count($allowed_groups)) {
54 $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
55 dbesc(implode(', ', $allowed_groups))
57 if (dbm::is_result($r))
59 $l[] = '<b>' . $rr['name'] . '</b>';
61 if(count($allowed_users)) {
62 $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
63 dbesc(implode(', ',$allowed_users))
65 if (dbm::is_result($r))
71 if(count($deny_groups)) {
72 $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
73 dbesc(implode(', ', $deny_groups))
75 if (dbm::is_result($r))
77 $l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
79 if(count($deny_users)) {
80 $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
81 dbesc(implode(', ',$deny_users))
83 if (dbm::is_result($r))
85 $l[] = '<strike>' . $rr['name'] . '</strike>';
89 echo $o . implode(', ', $l);