From f0bfe454941703b2954c78fe96f736bb06a21f60 Mon Sep 17 00:00:00 2001 From: Florian Schaal <info@schaal-24.de> Date: Mon, 4 Nov 2019 15:17:20 +0100 Subject: [PATCH] show ips only with vhost = y and show directive_snippets for the admin even if they are set to customer_viewable = 'n' --- interface/web/sites/web_vhost_domain_edit.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index 86deb5b2a5..52b44acc79 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -206,7 +206,7 @@ class page_action extends tform_actions { } //* 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'].")"; + $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'].")"; $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"; @@ -222,7 +222,7 @@ 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 = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)"; + $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND virtualhost = 'y' 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 = ""; @@ -352,7 +352,7 @@ 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 = ? AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=?)"; + $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv4' AND virtualhost = 'y' 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"; @@ -368,7 +368,7 @@ 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 = ? AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=?)"; + $sql = "SELECT ip_address FROM server_ip WHERE server_id = ? AND ip_type = 'IPv6' AND virtualhost = 'y' 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 = ""; @@ -549,7 +549,7 @@ class page_action extends tform_actions { } //* Fill the IPv4 select field - $sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv4' AND server_id = ?"; + $sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv4' AND virtualhost = 'y' AND server_id = ?"; $ips = $app->db->queryAllRecords($sql, $server_id); $ip_select = ($web_config['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":""; //$ip_select = ""; @@ -564,7 +564,7 @@ class page_action extends tform_actions { unset($ips); //* Fill the IPv6 select field - $sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND server_id = ?"; + $sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND virtualhost = 'y' AND server_id = ?"; $ips = $app->db->queryAllRecords($sql, $server_id); $ip_select = "<option value=''></option>"; //$ip_select = ""; @@ -863,8 +863,12 @@ class page_action extends tform_actions { } $directive_snippets_id_select .= '</optgroup>'; } - - $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); + + if($is_admin) { + $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); + } else { + $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); + } if(is_array($directive_snippets) && !empty($directive_snippets)){ $directive_snippets_id_select .= '<optgroup label="'.$app->tform->wordbook["select_directive_snippet_txt"].'">'; foreach($directive_snippets as $directive_snippet){ -- GitLab