forked from projectexplorer/projectexplorer.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
85 lines (73 loc) · 2.13 KB
/
index.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/*
$HeadURL: https://textpattern.googlecode.com/svn/releases/4.5.5/source/index.php $
$LastChangedRevision: 4086 $
*/
// Make sure we display all errors that occur during initialization
error_reporting(E_ALL);
@ini_set("display_errors","1");
if (@ini_get('register_globals')) {
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
die('GLOBALS overwrite attempt detected. Please consider turning register_globals off.');
}
// Collect and unset all registered variables from globals
$_txpg = array_merge(
isset($_SESSION) ? (array) $_SESSION : array(),
(array) $_ENV,
(array) $_GET,
(array) $_POST,
(array) $_COOKIE,
(array) $_FILES,
(array) $_SERVER);
// As the deliberately awkward-named local variable $_txpfoo MUST NOT be unset to avoid notices further down
// we must remove any potentially identical-named global from the list of global names here.
unset($_txpg['_txpfoo']);
foreach ($_txpg as $_txpfoo => $value) {
if (!in_array($_txpfoo, array(
'GLOBALS',
'_SERVER',
'_GET',
'_POST',
'_FILES',
'_COOKIE',
'_SESSION',
'_REQUEST',
'_ENV',
))) {
unset($GLOBALS[$_txpfoo], $$_txpfoo);
}
}
}
define("txpinterface", "public");
if (!defined('txpath'))
{
define("txpath", dirname(__FILE__).'/textpattern');
}
// save server path to site root
if (!isset($here))
{
$here = dirname(__FILE__);
}
// pull in config unless configuration data has already been provided (multi-headed use).
if (!isset($txpcfg['table_prefix']))
{
// Use buffering to ensure bogus whitespace in config.php is ignored
ob_start(NULL, 2048);
include txpath.'/config.php';
ob_end_clean();
}
include txpath.'/lib/constants.php';
include txpath.'/lib/txplib_misc.php';
if (!isset($txpcfg['table_prefix']))
{
txp_status_header('503 Service Unavailable');
exit('config.php is missing or corrupt. To install Textpattern, visit <a href="./textpattern/setup/">textpattern/setup/</a>');
}
// custom caches et cetera?
if (isset($txpcfg['pre_publish_script']))
{
require $txpcfg['pre_publish_script'];
}
include txpath.'/publish.php';
textpattern();
?>