Skip to content

Commit 7c0747e

Browse files
author
Till Brehm
committed
Merge branch 'stable-3.1' into 'stable-3.1'
show ips only with vhost = y and show directive_snippets for the admin even... See merge request ispconfig/ispconfig3!929
2 parents b047ebd + f0bfe45 commit 7c0747e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

interface/web/sites/web_vhost_domain_edit.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ function onShowEnd() {
206206
}
207207

208208
//* Fill the IPv4 select field with the IP addresses that are allowed for this client on the current server
209-
$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'].")";
209+
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND virtualhost = 'y' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
210210
$ips = $app->db->queryAllRecords($sql, $server_id);
211211
$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
212212
//if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n";
@@ -222,7 +222,7 @@ function onShowEnd() {
222222
unset($ips);
223223

224224
//* Fill the IPv6 select field with the IP addresses that are allowed for this client
225-
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)";
225+
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND virtualhost = 'y' AND (client_id = 0 OR client_id=?)";
226226
$ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']);
227227
//$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
228228
//$ip_select = "";
@@ -352,7 +352,7 @@ function onShowEnd() {
352352
}
353353

354354
//* Fill the IPv4 select field with the IP addresses that are allowed for this client
355-
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=?)";
355+
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND virtualhost = 'y' AND (client_id = 0 OR client_id=?)";
356356
$ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']);
357357
$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
358358
//if(!in_array($this->dataRecord["ip_address"], $ips)) $ip_select .= "<option value='".$this->dataRecord["ip_address"]."' SELECTED>".$this->dataRecord["ip_address"]."</option>\r\n";
@@ -368,7 +368,7 @@ function onShowEnd() {
368368
unset($ips);
369369

370370
//* Fill the IPv6 select field with the IP addresses that are allowed for this client
371-
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)";
371+
$sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND virtualhost = 'y' AND (client_id = 0 OR client_id=?)";
372372
$ips = $app->db->queryAllRecords($sql, $server_id, $_SESSION['s']['user']['client_id']);
373373
$ip_select = "<option value=''></option>";
374374
//$ip_select = "";
@@ -549,7 +549,7 @@ function onShowEnd() {
549549
}
550550

551551
//* Fill the IPv4 select field
552-
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv4' AND server_id = ?";
552+
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv4' AND virtualhost = 'y' AND server_id = ?";
553553
$ips = $app->db->queryAllRecords($sql, $server_id);
554554
$ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":"";
555555
//$ip_select = "";
@@ -564,7 +564,7 @@ function onShowEnd() {
564564
unset($ips);
565565

566566
//* Fill the IPv6 select field
567-
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND server_id = ?";
567+
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND virtualhost = 'y' AND server_id = ?";
568568
$ips = $app->db->queryAllRecords($sql, $server_id);
569569
$ip_select = "<option value=''></option>";
570570
//$ip_select = "";
@@ -863,8 +863,12 @@ function onShowEnd() {
863863
}
864864
$directive_snippets_id_select .= '</optgroup>';
865865
}
866-
867-
$directive_snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND active = 'y' AND master_directive_snippets_id = 0 AND type = ? ORDER BY name ASC", $server_type);
866+
867+
if($is_admin) {
868+
$directive_snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE active = 'y' AND master_directive_snippets_id = 0 AND type = ? ORDER BY name ASC", $server_type);
869+
} else {
870+
$directive_snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND active = 'y' AND master_directive_snippets_id = 0 AND type = ? ORDER BY name ASC", $server_type);
871+
}
868872
if(is_array($directive_snippets) && !empty($directive_snippets)){
869873
$directive_snippets_id_select .= '<optgroup label="'.$app->tform->wordbook["select_directive_snippet_txt"].'">';
870874
foreach($directive_snippets as $directive_snippet){

0 commit comments

Comments
 (0)