From 4e18bd4210f5c79d341436b1ed026300d59ba208 Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Tue, 11 Sep 2012 12:45:53 -0400
Subject: [PATCH] Fixed: FS#2421 - Domain module does not check for valid selection Implemented: FS#2422 - Use domain module when creating subdomains Bugfix: datalog was used in the wrong way on editing aliasdomains Bugfix: missing datalog update for parent domain on editing subdomains
---
interface/web/mail/mail_domain_edit.php | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index ee7eaea..8a43a69 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -126,7 +126,7 @@
/*
* The admin can select ALL domains, the user only the domains assigned to him
*/
- $sql = "SELECT domain FROM domain ";
+ $sql = "SELECT domain_id, domain FROM domain ";
if ($_SESSION["s"]["user"]["typ"] != 'admin') {
$sql .= "WHERE sys_groupid =" . $client_group_id;
}
@@ -136,7 +136,7 @@
if(is_array($domains) && sizeof($domains) > 0) {
/* We have domains in the list, so create the drop-down-list */
foreach( $domains as $domain) {
- $domain_select .= "<option value=" . $domain['domain'] ;
+ $domain_select .= "<option value=" . $domain['domain_id'] ;
if ($domain['domain'] == $this->dataRecord["domain"]) {
$domain_select .= " selected";
}
@@ -184,7 +184,27 @@
function onSubmit() {
global $app, $conf;
- if($_SESSION["s"]["user"]["typ"] != 'admin') {
+
+ /* check if the domain module is used - and check if the selected domain can be used! */
+ $app->uses('ini_parser,getconf');
+ $settings = $app->getconf->get_global_config('domains');
+ if ($settings['use_domain_module'] == 'y') {
+ $client_group_id = intval($_SESSION["s"]["user"]["default_group"]);
+
+ $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . intval($this->dataRecord['domain']);
+ if ($_SESSION["s"]["user"]["typ"] != 'admin') {
+ $sql .= "AND sys_groupid =" . $client_group_id;
+ }
+ $domain_check = $app->db->queryOneRecord($sql);
+ if(!$domain_check) {
+ // invalid domain selected
+ $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+ } else {
+ $this->dataRecord['domain'] = $domain_check['domain'];
+ }
+ }
+
+ if($_SESSION["s"]["user"]["typ"] != 'admin') {
// Get the limits of the client
$client_group_id = $_SESSION["s"]["user"]["default_group"];
--
Gitblit v1.9.1