Skip to content

Commit 0d3e958

Browse files
author
Till Brehm
committed
Fixed Issue #3966 Error when Web-IP is '*'
1 parent 8225ad2 commit 0d3e958

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ALTER TABLE `client` CHANGE `web_servers` `web_servers` TEXT NULL DEFAULT NULL;
2+
ALTER TABLE `client` CHANGE `mail_servers` `mail_servers` TEXT NULL DEFAULT NULL;
3+
ALTER TABLE `client` CHANGE `xmpp_servers` `xmpp_servers` TEXT NULL DEFAULT NULL;
4+
ALTER TABLE `client` CHANGE `db_servers` `db_servers` TEXT NULL DEFAULT NULL;
5+
ALTER TABLE `client` CHANGE `dns_servers` `dns_servers` TEXT NULL DEFAULT NULL;
6+
UPDATE client SET web_servers = default_webserver WHERE (web_servers = '' OR web_servers IS NULL);
7+
UPDATE client SET mail_servers = default_mailserver WHERE (mail_servers = '' OR mail_servers IS NULL);
8+
UPDATE client SET xmpp_servers = default_xmppserver WHERE (xmpp_servers = '' OR xmpp_servers IS NULL);
9+
UPDATE client SET db_servers = default_dbserver WHERE (db_servers = '' OR db_servers IS NULL);
10+
UPDATE client SET dns_servers = default_dnsserver WHERE (dns_servers = '' OR dns_servers IS NULL);

interface/web/sites/ajax_get_ip.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@
3939
$client_group_id = $app->functions->intval($_GET["client_group_id"]);
4040
$ip_type = $_GET['ip_type'];
4141

42-
if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
42+
//if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
4343

4444
//* Get global web config
4545
$web_config = $app->getconf->get_server_config($server_id, 'web');
46+
47+
$tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $client_group_id);
48+
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = ? AND server_id = ? AND (client_id = 0 OR client_id=?)";
4649

47-
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = ? AND server_id = ?";
48-
$ips = $app->db->queryAllRecords($sql, $ip_type, $server_id);
50+
$ips = $app->db->queryAllRecords($sql, $ip_type, $server_id, $tmp['groupid']);
4951
// $ip_select = "<option value=''></option>";
5052
if($ip_type == 'IPv4'){
5153
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"*#":"";
@@ -60,7 +62,7 @@
6062
}
6163
unset($tmp);
6264
unset($ips);
63-
}
65+
//}
6466

6567
echo substr($ip_select, 0, -1);
6668
?>

interface/web/sites/web_vhost_domain_edit.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function onShowEnd() {
188188
}
189189
$server_id = intval(@$this->dataRecord["server_id"]);
190190
} else {
191-
$server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 1;
191+
$server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 0;
192192
}
193193

194194
if($app->functions->intval($this->dataRecord["server_id"]) > 0) {
@@ -200,9 +200,9 @@ function onShowEnd() {
200200
}
201201
}
202202

203-
//* Fill the IPv4 select field with the IP addresses that are allowed for this client
204-
$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'].")";
205-
$ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers']));
203+
//* Fill the IPv4 select field with the IP addresses that are allowed for this client on the current server
204+
$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'].")";
205+
$ips = $app->db->queryAllRecords($sql, $server_id);
206206
$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
207207
//if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n";
208208
//$ip_select = "";
@@ -217,8 +217,8 @@ function onShowEnd() {
217217
unset($ips);
218218

219219
//* Fill the IPv6 select field with the IP addresses that are allowed for this client
220-
$sql = "SELECT ip_address FROM server_ip WHERE server_id IN ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)";
221-
$ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers']), $_SESSION['s']['user']['client_id']);
220+
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)";
221+
$ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']);
222222
//$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
223223
//$ip_select = "";
224224
$ip_select = "<option value=''></option>";
@@ -314,7 +314,7 @@ function onShowEnd() {
314314
}
315315
$server_id = intval(@$this->dataRecord["server_id"]);
316316
} else {
317-
$server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 1;
317+
$server_id = (isset($web_servers[0])) ? intval($web_servers[0]['server_id']) : 0;
318318
}
319319

320320
if ($settings['use_domain_module'] != 'y') {
@@ -346,8 +346,8 @@ function onShowEnd() {
346346
}
347347

348348
//* Fill the IPv4 select field with the IP addresses that are allowed for this client
349-
$sql = "SELECT ip_address FROM server_ip WHERE server_id IN ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=?)";
350-
$ips = $app->db->queryAllRecords($sql, explode(',', $client['web_servers']), $_SESSION['s']['user']['client_id']);
349+
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=?)";
350+
$ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']);
351351
$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
352352
//if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n";
353353
//$ip_select = "";
@@ -362,8 +362,8 @@ function onShowEnd() {
362362
unset($ips);
363363

364364
//* Fill the IPv6 select field with the IP addresses that are allowed for this client
365-
$sql = "SELECT ip_address FROM server_ip WHERE server_id IN ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)";
366-
$ips = $app->db->queryAllRecords($sql, $client['web_servers'], $_SESSION['s']['user']['client_id']);
365+
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)";
366+
$ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']);
367367
$ip_select = "<option value=''></option>";
368368
//$ip_select = "";
369369
if(is_array($ips)) {

0 commit comments

Comments
 (0)