-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
86 lines (84 loc) · 2.98 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
<?php
/**
* Bel-CMS [Content management system]
* @version 4.0.0 [PHP8.3]
* @link https://bel-cms.dev
* @link https://determe.be
* @license MIT License
* @copyright 2015-2025 Bel-CMS
* @author as Stive - [email protected]
*/
#######################################################
# Demarre une $_SESSION
#######################################################
if(!isset($_SESSION)) {
session_start();
}
use BelCMS\Core\BelCMS;
use BelCMS\Core\Dispatcher;
use BelCMS\Core\Ban;
use Belcms\Management\Managements;
# TimeZone et charset
#######################################################
ini_set('default_charset', 'utf-8');
date_default_timezone_set('Europe/Brussels');
#######################################################
# Définit comme l'index
#######################################################
define('CHECK_INDEX', true);
define('VERSION_CMS', '4.0.0');
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', __DIR__);
define('SHOW_ALL_REQUEST_SQL', false);
define('ERROR_INDEX', '<!doctype html><html><head><meta charset="utf-8"><title>BEL-CMS : Error 403 Forbidden</title><style>h1{margin: 20px auto;text-align:center;color: red;}p{text-align:center;font-weight:bold;</style></head><body><h1>HTTP Error 403 : Forbidden</h1><p>You don\'t permission to access / on this server.</p></body></html>');
#######################################################
# Function debug
#######################################################
require_once 'debug.php';
#######################################################
# MicroTime loading
#######################################################
$_SESSION['SESSION_START'] = microtime(true);
#########################################
$_SESSION['NB_REQUEST_SQL'] = 0;
$_SESSION['CMS_DEBUG'] = true;
#######################################################
# Install
#######################################################
if (is_file(ROOT.DS.'INSTALL'.DS.'index.php')) {
header('Location: INSTALL/index.php');
die();
}
#######################################################
# Fichier requis
#######################################################
require_once ROOT.DS.'requires'.DS.'requires.all.php';
#########################################
# Bannissement
#########################################
new Ban();
#########################################
# Initialise le C.M.S
#########################################
if (Dispatcher::isManagement() === true) {
header('Content-Type: text/html');
require_once constant('DIR_ADMIN').'index.php';
new Managements ();
} else {
$belcms = new BelCMS;
if (isset($_GET['echo'])) {
header('Content-Type: text/html; charset=UTF-8');
echo $belcms->page;
} else if (isset($_GET['img'])) {
header('Content-Type: image/png');
echo $belcms->page;
} else if (isset($_GET['json'])) {
header('Content-Type: application/json; charset=UTF-8');
echo json_encode($belcms->page);
} else if (isset($_GET['text'])) {
echo $belcms->page;
} else {
header('Content-Type: text/html; charset=UTF-8');
echo $belcms->templates;
}
}