forked from pluxml/PluXml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
91 lines (75 loc) · 2.94 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
<?php
define('PLX_ROOT', './');
define('PLX_CORE', PLX_ROOT.'core/');
include(PLX_ROOT.'config.php');
include(PLX_CORE.'lib/config.php');
# On verifie que PluXml est installé
if(!file_exists(path('XMLFILE_PARAMETERS'))) {
header('Location: '.PLX_ROOT.'install.php');
exit;
}
# On démarre la session
session_start();
# On inclut les librairies nécessaires
include(PLX_CORE.'lib/class.plx.date.php');
include(PLX_CORE.'lib/class.plx.glob.php');
include(PLX_CORE.'lib/class.plx.utils.php');
include(PLX_CORE.'lib/class.plx.capcha.php');
include(PLX_CORE.'lib/class.plx.erreur.php');
include(PLX_CORE.'lib/class.plx.record.php');
include(PLX_CORE.'lib/class.plx.motor.php');
include(PLX_CORE.'lib/class.plx.feed.php');
include(PLX_CORE.'lib/class.plx.show.php');
include(PLX_CORE.'lib/class.plx.encrypt.php');
include(PLX_CORE.'lib/class.plx.plugins.php');
# Creation de l'objet principal et lancement du traitement
$plxMotor = plxMotor::getInstance();
# Hook Plugins
eval($plxMotor->plxPlugins->callHook('Index'));
$plxMotor->prechauffage();
$plxMotor->demarrage();
# Creation de l'objet d'affichage
$plxShow = plxShow::getInstance();
eval($plxMotor->plxPlugins->callHook('IndexBegin'));
# On démarre la bufferisation
ob_start();
ob_implicit_flush(0);
# Traitements du thème
if($plxMotor->style == '' or !is_dir(PLX_ROOT.$plxMotor->aConf['racine_themes'].$plxMotor->style)) {
header('Content-Type: text/plain; charset='.PLX_CHARSET);
echo L_ERR_THEME_NOTFOUND.' ('.PLX_ROOT.$plxMotor->aConf['racine_themes'].$plxMotor->style.') !';
} elseif(file_exists(PLX_ROOT.$plxMotor->aConf['racine_themes'].$plxMotor->style.'/'.$plxMotor->template)) {
# On impose le charset
header('Content-Type: text/html; charset='.PLX_CHARSET);
# Insertion du template
include(PLX_ROOT.$plxMotor->aConf['racine_themes'].$plxMotor->style.'/'.$plxMotor->template);
} else {
header('Content-Type: text/plain; charset='.PLX_CHARSET);
echo L_ERR_FILE_NOTFOUND.' ('.PLX_ROOT.$plxMotor->aConf['racine_themes'].$plxMotor->style.'/'.$plxMotor->template.') !';
}
# Récuperation de la bufférisation
$output = ob_get_clean();
# Hooks spécifiques au thème
ob_start();
eval($plxMotor->plxPlugins->callHook('ThemeEndHead'));
$output = str_replace('</head>', ob_get_clean().'</head>', $output);
ob_start();
eval($plxMotor->plxPlugins->callHook('ThemeEndBody'));
$output = str_replace('</body>', ob_get_clean().'</body>', $output);
# Hook Plugins
eval($plxMotor->plxPlugins->callHook('IndexEnd'));
# On applique la réécriture d'url si nécessaire
if($plxMotor->aConf['urlrewriting']) {
$output = plxUtils::rel2abs($plxMotor->aConf['racine'], $output);
}
# On applique la compression gzip si nécessaire et disponible
if($plxMotor->aConf['gzip']) {
if($encoding=plxUtils::httpEncoding()) {
header('Content-Encoding: '.$encoding);
$output = gzencode($output,-1,FORCE_GZIP);
}
}
# Restitution écran
echo $output;
exit;
?>