aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-09-13 11:32:43 +0200
committerMario Vavti <mario@mariovavti.com>2018-09-13 11:32:43 +0200
commit56f88f2e30ef75fa7e41cbcbbc6344abc6b7d37d (patch)
tree44e52b8dfeb719760bc60325e93bbbb6c374e21a
parenta1d5ce3716d09b7ccd81e252309ca9fd5e841b26 (diff)
downloadvolse-hubzilla-56f88f2e30ef75fa7e41cbcbbc6344abc6b7d37d.tar.gz
volse-hubzilla-56f88f2e30ef75fa7e41cbcbbc6344abc6b7d37d.tar.bz2
volse-hubzilla-56f88f2e30ef75fa7e41cbcbbc6344abc6b7d37d.zip
move chat from feature to apps
-rw-r--r--Zotlabs/Lib/Apps.php2
-rw-r--r--Zotlabs/Module/Apps.php4
-rw-r--r--Zotlabs/Module/Chat.php69
-rw-r--r--app/chat.apd6
-rw-r--r--include/features.php10
-rw-r--r--include/nav.php2
6 files changed, 46 insertions, 47 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 860a799ef..6b87ac6cb 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -303,7 +303,7 @@ class Apps {
'Admin' => t('Site Admin'),
'Report Bug' => t('Report Bug'),
'View Bookmarks' => t('View Bookmarks'),
- 'My Chatrooms' => t('My Chatrooms'),
+ 'Chatrooms' => t('Chatrooms'),
'Connections' => t('Connections'),
'Remote Diagnostics' => t('Remote Diagnostics'),
'Suggest Channels' => t('Suggest Channels'),
diff --git a/Zotlabs/Module/Apps.php b/Zotlabs/Module/Apps.php
index 11025ce6e..05b4495fc 100644
--- a/Zotlabs/Module/Apps.php
+++ b/Zotlabs/Module/Apps.php
@@ -50,8 +50,8 @@ class Apps extends \Zotlabs\Web\Controller {
'$title' => (($available) ? t('Available Apps') : t('Installed Apps')),
'$apps' => $apps,
'$authed' => ((local_channel()) ? true : false),
- '$manage' => (($available) ? '' : t('Manage apps')),
- '$create' => (($mode == 'edit') ? t('Create new app') : '')
+ '$manage' => (($available) ? '' : t('Manage Apps')),
+ '$create' => (($mode == 'edit') ? t('Create Custom App') : '')
));
}
diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php
index 71138e8d8..551dc5e2a 100644
--- a/Zotlabs/Module/Chat.php
+++ b/Zotlabs/Module/Chat.php
@@ -1,13 +1,19 @@
<?php /** @file */
-namespace Zotlabs\Module;
+namespace Zotlabs\Module;
+
+use App;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Web\Controller;
+use Zotlabs\Lib\Chatroom;
+use Zotlabs\Access\AccessList;
-require_once('include/bookmarks.php');
-use \Zotlabs\Lib as Zlib;
-class Chat extends \Zotlabs\Web\Controller {
+require_once('include/bookmarks.php');
+
+class Chat extends Controller {
function init() {
@@ -16,7 +22,7 @@ class Chat extends \Zotlabs\Web\Controller {
$which = argv(1);
if(! $which) {
if(local_channel()) {
- $channel = \App::get_channel();
+ $channel = App::get_channel();
if($channel && $channel['channel_address'])
$which = $channel['channel_address'];
}
@@ -27,7 +33,7 @@ class Chat extends \Zotlabs\Web\Controller {
}
$profile = 0;
- $channel = \App::get_channel();
+ $channel = App::get_channel();
if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address'];
@@ -49,16 +55,16 @@ class Chat extends \Zotlabs\Web\Controller {
if((! $room) || (! local_channel()))
return;
- $channel = \App::get_channel();
+ $channel = App::get_channel();
if($_POST['action'] === 'drop') {
logger('delete chatroom');
- Zlib\Chatroom::destroy($channel,array('cr_name' => $room));
+ Chatroom::destroy($channel,array('cr_name' => $room));
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();
@@ -67,7 +73,7 @@ class Chat extends \Zotlabs\Web\Controller {
if(intval($arr['expire']) < 0)
$arr['expire'] = 0;
- Zlib\Chatroom::create($channel,$arr);
+ Chatroom::create($channel,$arr);
$x = q("select * from chatroom where cr_name = '%s' and cr_uid = %d limit 1",
dbesc($room),
@@ -88,26 +94,35 @@ class Chat extends \Zotlabs\Web\Controller {
function get() {
+
+ if(! Apps::system_app_installed(App::$profile_uid, 'Chatrooms')) {
+ //Do not display any associated widgets at this point
+ App::$pdl = '';
+
+ $o = '<b>Chatrooms App (Not Installed):</b><br>';
+ $o .= t('Access Controlled Chatrooms');
+ return $o;
+ }
if(local_channel()) {
- $channel = \App::get_channel();
- nav_set_selected('My Chatrooms');
+ $channel = App::get_channel();
+ nav_set_selected('Chatrooms');
}
- $ob = \App::get_observer();
+ $ob = App::get_observer();
$observer = get_observer_hash();
if(! $observer) {
notice( t('Permission denied.') . EOL);
return;
}
- if(! perm_is_allowed(\App::$profile['profile_uid'],$observer,'chat')) {
+ if(! perm_is_allowed(App::$profile['profile_uid'],$observer,'chat')) {
notice( t('Permission denied.') . EOL);
return;
}
if((argc() > 3) && intval(argv(2)) && (argv(3) === 'leave')) {
- Zlib\Chatroom::leave($observer,argv(2),$_SERVER['REMOTE_ADDR']);
+ Chatroom::leave($observer,argv(2),$_SERVER['REMOTE_ADDR']);
goaway(z_root() . '/channel/' . argv(1));
}
@@ -160,16 +175,16 @@ class Chat extends \Zotlabs\Web\Controller {
$room_id = intval(argv(2));
$bookmark_link = get_bookmark_link($ob);
- $x = Zlib\Chatroom::enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']);
+ $x = Chatroom::enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']);
if(! $x)
return;
$x = q("select * from chatroom where cr_id = %d and cr_uid = %d $sql_extra limit 1",
intval($room_id),
- intval(\App::$profile['profile_uid'])
+ intval(App::$profile['profile_uid'])
);
if($x) {
- $acl = new \Zotlabs\Access\AccessList(false);
+ $acl = new AccessList(false);
$acl->set($x[0]);
$private = $acl->is_private();
@@ -208,18 +223,12 @@ class Chat extends \Zotlabs\Web\Controller {
));
return $o;
}
-
-
+
require_once('include/conversation.php');
$o = '';
-
- if(! feature_enabled(\App::$profile['profile_uid'],'ajaxchat')) {
- notice( t('Feature disabled.') . EOL);
- return $o;
- }
- $acl = new \Zotlabs\Access\AccessList($channel);
+ $acl = new AccessList($channel);
$channel_acl = $acl->get();
$lockstate = (($channel_acl['allow_cid'] || $channel_acl['allow_gid'] || $channel_acl['deny_cid'] || $channel_acl['deny_gid']) ? 'lock' : 'unlock');
@@ -243,17 +252,17 @@ class Chat extends \Zotlabs\Web\Controller {
));
}
- $rooms = Zlib\Chatroom::roomlist(\App::$profile['profile_uid']);
+ $rooms = Chatroom::roomlist(App::$profile['profile_uid']);
$o .= replace_macros(get_markup_template('chatrooms.tpl'), array(
- '$header' => sprintf( t('%1$s\'s Chatrooms'), \App::$profile['fullname']),
+ '$header' => sprintf( t('%1$s\'s Chatrooms'), App::$profile['fullname']),
'$name' => t('Name'),
'$baseurl' => z_root(),
- '$nickname' => \App::$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() == \App::$profile['profile_uid']) ? 1 : 0),
+ '$is_owner' => ((local_channel() && local_channel() == App::$profile['profile_uid']) ? 1 : 0),
'$chatroom_new' => $chatroom_new,
'$expire' => t('Expiration'),
'$expire_unit' => t('min') //minutes
diff --git a/app/chat.apd b/app/chat.apd
index b59d846a6..524c13bfd 100644
--- a/app/chat.apd
+++ b/app/chat.apd
@@ -1,6 +1,6 @@
-version: 1
+version: 1.1
url: $baseurl/chat/$nick
-requires: local_channel, ajaxchat
-name: My Chatrooms
+requires: local_channel
+name: Chatrooms
photo: icon:comments-o
categories: Productivity
diff --git a/include/features.php b/include/features.php
index b7e1878c3..5479be122 100644
--- a/include/features.php
+++ b/include/features.php
@@ -119,16 +119,6 @@ function get_features($filtered = true, $level = (-1)) {
],
[
- 'ajaxchat',
- t('Access Controlled Chatrooms'),
- t('Provide chatrooms and chat services with access control.'),
- true,
- get_config('feature_lock','ajaxchat'),
- feature_level('ajaxchat',1),
- ],
-
-
- [
'smart_birthdays',
t('Smart Birthdays'),
t('Make birthday events timezone aware in case your friends are scattered across the planet.'),
diff --git a/include/nav.php b/include/nav.php
index 15060a033..9afba7945 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -417,7 +417,7 @@ function channel_apps($is_owner = false, $nickname = null) {
}
- if ($p['chat'] && feature_enabled($uid,'ajaxchat')) {
+ if ($p['chat'] && Apps::system_app_installed($uid,'Chatrooms')) {
$has_chats = Chatroom::list_count($uid);
if ($has_chats) {
$tabs[] = [