This repository was archived by the owner on Oct 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
115 lines (113 loc) · 3.28 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
<?php
/**
* Bel-CMS [Content management system]
* @version 2.0.0
* @link http://bel-cms.dev
* @link http://determe.be
* @license http://opensource.org/licenses/GPL-3.0 copyleft
* @copyright 2015-2022 Bel-CMS
* @author Stive - [email protected]
*/
#########################################
# start timer
#########################################
$GLOBALS['TIME_START'] = explode(' ', microtime())[0] + explode(' ', microtime())[1];
#########################################
# Initialise TimeZone
#########################################
date_default_timezone_set("Europe/Brussels");
setlocale(LC_TIME, 'fr','fr_FR','fr_FR@euro','fr_FR.utf8','fr-FR','fra');
#########################################
# Debug
#########################################
function debug ($data = null, $exitAfter = false)
{
echo '<pre>';
print_r($data);
echo '</pre>';
if ($exitAfter === true) {
exit();
}
}
#########################################
# base constant
#########################################
define ('DEBUG', true);
define ('CHECK_INDEX', true);
define ('SHOW_ALL_REQUEST_SQL', false);
define('ERROR_INDEX', '<!doctype html><html lang="fr"><head><meta charset="utf-8"><title>403 Direct access forbidden</title></head><body><h1>Direct access forbidden</h1><p>The requested URL '.$_SERVER['SCRIPT_NAME'].' is prohibited.</p></body></html>');
define ('DS', '/');
define ('WEB_ROOT',str_replace('index.php','',$_SERVER['SCRIPT_NAME']));
define ('ROOT',str_replace('index.php','',$_SERVER['SCRIPT_FILENAME']));
define ('ROOT_HTML', 'templates'.DS);
define ('DIR_CORE', ROOT.'core'.DS);
define ('DIR_TPL', ROOT.'templates'.DS);
define ('DIR_TPL_DEFAULT', ROOT.'assets'.DS.'template'.DS);
define ('DIR_CONFIG', ROOT.'config'.DS);
define ('DIR_PAGES', ROOT.'pages'.DS);
define ('DIR_LANG', ROOT.'assets'.DS.'langs'.DS);
define ('DIR_ASSET',ROOT.'assets'.DS);
define ('DIR_WIDGETS', ROOT.'widgets'.DS);
define ('DIR_UPLOADS', ROOT.'uploads'.DS);
define ('MANAGEMENTS', ROOT.'managements'.DS);
define ('VERSION_CMS', '2.0.1');
#########################################
# Install
#########################################
if (is_file(ROOT.'INSTALL'.DS.'index.php')) {
header('Location: INSTALL/index.php');
die();
}
#########################################
# require
#########################################
require DIR_CORE.'core.error.php';
require 'file_require.php';
new RequireFiles;
#########################################
# Bannissement(s)
#########################################
$sql = New BDD;
$sql->table('TABLE_BAN');
$sql->queryAll();
$ban = $sql->data;
if (!empty($ban)) {
foreach ($ban as $v) {
if ($v->number == 0) {
_init();
return;
} else {
if (!isset($_SESSION['USER']['HASH_KEY'])) {
$_SESSION['USER']['HASH_KEY'] = null;
}
if ($v->author == $_SESSION['USER']['HASH_KEY'] or $v->ip == Common::GetIp()) {
if ($v->effective != 0) {
require_once DIR_TPL_DEFAULT.'ban/index.php';
return;
} else {
_init();
return;
}
} else {
_init();
return;
}
}
}
} else {
_init();
return;
}
#########################################
# Initialisation
#########################################
function _init ()
{
try {
$BelCMS = new BelCMS;
$BelCMS->_init();
echo $BelCMS->render;
} catch (Exception $e) {
echo 'Exception reçue : ', $e->getMessage(), "\n";
}
}