Commit a7d80457 authored by Michael Fürmann's avatar Michael Fürmann

Review 0.1

parent 36c8a26c
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',
......
......@@ -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',
......
......@@ -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',
......
......@@ -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',
......
......@@ -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',
......
......@@ -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';
?>
......@@ -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.';
......
......@@ -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">
......
......@@ -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">
......
......@@ -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">
......
......@@ -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;
......
......@@ -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']);
}
}
*/
}
......
......@@ -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');
}
......
......@@ -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';