diff --git a/interface/lib/lang/en.lng b/interface/lib/lang/en.lng index 1d47aeb63bb4749e10ed9629e43cc7d1f840ad98..ec309d9f850adf2f1540598fda4ab7c366067569 100644 --- a/interface/lib/lang/en.lng +++ b/interface/lib/lang/en.lng @@ -149,6 +149,5 @@ $wb['strength_4'] = 'Strong'; $wb['strength_5'] = 'Very Strong'; $wb['weak_password_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length and have a strength of "{strength}".'; $wb['weak_password_length_txt'] = 'The chosen password does not match the security guidelines. It has to be at least {chars} chars in length.'; -$wb['domain_owner_changed'] = 'You have changed the owner of domain {domain}, please change website and mail domain owner for this domain accordingly.'; ?> diff --git a/interface/lib/lang/es.lng b/interface/lib/lang/es.lng index e5763574e821f14f9734617e85b4dd663b9c710b..38f6103ddfd53db7c7302a04b1fcf1dd1af31e5f 100644 --- a/interface/lib/lang/es.lng +++ b/interface/lib/lang/es.lng @@ -148,5 +148,4 @@ $wb['strength_5'] = 'Muy fuerte'; $wb['weak_password_txt'] = 'La contraseña elegida no cumple las directrices de seguridad. Debe tener al menos {chars} caracteres y una fortaleza \"{strength}\".'; $wb['weak_password_length_txt'] = 'La contraseña elegida no cumple las directrices de seguridad. Debe tener al menos {chars} caracteres.'; $wb['Firewall'] = 'Cortafuegos'; -$wb['domain_owner_changed'] = 'Has cambiado el propietario del dominio {domain}, por favor cambia también el propietario del sitio web y dominio de correo de este dominio.'; ?> diff --git a/interface/lib/plugins/mail_mail_domain_plugin.inc.php b/interface/lib/plugins/mail_mail_domain_plugin.inc.php index e7958fe7eee5e76e2b1f711e1cfb069140a69f74..961e46f3ad7751699d973ab2f9aa9cccaf648e5f 100644 --- a/interface/lib/plugins/mail_mail_domain_plugin.inc.php +++ b/interface/lib/plugins/mail_mail_domain_plugin.inc.php @@ -50,28 +50,6 @@ class mail_mail_domain_plugin { $app->db->query("UPDATE mail_domain SET $updates WHERE domain_id = ".$page_form->id); } - // Spamfilter policy - $policy_id = $app->functions->intval($page_form->dataRecord["policy"]); - $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($page_form->dataRecord["domain"])."'"); - if($policy_id > 0) { - if($tmp_user["id"] > 0) { - // There is already a record that we will update - $app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]); - } else { - $tmp_domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain_id = ".$page_form->id); - // We create a new record - $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) - VALUES (".$_SESSION["s"]["user"]["userid"].", ".$app->functions->intval($tmp_domain["sys_groupid"]).", 'riud', 'riud', '', ".$app->functions->intval($page_form->dataRecord["server_id"]).", 5, ".$app->functions->intval($policy_id).", '@".$app->db->quote($page_form->dataRecord["domain"])."', '@".$app->db->quote($page_form->dataRecord["domain"])."', 'Y')"; - $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); - unset($tmp_domain); - } - } else { - if($tmp_user["id"] > 0) { - // There is already a record but the user shall have no policy, so we delete it - $app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]); - } - } // endif spamfilter policy - //** If the domain name or owner has been changed, change the domain and owner in all mailbox records if($page_form->oldDataRecord && ($page_form->oldDataRecord['domain'] != $page_form->dataRecord['domain'] || (isset($page_form->dataRecord['client_group_id']) && $page_form->oldDataRecord['sys_groupid'] != $page_form->dataRecord['client_group_id']))) { diff --git a/interface/web/client/domain_edit.php b/interface/web/client/domain_edit.php index a79ba856f80364aa3ac5792057c5cbc4899b3019..221e8a2079e445e269a0677f7ec39817b820e87b 100644 --- a/interface/web/client/domain_edit.php +++ b/interface/web/client/domain_edit.php @@ -216,8 +216,44 @@ class page_action extends tform_actions { if(isset($this->dataRecord["client_group_id"])) { $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); - $lng_text = $app->lng("domain_owner_changed"); - $_SESSION['show_warning_msg'] = str_replace("{domain}", $this->dataRecord["domain"], $lng_text); + + $data = new tform_actions(); + $tform = $app->tform; + $app->tform = new tform(); + + $app->tform->loadFormDef("../dns/form/dns_soa.tform.php"); + $data->oldDataRecord = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin LIKE '".$this->dataRecord['domain'].".'"); + if ($data->oldDataRecord) { + $data->dataRecord = array_merge($data->oldDataRecord, array('client_group_id' => $this->dataRecord["client_group_id"])); + $data->id = $data->dataRecord['id']; + $app->plugin->raiseEvent("dns:dns_soa:on_after_update", $data); + } + + $app->tform->loadFormDef("../dns/form/dns_slave.tform.php"); + $data->oldDataRecord = $app->db->queryOneRecord("SELECT * FROM dns_slave WHERE origin LIKE '".$this->dataRecord['domain'].".'"); + if ($data->oldDataRecord) { + $data->dataRecord = array_merge($data->oldDataRecord, array('client_group_id' => $this->dataRecord["client_group_id"])); + $data->id = $data->dataRecord['id']; + $app->plugin->raiseEvent("dns:dns_slave:on_after_update", $data); + } + + $app->tform->loadFormDef("../mail/form/mail_domain.tform.php"); + $data->oldDataRecord = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '".$this->dataRecord['domain']."'"); + if ($data->oldDataRecord) { + $data->dataRecord = array_merge($data->oldDataRecord, array('client_group_id' => $this->dataRecord["client_group_id"])); + $data->id = $data->dataRecord['domain_id']; + $app->plugin->raiseEvent("mail:mail_domain:on_after_update", $data); + } + + $app->tform->loadFormDef("../sites/form/web_vhost_domain.tform.php"); + $data->oldDataRecord = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '".$this->dataRecord['domain']."'"); + if ($data->oldDataRecord) { + $data->dataRecord = array_merge($data->oldDataRecord, array('client_group_id' => $this->dataRecord["client_group_id"])); + $data->id = $data->dataRecord['domain_id']; + $app->plugin->raiseEvent("sites:web_vhost_domain:on_after_update", $data); + } + + $app->tform = $tform; } } diff --git a/interface/web/client/domain_list.php b/interface/web/client/domain_list.php index 4c6bdf9925187bcb64d2bce2d67610e20683a11e..622e52a97e3a62d9dd94b20d1b2dd0c4321d9b8e 100644 --- a/interface/web/client/domain_list.php +++ b/interface/web/client/domain_list.php @@ -46,11 +46,6 @@ $app->auth->check_module_permissions('client'); $app->uses('listform_actions'); -if(isset($_SESSION['show_warning_msg'])) { - $app->tpl->setVar('warning_msg', $_SESSION['show_warning_msg']); - unset($_SESSION['show_warning_msg']); -} - $app->listform_actions->SQLOrderBy = 'ORDER BY domain.domain'; $app->listform_actions->onLoad(); diff --git a/interface/web/client/templates/domain_list.htm b/interface/web/client/templates/domain_list.htm index 4bbb09a3899ca138561be5ffd23f91933c769f7b..3100660896b877df92d90c3908fc88813c7ccc17 100644 --- a/interface/web/client/templates/domain_list.htm +++ b/interface/web/client/templates/domain_list.htm @@ -4,16 +4,6 @@ <div class="panel panel_list_domain"> <div class="pnl_toolsarea"> - <div> - <tmpl_if name='warning_msg'> - <div class="systemmonitor-state state-warning"> - <div class="status"></div> - <div class="statusMsg"> - {tmpl_var name='warning_msg'} - </div> - </div> - </tmpl_if> - </div> <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend> <div class="buttons"> <button class="button iconstxt icoAdd" type="button" onclick="loadContent('client/domain_edit.php');"> diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php index 81b6f2a019cd13143b189dbb1f2f52ac19595f64..d7c8d7c1de9c88bf6d132a0083286afcb179cb63 100644 --- a/interface/web/mail/mail_domain_edit.php +++ b/interface/web/mail/mail_domain_edit.php @@ -255,6 +255,27 @@ class page_action extends tform_actions { parent::onSubmit(); } + function onAfterInsert() { + global $app, $conf; + + // Spamfilter policy + $policy_id = $app->functions->intval($page_form->dataRecord["policy"]); + if($policy_id > 0) { + $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($page_form->dataRecord["domain"])."'"); + if($tmp_user["id"] > 0) { + // There is already a record that we will update + $app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]); + } else { + $tmp_domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain_id = ".$page_form->id); + // We create a new record + $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) + VALUES (".$_SESSION["s"]["user"]["userid"].", ".$app->functions->intval($tmp_domain["sys_groupid"]).", 'riud', 'riud', '', ".$app->functions->intval($page_form->dataRecord["server_id"]).", 5, ".$app->functions->intval($policy_id).", '@".$app->db->quote($page_form->dataRecord["domain"])."', '@".$app->db->quote($page_form->dataRecord["domain"])."', 'Y')"; + $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); + unset($tmp_domain); + } + } // endif spamfilter policy + } + function onBeforeUpdate() { global $app, $conf; @@ -281,6 +302,31 @@ class page_action extends tform_actions { } } + function onAfterUpdate() { + global $app, $conf; + + // Spamfilter policy + $policy_id = $app->functions->intval($page_form->dataRecord["policy"]); + $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($page_form->dataRecord["domain"])."'"); + if($policy_id > 0) { + if($tmp_user["id"] > 0) { + // There is already a record that we will update + $app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]); + } else { + $tmp_domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain_id = ".$page_form->id); + // We create a new record + $insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) + VALUES (".$_SESSION["s"]["user"]["userid"].", ".$app->functions->intval($tmp_domain["sys_groupid"]).", 'riud', 'riud', '', ".$app->functions->intval($page_form->dataRecord["server_id"]).", 5, ".$app->functions->intval($policy_id).", '@".$app->db->quote($page_form->dataRecord["domain"])."', '@".$app->db->quote($page_form->dataRecord["domain"])."', 'Y')"; + $app->db->datalogInsert('spamfilter_users', $insert_data, 'id'); + unset($tmp_domain); + } + } else { + if($tmp_user["id"] > 0) { + // There is already a record but the user shall have no policy, so we delete it + $app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]); + } + } // endif spamfilter policy + } } $page = new page_action;