-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
executable file
·77 lines (63 loc) · 2.16 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
<?php
error_reporting(E_ALL);
/**
* is Xhprof Hierarchical Profiler enabled?
*/
$minimalConfig = @parse_ini_file('config/yalf.ini');
if (@$minimalConfig['XHPROF']) {
define('XHPROF', 1);
} else {
define('XHPROF', 0);
}
/**
* rcms-like commons consts defines
*/
define('CONFIG_PATH', 'config/');
define('DATA_PATH', 'content/');
define('USERS_PATH', 'content/users/');
define('MODULES_PATH', 'modules/general/');
/**
* Profiler init
*/
if (XHPROF) {
$yalfConf = parse_ini_file(CONFIG_PATH . 'yalf.ini');
if ($yalfConf['XHPROF_PATH']) {
$xhProfLibsPath = $yalfConf['XHPROF_PATH'];
} else {
$xhProfLibsPath = 'xhprof';
}
define("XHPROF_ROOT", __DIR__ . '/' . $xhProfLibsPath);
require_once (XHPROF_ROOT . '/xhprof_lib/utils/xhprof_lib.php');
require_once (XHPROF_ROOT . '/xhprof_lib/utils/xhprof_runs.php');
//append XHPROF_FLAGS_NO_BUILTINS if your PHP instance crashes
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
}
/**
* Default headers
*/
header('Last-Modified: ' . gmdate('r'));
header('Content-Type: text/html; charset=UTF-8');
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
/**
* Page generation time counters begins
*/
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];
$query_counter = 0;
/**
* System initialization
*/
require_once('api/autoloader.php'); //preloaging required libs
define('LOGGED_IN', $system->getLoggedInState()); //emulating RCMS LOGGED_IN state
require_once ($system->getIndexModulePath()); //react to some module routes
if (XHPROF) {
$xhprof_data = xhprof_disable();
$xhprof_runs = new XHProfRuns_Default();
$xhprof_run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_yalf");
$xhprof_link = wf_modal(wf_img_sized('skins/xhprof.png', __('XHPROF'), 20), 'XHProf current page results', '<iframe src="' . $xhProfLibsPath . '/xhprof_html/index.php?run=' . $xhprof_run_id . '&source=xhprof_yalf" width="100%" height="750"></iframe>', '', '1024', '768');
}
//web based renderer template load
if ($system->getRenderer() == 'WEB') {
require_once($system->getSkinPath() . $system::SKIN_TEMPLATE_NAME);
}