-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpermalink.php
29 lines (27 loc) · 989 Bytes
/
permalink.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
<?php
require 'includes/user_init.php';
// remove domain & protocol from URL, eg: https://wwww.c97.net/page.php?page_id=5 -> page.php?cmd=5
$s = array('http://', 'http://www.', 'https://', 'https://www.');
$request = str_replace($s, '', get_param('permalink_request'));
$site_url = str_replace($s, '', $config['site_url']);
$x = str_replace($site_url.'/', '', $request);
$row = sql_qquery("SELECT * FROM ".$db_prefix."permalink WHERE url='$x' LIMIT 1");
if (!empty($row)) {
$original_idx = $row['target_idx'];
$permalink_param = $row['target_param'];
$isPermalink = true;
parse_str($permalink_param, $arr);
if (!empty($arr)) {
foreach ($arr as $k => $v) {
$_GET[$k] = $v;
}
}
require $row['target_script'];
} else {
if (function_exists('http_response_code')) {
http_response_code(404);
} else {
header("HTTP/1.0 404 Not Found");
}
fullpage_die(sprintf($lang['msg']['permalink_error'], $request));
}