Skip to content

Commit

Permalink
Added detection for mod_rewrite and a "plan B" if it is not available.
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Schepp Schaefer <schaepp@gmx.de>
  • Loading branch information
Schepp authored and SirPepe committed Sep 5, 2010
1 parent b91b8fb commit b9b5b00
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions booster/booster_inc.php
Expand Up @@ -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 ///////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -1807,7 +1821,10 @@ public function css_markup()
$markup .= '<link rel="'.$this->css_rel.
'" media="'.$this->css_media.
'" title="'.htmlentities($this->css_title,ENT_QUOTES).
'" type="text/css" href="'.$this->base_offset.ltrim($booster_path,'/').'/booster_css.php/dir='.htmlentities(str_replace('..','%3E',$source),ENT_QUOTES).'&amp;cachedir='.htmlentities(str_replace('..','%3E',$this->booster_cachedir),ENT_QUOTES).
'" type="text/css" href="'.$this->base_offset.ltrim($booster_path,'/').'/booster_css.php'.
($this->mod_rewrite ? '/' : '?').
'dir='.htmlentities(str_replace('..','%3E',$source),ENT_QUOTES).
'&amp;cachedir='.htmlentities(str_replace('..','%3E',$this->booster_cachedir),ENT_QUOTES).
($this->css_hosted_minifier ? '&amp;css_hosted_minifier=1' : '').
'&amp;totalparts='.intval($this->css_totalparts).
'&amp;part='.($j+1).
Expand Down Expand Up @@ -2069,7 +2086,9 @@ public function js_markup()
$markup .= ($this->markuptype == 'XHTML' ? ' defer="defer"' : ' defer');
break;
}
$markup .= ' src="'.$this->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).
'&amp;cachedir='.htmlentities(str_replace('..','%3E',$this->booster_cachedir),ENT_QUOTES).
($this->js_hosted_minifier ? '&amp;js_hosted_minifier=1' : '').
($this->debug ? '&amp;debug=1' : '').
Expand Down

0 comments on commit b9b5b00

Please sign in to comment.