diff --git a/interface/web/admin/lib/lang/de_system_config.lng b/interface/web/admin/lib/lang/de_system_config.lng index 79f80c2f8bfc3eebcdf674310e58b3996b2abdfc..5eaa996fe4a1bde0c984dd6b8e2f351c7aa3ddf1 100644 --- a/interface/web/admin/lib/lang/de_system_config.lng +++ b/interface/web/admin/lib/lang/de_system_config.lng @@ -6,7 +6,7 @@ $wb['dbuser_prefix_txt'] = 'Datenbankbenutzer Prefix'; $wb['shelluser_prefix_txt'] = 'Shellbenutzer Prefix'; $wb['ftpuser_prefix_txt'] = 'FTP Benutzer Prefix'; $wb['vhost_subdomains_txt'] = 'Subdomains als Website anlegen'; -$wb['vhost_subdomains_note_txt'] = 'Diese Einstellung kann nicht geändert werden, wenn Subdomains im System vorhanden sind!'; +$wb['vhost_subdomains_note_txt'] = 'Diese Einstellung kann nicht wieder deaktiviert werden, wenn Vhost Subdomains im System vorhanden sind!'; $wb['dbname_prefix_error_regex'] = 'Zeichen nicht erlaubt in Datenbanknamen Prefix.'; $wb['dbuser_prefix_error_regex'] = 'Zeichen nicht erlaubt in Datenbankbenutzer Prefix.'; $wb['ftpuser_prefix_error_regex'] = 'Zeichen nicht erlaubt in FTP Benutzer Prefix.'; diff --git a/interface/web/admin/lib/lang/en_system_config.lng b/interface/web/admin/lib/lang/en_system_config.lng index dc2f96e154d4fde3f471fa61843491247ec55c67..4fbaa579b23aac16d728db0ee8d076fe6c6d70f2 100644 --- a/interface/web/admin/lib/lang/en_system_config.lng +++ b/interface/web/admin/lib/lang/en_system_config.lng @@ -10,7 +10,7 @@ $wb["shelluser_prefix_txt"] = 'Shell user prefix'; $wb["webdavuser_prefix_txt"] = 'Webdav user prefix'; $wb["ftpuser_prefix_txt"] = 'FTP user prefix'; $wb['vhost_subdomains_txt'] = 'Create Subdomains as web site'; -$wb['vhost_subdomains_note_txt'] = 'You cannot change this as long as subdomains exist in the system!'; +$wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!'; $wb["dbname_prefix_error_regex"] = 'Char not allowed in database name prefix.'; $wb["dbuser_prefix_error_regex"] = 'Char not allowed in database user prefix.'; $wb["ftpuser_prefix_error_regex"] = 'Char not allowed in ftp user prefix.'; diff --git a/interface/web/admin/system_config_edit.php b/interface/web/admin/system_config_edit.php index c78e91917f6873975c45bf4079095150426f6a50..dc615a1f6cf0f27b993c0f80319718e932e62868 100644 --- a/interface/web/admin/system_config_edit.php +++ b/interface/web/admin/system_config_edit.php @@ -88,11 +88,11 @@ class page_action extends tform_actions { $server_config_array = $app->getconf->get_global_config(); $new_config = $app->tform->encode($this->dataRecord,$section); - if($section == 'sites' && $new_config['vhost_subdomains'] != $server_config_array['vhost_subdomains']) { - // check for existing subdomains - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'subdomain' OR `type` = 'vhostsubdomain'"); + if($section == 'sites' && $new_config['vhost_subdomains'] != 'y' && $server_config_array['vhost_subdomains'] == 'y') { + // check for existing vhost subdomains, if found the mode cannot be disabled + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain'"); if($check['cnt'] > 0) { - $new_config['vhost_subdomains'] = $server_config_array['vhost_subdomains']; + $new_config['vhost_subdomains'] = 'y'; } } $server_config_array[$section] = $new_config; diff --git a/interface/web/sites/form/web_vhost_subdomain.tform.php b/interface/web/sites/form/web_vhost_subdomain.tform.php index 448e3ae339ca91e381c1f6eeab59b721b0a81973..1b257671208a40f5a9f54e5d96ba234a39b606eb 100644 --- a/interface/web/sites/form/web_vhost_subdomain.tform.php +++ b/interface/web/sites/form/web_vhost_subdomain.tform.php @@ -277,7 +277,7 @@ $form["tabs"]['domain'] = array ( $form["tabs"]['redirect'] = array ( 'title' => "Redirect", 'width' => 100, - 'template' => "templates/web_domain_redirect.htm", + 'template' => "templates/web_vhost_subdomain_redirect.htm", 'readonly' => false, 'fields' => array ( ################################## @@ -317,7 +317,7 @@ if($ssl_available) { $form["tabs"]['ssl'] = array ( 'title' => "SSL", 'width' => 100, - 'template' => "templates/web_domain_ssl.htm", + 'template' => "templates/web_vhost_subdomain_ssl.htm", 'readonly' => false, 'fields' => array ( ################################## @@ -453,7 +453,7 @@ $form["tabs"]['ssl'] = array ( $form["tabs"]['stats'] = array ( 'title' => "Stats", 'width' => 100, - 'template' => "templates/web_domain_stats.htm", + 'template' => "templates/web_vhost_subdomain_stats.htm", 'readonly' => false, 'fields' => array ( ################################## @@ -486,7 +486,7 @@ $form["tabs"]['stats'] = array ( $form["tabs"]['backup'] = array ( 'title' => "Backup", 'width' => 100, - 'template' => "templates/web_domain_backup.htm", + 'template' => "templates/web_vhost_subdomain_backup.htm", 'readonly' => false, 'fields' => array ( ################################## @@ -524,7 +524,7 @@ if($_SESSION["s"]["user"]["typ"] == 'admin') { $form["tabs"]['advanced'] = array ( 'title' => "Options", 'width' => 100, - 'template' => "templates/web_domain_advanced.htm", + 'template' => "templates/web_vhost_subdomain_advanced.htm", 'readonly' => false, 'fields' => array ( ################################## diff --git a/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng b/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng index 92f55a9811eef58d9469dd9c8323c00e9e1745c3..d4d9660e8b4e505b95aff792c69d385acf332bf6 100644 --- a/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng +++ b/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng @@ -15,6 +15,7 @@ $wb['ssl_bundle_txt'] = 'SSL-Bundle'; $wb['ssl_action_txt'] = 'SSL-Aktion'; $wb['server_id_txt'] = 'Server'; $wb['domain_txt'] = 'Domain'; +$wb["host_txt"] = 'Host'; $wb['type_txt'] = 'Typ'; $wb['parent_domain_id_txt'] = 'Zugehörige Website'; $wb['web_folder_error_regex'] = 'Ungültige Ordnerangabe, bitte keinen / eingeben.'; diff --git a/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng b/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng index 274a5b63c34a44acb8aabcdb331cb7d9551d8914..42c6e4fe536f9f204e8f2810f14fb5ad5e4739b1 100644 --- a/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng +++ b/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng @@ -18,6 +18,7 @@ $wb["ssl_action_txt"] = 'SSL Action'; $wb["ssl_domain_txt"] = 'SSL Domain'; $wb["server_id_txt"] = 'Server'; $wb["domain_txt"] = 'Domain'; +$wb["host_txt"] = 'Hostname'; $wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.'; $wb["type_txt"] = 'Type'; $wb["parent_domain_id_txt"] = 'Parent Website'; diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php index aa0cb67efa334d34a5f14359c144590b76206813..1e11450f8130df660e31c45ae01fd4ab41c31dec 100644 --- a/interface/web/sites/lib/module.conf.php +++ b/interface/web/sites/lib/module.conf.php @@ -21,13 +21,20 @@ $items[] = array( 'title' => "Website", if($app->auth->get_client_limit($userid,'web_subdomain') != 0) { +$items[] = array( 'title' => "Subdomain", + 'target' => 'content', + 'link' => 'sites/web_subdomain_list.php', + 'html_id' => 'subdomain_list'); + // read web config $app->uses('getconf'); $sys_config = $app->getconf->get_global_config('sites'); -$items[] = array( 'title' => "Subdomain", + if($sys_config['vhost_subdomains'] == 'y') { +$items[] = array( 'title' => "Subdomain (Vhost)", 'target' => 'content', - 'link' => 'sites/' . ($sys_config['vhost_subdomains'] == 'y' ? 'web_vhost_subdomain_list.php' : 'web_subdomain_list.php'), + 'link' => 'sites/web_vhost_subdomain_list.php', 'html_id' => 'subdomain_list'); + } } if($app->auth->get_client_limit($userid,'web_aliasdomain') != 0) diff --git a/interface/web/sites/templates/web_vhost_subdomain_advanced.htm b/interface/web/sites/templates/web_vhost_subdomain_advanced.htm new file mode 100644 index 0000000000000000000000000000000000000000..87107400af24704f79644aa7ac3cc83dac2373cf --- /dev/null +++ b/interface/web/sites/templates/web_vhost_subdomain_advanced.htm @@ -0,0 +1,146 @@ +

