-
Notifications
You must be signed in to change notification settings - Fork 119
/
index.php
123 lines (102 loc) · 4 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
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
<?php
/******************************************************************************
*
* Subrion - open source content management system
* Copyright (C) 2018 Intelliants, LLC <https://intelliants.com>
*
* This file is part of Subrion.
*
* Subrion is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Subrion is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Subrion. If not, see <http://www.gnu.org/licenses/>.
*
*
* @link https://subrion.org/
*
******************************************************************************/
define('IA_VERSION', '4.2.1');
if (defined('IA_INSTALL')) {
return IA_VERSION;
}
if (version_compare(PHP_VERSION, '5.6', '<')) {
exit('Subrion ' . IA_VERSION . ' requires PHP 5.6 or higher to run properly.');
}
if (function_exists('apache_get_modules') && !in_array('mod_rewrite', apache_get_modules())) {
exit('Subrion ' . IA_VERSION . ' requires the mod_rewrite module to run properly.');
}
// enable errors display
ini_set('display_errors', true);
error_reporting(E_ALL | E_STRICT | E_DEPRECATED);
// define system constants
define('IA_DS', '/');
define('IA_URL_DELIMITER', '/');
define('IA_HOME', str_replace('\\', IA_DS, dirname(__FILE__)) . IA_DS);
define('IA_INCLUDES', IA_HOME . 'includes/');
define('IA_CLASSES', IA_INCLUDES . 'classes/');
define('IA_MODULES', IA_HOME . 'modules/');
define('IA_UPLOADS', IA_HOME . 'uploads/');
define('IA_SMARTY', IA_INCLUDES . 'smarty/');
define('IA_TMP', IA_HOME . 'tmp/');
define('IA_CACHEDIR', IA_TMP . 'cache/');
define('IA_FRONT', IA_HOME . 'front/');
define('IA_ADMIN', IA_HOME . 'admin/');
define('FOLDER', trim(str_replace(IA_DS . 'index.php', '', $_SERVER['PHP_SELF']), IA_URL_DELIMITER));
define('FOLDER_URL', FOLDER != '' ? trim(str_replace(IA_DS, IA_URL_DELIMITER, FOLDER), IA_URL_DELIMITER) . IA_URL_DELIMITER : '');
$performInstallation = false;
if (file_exists(IA_INCLUDES . 'config.inc.php')) {
include IA_INCLUDES . 'config.inc.php';
defined('INTELLI_DEBUG') || $performInstallation = true;
} else {
$performInstallation = true;
}
// redirect to installation
if ($performInstallation) {
if (file_exists(IA_HOME . 'install/index.php')) {
header('Location: ' . str_replace('index.php', 'install/', $_SERVER['SCRIPT_NAME']));
return;
}
exit('Install directory was not found!');
}
/*$domain = explode(':', $_SERVER['HTTP_HOST']);
$domain = reset($domain);
if (strpos($domain, '.') && !filter_var($domain, FILTER_VALIDATE_IP)) {
$chunks = array_reverse(explode('.', $domain));
if (count($chunks) > 2) {
if (!in_array($chunks[1], ['co', 'com', 'net', 'org', 'gov', 'ltd', 'ac', 'edu'])) {
$domain = implode('.', [$chunks[1], $chunks[0]]);
if ($chunks[2] != 'www') {
$domain = implode('.', [$chunks[2], $chunks[1], $chunks[0]]);
}
}
}
$domain = '.' . $domain;
}*/
ini_set('session.gc_maxlifetime', 1800); // 30 minutes
//session_set_cookie_params(1800, '/', $domain, false, true);
session_name('INTELLI_' . substr(md5(IA_HOME), 0, 10));
session_start();
setcookie(session_name(), session_id(), time() + 1800, '/');
require_once IA_CLASSES . 'ia.system.php';
require_once IA_INCLUDES . 'function.php';
if (function_exists('spl_autoload_register')) {
spl_autoload_register(['iaSystem', 'autoload']);
}
iaSystem::renderTime('start');
if (INTELLI_DEBUG) {
register_shutdown_function(['iaSystem', 'shutdown']);
ob_start(['iaSystem', 'output']);
} else {
error_reporting(0);
}
set_error_handler(['iaSystem', 'error']);
iaSystem::renderTime('Core started');
iaCore::instance()->init();