From b9b5b00a1fb3b855c01e74e3456b8223e6ddfaf8 Mon Sep 17 00:00:00 2001 From: Christian Schepp Schaefer Date: Wed, 18 Aug 2010 22:53:50 +0800 Subject: [PATCH] Added detection for mod_rewrite and a "plan B" if it is not available. Signed-off-by: Christian Schepp Schaefer --- booster/booster_inc.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/booster/booster_inc.php b/booster/booster_inc.php index 00226c6..41871fe 100755 --- a/booster/booster_inc.php +++ b/booster/booster_inc.php @@ -167,6 +167,14 @@ class Booster { */ private $errormessage = ''; + /** + * Variable in which we store if mod_rewrite is active + * + * @var bool + * @access private + */ + private $mod_rewrite = FALSE; + // CSS specific configuration /////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -454,6 +462,12 @@ public function __construct() $this->js_stringtime = filemtime(realpath($_SERVER['SCRIPT_FILENAME'])); $this->js_hosted_minifier_path = realpath(dirname(__FILE__).'/'.$this->js_hosted_minifier_path); $this->browser = new browser(); + + // Checking if Apache runs with mod_rewrite + ob_clean(); + phpinfo(INFO_MODULES); + $result = ob_get_clean(); + if(stristr($result,'mod_rewrite')) $this->mod_rewrite = TRUE; } /** @@ -1807,7 +1821,10 @@ public function css_markup() $markup .= 'base_offset.ltrim($booster_path,'/').'/booster_js.php/dir='.htmlentities(str_replace('..','%3E',$source),ENT_QUOTES). + $markup .= ' src="'.$this->base_offset.ltrim($booster_path,'/').'/booster_js.php'. + ($this->mod_rewrite ? '/' : '?'). + 'dir='.htmlentities(str_replace('..','%3E',$source),ENT_QUOTES). '&cachedir='.htmlentities(str_replace('..','%3E',$this->booster_cachedir),ENT_QUOTES). ($this->js_hosted_minifier ? '&js_hosted_minifier=1' : ''). ($this->debug ? '&debug=1' : '').