From 51a7b5e29a1cbf53e9858a6b11aa0be1f8fc59d2 Mon Sep 17 00:00:00 2001 From: Till Brehm <tbrehm@ispconfig.org> Date: Fri, 27 May 2016 12:14:24 -0400 Subject: [PATCH] Merge branch 'stable-3.1' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.1 --- interface/web/sites/web_vhost_domain_edit.php | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 53 insertions(+), 1 deletions(-) diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index 4e1853f..09ff8ab 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -50,6 +50,7 @@ class page_action extends tform_actions { var $_vhostdomain_type = 'domain'; + var $_letsencrypt_on_insert = false; //* Returna a "3/2/1" path hash from a numeric id '123' function id_hash($id, $levels) { @@ -218,8 +219,9 @@ //* 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']); - $ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":""; + //$ip_select = ($web_config[$server_id]['enable_ip_wildcard'] == 'y')?"<option value='*'>*</option>":""; //$ip_select = ""; + $ip_select = "<option value=''></option>"; if(is_array($ips)) { foreach( $ips as $ip) { $selected = ($ip["ip_address"] == $this->dataRecord["ipv6_address"])?'SELECTED':''; @@ -757,6 +759,7 @@ * Now we have to check, if we should use the domain-module to select the domain * or not */ + $settings = $app->getconf->get_global_config('domains'); if ($settings['use_domain_module'] == 'y') { /* * The domain-module is in use. @@ -1304,8 +1307,47 @@ $this->dataRecord['folder_directive_snippets'] = trim($this->dataRecord['folder_directive_snippets']); } + // Check custom PHP version + if(isset($this->dataRecord['fastcgi_php_version']) && $this->dataRecord['fastcgi_php_version'] != '') { + // Check php-fpm mode + if($this->dataRecord['php'] == 'php-fpm'){ + $tmp = $app->db->queryOneRecord("SELECT * FROM server_php WHERE CONCAT(name,':',php_fpm_init_script,':',php_fpm_ini_dir,':',php_fpm_pool_dir) = '".$app->db->quote($this->dataRecord['fastcgi_php_version'])."'"); + if(is_array($tmp)) { + $this->dataRecord['fastcgi_php_version'] = $tmp['name'].':'.$tmp['php_fpm_init_script'].':'.$tmp['php_fpm_ini_dir'].':'.$tmp['php_fpm_pool_dir']; + } else { + $this->dataRecord['fastcgi_php_version'] = ''; + } + unset($tmp); + // Check fast-cgi mode + } elseif($this->dataRecord['php'] == 'fast-cgi') { + $tmp = $app->db->queryOneRecord("SELECT * FROM server_php WHERE CONCAT(name,':',php_fastcgi_binary,':',php_fastcgi_ini_dir) = '".$app->db->quote($this->dataRecord['fastcgi_php_version'])."'"); + if(is_array($tmp)) { + $this->dataRecord['fastcgi_php_version'] = $tmp['name'].':'.$tmp['php_fastcgi_binary'].':'.$tmp['php_fastcgi_ini_dir']; + } else { + $this->dataRecord['fastcgi_php_version'] = ''; + } + unset($tmp); + } else { + // Other PHP modes do not have custom versions, so we force the value to be empty + $this->dataRecord['fastcgi_php_version'] = ''; + } + } + parent::onSubmit(); } + + function onBeforeInsert() { + global $app, $conf; + + // Letsencrypt can not be activated before the website has been created + // So we deactivate it here and add a datalog update in onAfterInsert + if(isset($this->dataRecord['ssl_letsencrypt']) && $this->dataRecord['ssl_letsencrypt'] == 'y' && isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y') { + $this->dataRecord['ssl_letsencrypt'] = 'n'; + $this->dataRecord['ssl'] = 'n'; + $this->_letsencrypt_on_insert = true; + } + } + function onAfterInsert() { global $app, $conf; @@ -1376,6 +1418,16 @@ $app->db->query($sql, $this->parent_domain_record['sys_groupid'], $system_user, $system_group, $document_root, $htaccess_allow_override, $php_open_basedir, $added_by, $this->id); } if(isset($this->dataRecord['folder_directive_snippets'])) $app->db->query("UPDATE web_domain SET folder_directive_snippets = ? WHERE domain_id = ?", $this->dataRecord['folder_directive_snippets'], $this->id); + + // Add a datalog update with letsencrypt enabled (see also onBeforeInsert) + if($this->_letsencrypt_on_insert == true) { + $tmp = $web_rec; + $tmp['ssl_letsencrypt'] = 'y'; + $tmp['ssl'] = 'y'; + $app->db->datalogUpdate('web_domain', $tmp, 'domain_id', $this->id); + unset($tmp); + } + } function onBeforeUpdate () { -- Gitblit v1.9.1