From 8d1b1f1017502c63751d7741df7240d4dd20027e Mon Sep 17 00:00:00 2001 From: mcramer Date: Mon, 20 Aug 2012 11:37:01 +0000 Subject: [PATCH] Added web_folder name check for reserved names and already taken names FS#1993 - Creating Subdomains as VirtualHost --- .../web/sites/lib/lang/de_web_vhost_subdomain.lng | 2 ++ .../web/sites/lib/lang/en_web_vhost_subdomain.lng | 2 ++ interface/web/sites/web_vhost_subdomain_edit.php | 11 ++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) 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 909e5b69b..92f55a981 100644 --- a/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng +++ b/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng @@ -1,6 +1,8 @@ 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($_SESSION["s"]["user"]["typ"] != 'admin') { // Get the limits of the client -- GitLab