From 65164295778caa2c4e623e7c8e195f2aa3560121 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Thu, 07 Apr 2016 13:19:58 -0400
Subject: [PATCH] - Changed 0000-00-00 date and datetime values to NULL (mySQL compatibility), Fixes: #3690
---
interface/web/sites/web_childdomain_edit.php | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/interface/web/sites/web_childdomain_edit.php b/interface/web/sites/web_childdomain_edit.php
index 435b901..33c2422 100644
--- a/interface/web/sites/web_childdomain_edit.php
+++ b/interface/web/sites/web_childdomain_edit.php
@@ -105,7 +105,7 @@
/*
* The domain-module is in use.
*/
- $domains = $app->tools_sites->getDomainModuleDomains();
+ $domains = $app->tools_sites->getDomainModuleDomains($this->_vhostdomain_type == 'subdomain' ? null : "web_domain", $this->dataRecord["domain"]);
$domain_select = '';
$selected_domain = '';
if(is_array($domains) && sizeof($domains) > 0) {
@@ -136,7 +136,7 @@
} else {
if($this->_childdomain_type == 'subdomain') {
// Get the record of the parent domain
- $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
+ $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ?", @$this->dataRecord["parent_domain_id"]);
// remove the parent domain part of the domain name before we show it in the text field.
$this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"], '', $this->dataRecord["domain"]);
@@ -165,9 +165,16 @@
function onSubmit() {
global $app, $conf;
+
+ // Get the record of the parent domain
+ if(!@$this->dataRecord["parent_domain_id"] && $this->id) {
+ $tmp = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_domain WHERE domain_id = ?", $this->id);
+ if($tmp) $this->dataRecord["parent_domain_id"] = $tmp['parent_domain_id'];
+ unset($tmp);
+ }
// Get the record of the parent domain
- $parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
+ $parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ? AND ".$app->tform->getAuthSQL('r'), @$this->dataRecord["parent_domain_id"]);
if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
/* check if the domain module is used - and check if the selected domain can be used! */
$app->uses('ini_parser,getconf');
@@ -207,7 +214,7 @@
//* make sure that the domain is lowercase
if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-
+
parent::onSubmit();
}
@@ -229,7 +236,7 @@
//* Update the old website, so that the vhost alias gets removed
//* We force the update by inserting a transaction record without changes manually.
- $old_website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$app->functions->intval($this->oldDataRecord['domain_id']));
+ $old_website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ?', $this->oldDataRecord['domain_id']);
$app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $app->functions->intval($this->oldDataRecord['parent_domain_id']), $old_website, $old_website, true);
}
--
Gitblit v1.9.1