3 * @file mod/lockview.php
6 use Friendica\Core\Addon;
7 use Friendica\Core\L10n;
8 use Friendica\Database\DBM;
10 function lockview_content(App $a) {
12 $type = (($a->argc > 1) ? $a->argv[1] : 0);
13 if (is_numeric($type)) {
14 $item_id = intval($type);
17 $item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
23 if (!in_array($type, ['item','photo','event']))
26 $r = q("SELECT * FROM `%s` WHERE `id` = %d LIMIT 1",
30 if (! DBM::is_result($r)) {
35 Addon::callHooks('lockview_content', $item);
37 if($item['uid'] != local_user()) {
38 echo L10n::t('Remote privacy information not available.') . '<br />';
43 if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid']))
44 && (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) {
46 echo L10n::t('Remote privacy information not available.') . '<br />';
50 $allowed_users = expand_acl($item['allow_cid']);
51 $allowed_groups = expand_acl($item['allow_gid']);
52 $deny_users = expand_acl($item['deny_cid']);
53 $deny_groups = expand_acl($item['deny_gid']);
55 $o = L10n::t('Visible to:') . '<br />';
58 if(count($allowed_groups)) {
59 $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
60 dbesc(implode(', ', $allowed_groups))
62 if (DBM::is_result($r))
64 $l[] = '<b>' . $rr['name'] . '</b>';
66 if(count($allowed_users)) {
67 $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
68 dbesc(implode(', ',$allowed_users))
70 if (DBM::is_result($r))
76 if(count($deny_groups)) {
77 $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
78 dbesc(implode(', ', $deny_groups))
80 if (DBM::is_result($r))
82 $l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
84 if(count($deny_users)) {
85 $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
86 dbesc(implode(', ',$deny_users))
88 if (DBM::is_result($r))
90 $l[] = '<strike>' . $rr['name'] . '</strike>';
94 echo $o . implode(', ', $l);