From c146a27b0aefbdd98456c6faaef5fb7d01d7c69a Mon Sep 17 00:00:00 2001 From: mcramer Date: Mon, 20 Aug 2012 17:20:57 +0000 Subject: [PATCH] Bugfix reading PHP versions from wrong server under some circumstances Made web_folder field read only on edit --- .../web/sites/templates/web_vhost_subdomain_edit.htm | 3 ++- interface/web/sites/web_domain_edit.php | 8 ++++---- interface/web/sites/web_vhost_subdomain_edit.php | 11 ++++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/interface/web/sites/templates/web_vhost_subdomain_edit.htm b/interface/web/sites/templates/web_vhost_subdomain_edit.htm index 0c6877d73f..159830c685 100644 --- a/interface/web/sites/templates/web_vhost_subdomain_edit.htm +++ b/interface/web/sites/templates/web_vhost_subdomain_edit.htm @@ -5,6 +5,7 @@
+
@@ -15,7 +16,7 @@
- + readonly="readonly" />
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index 97d7d57301..8a684d0d11 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -141,10 +141,10 @@ class page_action extends tform_actions { if(!empty($web_config['server_type'])) $server_type = $web_config['server_type']; if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm'; if($this->dataRecord['php'] == 'php-fpm'){ - $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"); + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver'])." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"); } if($this->dataRecord['php'] == 'fast-cgi'){ - $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"); + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver'])." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"); } $php_select = ""; if(is_array($php_records) && !empty($php_records)) { @@ -229,10 +229,10 @@ class page_action extends tform_actions { if(!empty($web_config['server_type'])) $server_type = $web_config['server_type']; if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm'; if($this->dataRecord['php'] == 'php-fpm'){ - $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"); + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver'])." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"); } if($this->dataRecord['php'] == 'fast-cgi') { - $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".$client['default_webserver']." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"); + $php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ".($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver'])." AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"); } $php_select = ""; if(is_array($php_records) && !empty($php_records)) { diff --git a/interface/web/sites/web_vhost_subdomain_edit.php b/interface/web/sites/web_vhost_subdomain_edit.php index e718413594..82a60b8de9 100644 --- a/interface/web/sites/web_vhost_subdomain_edit.php +++ b/interface/web/sites/web_vhost_subdomain_edit.php @@ -86,7 +86,7 @@ class page_action extends tform_actions { $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl'); $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); - + //* Client: If the logged in user is not admin and has no sub clients (no reseller) if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { @@ -209,8 +209,13 @@ class page_action extends tform_actions { } } - if($this->id > 0) $app->tpl->setVar('fixed_folder', 'y'); - else $app->tpl->setVar('fixed_folder', 'n'); + if($this->id > 0) { + $app->tpl->setVar('fixed_folder', 'y'); + $app->tpl->setVar('server_id_value', $parent_domain['server_id']); + } else { + $app->tpl->setVar('fixed_folder', 'n'); + $app->tpl->setVar('server_id_value', $parent_domain['server_id']); + } $app->tpl->setVar("ssl_domain",$ssl_domain_select); unset($ssl_domain_select); -- GitLab