From 5462453bf2bde50166c68f90b08d24826dd07ba8 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 30 Mar 2016 14:31:55 +0200 Subject: some work on mod chat --- mod/lockview.php | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'mod/lockview.php') diff --git a/mod/lockview.php b/mod/lockview.php index 84c16f658..d4a626a11 100644 --- a/mod/lockview.php +++ b/mod/lockview.php @@ -14,11 +14,21 @@ function lockview_content(&$a) { if(! $item_id) killme(); - if (!in_array($type, array('item','photo','event', 'menu_item'))) + if (!in_array($type, array('item','photo','event', 'menu_item', 'chatroom'))) killme(); - //we have different naming in in menu_item table - $id = (($type == 'menu_item') ? 'mitem_id' : 'id'); + //we have different naming in in menu_item table and chatroom table + switch($type) { + case 'menu_item': + $id = 'mitem_id'; + break; + case 'chatroom': + $id = 'cr_id'; + break; + default: + $id = 'id'; + break; + } $r = q("SELECT * FROM %s WHERE $id = %d LIMIT 1", dbesc($type), @@ -30,8 +40,18 @@ function lockview_content(&$a) { $item = $r[0]; - //we have different naming in in menu_item table - $uid = (($type == 'menu_item') ? $item['mitem_channel_id'] : $item['uid']); + //we have different naming in in menu_item table and chatroom table + switch($type) { + case 'menu_item': + $uid = $item['mitem_channel_id']; + break; + case 'chatroom': + $uid = $item['cr_uid']; + break; + default: + $uid = $item['uid']; + break; + } if($uid != local_channel()) { echo '
  • ' . t('Remote privacy information not available.') . '
  • '; -- cgit v1.2.3