diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/display.php | 3 | ||||
-rw-r--r-- | mod/lockview.php | 67 | ||||
-rw-r--r-- | mod/network.php | 4 | ||||
-rw-r--r-- | mod/profile.php | 5 |
4 files changed, 70 insertions, 9 deletions
diff --git a/mod/display.php b/mod/display.php index d0bbf54bf..451b9d644 100644 --- a/mod/display.php +++ b/mod/display.php @@ -151,10 +151,9 @@ function display_content(&$a) { $lock = (($item['uid'] == get_uid()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) - ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" alt="Private Message" /></div>' + ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>' : '<div class="wall-item-lock"></div>'); - if(can_write_wall($a,$a->profile['uid'])) { if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( diff --git a/mod/lockview.php b/mod/lockview.php new file mode 100644 index 000000000..b8f4318df --- /dev/null +++ b/mod/lockview.php @@ -0,0 +1,67 @@ +<?php + + +function lockview_content(&$a) { + + $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0); + if(! $item_id) + killme(); + + $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", + intval($item_id) + ); + if(! count($r)) + killme(); + $item = $r[0]; + if($item['uid'] != local_user()) + killme(); + + + $allowed_users = expand_acl($item['allow_cid']); + $allowed_groups = expand_acl($item['allow_gid']); + $deny_users = expand_acl($item['deny_cid']); + $deny_groups = expand_acl($item['deny_gid']); + + $o = t('Visible to:') . '<br />'; + $l = array(); + + if(count($allowed_groups)) { + $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )", + dbesc(implode(', ', $allowed_groups)) + ); + if(count($r)) + foreach($r as $rr) + $l[] = '<b>' . $rr['name'] . '</b>'; + } + if(count($allowed_users)) { + $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )", + dbesc(implode(', ',$allowed_users)) + ); + if(count($r)) + foreach($r as $rr) + $l[] = $rr['name']; + + } + + if(count($deny_groups)) { + $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )", + dbesc(implode(', ', $deny_groups)) + ); + if(count($r)) + foreach($r as $rr) + $l[] = '<b><strike>' . $rr['name'] . '</strike></b>'; + } + if(count($deny_users)) { + $r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )", + dbesc(implode(', ',$deny_users)) + ); + if(count($r)) + foreach($r as $rr) + $l[] = '<strike>' . $rr['name'] . '</strike>'; + + } + + echo $o . implode(', ', $l); + killme(); + +} diff --git a/mod/network.php b/mod/network.php index b0daecac4..ac5664b4f 100644 --- a/mod/network.php +++ b/mod/network.php @@ -173,13 +173,11 @@ function network_content(&$a, $update = 0) { if((($item['verb'] == ACTIVITY_LIKE) || ($item['verb'] == ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent'])) continue; - $lock = (($item['uid'] == get_uid()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) - ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" alt="Private Message" /></div>' + ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>' : '<div class="wall-item-lock"></div>'); - // Top-level wall post not written by the wall owner (wall-to-wall) // First figure out who owns it. diff --git a/mod/profile.php b/mod/profile.php index bf9c0f758..de0ae5745 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -309,12 +309,9 @@ function profile_content(&$a, $update = 0) { $lock = (($item['uid'] == get_uid()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) - ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" alt="Private Message" /></div>' + ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>' : '<div class="wall-item-lock"></div>'); - - - if(can_write_wall($a,$a->profile['profile_uid'])) { if($item['id'] == $item['parent']) { $likebuttons = replace_macros($like_tpl,array('$id' => $item['id'])); |