From 011386d8a134375c8349086272e82498f7796a6c Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 25 Jun 2009 12:13:52 -0400 Subject: Ensure leading http(s):// and trailing / on additional hostnames --- config/apache_mod_security/apache_mod_security.inc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/config/apache_mod_security/apache_mod_security.inc b/config/apache_mod_security/apache_mod_security.inc index 15550dd3..107e8b4f 100644 --- a/config/apache_mod_security/apache_mod_security.inc +++ b/config/apache_mod_security/apache_mod_security.inc @@ -218,8 +218,16 @@ EOF; if($config['installedpackages']['apachemodsecurity']) { foreach($config['installedpackages']['apachemodsecurity']['config'] as $ams) { // Set rowhelper used variables - foreach($ams['row'] as $row) - $additionalsitehostnames .= "{$row['additionalsitehostnames']} "; + foreach($ams['row'] as $row) { + if(!strstr($row['additionalsitehostnames'], "http")) + $additionalsitehostnames .= "http://"; + $additionalsitehostnames .= "{$row['additionalsitehostnames']}"; + // Ensure trailing / + if(substr($row['additionalsitehostnames'],count($row['additionalsitehostnames']),1) != "/") + $additionalsitehostnames .= "/ "; + else + $additionalsitehostnames .= " "; + } $backend_sites = ""; // not technically needed. added for readability due to .='s foreach($ams['row'] as $row) { // Ensure leading http(s):// -- cgit v1.2.3