From 30cdbe67744706b5a82a8a17ed5b6e502dcca6e6 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 19 Oct 2014 14:42:29 -0700 Subject: [PATCH] Fix for e_url failed regexp. --- index.php | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/index.php b/index.php index 200dee565..cd97e4745 100644 --- a/index.php +++ b/index.php @@ -89,29 +89,47 @@ $tmp = e107::getAddonConfig('e_url'); - $req = str_replace(e_HTTP,'', e_REQUEST_URI); - + $req = (e_HTTP === '/') ? ltrim(e_REQUEST_URI,'/') : str_replace(e_HTTP,'', e_REQUEST_URI) ; + if(count($tmp)) { + foreach($tmp as $plug=>$cfg) { + foreach($cfg as $k=>$v) { $regex = '#'.$v['regex'].'#'; - $newLocation = preg_replace($regex, $v['redirect'], $req); + if(empty($v['redirect'])) + { + continue; + } + + $newLocation = preg_replace($regex, $v['redirect'], $req); + if($newLocation !=$req) { $redirect = e107::getParser()->replaceConstants($newLocation); list($file,$query) = explode("?",$redirect,2); parse_str($query,$_GET); - // echo " file=".$file; - include_once($file); - //print_a($_GET); - exit; + + e107::getMessage()->addDebug('e_URL in '.$plug.' matched '.$v['regex'].' and included: '.$file.' with $_GET: '.print_a($_GET,true)); + + if(file_exists($file)) + { + include_once($file); + exit; + } + elseif(getperms('0')) + { + echo "File missing: ".$file; + exit; + } + } } @@ -120,7 +138,7 @@ unset($tmp,$redirect,$regex); } - + // ----------------------------------------- $sql->db_Mark_Time("Start regular eFront Class");