-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathseo.php
More file actions
72 lines (63 loc) · 1.8 KB
/
seo.php
File metadata and controls
72 lines (63 loc) · 1.8 KB
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
70
71
72
<?php
/**
* imFAQ seo feature
*
* This file holds the configuration information of this module
*
* @copyright INBOX International
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @since 1.0
* @author Rodrigo Pereira Lima <rodrigo@inboxinternational.com>
* @package imfaq
* @version $Id$
*/
include '../../mainfile.php';
$seoMap = array(
'category' => 'category.php',
'faq' => 'faq.php',
'print' => 'print.php'
);
if(array_key_exists($_GET['seoOp'], $seoMap) || $_GET['seoOp'] = '')
{
$safe_seoOp = $_GET['seoOp'];
};
if (empty($safe_seoOp))
{
// SEO mode is path-info
/*
Sample URL for path-info
http://localhost/modules/smartcontent/seo.php/item.2/can-i-turn-the-ads-off.html
*/
$data = explode("/",$_SERVER['PATH_INFO']);
$seoParts = explode('.', $data[1]);
$seoOp = $seoParts[0];
$seoArg = $seoParts[1];
// for multi-argument modules, where itemid and catid both are required.
// $seoArg = substr($data[1], strlen($seoOp) + 1);
}
if (! empty($safe_seoOp) && ! empty($seoMap[$safe_seoOp]))
{
// module specific dispatching logic, other module must implement as
// per their requirements.
$newUrl = '/modules/imfaq/' . $seoMap[$safe_seoOp];
if (substr($newUrl,-4) != '.php'){
$newUrl .= '.php';
}
$newUrl = str_ireplace('http://'.$_SERVER['SERVER_NAME'],'',ICMS_URL.$newUrl);
$_ENV['PHP_SELF'] = $newUrl;
$_SERVER['SCRIPT_NAME'] = $newUrl;
$_SERVER['PHP_SELF'] = $newUrl;
switch ($safe_seoOp) {
case 'category':
$_SERVER['REQUEST_URI'] = $newUrl . '?short_url=' . $_GET['seoArg'];
$_GET['short_url'] = $_GET['seoArg'];
break;
case 'faq':
case 'print':
default:
$_SERVER['REQUEST_URI'] = $newUrl . '?short_url=' . $_GET['seoArg'];
$_GET['short_url'] = $_GET['seoArg'];
}
include($safe_seoOp . ".php");
}
exit;