From 2d7d9eaa5acda62f1580bc09304ce85a7f7cea9f Mon Sep 17 00:00:00 2001
From: Dominik <info@profi-webdesign.net>
Date: Thu, 23 Jan 2014 13:40:54 -0500
Subject: [PATCH] Merge remote-tracking branch 'ispc3master/master' into vhostalias

---
 interface/web/sites/web_domain_edit.php |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index c793cd0..7673895 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -133,11 +133,21 @@
 			} else {
 				$server_id = (isset($web_servers[0])) ? intval($web_servers[0]) : 0;
 			}
-
+			
+			if($app->functions->intval($this->dataRecord["server_id"]) > 0) {
+				// check if server is in client's servers or add it.
+				$chk_sid = explode(',', $client['web_servers']);
+				if(in_array($this->dataRecord["server_id"], $client['web_servers']) == false) {
+					if($client['web_servers'] != '') $client['web_servers'] .= ',';
+					$client['web_servers'] .= $app->functions->intval($this->dataRecord["server_id"]);
+				}
+			}
+			
 			//* Fill the IPv4 select field with the IP addresses that are allowed for this client
 			$sql = "SELECT ip_address FROM server_ip WHERE server_id IN (" . $client['web_servers'] . ") AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
 			$ips = $app->db->queryAllRecords($sql);
 			$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
+			//if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n";
 			//$ip_select = "";
 			if(is_array($ips)) {
 				foreach( $ips as $ip) {
@@ -234,10 +244,20 @@
 			}
 			$app->tpl->setVar("client_group_id", $client_select);
 
+			if($app->functions->intval($this->dataRecord["server_id"]) > 0) {
+				// check if server is in client's servers or add it.
+				$chk_sid = explode(',', $client['web_servers']);
+				if(in_array($this->dataRecord["server_id"], $client['web_servers']) == false) {
+					if($client['web_servers'] != '') $client['web_servers'] .= ',';
+					$client['web_servers'] .= $app->functions->intval($this->dataRecord["server_id"]);
+				}
+			}
+			
 			//* Fill the IPv4 select field with the IP addresses that are allowed for this client
 			$sql = "SELECT ip_address FROM server_ip WHERE server_id IN (" . $client['web_servers'] . ") AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
 			$ips = $app->db->queryAllRecords($sql);
 			$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
+			//if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n";
 			//$ip_select = "";
 			if(is_array($ips)) {
 				foreach( $ips as $ip) {

--
Gitblit v1.9.1