diff options
author | Mario Vavti <mario@mariovavti.com> | 2016-03-30 14:31:55 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2016-03-30 14:31:55 +0200 |
commit | 5462453bf2bde50166c68f90b08d24826dd07ba8 (patch) | |
tree | 8951f8c1f38cb9847419fce8874a89325da6fe54 /mod | |
parent | e4f360505466d4701ea4ac8f8bec18fac5b4c3ec (diff) | |
download | volse-hubzilla-5462453bf2bde50166c68f90b08d24826dd07ba8.tar.gz volse-hubzilla-5462453bf2bde50166c68f90b08d24826dd07ba8.tar.bz2 volse-hubzilla-5462453bf2bde50166c68f90b08d24826dd07ba8.zip |
some work on mod chat
Diffstat (limited to 'mod')
-rw-r--r-- | mod/chat.php | 48 | ||||
-rw-r--r-- | mod/lockview.php | 30 |
2 files changed, 47 insertions, 31 deletions
diff --git a/mod/chat.php b/mod/chat.php index f219bde73..6c0a61880 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -194,42 +194,38 @@ function chat_content(&$a) { } + require_once('include/conversation.php'); + $o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']); + $acl = new Zotlabs\Access\AccessList($channel); + $channel_acl = $acl->get(); - if(local_channel() && argc() > 2 && argv(2) === 'new') { - - $acl = new Zotlabs\Access\AccessList($channel); - $channel_acl = $acl->get(); - - require_once('include/acl_selectors.php'); - - $o = replace_macros(get_markup_template('chatroom_new.tpl'),array( - '$header' => t('New Chatroom'), - '$name' => array('room_name',t('Chatroom Name'),'', ''), - '$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''), - '$permissions' => t('Permissions'), - '$acl' => populate_acl($channel_acl,false), - '$submit' => t('Submit') - )); - return $o; - } - - + $lockstate = (($channel_acl['allow_cid'] || $channel_acl['allow_gid'] || $channel_acl['deny_cid'] || $channel_acl['deny_gid']) ? 'lock' : 'unlock'); + require_once('include/acl_selectors.php'); - require_once('include/conversation.php'); + $chatroom_new = replace_macros(get_markup_template('chatroom_new.tpl'),array( + '$header' => t('New Chatroom'), + '$name' => array('room_name',t('Chatroom name'),'', ''), + '$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''), + '$permissions' => t('Permissions'), + '$acl' => populate_acl($channel_acl,false), + '$lockstate' => $lockstate, + '$submit' => t('Submit') - $o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']); + )); - require_once('include/widgets.php'); + $rooms = chatroom_list($a->profile['profile_uid']); $o .= replace_macros(get_markup_template('chatrooms.tpl'), array( '$header' => sprintf( t('%1$s\'s Chatrooms'), $a->profile['name']), '$baseurl' => z_root(), - '$nickname' => $channel['channel_address'], - '$rooms' => widget_chatroom_list(array()), - '$newroom' => t('New Chatroom'), - '$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0) + '$nickname' => $a->profile['channel_address'], + '$rooms' => $rooms, + '$norooms' => t('No chatrooms available'), + '$newroom' => t('Create New'), + '$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0), + '$chatroom_new' => $chatroom_new )); return $o; 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 '<li>' . t('Remote privacy information not available.') . '</li>'; |