| | |
| | | $this->dataRecord["ipv6_address"] = $parent_domain["ipv6_address"]; |
| | | $this->dataRecord["client_group_id"] = $parent_domain["client_group_id"]; |
| | | $this->dataRecord["vhost_type"] = 'name'; |
| | | $this->dataRecord["system_user"] = $parent_domain["system_user"]; |
| | | $this->dataRecord["system_group"] = $parent_domain["system_group"]; |
| | | |
| | | $this->parent_domain_record = $parent_domain; |
| | | |
| | |
| | | |
| | | if($app->tform->getCurrentTab() == 'domain') { |
| | | |
| | | // Check that domain (the subdomain part) is not empty |
| | | if(!preg_match('/^[a-zA-Z0-9].*/',$this->dataRecord['domain'])) { |
| | | $app->tform->errorMessage .= $app->tform->lng("subdomain_error_empty")."<br />"; |
| | | } |
| | | |
| | | /* check if the domain module is used - and check if the selected domain can be used! */ |
| | | $app->uses('ini_parser,getconf'); |
| | | $settings = $app->getconf->get_global_config('domains'); |
| | |
| | | $app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'<br>'; |
| | | } |
| | | } |
| | | |
| | | // 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 onAfterUpdate() { |
| | | global $app, $conf; |
| | | |
| | | //* Update settings when parent domain gets changed |
| | | if(isset($this->dataRecord["parent_domain_id"]) && $this->dataRecord["parent_domain_id"] != $this->oldDataRecord["parent_domain_id"]) { |
| | | // Get configuration for the web system |
| | | $app->uses("getconf"); |
| | | $web_rec = $app->tform->getDataRecord($this->id); |
| | | $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web'); |
| | | |
| | | // Get configuration for the web system |
| | | $app->uses("getconf"); |
| | | $web_rec = $app->tform->getDataRecord($this->id); |
| | | $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web'); |
| | | // Set the values for document_root, system_user and system_group |
| | | $system_user = $app->db->quote($this->parent_domain_record['system_user']); |
| | | $system_group = $app->db->quote($this->parent_domain_record['system_group']); |
| | | $document_root = $app->db->quote($this->parent_domain_record['document_root']); |
| | | $php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$web_rec['web_folder'], $web_config["php_open_basedir"]); |
| | | $php_open_basedir = str_replace("[website_domain]/web", $web_rec['domain'].'/'.$web_rec['web_folder'], $php_open_basedir); |
| | | $php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir); |
| | | $php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir)); |
| | | $htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']); |
| | | |
| | | // Set the values for document_root, system_user and system_group |
| | | $system_user = $app->db->quote($this->parent_domain_record['system_user']); |
| | | $system_group = $app->db->quote($this->parent_domain_record['system_group']); |
| | | $document_root = $app->db->quote($this->parent_domain_record['document_root']); |
| | | $php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$web_rec['web_folder'], $web_config["php_open_basedir"]); |
| | | $php_open_basedir = str_replace("[website_domain]/web", $web_rec['domain'].'/'.$web_rec['web_folder'], $php_open_basedir); |
| | | $php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir); |
| | | $php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir)); |
| | | $htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']); |
| | | |
| | | $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id; |
| | | $app->db->query($sql); |
| | | $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id; |
| | | $app->db->query($sql); |
| | | } |
| | | } |
| | | |
| | | } |