From a7d8045759881eeb18d3c6304169f3d8b5ea0235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=C3=BCrmann?= <michael@spicyweb.de> Date: Thu, 5 Mar 2015 19:00:23 +0100 Subject: [PATCH] Review 0.1 --- install/sql/incremental/upd_0081.sql | 2 + install/sql/ispconfig3.sql | 2 + interface/web/client/form/client.tform.php | 11 +++ .../web/client/form/client_template.tform.php | 99 +++++++++++++++++++ interface/web/client/form/reseller.tform.php | 99 +++++++++++++++++++ .../client/lib/lang/en_client_template.lng | 17 ++++ interface/web/client/lib/lang/en_reseller.lng | 18 ++++ .../client/templates/client_edit_limits.htm | 8 +- .../templates/client_template_edit_limits.htm | 65 ++++++++++++ .../client/templates/reseller_edit_limits.htm | 64 ++++++++++++ interface/web/mail/xmpp_domain_del.php | 61 +++++------- interface/web/mail/xmpp_domain_edit.php | 21 ++-- interface/web/mail/xmpp_user_del.php | 3 +- server/mods-available/xmpp_module.inc.php | 1 - server/plugins-available/xmpp_plugin.inc.php | 15 +-- 15 files changed, 428 insertions(+), 58 deletions(-) diff --git a/install/sql/incremental/upd_0081.sql b/install/sql/incremental/upd_0081.sql index 5e6b90ecd4..5deca8be6e 100644 --- a/install/sql/incremental/upd_0081.sql +++ b/install/sql/incremental/upd_0081.sql @@ -1,6 +1,8 @@ ALTER TABLE `server` ADD COLUMN `xmpp_server` tinyint(1) NOT NULL default '0' AFTER `firewall_server`; ALTER TABLE `client` + ADD COLUMN `default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1', + ADD COLUMN `xmpp_servers` blob, ADD COLUMN `limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1', ADD COLUMN `limit_xmpp_user` int(11) NOT NULL DEFAULT '-1', ADD COLUMN `limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n', diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index f1e661a393..291adbfb21 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -184,6 +184,8 @@ CREATE TABLE `client` ( `limit_spamfilter_wblist` int(11) NOT NULL DEFAULT '0', `limit_spamfilter_user` int(11) NOT NULL DEFAULT '0', `limit_spamfilter_policy` int(11) NOT NULL DEFAULT '0', + `default_xmppserver` int(11) unsigned NOT NULL DEFAULT '1', + `xmpp_servers` blob, `limit_xmpp_domain` int(11) NOT NULL DEFAULT '-1', `limit_xmpp_user` int(11) NOT NULL DEFAULT '-1', `limit_xmpp_muc` ENUM( 'n', 'y' ) NOT NULL default 'n', diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php index c0bed86cb9..7507c18435 100644 --- a/interface/web/client/form/client.tform.php +++ b/interface/web/client/form/client.tform.php @@ -773,6 +773,17 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), + 'default_xmppserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'client_servers' + ), + 'value' => '', + 'name' => 'default_xmppserver' + ), 'xmpp_servers' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'MULTIPLE', diff --git a/interface/web/client/form/client_template.tform.php b/interface/web/client/form/client_template.tform.php index b1fd7d350f..21f85963ee 100644 --- a/interface/web/client/form/client_template.tform.php +++ b/interface/web/client/form/client_template.tform.php @@ -322,6 +322,105 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), + 'default_xmppserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'client_servers' + ), + 'value' => '', + 'name' => 'default_xmppserver' + ), + 'xmpp_servers' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'MULTIPLE', + 'separator' => ',', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'client_servers' + ), + 'validators' => array ( + 0 => array ( 'type' => 'CUSTOM', + 'class' => 'validate_client', + 'function' => 'check_used_servers', + 'errmsg'=> 'xmpp_servers_used'), + ), + 'value' => '', + 'name' => 'xmpp_servers' + ), + 'limit_xmpp_domain' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_xmpp_domain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_xmpp_user' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_xmpp_user_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_xmpp_muc' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_anon' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_vjud' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_proxy' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_status' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_pastebin' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_httparchive' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), 'default_webserver' => array ( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php index b70c765386..75e9fa2e67 100644 --- a/interface/web/client/form/reseller.tform.php +++ b/interface/web/client/form/reseller.tform.php @@ -769,6 +769,105 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), + 'default_xmppserver' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'SELECT', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'client_servers' + ), + 'value' => '', + 'name' => 'default_xmppserver' + ), + 'xmpp_servers' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'MULTIPLE', + 'separator' => ',', + 'default' => '1', + 'datasource' => array ( 'type' => 'CUSTOM', + 'class'=> 'custom_datasource', + 'function'=> 'client_servers' + ), + 'validators' => array ( + 0 => array ( 'type' => 'CUSTOM', + 'class' => 'validate_client', + 'function' => 'check_used_servers', + 'errmsg'=> 'xmpp_servers_used'), + ), + 'value' => '', + 'name' => 'xmpp_servers' + ), + 'limit_xmpp_domain' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_xmpp_domain_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_xmpp_user' => array( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_xmpp_user_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), + 'limit_xmpp_muc' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_anon' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_vjud' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_proxy' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_status' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_pastebin' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), + 'limit_xmpp_httparchive' => array( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'n', + 'value' => array(0 => 'n', 1 => 'y') + ), 'default_webserver' => array ( 'datatype' => 'INTEGER', 'formtype' => 'SELECT', diff --git a/interface/web/client/lib/lang/en_client_template.lng b/interface/web/client/lib/lang/en_client_template.lng index 9aacf40319..a65c1a514b 100644 --- a/interface/web/client/lib/lang/en_client_template.lng +++ b/interface/web/client/lib/lang/en_client_template.lng @@ -98,4 +98,21 @@ $wb['limit_domainmodule_txt'] = 'Domainmodule Limit'; $wb['client_limits_txt'] = 'Client Limits'; $wb['limit_database_quota_txt'] = 'Database quota'; $wb['limit_database_quota_error_notint'] = 'The database quota limit must be a number.'; + +$wb["xmpp_limits_txt"] = 'XMPP Limits'; +$wb["xmpp_servers_txt"] = 'XMPP Servers'; +$wb["xmpp_servers_placeholder"] = 'Select XMPP Servers'; +$wb['no_xmpp_server_error'] = 'At least one XMPP Server must be selected.'; +$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['limit_xmpp_domain_txt'] = 'Max. number of XMPP domains'; +$wb['limit_xmpp_user_txt'] = 'Max. number of XMPP accounts'; +$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'; +$wb['limit_xmpp_anon_txt'] = 'Anonymous host available'; +$wb['limit_xmpp_vjud_txt'] = 'VJUD user directory available'; +$wb['limit_xmpp_proxy_txt'] = 'Bytestream proxy available'; +$wb['limit_xmpp_status_txt'] = 'Status host available'; ?> diff --git a/interface/web/client/lib/lang/en_reseller.lng b/interface/web/client/lib/lang/en_reseller.lng index e23657c055..eb47bfdecd 100644 --- a/interface/web/client/lib/lang/en_reseller.lng +++ b/interface/web/client/lib/lang/en_reseller.lng @@ -172,6 +172,24 @@ $wb['customer_no_template_txt'] = 'Customer No. template'; $wb['customer_no_template_error_regex_txt'] = 'The customer No. template contains invalid characters'; $wb['customer_no_start_txt'] = 'Customer No. start value'; $wb['customer_no_counter_txt'] = 'Customer No. counter'; + +$wb["xmpp_limits_txt"] = 'XMPP Limits'; +$wb["xmpp_servers_txt"] = 'XMPP Servers'; +$wb["xmpp_servers_placeholder"] = 'Select XMPP Servers'; +$wb['no_xmpp_server_error'] = 'At least one XMPP Server must be selected.'; +$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['limit_xmpp_domain_txt'] = 'Max. number of XMPP domains'; +$wb['limit_xmpp_user_txt'] = 'Max. number of XMPP accounts'; +$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'; +$wb['limit_xmpp_anon_txt'] = 'Anonymous host available'; +$wb['limit_xmpp_vjud_txt'] = 'VJUD user directory available'; +$wb['limit_xmpp_proxy_txt'] = 'Bytestream proxy available'; +$wb['limit_xmpp_status_txt'] = 'Status host available'; + $wb['added_by_txt'] = 'Added by'; $wb['added_date_txt'] = 'Added date'; $wb['limit_domainmodule_error_notint'] = 'Domainmodule limit must be a number.'; diff --git a/interface/web/client/templates/client_edit_limits.htm b/interface/web/client/templates/client_edit_limits.htm index ffb1708adc..ed150b4d12 100644 --- a/interface/web/client/templates/client_edit_limits.htm +++ b/interface/web/client/templates/client_edit_limits.htm @@ -219,16 +219,16 @@ </div> <div class="form-group"> <label for="limit_xmpp_domain" class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_domain_txt'}</label> - <div class="col-sm-9"><input type="text" name="limit_web_domain" id="limit_xmpp_domain" value="{tmpl_var name='limit_xmpp_domain'}" class="form-control" /></div></div> + <div class="col-sm-9"><input type="text" name="limit_xmpp_domain" id="limit_xmpp_domain" value="{tmpl_var name='limit_xmpp_domain'}" class="form-control" /></div></div> <div class="form-group"> <label for="limit_xmpp_user" class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_user_txt'}</label> - <div class="col-sm-9"><input type="text" name="limit_web_domain" id="limit_xmpp_user" value="{tmpl_var name='limit_xmpp_user'}" class="form-control" /></div></div> - <div class="form-group"> + <div class="col-sm-9"><input type="text" name="limit_xmpp_user" id="limit_xmpp_user" value="{tmpl_var name='limit_xmpp_user'}" class="form-control" /></div></div> + <!--<div class="form-group"> <label class="col-sm-3 control-label">{tmpl_var name='xmpp_auth_options_txt'}</label> <div class="col-sm-9"> {tmpl_var name='xmpp_auth_options'} </div> - </div> + </div>--> <div class="form-group"> <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_muc_txt'}</label> <div class="col-sm-9"> diff --git a/interface/web/client/templates/client_template_edit_limits.htm b/interface/web/client/templates/client_template_edit_limits.htm index 6421d8f1b4..abb68792b3 100644 --- a/interface/web/client/templates/client_template_edit_limits.htm +++ b/interface/web/client/templates/client_template_edit_limits.htm @@ -163,6 +163,71 @@ <label for="limit_spamfilter_policy" class="col-sm-3 control-label">{tmpl_var name='limit_spamfilter_policy_txt'}</label> <div class="col-sm-9"><input type="text" name="limit_spamfilter_policy" id="limit_spamfilter_policy" value="{tmpl_var name='limit_spamfilter_policy'}" class="form-control" /></div></div> </div> + + <div class="col-sm-3"></div><div class="col-sm-9"><button class="btn btn-default formbutton-default" type="button" data-toggle="collapse" data-target="#toggle-xmpp_limits" aria-expanded="false" aria-controls="toggle-xmpp_limits">{tmpl_var name='xmpp_limits_txt'}</button></div> + <div id="toggle-xmpp_limits" class="collapse"> + <div class="form-group"> + <label for="xmpp_servers" class="col-sm-3 control-label">{tmpl_var name='xmpp_servers_txt'}</label> + <div class="col-sm-9"><select data-placeholder="{tmpl_var name='xmpp_servers_placeholder'}" multiple name="xmpp_servers[]" id="xmpp_servers" class="form-control"> + {tmpl_var name='xmpp_servers'} + </select></div> + </div> + <div class="form-group"> + <label for="limit_xmpp_domain" class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_domain_txt'}</label> + <div class="col-sm-9"><input type="text" name="limit_xmpp_domain" id="limit_xmpp_domain" value="{tmpl_var name='limit_xmpp_domain'}" class="form-control" /></div></div> + <div class="form-group"> + <label for="limit_xmpp_user" class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_user_txt'}</label> + <div class="col-sm-9"><input type="text" name="limit_xmpp_user" id="limit_xmpp_user" value="{tmpl_var name='limit_xmpp_user'}" class="form-control" /></div></div> + <!--<div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='xmpp_auth_options_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='xmpp_auth_options'} + </div> + </div>--> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_muc_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_muc'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_pastebin_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_pastebin'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_httparchive_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_httparchive'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_anon_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_anon'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_vjud_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_vjud'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_proxy_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_proxy'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_status_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_status'} + </div> + </div> + + </div> <div class="col-sm-3"></div><div class="col-sm-9"><button class="btn btn-default formbutton-default" type="button" data-toggle="collapse" data-target="#toggle-database_limits" aria-expanded="false" aria-controls="toggle-database_limits">{tmpl_var name='database_limits_txt'}</button></div> <div id="toggle-database_limits" class="collapse"> <div class="form-group"> diff --git a/interface/web/client/templates/reseller_edit_limits.htm b/interface/web/client/templates/reseller_edit_limits.htm index aaefaffd56..7644b95747 100644 --- a/interface/web/client/templates/reseller_edit_limits.htm +++ b/interface/web/client/templates/reseller_edit_limits.htm @@ -211,6 +211,70 @@ <label for="limit_spamfilter_policy" class="col-sm-3 control-label">{tmpl_var name='limit_spamfilter_policy_txt'}</label> <div class="col-sm-9"><input type="text" name="limit_spamfilter_policy" id="limit_spamfilter_policy" value="{tmpl_var name='limit_spamfilter_policy'}" class="form-control" /></div></div> </div> + <div class="col-sm-3"></div><div class="col-sm-9"><button class="btn btn-default formbutton-default" type="button" data-toggle="collapse" data-target="#toggle-xmpp_limits" aria-expanded="false" aria-controls="toggle-xmpp_limits">{tmpl_var name='xmpp_limits_txt'}</button></div> + <div id="toggle-xmpp_limits" class="collapse"> + <div class="form-group"> + <label for="xmpp_servers" class="col-sm-3 control-label">{tmpl_var name='xmpp_servers_txt'}</label> + <div class="col-sm-9"><select data-placeholder="{tmpl_var name='xmpp_servers_placeholder'}" multiple name="xmpp_servers[]" id="xmpp_servers" class="form-control"> + {tmpl_var name='xmpp_servers'} + </select></div> + </div> + <div class="form-group"> + <label for="limit_xmpp_domain" class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_domain_txt'}</label> + <div class="col-sm-9"><input type="text" name="limit_xmpp_domain" id="limit_xmpp_domain" value="{tmpl_var name='limit_xmpp_domain'}" class="form-control" /></div></div> + <div class="form-group"> + <label for="limit_xmpp_user" class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_user_txt'}</label> + <div class="col-sm-9"><input type="text" name="limit_xmpp_user" id="limit_xmpp_user" value="{tmpl_var name='limit_xmpp_user'}" class="form-control" /></div></div> + <!--<div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='xmpp_auth_options_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='xmpp_auth_options'} + </div> + </div>--> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_muc_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_muc'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_pastebin_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_pastebin'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_httparchive_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_httparchive'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_anon_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_anon'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_vjud_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_vjud'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_proxy_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_proxy'} + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">{tmpl_var name='limit_xmpp_status_txt'}</label> + <div class="col-sm-9"> + {tmpl_var name='limit_xmpp_status'} + </div> + </div> + + </div> <div class="col-sm-3"></div><div class="col-sm-9"><button class="btn btn-default formbutton-default" type="button" data-toggle="collapse" data-target="#toggle-database_limits" aria-expanded="false" aria-controls="toggle-database_limits">{tmpl_var name='database_limits_txt'}</button></div> <div id="toggle-database_limits" class="collapse"> <div class="form-group"> diff --git a/interface/web/mail/xmpp_domain_del.php b/interface/web/mail/xmpp_domain_del.php index 3dcc859764..da481c8f2b 100644 --- a/interface/web/mail/xmpp_domain_del.php +++ b/interface/web/mail/xmpp_domain_del.php @@ -52,48 +52,39 @@ $app->load('tform_actions'); class page_action extends tform_actions { function onBeforeDelete() { - global $app; $conf; + global $app, $conf; $domain = $this->dataRecord['domain']; // Before we delete the email domain, // we will delete all depending records. - // TODO: Delete xmpp accounts in filesystem - // TODO: Delete xmpp accounts in isp - // TODO: Delete DNS Records -/* - // Delete all forwardings where the source or destination belongs to this domain - $records = $app->db->queryAllRecords("SELECT forwarding_id as id FROM mail_forwarding WHERE source like '%@".$app->db->quote($domain)."' OR (destination like '%@".$app->db->quote($domain)."' AND type != 'forward')"); - foreach($records as $rec) { - $app->db->datalogDelete('mail_forwarding', 'forwarding_id', $rec['id']); - } - - // Delete all fetchmail accounts where destination belongs to this domain - $records = $app->db->queryAllRecords("SELECT mailget_id as id FROM mail_get WHERE destination like '%@".$app->db->quote($domain)."'"); - foreach($records as $rec) { - $app->db->datalogDelete('mail_get', 'mailget_id', $rec['id']); - } - - // Delete all mailboxes where destination belongs to this domain - $records = $app->db->queryAllRecords("SELECT mailuser_id as id FROM mail_user WHERE email like '%@".$app->db->quote($domain)."'"); - foreach($records as $rec) { - $app->db->datalogDelete('mail_user', 'mailuser_id', $rec['id']); - } - - // Delete all spamfilters that belong to this domain - $records = $app->db->queryAllRecords("SELECT id FROM spamfilter_users WHERE email = '%@".$app->db->quote($domain)."'"); - foreach($records as $rec) { - $app->db->datalogDelete('spamfilter_users', 'id', $rec['id']); - } - - // Delete all mailinglists that belong to this domain - $records = $app->db->queryAllRecords("SELECT mailinglist_id FROM mail_mailinglist WHERE domain = '".$app->db->quote($domain)."'"); - foreach($records as $rec) { - $app->db->datalogDelete('mail_mailinglist', 'mailinglist_id', $rec['id']); - } -*/ + $this->delete_accounts($domain); + // and DNS entries + $soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, ttl, serial FROM dns_soa WHERE active = 'Y' AND origin = ?", $domain.'.'); + if ( isset($soa) && !empty($soa) ) $this->remove_dns($soa); } + private function delete_accounts($domain){ + global $app; + // get all accounts + $sql = "SELECT * FROM xmpp_user WHERE jid LIKE ? AND ?"; + $users = $app->db->queryAllRecords($sql, '%@'.$domain, $app->tform->getAuthSQL('d')); + foreach($users AS $u) + $app->db->datalogDelete('xmpp_user', 'xmppuser_id', $u['xmppuser_id']); + } + + private function remove_dns($new_rr) { + global $app; + + // purge all xmpp related rr-record + $sql = "SELECT * FROM dns_rr WHERE zone = ? AND (name IN ? AND type = 'CNAME' OR name LIKE ? AND type = 'SRV') AND ? ORDER BY serial DESC"; + $rec = $app->db->queryAllRecords($sql, $new_rr['zone'], array('xmpp', 'pubsub', 'proxy', 'anon', 'vjud', 'muc'), '_xmpp-%', $app->tform->getAuthSQL('r')); + if (is_array($rec[1])) { + for ($i=0; $i < count($rec); ++$i) + $app->db->datalogDelete('dns_rr', 'id', $rec[$i]['id']); + } + } + } $page = new page_action; diff --git a/interface/web/mail/xmpp_domain_edit.php b/interface/web/mail/xmpp_domain_edit.php index 6d1703020d..1213a91e6a 100644 --- a/interface/web/mail/xmpp_domain_edit.php +++ b/interface/web/mail/xmpp_domain_edit.php @@ -329,8 +329,8 @@ class page_action extends tform_actions { if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]); // create new accounts from mail domain - if($this->dataRecord['management_method']=='maildomain') - $this->syncMailusers($this->dataRecord['domain']); + //if($this->dataRecord['management_method']=='maildomain') + // $this->syncMailusers($this->dataRecord['domain']); // Insert DNS Records $soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, ttl, serial FROM dns_soa WHERE active = 'Y' AND origin = ?", $this->dataRecord['domain'].'.'); @@ -395,17 +395,15 @@ class page_action extends tform_actions { global $app, $conf; // create new accounts from mail domain - if($this->oldDataRecord['management_method'] != 'maildomain' && $this->dataRecord['management_method']=='maildomain') - $this->syncMailusers($this->dataRecord['domain']); + //if($this->oldDataRecord['management_method'] != 'maildomain' && $this->dataRecord['management_method']=='maildomain') + // $this->syncMailusers($this->dataRecord['domain']); // or reset to normal permissions - elseif($this->oldDataRecord['management_method'] == 'maildomain' && $this->dataRecord['management_method']!='maildomain') - $this->desyncMailusers($this->dataRecord['domain']); + //elseif($this->oldDataRecord['management_method'] == 'maildomain' && $this->dataRecord['management_method']!='maildomain') + // $this->desyncMailusers($this->dataRecord['domain']); // Update DNS Records // TODO: Update gets only triggered from main form. WHY? - // TODO: if(in_array($this->_xmpp_type, array('muc', 'modules'))){ - $soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other FROM dns_soa WHERE active = 'Y' AND = ?", $this->dataRecord['domain'].'.'); - if ( isset($soa) && !empty($soa) ) $this->update_dns($this->dataRecord, $soa); - //} + $soa = $app->db->queryOneRecord("SELECT id AS zone, sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other FROM dns_soa WHERE active = 'Y' AND = ?", $this->dataRecord['domain'].'.'); + if ( isset($soa) && !empty($soa) ) $this->update_dns($this->dataRecord, $soa); } @@ -473,6 +471,8 @@ class page_action extends tform_actions { $app->db->datalogUpdate('dns_soa', "serial = '".$new_serial."'", 'id', $zone['id']); } + /* + * NOT YET FINISHED private function syncMailusers($domain){ global $app, $conf; @@ -533,6 +533,7 @@ class page_action extends tform_actions { $app->db->datalogUpdate('xmpp_user', $u, 'xmppuser_id', $u['xmppuser_id']); } } + */ } diff --git a/interface/web/mail/xmpp_user_del.php b/interface/web/mail/xmpp_user_del.php index 3d32f7fd13..cf0cc62a10 100644 --- a/interface/web/mail/xmpp_user_del.php +++ b/interface/web/mail/xmpp_user_del.php @@ -58,7 +58,8 @@ class page_action extends tform_actions { $domain = $jid_parts[1]; // check if domain is managed through mail domain - $app->error('blubb'); + // if yes, manual deletion is not allowed + //$app->error('blubb'); } diff --git a/server/mods-available/xmpp_module.inc.php b/server/mods-available/xmpp_module.inc.php index f8c1526e73..aace2567d6 100644 --- a/server/mods-available/xmpp_module.inc.php +++ b/server/mods-available/xmpp_module.inc.php @@ -112,7 +112,6 @@ class xmpp_module { // load the server configuration options $app->uses('getconf,system'); - $xmpp_config = $app->getconf->get_server_config($conf['server_id'], 'xmpp'); $daemon = 'metronome'; diff --git a/server/plugins-available/xmpp_plugin.inc.php b/server/plugins-available/xmpp_plugin.inc.php index 2176cc513f..d5d36a05a7 100644 --- a/server/plugins-available/xmpp_plugin.inc.php +++ b/server/plugins-available/xmpp_plugin.inc.php @@ -1,9 +1,7 @@ <?php - -// TODO Plugin bei Installation symlinken in plugins-enabled! /* -Copyright (c) 2007, Till Brehm, projektfarm Gmbh +Copyright (c) 2015 Michael Fürmann, Spicy Web (spicyweb.de) All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -35,7 +33,6 @@ class xmpp_plugin { var $plugin_name = 'xmpp_server_plugin'; var $class_name = 'xmpp_server_plugin'; - var $xmpp_config_dir = '/etc/metronome'; var $ssl_certificate_changed = false; @@ -100,20 +97,22 @@ class xmpp_plugin { $old_ini_data = $app->ini_parser->parse_ini_string($data['old']['config']); $xmpp_config = $app->getconf->get_server_config($conf['server_id'], 'xmpp'); + // Global server config $tpl = new tpl(); $tpl->newTemplate('metronome_conf_global.master'); - $tpl->setVar('ipv6', $xmpp_config['xmpp_use_ipv6']=='y'?'true':'false'); $tpl->setVar('bosh_timeout', intval($xmpp_config['xmpp_bosh_max_inactivity'])); $tpl->setVar('port_http', intval($xmpp_config['xmpp_port_http'])); $tpl->setVar('port_https', intval($xmpp_config['xmpp_port_https'])); $tpl->setVar('port_pastebin', intval($xmpp_config['xmpp_port_pastebin'])); $tpl->setVar('port_bosh', intval($xmpp_config['xmpp_port_bosh'])); + // Global server admins (for all hosted domains) $admins = ''; foreach(explode(',', $xmpp_config['xmpp_server_admins']) AS $a) $admins.= "\t\"".trim($a)."\",\n"; $tpl->setVar('server_admins', $admins); unset($admins); + // enabled modules, so own modules or simmilar prosody-modules can easily be added $modules = ''; foreach(explode(',', $xmpp_config['xmpp_modules_enabled']) AS $m) $modules.= "\t\"".trim($m)."\",\n"; @@ -149,13 +148,14 @@ class xmpp_plugin { $tpl->setVar('domain', $data['new']['domain']); $tpl->setVar('active', $data['new']['active'] == 'y' ? 'true' : 'false'); $tpl->setVar('public_registration', $data['new']['public_registration'] == 'y' ? 'true' : 'false'); - + // Domain admins $admins = array(); foreach(explode(',',$data['new']['domain_admins']) AS $adm){ $admins[] = trim($adm); } $tpl->setVar('domain_admins', "\t\t\"".implode("\",\n\t\t\"",$admins)."\"\n"); + // Enable / Disable features if($data['new']['use_pubsub']=='y'){ $tpl->setVar('use_pubsub', 'true'); $status_comps[] = 'pubsub.'.$data['new']['domain']; @@ -188,6 +188,7 @@ class xmpp_plugin { $status_comps[] = 'muc.'.$data['new']['domain']; $tpl->setVar('muc_restrict_room_creation', $data['new']['muc_restrict_room_creation']); $tpl->setVar('muc_name', strlen($data['new']['muc_name']) ? $data['new']['muc_name'] : $data['new']['domain'].' Chatrooms'); + // Admins for MUC channels $admins = array(); foreach(explode(',',$data['new']['muc_admins']) AS $adm){ $admins[] = trim($adm); @@ -242,7 +243,7 @@ class xmpp_plugin { exec('rm -rf /var/lib/metronome/'.$folder); exec('rm -rf /var/lib/metronome/*%2e'.$folder); - $app->services->restartServiceDelayed('metronome', 'restart'); + $app->services->restartServiceDelayed('metronome', 'reload'); } function userInsert($event_name, $data){ -- GitLab