diff --git a/install/sql/incremental/upd_dev_collection.sql b/install/sql/incremental/upd_dev_collection.sql index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..13c895c75b3e88b8a86bc6a7239536fabbf223e6 100644 --- a/install/sql/incremental/upd_dev_collection.sql +++ b/install/sql/incremental/upd_dev_collection.sql @@ -0,0 +1,10 @@ +ALTER TABLE `client` CHANGE `web_servers` `web_servers` TEXT NULL DEFAULT NULL; +ALTER TABLE `client` CHANGE `mail_servers` `mail_servers` TEXT NULL DEFAULT NULL; +ALTER TABLE `client` CHANGE `xmpp_servers` `xmpp_servers` TEXT NULL DEFAULT NULL; +ALTER TABLE `client` CHANGE `db_servers` `db_servers` TEXT NULL DEFAULT NULL; +ALTER TABLE `client` CHANGE `dns_servers` `dns_servers` TEXT NULL DEFAULT NULL; +UPDATE client SET web_servers = default_webserver WHERE (web_servers = '' OR web_servers IS NULL); +UPDATE client SET mail_servers = default_mailserver WHERE (mail_servers = '' OR mail_servers IS NULL); +UPDATE client SET xmpp_servers = default_xmppserver WHERE (xmpp_servers = '' OR xmpp_servers IS NULL); +UPDATE client SET db_servers = default_dbserver WHERE (db_servers = '' OR db_servers IS NULL); +UPDATE client SET dns_servers = default_dnsserver WHERE (dns_servers = '' OR dns_servers IS NULL); \ No newline at end of file diff --git a/interface/web/sites/ajax_get_ip.php b/interface/web/sites/ajax_get_ip.php index 205be4803b08d894189d5e75d31725a1a700485c..8c83191920887351e67d2232152fe20623615d04 100644 --- a/interface/web/sites/ajax_get_ip.php +++ b/interface/web/sites/ajax_get_ip.php @@ -39,13 +39,15 @@ $server_id = $app->functions->intval($_GET["server_id"]); $client_group_id = $app->functions->intval($_GET["client_group_id"]); $ip_type = $_GET['ip_type']; -if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) { +//if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) { //* Get global web config $web_config = $app->getconf->get_server_config($server_id, 'web'); + + $tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $client_group_id); + $sql = "SELECT ip_address FROM server_ip WHERE ip_type = ? AND server_id = ? AND (client_id = 0 OR client_id=?)"; - $sql = "SELECT ip_address FROM server_ip WHERE ip_type = ? AND server_id = ?"; - $ips = $app->db->queryAllRecords($sql, $ip_type, $server_id); + $ips = $app->db->queryAllRecords($sql, $ip_type, $server_id, $tmp['groupid']); // $ip_select = "<option value=''></option>"; if($ip_type == 'IPv4'){ $ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"*#":""; @@ -60,7 +62,7 @@ if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION } unset($tmp); unset($ips); -} +//} echo substr($ip_select, 0, -1); ?> diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index ec91daf7ebabab245dfc185cd735942d08852807..6f843571a3b7d15653ae0515ee8e4b74899a45fa 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -188,7 +188,7 @@ class page_action extends tform_actions { } $server_id = intval(@$this->dataRecord["server_id"]); } else { - $server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 1; + $server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 0; } if($app->functions->intval($this->dataRecord["server_id"]) > 0) { @@ -200,9 +200,9 @@ class page_action extends tform_actions { } } - //* 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 ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"; - $ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers'])); + //* Fill the IPv4 select field with the IP addresses that are allowed for this client on the current server + $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"; + $ips = $app->db->queryAllRecords($sql, $server_id); $ip_select = ($web_config[$server_id]['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 = ""; @@ -217,8 +217,8 @@ class page_action extends tform_actions { unset($ips); //* Fill the IPv6 select field with the IP addresses that are allowed for this client - $sql = "SELECT ip_address FROM server_ip WHERE server_id IN ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)"; - $ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers']), $_SESSION['s']['user']['client_id']); + $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)"; + $ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']); //$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":""; //$ip_select = ""; $ip_select = "<option value=''></option>"; @@ -314,7 +314,7 @@ class page_action extends tform_actions { } $server_id = intval(@$this->dataRecord["server_id"]); } else { - $server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 1; + $server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 0; } if ($settings['use_domain_module'] != 'y') { @@ -346,8 +346,8 @@ class page_action extends tform_actions { } //* 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 ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=?)"; - $ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers']), $_SESSION['s']['user']['client_id']); + $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=?)"; + $ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']); $ip_select = ($web_config[$server_id]['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 = ""; @@ -362,8 +362,8 @@ class page_action extends tform_actions { unset($ips); //* Fill the IPv6 select field with the IP addresses that are allowed for this client - $sql = "SELECT ip_address FROM server_ip WHERE server_id IN ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)"; - $ips = $app->db->queryAllRecords($sql, $client['web_servers'], $_SESSION['s']['user']['client_id']); + $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)"; + $ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']); $ip_select = "<option value=''></option>"; //$ip_select = ""; if(is_array($ips)) {