Completed
Push — develop ( 923a1c...1e9876 )
by Maxim
47s queued 29s
created

index.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
*************************************************************************
4
	EVO Content Management System and PHP Application Framework ("EVO")
5
	Managed and maintained by Dmytro Lukianenko and the	EVO community
6
*************************************************************************
7
	EVO is an opensource PHP/MySQL content management system and content
8
	management framework that is flexible, adaptable, supports XHTML/CSS
9
	layouts, and works with most web browsers.
10
11
	EVO is distributed under the GNU General Public License
12
*************************************************************************
13
14
	This file and all related or dependant files distributed with this file
15
	are considered as a whole to make up EVO.
16
17
	EVO is free software; you can redistribute it and/or modify
18
	it under the terms of the GNU General Public License as published by
19
	the Free Software Foundation; either version 2 of the License, or
20
	(at your option) any later version.
21
22
	EVO is distributed in the hope that it will be useful,
23
	but WITHOUT ANY WARRANTY; without even the implied warranty of
24
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
	GNU General Public License for more details.
26
27
	You should have received a copy of the GNU General Public License
28
	along with EVO (located in "/assets/docs/"); if not, write to the Free Software
29
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1335, USA
30
31
	For more information on EVO please visit https://evo.im/
32
	Github: https://github.com/evolution-cms/evolution/
33
34
**************************************************************************
35
	Based on MODX Evolution CMS and Application Framework
36
	Copyright 2005 and forever thereafter by Raymond Irving & Ryan Thrash.
37
	All rights reserved.
38
39
	MODX Evolution is originally based on Etomite by Alex Butter
40
**************************************************************************
41
*/
42
43
/**
44
 * Initialize Document Parsing
45
 * -----------------------------
46
 */
47
48
$autoloader = __DIR__.'/vendor/autoload.php';
49
if (file_exists($autoloader) && is_readable($autoloader)) {
50
	include_once($autoloader);
51
}
52
53
if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
54
55
$base_path = str_replace('\\','/',dirname(__FILE__)) . '/';
56
if(is_file($base_path . 'assets/cache/siteManager.php'))
57
    include_once($base_path . 'assets/cache/siteManager.php');
58
if(!defined('MGR_DIR') && is_dir("{$base_path}manager"))
59
	define('MGR_DIR','manager');
60
if(is_file($base_path . 'assets/cache/siteHostnames.php'))
61
    include_once($base_path . 'assets/cache/siteHostnames.php');
62
if(!defined('MODX_SITE_HOSTNAMES'))
63
	define('MODX_SITE_HOSTNAMES','');
64
65
// get start time
66
$mstart = memory_get_usage();
67
68
// harden it
69
require_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/protect.inc.php');
70
71
// set some settings, and address some IE issues
72
@ini_set('url_rewriter.tags', '');
73
@ini_set('session.use_trans_sid', 0);
74
@ini_set('session.use_only_cookies',1);
75
session_cache_limiter('');
76
header('P3P: CP="NOI NID ADMa OUR IND UNI COM NAV"'); // header for weird cookie stuff. Blame IE.
77
header('Cache-Control: private, must-revalidate');
78
ob_start();
79
80
/**
81
 *	Filename: index.php
82
 *	Function: This file loads and executes the parser. *
83
 */
84
85
define("IN_PARSER_MODE", true);
86
if (!defined('IN_MANAGER_MODE')) {
87
	define("IN_MANAGER_MODE", false);
88
}
89
if (!defined('MODX_API_MODE')) {
90
    define('MODX_API_MODE', false);
91
}
92
93
// get the required includes
94
if(!isset($database_user) || $database_user=="") {
95
	$rt = @include_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/config.inc.php');
96
	// Be sure config.inc.php is there and that it contains some important values
97
	if(!$rt || !$database_type || !$database_server || !$database_user || !$dbase) {
98
		readfile('install/not_installed.tpl');
99
		exit;
100
	}
101
}
102
103
// start session 
104
startCMSSession();
105
106
// initiate a new document parser
107
if (isset($coreClass) && class_exists($coreClass)) {
108
	$modx = new $coreClass;
109
} 	
0 ignored issues
show
There is some trailing whitespace on this line which should be avoided as per coding-style.
Loading history...
110 View Code Duplication
if (!isset($modx) || !($modx instanceof \DocumentParser)) {
111
	include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php');
112
	$modx = new \DocumentParser;
113
}
114
115
// set some parser options
116
$modx->minParserPasses = 1; // min number of parser recursive loops or passes
117
$modx->maxParserPasses = 10; // max number of parser recursive loops or passes
118
$modx->dumpSQL = false;
119
$modx->dumpSnippets = false; // feed the parser the execution start time
120
$modx->dumpPlugins = false;
121
$modx->tstart = $_SERVER['REQUEST_TIME_FLOAT'];
122
$modx->mstart = $mstart;
123
124
// Debugging mode:
125
$modx->stopOnNotice = false;
126
127
// Don't show PHP errors to the public
128
if(!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) {
129
    @ini_set("display_errors","0");
130
}
131
132
// execute the parser if index.php was not included
133
if (!MODX_API_MODE) {
134
    $modx->executeParser();
135
}
136
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
137