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/sites/web_domain_edit.php | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index bd357dc..92a5c08 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -418,7 +418,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;
}
@@ -428,7 +428,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";
}
@@ -458,6 +458,25 @@
function onSubmit() {
global $app, $conf;
+ /* 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'];
+ }
+ }
+
// Set a few fixed values
$this->dataRecord["parent_domain_id"] = 0;
$this->dataRecord["type"] = 'vhost';
--
Gitblit v1.9.1