From a9711895cf254a0ca34b1e3f7c8e75bb832e6973 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 20 Feb 2016 19:39:54 +1100 Subject: move accesslist class to namespace --- mod/chat.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mod/chat.php') diff --git a/mod/chat.php b/mod/chat.php index 79a5c050b..f219bde73 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -54,7 +54,7 @@ function chat_post(&$a) { goaway(z_root() . '/chat/' . $channel['channel_address']); } - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $acl->set_from_array($_REQUEST); $arr = $acl->get(); @@ -162,7 +162,7 @@ function chat_content(&$a) { intval($a->profile['profile_uid']) ); if($x) { - $acl = new AccessList(false); + $acl = new Zotlabs\Access\AccessList(false); $acl->set($x[0]); $private = $acl->is_private(); @@ -199,7 +199,7 @@ function chat_content(&$a) { if(local_channel() && argc() > 2 && argv(2) === 'new') { - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); require_once('include/acl_selectors.php'); -- cgit v1.2.3 From dfbe2eaf9856140de84f4d891fd442cdd6872545 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 20 Feb 2016 00:49:37 -0800 Subject: Revert "move accesslist class to namespace" This reverts commit a9711895cf254a0ca34b1e3f7c8e75bb832e6973. --- mod/chat.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mod/chat.php') diff --git a/mod/chat.php b/mod/chat.php index f219bde73..79a5c050b 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -54,7 +54,7 @@ function chat_post(&$a) { goaway(z_root() . '/chat/' . $channel['channel_address']); } - $acl = new Zotlabs\Access\AccessList($channel); + $acl = new AccessList($channel); $acl->set_from_array($_REQUEST); $arr = $acl->get(); @@ -162,7 +162,7 @@ function chat_content(&$a) { intval($a->profile['profile_uid']) ); if($x) { - $acl = new Zotlabs\Access\AccessList(false); + $acl = new AccessList(false); $acl->set($x[0]); $private = $acl->is_private(); @@ -199,7 +199,7 @@ function chat_content(&$a) { if(local_channel() && argc() > 2 && argv(2) === 'new') { - $acl = new Zotlabs\Access\AccessList($channel); + $acl = new AccessList($channel); $channel_acl = $acl->get(); require_once('include/acl_selectors.php'); -- cgit v1.2.3 From f1564b4cff5a584d37b12000f68014df49e683d9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 21 Feb 2016 16:49:49 -0800 Subject: retry the move of AccessList to composer format (one or more third-party plugins will likely break as a result) --- mod/chat.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mod/chat.php') diff --git a/mod/chat.php b/mod/chat.php index 79a5c050b..f219bde73 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -54,7 +54,7 @@ function chat_post(&$a) { goaway(z_root() . '/chat/' . $channel['channel_address']); } - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $acl->set_from_array($_REQUEST); $arr = $acl->get(); @@ -162,7 +162,7 @@ function chat_content(&$a) { intval($a->profile['profile_uid']) ); if($x) { - $acl = new AccessList(false); + $acl = new Zotlabs\Access\AccessList(false); $acl->set($x[0]); $private = $acl->is_private(); @@ -199,7 +199,7 @@ function chat_content(&$a) { if(local_channel() && argc() > 2 && argv(2) === 'new') { - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); require_once('include/acl_selectors.php'); -- cgit v1.2.3 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/chat.php | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'mod/chat.php') 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; -- cgit v1.2.3 From 08461c7049ee5c9788e815537b540b9987a5eace Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 30 Mar 2016 14:44:03 +0200 Subject: more on mod chat --- mod/chat.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'mod/chat.php') diff --git a/mod/chat.php b/mod/chat.php index 6c0a61880..ecd94bd95 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -203,22 +203,26 @@ function chat_content(&$a) { $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'); + + $chatroom_new = ''; + if(local_channel()) { + $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') - $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') - - )); + )); + } $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']), + '$name' => t('Name'), '$baseurl' => z_root(), '$nickname' => $a->profile['channel_address'], '$rooms' => $rooms, -- cgit v1.2.3 From df891f4ad2eee3b07bad73d703a46364dad03508 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 31 Mar 2016 00:37:40 +0200 Subject: more work on mod chat --- mod/chat.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'mod/chat.php') diff --git a/mod/chat.php b/mod/chat.php index ecd94bd95..95b3802a8 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -161,6 +161,7 @@ function chat_content(&$a) { intval($room_id), intval($a->profile['profile_uid']) ); + if($x) { $acl = new Zotlabs\Access\AccessList(false); $acl->set($x[0]); @@ -175,6 +176,11 @@ function chat_content(&$a) { return; } + $cipher = get_pconfig(local_channel(),'system','default_cipher'); + if(! $cipher) + $cipher = 'aes256'; + + $o = replace_macros(get_markup_template('chat.tpl'),array( '$is_owner' => ((local_channel() && local_channel() == $x[0]['cr_uid']) ? true : false), '$room_name' => $room_name, @@ -183,12 +189,16 @@ function chat_content(&$a) { '$nickname' => argv(1), '$submit' => t('Submit'), '$leave' => t('Leave Room'), - '$drop' => t('Delete This Room'), + '$drop' => t('Delete Room'), '$away' => t('I am away right now'), '$online' => t('I am online'), '$bookmark_link' => $bookmark_link, - '$bookmark' => t('Bookmark this room') - + '$bookmark' => t('Bookmark this room'), + '$feature_encrypt' => ((feature_enabled(local_channel(),'content_encrypt')) ? true : false), + '$cipher' => $cipher, + '$linkurl' => t('Please enter a link URL:'), + '$encrypt' => t('Encrypt text'), + '$insert' => t('Insert web link') )); return $o; } @@ -229,7 +239,7 @@ function chat_content(&$a) { '$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 + '$chatroom_new' => $chatroom_new, )); return $o; -- cgit v1.2.3 From 1cd3b4182595b838a535dd6b6990251db05d49e6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 30 Mar 2016 22:13:24 -0700 Subject: deprecate $a->get_baseurl() --- mod/chat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/chat.php') diff --git a/mod/chat.php b/mod/chat.php index 95b3802a8..682921ec2 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -28,7 +28,7 @@ function chat_init(&$a) { $profile = argv(1); } - $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n" ; // Run profile_load() here to make sure the theme is set before // we start loading content -- cgit v1.2.3 From 9abd95fad3784a10fc48bc40f9b8a75d7d74edda Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 16:06:03 -0700 Subject: static App --- mod/chat.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'mod/chat.php') diff --git a/mod/chat.php b/mod/chat.php index 682921ec2..211846964 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -10,7 +10,7 @@ function chat_init(&$a) { $which = argv(1); if(! $which) { if(local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel && $channel['channel_address']) $which = $channel['channel_address']; } @@ -21,14 +21,14 @@ function chat_init(&$a) { } $profile = 0; - $channel = $a->get_channel(); + $channel = App::get_channel(); if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { $which = $channel['channel_address']; $profile = argv(1); } - $a->page['htmlhead'] .= '' . "\r\n" ; + App::$page['htmlhead'] .= '' . "\r\n" ; // Run profile_load() here to make sure the theme is set before // we start loading content @@ -45,7 +45,7 @@ function chat_post(&$a) { if((! $room) || (! local_channel())) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if($_POST['action'] === 'drop') { @@ -86,16 +86,16 @@ function chat_post(&$a) { function chat_content(&$a) { if(local_channel()) - $channel = $a->get_channel(); + $channel = App::get_channel(); - $ob = $a->get_observer(); + $ob = App::get_observer(); $observer = get_observer_hash(); if(! $observer) { notice( t('Permission denied.') . EOL); return; } - if(! perm_is_allowed($a->profile['profile_uid'],$observer,'chat')) { + if(! perm_is_allowed(App::$profile['profile_uid'],$observer,'chat')) { notice( t('Permission denied.') . EOL); return; } @@ -159,7 +159,7 @@ function chat_content(&$a) { return; $x = q("select * from chatroom where cr_id = %d and cr_uid = %d $sql_extra limit 1", intval($room_id), - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); if($x) { @@ -206,7 +206,7 @@ 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']); + $o = profile_tabs($a,((local_channel() && local_channel() == App::$profile['profile_uid']) ? true : false),App::$profile['channel_address']); $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); @@ -228,17 +228,17 @@ function chat_content(&$a) { )); } - $rooms = chatroom_list($a->profile['profile_uid']); + $rooms = chatroom_list(App::$profile['profile_uid']); $o .= replace_macros(get_markup_template('chatrooms.tpl'), array( - '$header' => sprintf( t('%1$s\'s Chatrooms'), $a->profile['name']), + '$header' => sprintf( t('%1$s\'s Chatrooms'), App::$profile['name']), '$name' => t('Name'), '$baseurl' => z_root(), - '$nickname' => $a->profile['channel_address'], + '$nickname' => App::$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), + '$is_owner' => ((local_channel() && local_channel() == App::$profile['profile_uid']) ? 1 : 0), '$chatroom_new' => $chatroom_new, )); -- cgit v1.2.3 From b8d8be701382b72b3556ff9a3d67aabfc85223f5 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 3 Apr 2016 11:34:07 +0200 Subject: show chat expiration time in overview and minor fixes --- mod/chat.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod/chat.php') diff --git a/mod/chat.php b/mod/chat.php index 211846964..75c364008 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -240,6 +240,8 @@ function chat_content(&$a) { '$newroom' => t('Create New'), '$is_owner' => ((local_channel() && local_channel() == App::$profile['profile_uid']) ? 1 : 0), '$chatroom_new' => $chatroom_new, + '$expire' => t('Expiration'), + '$expire_unit' => t('min') //minutes )); return $o; -- cgit v1.2.3 From bf3f3564e08754c3f91524798523839ae7b9094c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 3 Apr 2016 16:41:40 -0700 Subject: issue #138 ; make ajaxchat optional and configurable. For reasons we've discussed repeatedly the ajax chat will not be removed from core as XMPP chat does not provide decentralised access control compatible with nomadic identity. --- mod/chat.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mod/chat.php') diff --git a/mod/chat.php b/mod/chat.php index 75c364008..375d069be 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -208,6 +208,12 @@ function chat_content(&$a) { $o = profile_tabs($a,((local_channel() && local_channel() == App::$profile['profile_uid']) ? true : false),App::$profile['channel_address']); + if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat')) { + notice( t('Feature disabled.') . EOL); + return $o; + } + + $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); -- cgit v1.2.3