From cc65688b3da3e16729a1f73dd50fd975bd1ff741 Mon Sep 17 00:00:00 2001
From: hellkat <hellkat@ispconfig3>
Date: Tue, 26 Mar 2013 00:43:51 -0400
Subject: [PATCH]     Merged revisions 3845-3876 and 3879-3918 from stable branch.

---
 interface/web/sites/database_edit.php |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index a11d38a..c259ff0 100644
--- a/interface/web/sites/database_edit.php
+++ b/interface/web/sites/database_edit.php
@@ -248,11 +248,24 @@
             // we need remote access rights for this server, so get it's ip address
             $server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
             if($server_config['ip_address']!='') {
+				/*
                 if($this->dataRecord['remote_access'] != 'y') $this->dataRecord['remote_ips'] = '';
                 $this->dataRecord['remote_access'] = 'y';
                 if(preg_match('/(^|,)' . preg_quote($server_config['ip_address'], '/') . '(,|$)/', $this->dataRecord['remote_ips']) == false) {
                     $this->dataRecord['remote_ips'] .= ($this->dataRecord['remote_ips'] != '' ? ',' : '') . $server_config['ip_address'];
                 }
+				*/
+				
+				if($this->dataRecord['remote_access'] != 'y'){
+					$this->dataRecord['remote_ips'] = $server_config['ip_address'];
+					$this->dataRecord['remote_access'] = 'y';
+				} else {
+					if($this->dataRecord['remote_ips'] != ''){
+						if(preg_match('/(^|,)' . preg_quote($server_config['ip_address'], '/') . '(,|$)/', $this->dataRecord['remote_ips']) == false) {
+							$this->dataRecord['remote_ips'] .= ',' . $server_config['ip_address'];
+						}
+					}
+				}
             }
         }
         
@@ -299,11 +312,24 @@
             // we need remote access rights for this server, so get it's ip address
             $server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
             if($server_config['ip_address']!='') {
+				/*
                 if($this->dataRecord['remote_access'] != 'y') $this->dataRecord['remote_ips'] = '';
                 $this->dataRecord['remote_access'] = 'y';
                 if(preg_match('/(^|,)' . preg_quote($server_config['ip_address'], '/') . '(,|$)/', $this->dataRecord['remote_ips']) == false) {
                     $this->dataRecord['remote_ips'] .= ($this->dataRecord['remote_ips'] != '' ? ',' : '') . $server_config['ip_address'];
                 }
+				*/
+				
+				if($this->dataRecord['remote_access'] != 'y'){
+					$this->dataRecord['remote_ips'] = $server_config['ip_address'];
+					$this->dataRecord['remote_access'] = 'y';
+				} else {
+					if($this->dataRecord['remote_ips'] != ''){
+						if(preg_match('/(^|,)' . preg_quote($server_config['ip_address'], '/') . '(,|$)/', $this->dataRecord['remote_ips']) == false) {
+							$this->dataRecord['remote_ips'] .= ',' . $server_config['ip_address'];
+						}
+					}
+				}
             }
         }
         

--
Gitblit v1.9.1