+

+ +
+ +
+
+ +
+ + + +
+
+ + + +
+
+ + +
+
+
+

{tmpl_var name='php_fpm_use_socket_txt'}

+
+ {tmpl_var name='php_fpm_use_socket'} +
+
+
+ + +
+
+ {tmpl_var name='pm_ondemand_hint_txt'} +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +  s +
+
+ + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ + +
+
+ +
+ \ No newline at end of file diff --git a/interface/web/sites/templates/web_vhost_subdomain_backup.htm b/interface/web/sites/templates/web_vhost_subdomain_backup.htm new file mode 100644 index 0000000000000000000000000000000000000000..c46d4e2d4ef9a3fd0aae5921d68d194f959bfb86 --- /dev/null +++ b/interface/web/sites/templates/web_vhost_subdomain_backup.htm @@ -0,0 +1,32 @@ +

+

+ +
+ +
+
Backup +
+ + +
+
+ + +
+
+ + {tmpl_var name='backup_records'} + + + +
+ + +
+
+ +
\ No newline at end of file diff --git a/interface/web/sites/templates/web_vhost_subdomain_redirect.htm b/interface/web/sites/templates/web_vhost_subdomain_redirect.htm new file mode 100644 index 0000000000000000000000000000000000000000..66a17034c9b27fec864671d69ddddf1024273511 --- /dev/null +++ b/interface/web/sites/templates/web_vhost_subdomain_redirect.htm @@ -0,0 +1,76 @@ +

