-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·126 lines (102 loc) · 3.71 KB
/
index.php
File metadata and controls
executable file
·126 lines (102 loc) · 3.71 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/*
=====================================================
ExpressionEngine - by EllisLab
-----------------------------------------------------
http://expressionengine.com/
-----------------------------------------------------
Copyright (c) 2003 - 2010 EllisLab, Inc.
=====================================================
THIS IS COPYRIGHTED SOFTWARE
PLEASE READ THE LICENSE AGREEMENT
http://expressionengine.com/docs/license.html
=====================================================
File: index.php
-----------------------------------------------------
Purpose: Triggers the main engine
=====================================================
*/
// URI Type
// This variable allows you to hard-code the URI type.
// For most servers, 0 works fine.
// 0 = auto
// 1 = path_info
// 2 = query_string
$qtype = 0;
// DO NOT EDIT BELOW THIS!!!
error_reporting(0);
if (isset($_GET['URL']))
{
/** ---------------------------------
/** URL Redirect for CP and Links in Comments
/** ---------------------------------*/
$_GET['URL'] = str_replace(array("\r", "\r\n", "\n", '%3A','%3a','%2F','%2f', '%0D', '%0A', '%09', 'document.cookie'),
array('', '', '', ':', ':', '/', '/', '', '', '', ''),
$_GET['URL']);
if (substr($_GET['URL'], 0, 4) != "http" AND ! stristr($_GET['URL'], '://') AND substr($_GET['URL'], 0, 1) != '/')
$_GET['URL'] = "http://".$_GET['URL'];
$_GET['URL'] = str_replace( array('"', "'", ')', '(', ';', '}', '{', 'script%', 'script&', '(', ')', '<'),
'',
strip_tags($_GET['URL']));
$host = ( ! isset($_SERVER['HTTP_HOST'])) ? '' : (substr($_SERVER['HTTP_HOST'],0,4) == 'www.' ? substr($_SERVER['HTTP_HOST'], 4) : $_SERVER['HTTP_HOST']);
if ( ! isset($_SERVER['HTTP_REFERER']) OR ! stristr($_SERVER['HTTP_REFERER'], $host))
{
// Possibly not from our site, so we give the user the option
// Of clicking the link or not
$str = "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>".
"<p>To proceed to the URL you have requested, click the link below:</p>".
"<p><a href='".$_GET['URL']."'>".$_GET['URL']."</a></p>\n
</body>\n</html>";
}
else
{
$str = "<html>\n<head>\n<title>Redirect</title>\n".
'<meta http-equiv="refresh" content="0; URL='.$_GET['URL'].'">'.
"\n</head>\n<body>\n</body>\n</html>";
}
exit($str);
}
$uri = '';
$pathinfo = pathinfo(__FILE__);
$ext = ( ! isset($pathinfo['extension'])) ? '.php' : '.'.$pathinfo['extension'];
$self = ( ! isset($pathinfo['basename'])) ? 'index'.$ext : $pathinfo['basename'];
$path_info = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');
$query_str = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING');
switch ($qtype)
{
case 0 : $uri = ($path_info != '' AND $path_info != "/".$self) ? $path_info : $query_str;
break;
case 1 : $uri = $path_info;
break;
case 2 : $uri = $query_str;
break;
}
unset($system_path);
unset($config_file);
unset($path_info);
unset($query_str);
unset($qstr);
require 'path'.$ext;
if ((isset($template_group) AND isset($template)) && $uri != '' && $uri != '/')
{
$template_group = '';
$template = '';
}
if ( ! isset($system_path))
{
if (file_exists('install'.$ext))
{
header("location: install".$ext);
exit;
}
else
{
exit("The system does not appear to be installed. Click <a href='install.php'>here</a> to install it.");
}
}
$system_path = rtrim($system_path, '/').'/';
if ( ! @include($system_path.'core/core.system'.$ext))
{
exit("The system path does not appear to be set correctly. Please open your path.php file and correct the path.");
}
?>