From 36c8a26c02d71905b7ef1f01594c63b693cb44dc Mon Sep 17 00:00:00 2001
From: Michael Fürmann <michael@spicyweb.de>
Date: Tue, 03 Mar 2015 17:30:04 -0500
Subject: [PATCH] Clients limit update
---
interface/web/mail/lib/lang/en_xmpp_domain.lng | 1
interface/web/mail/xmpp_domain_edit.php | 36 ++-
interface/web/mail/templates/xmpp_domain_edit_muc.htm | 62 ++++---
interface/web/client/form/client.tform.php | 16 -
interface/web/mail/lib/module.conf.php | 4
interface/lib/classes/validate_client.inc.php | 4
interface/web/mail/form/xmpp_domain.tform.php | 243 ++++++++++++++++-------------
interface/web/client/lib/lang/en_client.lng | 2
interface/web/mail/templates/xmpp_domain_edit_modules.htm | 61 ++++---
9 files changed, 231 insertions(+), 198 deletions(-)
diff --git a/interface/lib/classes/validate_client.inc.php b/interface/lib/classes/validate_client.inc.php
index 198701b..c67601b 100644
--- a/interface/lib/classes/validate_client.inc.php
+++ b/interface/lib/classes/validate_client.inc.php
@@ -122,6 +122,10 @@
case 'mail_servers':
$used_servers = $app->db->queryAllRecords('SELECT domain_id FROM mail_domain INNER JOIN sys_user ON mail_domain.sys_userid = sys_user.userid WHERE client_id = ' . $client_id . ' AND server_id NOT IN (' . implode(', ', $field_value) . ');');
break;
+
+ case 'xmpp_servers':
+ $used_servers = $app->db->queryAllRecords('SELECT domain_id FROM xmpp_domain INNER JOIN sys_user ON xmpp_domain.sys_userid = sys_user.userid WHERE client_id = ' . $client_id . ' AND server_id NOT IN (' . implode(', ', $field_value) . ');');
+ break;
}
if ($used_servers === null || count($used_servers))
diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php
index b5bf002..c0bed86 100644
--- a/interface/web/client/form/client.tform.php
+++ b/interface/web/client/form/client.tform.php
@@ -782,9 +782,8 @@
'class'=> 'custom_datasource',
'function'=> 'client_servers'
),
- 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
- 'errmsg'=> 'no_xmpp_server_error'),
- 1 => array ( 'type' => 'CUSTOM',
+ 'validators' => array (
+ 0 => array ( 'type' => 'CUSTOM',
'class' => 'validate_client',
'function' => 'check_used_servers',
'errmsg'=> 'xmpp_servers_used'),
@@ -831,17 +830,6 @@
'formtype' => 'CHECKBOX',
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
- ),
- 'limit_xmpp_auth_options' => array(
- 'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOXARRAY',
- 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
- 'errmsg'=> 'xmpp_auth_options_notempty'),
- ),
- 'default' => '',
- 'separator' => ',',
- 'valuelimit' => 'client:xmpp_auth_options',
- 'value' => array('plain' => 'Plain', 'hashed' => 'Hashed', 'isp' => 'By Mail Account')
),
'limit_xmpp_vjud' => array(
'datatype' => 'VARCHAR',
diff --git a/interface/web/client/lib/lang/en_client.lng b/interface/web/client/lib/lang/en_client.lng
index 786bd7c..663d276 100644
--- a/interface/web/client/lib/lang/en_client.lng
+++ b/interface/web/client/lib/lang/en_client.lng
@@ -178,10 +178,8 @@
$wb['xmpp_servers_used'] = 'The server you are trying to remove from this client is used as a XMPP Server. Be sure that this server is not used by this client before you remove it.';
$wb['limit_xmpp_domain_error_notint'] = 'The XMPP domain limit must be a number.';
$wb['limit_xmpp_user_error_notint'] = 'The XMPP user limit must be a number.';
-$wb['xmpp_auth_options_notempty'] = 'At least one XMPP auth method must be selected.';
$wb['limit_xmpp_domain_txt'] = 'Max. number of XMPP domains';
$wb['limit_xmpp_user_txt'] = 'Max. number of XMPP accounts';
-$wb['xmpp_auth_options_txt'] = 'Available Auth options';
$wb['limit_xmpp_muc_txt'] = 'Multiuser chat available';
$wb['limit_xmpp_pastebin_txt'] = 'Pastebin for MUC available';
$wb['limit_xmpp_httparchive_txt'] = 'HTTP archive for MUC available';
diff --git a/interface/web/mail/form/xmpp_domain.tform.php b/interface/web/mail/form/xmpp_domain.tform.php
index 5934497..3fe62a2 100644
--- a/interface/web/mail/form/xmpp_domain.tform.php
+++ b/interface/web/mail/form/xmpp_domain.tform.php
@@ -55,6 +55,20 @@
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
+$muc_available = $muc_pastebin_available = $muc_httparchive_available = $anon_available = $vjud_available = $proxy_available = $status_available = true;
+if(!$app->auth->is_admin()) {
+ $client_group_id = $_SESSION["s"]["user"]["default_group"];
+ $client = $app->db->queryOneRecord("SELECT limit_xmpp_muc, limit_xmpp_anon, limit_xmpp_vjud, limit_xmpp_proxy, limit_xmpp_status, limit_xmpp_pastebin, limit_xmpp_httparchive FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+ if($client['limit_xmpp_muc'] != 'y') $muc_available = false;
+ if($client['limit_xmpp_pastebin'] != 'y' || $client['limit_xmpp_muc'] != 'y') $muc_pastebin_available = false;
+ if($client['limit_xmpp_httparchive'] != 'y' || $client['limit_xmpp_muc'] != 'y') $muc_httparchive_available = false;
+ if($client['limit_xmpp_anon'] != 'y') $anon_available = false;
+ if($client['limit_xmpp_vjud'] != 'y') $vjud_available = false;
+ if($client['limit_xmpp_proxy'] != 'y') $proxy_available= false;
+ if($client['limit_xmpp_status'] != 'y') $status_available = false;
+}
+
$form["tabs"]['domain'] = array (
'title' => "Domain",
'width' => 100,
@@ -149,7 +163,6 @@
)
);
-
$form["tabs"]['features'] = array (
'title' => "Modules",
'width' => 100,
@@ -158,127 +171,139 @@
//#################################
// Begin Datatable fields
//#################################
- 'use_anon_host' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOX',
- 'default' => 'y',
- 'value' => array(0 => 'n', 1 => 'y')
- ),
'use_pubsub' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
- ),
- 'use_vjud' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOX',
- 'default' => 'y',
- 'value' => array(0 => 'n', 1 => 'y')
- ),
- 'vjud_opt_mode' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'SELECT',
- 'default' => '0',
- 'value' => array(0 => 'Opt-In', 1 => 'Opt-Out')
- ),
- 'use_proxy' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOX',
- 'default' => 'y',
- 'value' => array(0 => 'n', 1 => 'y')
- ),
- 'use_status_host' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOX',
- 'default' => 'y',
- 'value' => array(0 => 'n', 1 => 'y')
- ),
+ )
//#################################
// ENDE Datatable fields
//#################################
)
);
+if($anon_available)
+ $form['tabs']['features']['fields']['use_anon_host'] = array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
+ );
+if($vjud_available){
+ $form['tabs']['features']['fields']['use_vjud'] = array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
+ );
+ $form['tabs']['features']['fields']['vjud_opt_mode'] = array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '0',
+ 'value' => array(0 => 'Opt-In', 1 => 'Opt-Out')
+ );
+}
-$form["tabs"]['muc'] = array (
- 'title' => "MUC",
- 'width' => 100,
- 'template' => "templates/xmpp_domain_edit_muc.htm",
- 'fields' => array (
- //#################################
- // Begin Datatable fields
- //#################################
- 'use_muc_host' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOX',
- 'default' => 'y',
- 'value' => array(0 => 'n', 1 => 'y')
- ),
- 'muc_name' => array(
- 'datatype' => 'VARCHAR',
- 'formtype' => 'TEXT',
- 'default' => ''
- ),
- 'muc_restrict_room_creation' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'SELECT',
- 'default' => '1',
- 'value' => array(0 => 'Everyone', 1 => 'Members', 2 => 'Admins')
- ),
- 'muc_admins' => array(
- 'datatype' => 'VARCHAR',
- 'formtype' => 'TEXT',
- 'default' => 'admin@service.com, superuser@service.com',
- 'value' => '',
- 'width' => '15',
- 'maxlength' => '3'
- ),
- 'use_pastebin' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOX',
- 'default' => 'y',
- 'value' => array(0 => 'n', 1 => 'y')
- ),
- 'pastebin_expire_after' => array(
- 'datatype' => 'VARCHAR',
- 'formtype' => 'TEXT',
- 'default' => '48',
- 'validators' => array(0 => array('type' => 'ISINT'),
- array('type'=>'RANGE', 'range'=>'1:168')
+if($proxy_available)
+ $form['tabs']['features']['fields']['use_proxy'] = array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
+ );
+if($status_available)
+ $form['tabs']['features']['fields']['use_status_host'] = array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
+ );
+
+
+if($muc_available)
+ $form["tabs"]['muc'] = array (
+ 'title' => "MUC",
+ 'width' => 100,
+ 'template' => "templates/xmpp_domain_edit_muc.htm",
+ 'fields' => array (
+ //#################################
+ // Begin Datatable fields
+ //#################################
+ 'use_muc_host' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
),
- 'value' => '',
- 'width' => '15'
+ 'muc_name' => array(
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => ''
+ ),
+ 'muc_restrict_room_creation' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'SELECT',
+ 'default' => '1',
+ 'value' => array(0 => 'Everyone', 1 => 'Members', 2 => 'Admins')
+ ),
+ 'muc_admins' => array(
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => 'admin@service.com, superuser@service.com',
+ 'value' => '',
+ 'width' => '15',
+ 'maxlength' => '3'
+ ),
+ //#################################
+ // ENDE Datatable fields
+ //#################################
+ )
+ );
+if($muc_available && $muc_pastebin_available){
+ $form['tabs']['muc']['fields']['use_pastebin'] = array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
+ );
+ $form['tabs']['muc']['fields']['pastebin_expire_after'] = array(
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => '48',
+ 'validators' => array(0 => array('type' => 'ISINT'),
+ array('type'=>'RANGE', 'range'=>'1:168')
),
- 'pastebin_trigger' => array(
- 'datatype' => 'VARCHAR',
- 'formtype' => 'TEXT',
- 'default' => '!paste',
- 'value' => '',
- 'width' => '15'
- ),
- 'use_http_archive' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOX',
- 'default' => 'y',
- 'value' => array(0 => 'n', 1 => 'y')
- ),
- 'http_archive_show_join' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOX',
- 'default' => 'y',
- 'value' => array(0 => 'n', 1 => 'y')
- ),
- 'http_archive_show_status' => array (
- 'datatype' => 'VARCHAR',
- 'formtype' => 'CHECKBOX',
- 'default' => 'y',
- 'value' => array(0 => 'n', 1 => 'y')
- ),
- //#################################
- // ENDE Datatable fields
- //#################################
- )
-);
+ 'value' => '',
+ 'width' => '15'
+ );
+ $form['tabs']['muc']['fields']['pastebin_trigger'] = array(
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => '!paste',
+ 'value' => '',
+ 'width' => '15'
+ );
+}
+if($muc_available && $muc_httparchive_available){
+ $form['tabs']['muc']['fields']['use_http_archive'] = array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
+ );
+ $form['tabs']['muc']['fields']['http_archive_show_join'] = array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
+ );
+ $form['tabs']['muc']['fields']['http_archive_show_status'] = array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'y',
+ 'value' => array(0 => 'n', 1 => 'y')
+ );
+}
$form["tabs"]['ssl'] = array (
'title' => "SSL",
diff --git a/interface/web/mail/lib/lang/en_xmpp_domain.lng b/interface/web/mail/lib/lang/en_xmpp_domain.lng
index 9e2924c..f1da77b 100644
--- a/interface/web/mail/lib/lang/en_xmpp_domain.lng
+++ b/interface/web/mail/lib/lang/en_xmpp_domain.lng
@@ -58,4 +58,5 @@
$wb['create_certificate_txt'] = 'Create certificate';
$wb['delete_certificate_txt'] = 'Delete certificate';
$wb['ssl_error_isemail'] = 'Please enter a valid email adress for generation of the SSL certificate';
+$wb["limit_xmppdomain_txt"] = 'The max. number of XMPP domains for your account is reached.';
?>
diff --git a/interface/web/mail/lib/module.conf.php b/interface/web/mail/lib/module.conf.php
index 24e45d0..b6df07e 100644
--- a/interface/web/mail/lib/module.conf.php
+++ b/interface/web/mail/lib/module.conf.php
@@ -151,7 +151,7 @@
//**** XMPP Menu
$items = array();
-if($app->auth->get_client_limit($userid, 'xmppdomain') != 0)
+if($app->auth->get_client_limit($userid, 'xmpp_domain') != 0)
{
$items[] = array( 'title' => 'XMPP Domain',
'target' => 'content',
@@ -159,7 +159,7 @@
'html_id' => 'xmpp_domain_list');
}
-if($app->auth->get_client_limit($userid, 'xmppaccount') != 0)
+if($app->auth->get_client_limit($userid, 'xmpp_user') != 0)
{
$items[] = array( 'title' => 'XMPP Account',
'target' => 'content',
diff --git a/interface/web/mail/templates/xmpp_domain_edit_modules.htm b/interface/web/mail/templates/xmpp_domain_edit_modules.htm
index f6d988f..8efcf50 100644
--- a/interface/web/mail/templates/xmpp_domain_edit_modules.htm
+++ b/interface/web/mail/templates/xmpp_domain_edit_modules.htm
@@ -4,43 +4,50 @@
<p><tmpl_var name="list_desc_txt"></p>
-
-<div class="form-group">
- <label class="col-sm-3 control-label">{tmpl_var name='use_anon_host_txt'}</label>
- <div class="col-sm-9">
- {tmpl_var name='use_anon_host'}
+<tmpl_if name="limit_xmpp_anon" value="y">
+ <div class="form-group">
+ <label class="col-sm-3 control-label">{tmpl_var name='use_anon_host_txt'}</label>
+ <div class="col-sm-9">
+ {tmpl_var name='use_anon_host'}
+ </div>
</div>
-</div>
+</tmpl_if>
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='use_pubsub_txt'}</label>
<div class="col-sm-9">
{tmpl_var name='use_pubsub'}
</div>
</div>
-<div class="form-group">
- <label class="col-sm-3 control-label">{tmpl_var name='use_vjud_txt'}</label>
- <div class="col-sm-9">
- {tmpl_var name='use_vjud'}
+<tmpl_if name="limit_xmpp_vjud" value="y">
+ <div class="form-group">
+ <label class="col-sm-3 control-label">{tmpl_var name='use_vjud_txt'}</label>
+ <div class="col-sm-9">
+ {tmpl_var name='use_vjud'}
+ </div>
</div>
-</div>
-<div class="form-group">
- <label for="vjud_opt_mode" class="col-sm-3 control-label">{tmpl_var name='vjud_opt_mode_txt'}</label>
- <div class="col-sm-3"><select name="vjud_opt_mode" id="vjud_opt_mode" class="form-control">
- {tmpl_var name='vjud_opt_mode'}
- </select></div>
-</div>
-<div class="form-group">
- <label class="col-sm-3 control-label">{tmpl_var name='use_proxy_txt'}</label>
- <div class="col-sm-9">
- {tmpl_var name='use_proxy'}
+ <div class="form-group">
+ <label for="vjud_opt_mode" class="col-sm-3 control-label">{tmpl_var name='vjud_opt_mode_txt'}</label>
+ <div class="col-sm-3"><select name="vjud_opt_mode" id="vjud_opt_mode" class="form-control">
+ {tmpl_var name='vjud_opt_mode'}
+ </select></div>
</div>
-</div>
-<div class="form-group">
- <label class="col-sm-3 control-label">{tmpl_var name='use_status_host_txt'}</label>
- <div class="col-sm-9">
- {tmpl_var name='use_status_host'}
+</tmpl_if>
+<tmpl_if name="limit_xmpp_proxy" value="y">
+ <div class="form-group">
+ <label class="col-sm-3 control-label">{tmpl_var name='use_proxy_txt'}</label>
+ <div class="col-sm-9">
+ {tmpl_var name='use_proxy'}
+ </div>
</div>
-</div>
+</tmpl_if>
+<tmpl_if name="limit_xmpp_status" value="y">
+ <div class="form-group">
+ <label class="col-sm-3 control-label">{tmpl_var name='use_status_host_txt'}</label>
+ <div class="col-sm-9">
+ {tmpl_var name='use_status_host'}
+ </div>
+ </div>
+</tmpl_if>
diff --git a/interface/web/mail/templates/xmpp_domain_edit_muc.htm b/interface/web/mail/templates/xmpp_domain_edit_muc.htm
index 533362d..dd46514 100644
--- a/interface/web/mail/templates/xmpp_domain_edit_muc.htm
+++ b/interface/web/mail/templates/xmpp_domain_edit_muc.htm
@@ -33,47 +33,51 @@
</div>
</div>
- <div class="form-group">
- <label class="col-sm-3 control-label">{tmpl_var name='use_pastebin_txt'}</label>
- <div class="col-sm-9">
- {tmpl_var name='use_pastebin'}
- </div>
- </div>
- <div id="toggle-use-pastebin" class="collapse">
+ <tmpl_if name='limit_xmpp_pastebin' value="y">
<div class="form-group">
- <label class="col-sm-3 control-label">{tmpl_var name='pastebin_expire_after_txt'}</label>
- <div class="col-sm-3">
- <input type="number" name="pastebin_expire_after" id="pastebin_expire_after" value="{tmpl_var name='pastebin_expire_after'}" class="form-control" />
+ <label class="col-sm-3 control-label">{tmpl_var name='use_pastebin_txt'}</label>
+ <div class="col-sm-9">
+ {tmpl_var name='use_pastebin'}
</div>
</div>
- <div class="form-group">
- <label class="col-sm-3 control-label">{tmpl_var name='pastebin_trigger_txt'}</label>
- <div class="col-sm-3">
- <input type="text" name="pastebin_trigger" id="pastebin_trigger" value="{tmpl_var name='pastebin_trigger'}" class="form-control" />
+ <div id="toggle-use-pastebin" class="collapse">
+ <div class="form-group">
+ <label class="col-sm-3 control-label">{tmpl_var name='pastebin_expire_after_txt'}</label>
+ <div class="col-sm-3">
+ <input type="number" name="pastebin_expire_after" id="pastebin_expire_after" value="{tmpl_var name='pastebin_expire_after'}" class="form-control" />
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-sm-3 control-label">{tmpl_var name='pastebin_trigger_txt'}</label>
+ <div class="col-sm-3">
+ <input type="text" name="pastebin_trigger" id="pastebin_trigger" value="{tmpl_var name='pastebin_trigger'}" class="form-control" />
+ </div>
</div>
</div>
- </div>
+ </tmpl_if>
- <div class="form-group">
- <label class="col-sm-3 control-label">{tmpl_var name='use_http_archive_txt'}</label>
- <div class="col-sm-9">
- {tmpl_var name='use_http_archive'}
- </div>
- </div>
- <div id="toggle-use-archive" class="collapse">
+ <tmpl_if name='limit_xmpp_httparchive' value="y">
<div class="form-group">
- <label class="col-sm-3 control-label">{tmpl_var name='http_archive_show_join_txt'}</label>
+ <label class="col-sm-3 control-label">{tmpl_var name='use_http_archive_txt'}</label>
<div class="col-sm-9">
- {tmpl_var name='http_archive_show_join'}
+ {tmpl_var name='use_http_archive'}
</div>
</div>
- <div class="form-group">
- <label class="col-sm-3 control-label">{tmpl_var name='http_archive_show_status_txt'}</label>
- <div class="col-sm-9">
- {tmpl_var name='http_archive_show_status'}
+ <div id="toggle-use-archive" class="collapse">
+ <div class="form-group">
+ <label class="col-sm-3 control-label">{tmpl_var name='http_archive_show_join_txt'}</label>
+ <div class="col-sm-9">
+ {tmpl_var name='http_archive_show_join'}
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-sm-3 control-label">{tmpl_var name='http_archive_show_status_txt'}</label>
+ <div class="col-sm-9">
+ {tmpl_var name='http_archive_show_status'}
+ </div>
</div>
</div>
- </div>
+ </tmpl_if>
</div>
diff --git a/interface/web/mail/xmpp_domain_edit.php b/interface/web/mail/xmpp_domain_edit.php
index b30d4d1..6d17030 100644
--- a/interface/web/mail/xmpp_domain_edit.php
+++ b/interface/web/mail/xmpp_domain_edit.php
@@ -72,18 +72,18 @@
// we will check only users, not admins
if($_SESSION["s"]["user"]["typ"] == 'user') {
- if(!$app->tform->checkClientLimit('limit_xmppdomain')) {
+ if(!$app->tform->checkClientLimit('limit_xmpp_domain')) {
$app->error($app->tform->wordbook["limit_xmppdomain_txt"]);
}
- if(!$app->tform->checkResellerLimit('limit_xmppdomain')) {
+ if(!$app->tform->checkResellerLimit('limit_xmpp_domain')) {
$app->error('Reseller: '.$app->tform->wordbook["limit_xmppdomain_txt"]);
}
} else {
$settings = $app->getconf->get_global_config('xmpp');
- $app->tform->formDef['tabs']['domain']['fields']['server_id']['default'] = intval($settings['default_xmppserver']);
- }
+ }
+ $app->tform->formDef['tabs']['domain']['fields']['server_id']['default'] = intval($settings['default_xmppserver']);
- parent::onShowNew();
+ parent::onShowNew();
}
function onShowEnd() {
@@ -91,6 +91,17 @@
$app->uses('ini_parser,getconf');
$settings = $app->getconf->get_global_config('domains');
+
+ $read_limits = array('limit_xmpp_pastebin', 'limit_xmpp_httparchive', 'limit_xmpp_anon', 'limit_xmpp_vjud', 'limit_xmpp_proxy', 'limit_xmpp_status');
+ if($_SESSION["s"]["user"]["typ"] != 'admin') {
+ $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
+ $client = $app->db->queryOneRecord("SELECT client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+ // add limits to template to be able to hide settings
+ foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+ }else{
+ foreach($read_limits as $limit) $app->tpl->setVar($limit, 'y');
+ }
+
if($_SESSION["s"]["user"]["typ"] == 'admin' && $settings['use_domain_module'] != 'y') {
// Getting Clients of the user
@@ -112,12 +123,7 @@
// Get the limits of the client
$client_group_id = $_SESSION["s"]["user"]["default_group"];
- $client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.default_xmppserver, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by client.contact_name");
-
- // Set the xmppserver to the default server of the client
- $tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_xmppserver]");
- $app->tpl->setVar("server_id", "<option value='$client[default_xmppserver]'>$tmp[server_name]</option>");
- unset($tmp);
+ $client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by client.contact_name");
if ($settings['use_domain_module'] != 'y') {
// Fill the client select field
@@ -233,7 +239,7 @@
if($_SESSION["s"]["user"]["typ"] != 'admin') {
// Get the limits of the client
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
- $client = $app->db->queryOneRecord("SELECT limit_xmppdomain, default_xmppserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+ $client = $app->db->queryOneRecord("SELECT limit_xmpp_domain FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
// When the record is updated
if($this->id > 0) {
// restore the server ID if the user is not admin and record is edited
@@ -249,9 +255,9 @@
$app->error($app->tform->wordbook['error_not_allowed_server_id']);
}
- if($client["limit_xmppdomain"] >= 0) {
+ if($client["limit_xmpp_domain"] >= 0) {
$tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM xmpp_domain WHERE sys_groupid = $client_group_id");
- if($tmp["number"] >= $client["limit_xmppdomain"]) {
+ if($tmp["number"] >= $client["limit_xmpp_domain"]) {
$app->error($app->tform->wordbook["limit_xmppdomain_txt"]);
}
}
@@ -355,7 +361,7 @@
//* If the user is neither admin nor reseller
} else {
//* We do not allow users to change a domain which has been created by the admin
- $rec = $app->db->queryOneRecord("SELECT sys_perm_group, domainfrom xmpp_domain WHERE domain_id = ".$this->id);
+ $rec = $app->db->queryOneRecord("SELECT sys_perm_group, domain from xmpp_domain WHERE domain_id = ".$this->id);
if(isset($this->dataRecord["domain"]) && $rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id, 'u')) {
//* Add a error message and switch back to old server
$app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
--
Gitblit v1.9.1