mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Experimental url creation code added.
This commit is contained in:
@@ -2527,7 +2527,25 @@ class e107
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Experimental static (easy) sef-url creation method (works with e_url.php @see /index.php)
|
||||||
|
*/
|
||||||
|
public static function url($plugin='',$key)
|
||||||
|
{
|
||||||
|
$tmp = e107::getAddonConfig('e_url');
|
||||||
|
|
||||||
|
if(varset($tmp[$plugin][$key]['sef']))
|
||||||
|
{
|
||||||
|
return e_HTTP.$tmp[$plugin][$key]['sef'];
|
||||||
|
}
|
||||||
|
elseif(varset($tmp[$plugin][$key]['redirect']))
|
||||||
|
{
|
||||||
|
return self::getParser()->replaceConstants($tmp[$plugin][$key]['redirect'],'full');
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
11
index.php
11
index.php
@@ -88,20 +88,27 @@
|
|||||||
$sql->db_Mark_Time("Start Simple URL-ReWrite Routine");
|
$sql->db_Mark_Time("Start Simple URL-ReWrite Routine");
|
||||||
|
|
||||||
$tmp = e107::getAddonConfig('e_url');
|
$tmp = e107::getAddonConfig('e_url');
|
||||||
|
|
||||||
|
$req = 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)
|
||||||
{
|
{
|
||||||
$req = str_replace(e_HTTP,'', e_REQUEST_URI);
|
|
||||||
$regex = '#'.$v['regex'].'#';
|
$regex = '#'.$v['regex'].'#';
|
||||||
if($newLocation = preg_replace($regex,$v['redirect'],$req))
|
|
||||||
|
$newLocation = preg_replace($regex, $v['redirect'], $req);
|
||||||
|
|
||||||
|
if($newLocation !=$req)
|
||||||
{
|
{
|
||||||
$redirect = e107::getParser()->replaceConstants($newLocation);
|
$redirect = e107::getParser()->replaceConstants($newLocation);
|
||||||
list($file,$query) = explode("?",$redirect,2);
|
list($file,$query) = explode("?",$redirect,2);
|
||||||
|
|
||||||
parse_str($query,$_GET);
|
parse_str($query,$_GET);
|
||||||
|
// echo " file=".$file;
|
||||||
include_once($file);
|
include_once($file);
|
||||||
//print_a($_GET);
|
//print_a($_GET);
|
||||||
exit;
|
exit;
|
||||||
|
Reference in New Issue
Block a user