1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Fix for e_url failed regexp.

This commit is contained in:
Cameron
2014-10-19 14:42:29 -07:00
parent 65b44a8abb
commit 30cdbe6774

View File

@@ -89,17 +89,25 @@
$tmp = e107::getAddonConfig('e_url'); $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)) if(count($tmp))
{ {
foreach($tmp as $plug=>$cfg) foreach($tmp as $plug=>$cfg)
{ {
foreach($cfg as $k=>$v) foreach($cfg as $k=>$v)
{ {
$regex = '#'.$v['regex'].'#'; $regex = '#'.$v['regex'].'#';
if(empty($v['redirect']))
{
continue;
}
$newLocation = preg_replace($regex, $v['redirect'], $req); $newLocation = preg_replace($regex, $v['redirect'], $req);
if($newLocation !=$req) if($newLocation !=$req)
@@ -108,11 +116,21 @@
list($file,$query) = explode("?",$redirect,2); list($file,$query) = explode("?",$redirect,2);
parse_str($query,$_GET); parse_str($query,$_GET);
// echo " file=".$file;
e107::getMessage()->addDebug('e_URL in <b>'.$plug.'</b> matched <b>'.$v['regex'].'</b> and included: <b>'.$file.'</b> with $_GET: '.print_a($_GET,true));
if(file_exists($file))
{
include_once($file); include_once($file);
//print_a($_GET);
exit; exit;
} }
elseif(getperms('0'))
{
echo "File missing: ".$file;
exit;
}
}
} }
} }