+

+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ + +
+
+ +
+ \ No newline at end of file diff --git a/interface/web/sites/templates/web_vhost_subdomain_ssl.htm b/interface/web/sites/templates/web_vhost_subdomain_ssl.htm new file mode 100644 index 0000000000000000000000000000000000000000..4c27bb77298df546759290df5dfd967d1400d8e7 --- /dev/null +++ b/interface/web/sites/templates/web_vhost_subdomain_ssl.htm @@ -0,0 +1,68 @@ +

+

+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+ + +
+
+ +
\ No newline at end of file diff --git a/interface/web/sites/templates/web_vhost_subdomain_stats.htm b/interface/web/sites/templates/web_vhost_subdomain_stats.htm new file mode 100644 index 0000000000000000000000000000000000000000..26eee94772c6b8ea574a65495cf7fa43aad68377 --- /dev/null +++ b/interface/web/sites/templates/web_vhost_subdomain_stats.htm @@ -0,0 +1,37 @@ +

+

+ +
+ +
+
+
+

{tmpl_var name='stats_user_txt'}

admin

+
+
+ +  {tmpl_var name='generate_password_txt'} +
+
+ + +
+ + +
+ + +
+
+ + + +
+ + +
+
+ +
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index f972b0db1956a545f427f24e14656b839947e591..97d7d57301d48ce103d119844045c8415e7dc5ce 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -342,7 +342,7 @@ class page_action extends tform_actions { } $app->tpl->setVar("client_group_id",$client_select); - foreach($read_limits as $limit) $app->tpl->setVar($limit, 'y'); + foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y')); } $ssl_domain_select = ''; diff --git a/interface/web/sites/web_vhost_subdomain_edit.php b/interface/web/sites/web_vhost_subdomain_edit.php index a5866c879821c08cca7f443df7bda716f1ece196..e71841359495607e5d592147ff7ee440d2c7b6e1 100644 --- a/interface/web/sites/web_vhost_subdomain_edit.php +++ b/interface/web/sites/web_vhost_subdomain_edit.php @@ -196,7 +196,7 @@ class page_action extends tform_actions { $app->tpl->setVar("fastcgi_php_version",$php_select); unset($php_records); - foreach($read_limits as $limit) $app->tpl->setVar($limit, 'y'); + foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y')); } $ssl_domain_select = ''; @@ -245,17 +245,20 @@ class page_action extends tform_actions { $this->parent_domain_record = $parent_domain; $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl'); - $this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']); - $forbidden_folders = array('', 'cgi-bin', 'web', 'log', 'private', 'ssl', 'tmp', 'webdav'); - if(in_array($this->dataRecord['web_folder'], $forbidden_folders) || preg_match('/^log_web\d+$/', $this->dataRecord['web_folder'])) { - $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."
"; - } - // check for duplicate folder usage - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain' AND `parent_domain_id` = '" . intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "'"); - if($check && $check['cnt'] > 0) { - $app->tform->errorMessage .= $app->tform->lng("web_folder_unique_txt")."
"; + + if($app->tform->getCurrentTab() == 'domain') { + $this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']); + $forbidden_folders = array('', 'cgi-bin', 'web', 'log', 'private', 'ssl', 'tmp', 'webdav'); + if(in_array($this->dataRecord['web_folder'], $forbidden_folders)) { + $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."
"; + } + // check for duplicate folder usage + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain' AND `parent_domain_id` = '" . intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "' AND `domain_id` != '" . intval($this->id) . "'"); + if($check && $check['cnt'] > 0) { + $app->tform->errorMessage .= $app->tform->lng("web_folder_unique_txt")."
"; + } } - + if($_SESSION["s"]["user"]["typ"] != 'admin') { // Get the limits of the client $client_group_id = $_SESSION["s"]["user"]["default_group"]; diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index a861265a922488d8e101e80deff51fc6964c5890..bd1b1c10f04047e3dbbd7f9f8ed5c59338573a42 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -328,8 +328,12 @@ class apache2_plugin { $web_folder = 'web'; $log_folder = 'log'; if($data['new']['type'] == 'vhostsubdomain') { + $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id'])); + $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']); + if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id']; $web_folder = $data['new']['web_folder']; - $log_folder .= '_web' . $data['new']['domain_id']; + $log_folder .= '/' . $subdomain_host; + unset($tmp); } // Create group and user, if not exist @@ -471,7 +475,7 @@ class apache2_plugin { if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']); if(!is_dir($data['new']['document_root'].'/'.$log_folder) || is_link($data['new']['document_root'].'/'.$log_folder)) { if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder); - $app->system->mkdir($data['new']['document_root'].'/'.$log_folder); + $app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder); $app->system->chown($data['new']['document_root'].'/'.$log_folder,'root'); $app->system->chgrp($data['new']['document_root'].'/'.$log_folder,'root'); $app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755); diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 424d96fa8e9427d46c3f7c60dc871f14927055f2..255fca43b0adca7a9969f3a178f543a40fa5b139 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -322,8 +322,12 @@ class nginx_plugin { $web_folder = 'web'; $log_folder = 'log'; if($data['new']['type'] == 'vhostsubdomain') { + $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id'])); + $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']); + if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id']; $web_folder = $data['new']['web_folder']; - $log_folder .= '_web' . $data['new']['domain_id']; + $log_folder .= '/' . $subdomain_host; + unset($tmp); } // Create group and user, if not exist @@ -459,7 +463,7 @@ class nginx_plugin { if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']); if(!is_dir($data['new']['document_root'].'/'.$log_folder) || is_link($data['new']['document_root'].'/'.$log_folder)) { if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder); - $app->system->mkdir($data['new']['document_root'].'/'.$log_folder); + $app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder); $app->system->chown($data['new']['document_root'].'/'.$log_folder,'root'); $app->system->chgrp($data['new']['document_root'].'/'.$log_folder,'root'); $app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);