-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsefurls.php
69 lines (54 loc) · 1.67 KB
/
sefurls.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/* ====================
Seditio - Website engine
Copyright Neocrome & Seditio Team
http://www.seditiocms.com
[BEGIN_SED]
File=sefurls.php
Version=177
Updated=2015-feb-06
Type=Core
Author=Seditio Team
Description=SEF Url's loader
[END_SED]
==================== */
require('system/config.urlrewrite.php');
$request_uri = $_SERVER['REQUEST_URI'];
$subdir_uri = (mb_strlen(dirname($_SERVER['PHP_SELF'])) > 1) ? dirname($_SERVER['PHP_SELF']) : "";
$request_uri = str_replace($subdir_uri, "", $request_uri);
$vars_req = array();
$params_req = "";
if (($pos = strpos($request_uri, "?")) !== false)
{
$params_req = mb_substr($request_uri, $pos+1);
$request_uri = mb_substr($request_uri, 0, $pos);
parse_str($params_req, $vars_req);
$params_req = "&".urldecode($params_req);
}
foreach($sed_urlrewrite as $val)
{
if(preg_match($val['cond'], $request_uri))
{
$url = preg_replace($val['cond'], $val['rule'], $request_uri);
$url = urldecode($url);
if (($pos = mb_strpos($url, "?")) !== false)
{
$params = mb_substr($url, $pos+1);
parse_str($params, $vars);
$vars += $vars_req;
$params = $params.$params_req;
$_GET += $vars;
$_REQUEST += $vars;
//$GLOBALS += $vars;
$_SERVER["QUERY_STRING"] = $QUERY_STRING = $params;
}
$pos = mb_strpos($url, ".php");
$incl = mb_substr($url, 0, $pos+4);
include_once($incl);
die();
}
}
//header("HTTP/1.1 404 Not Found");
header("Location: ".$subdir_uri."/message/404");
exit;
?>