From 77cc4a99b15f4639b56c29a1207dc04b459c5d54 Mon Sep 17 00:00:00 2001 From: Marius Cramer <m.cramer@pixcept.de> Date: Fri, 19 Dec 2014 12:18:11 -0500 Subject: [PATCH] - re-added jquery ui --- interface/lib/classes/validate_domain.inc.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/interface/lib/classes/validate_domain.inc.php b/interface/lib/classes/validate_domain.inc.php index d92de9b..a072412 100644 --- a/interface/lib/classes/validate_domain.inc.php +++ b/interface/lib/classes/validate_domain.inc.php @@ -97,6 +97,45 @@ $result = $this->_check_unique($field_value . '.' . $check_domain, true); if(!$result) return $this->get_error('domain_error_autosub'); } + + /* Check apache directives */ + function web_apache_directives($field_name, $field_value, $validator) { + global $app; + + if(trim($field_value) != '') { + $security_config = $app->getconf->get_security_config('ids'); + + if($security_config['apache_directives_scan_enabled'] == 'yes') { + + // Get blacklist + $blacklist_path = '/usr/local/ispconfig/security/apache_directives.blacklist'; + if(is_file('/usr/local/ispconfig/security/apache_directives.blacklist.custom')) $blacklist_path = '/usr/local/ispconfig/security/apache_directives.blacklist.custom'; + if(!is_file($blacklist_path)) $blacklist_path = realpath(ISPC_ROOT_PATH.'/../security/apache_directives.blacklist'); + + $directives = explode("\n",$field_value); + $regex = explode("\n",file_get_contents($blacklist_path)); + $blocked = false; + $blocked_line = ''; + + if(is_array($directives) && is_array($regex)) { + foreach($directives as $directive) { + $directive = trim($directive); + foreach($regex as $r) { + if(preg_match(trim($r),$directive)) { + $blocked = true; + $blocked_line .= $directive.'<br />'; + }; + } + } + } + } + } + + if($blocked === true) { + return $this->get_error('apache_directive_blocked_error').' '.$blocked_line; + } + } + /* internal validator function to match regexp */ function _regex_validate($domain_name, $allow_wildcard = false) { @@ -175,5 +214,6 @@ } return true; // admin may always add wildcard domain } + } -- Gitblit v1.9.1