From 896a5820ec4bd985d1772d7e9b72602fbc6ebf91 Mon Sep 17 00:00:00 2001
From: Falko Timme <ft@falkotimme.com>
Date: Thu, 22 May 2014 19:36:48 -0400
Subject: [PATCH] - Fixed "no_domain_perm" error when trying to add proxy directives for subdomains or alias domains (nginx).

---
 interface/web/sites/web_aliasdomain_edit.php |   10 +++++++++-
 interface/web/sites/web_subdomain_edit.php   |    9 ++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/interface/web/sites/web_aliasdomain_edit.php b/interface/web/sites/web_aliasdomain_edit.php
index 4131109..008e707 100644
--- a/interface/web/sites/web_aliasdomain_edit.php
+++ b/interface/web/sites/web_aliasdomain_edit.php
@@ -123,9 +123,17 @@
 
 	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 = ".$app->functions->intval($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'));
+		
 		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');
@@ -153,7 +161,7 @@
 
 		//* make sure that the domain is lowercase
 		if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-
+		
 		parent::onSubmit();
 	}
 
diff --git a/interface/web/sites/web_subdomain_edit.php b/interface/web/sites/web_subdomain_edit.php
index 0d485c4..4d079ff 100644
--- a/interface/web/sites/web_subdomain_edit.php
+++ b/interface/web/sites/web_subdomain_edit.php
@@ -130,6 +130,13 @@
 
 	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 = ".$app->functions->intval($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'));
@@ -162,7 +169,7 @@
 
 		//* make sure that the domain is lowercase
 		if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-
+		
 		parent::onSubmit();
 	}
 

--
Gitblit v1.9.1