1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pluxml_ynh.git synced 2024-09-03 20:16:02 +02:00
pluxml_ynh/sources/index.php

103 lines
3.4 KiB
PHP
Raw Normal View History

2014-11-12 22:01:48 +01:00
<?php
# ------------------ BEGIN LICENSE BLOCK ------------------
#
# This file is part of PluXml : http://www.pluxml.org
#
2015-08-17 21:12:54 +02:00
# Copyright (c) 2010-2015 Stephane Ferrari and contributors
2014-11-12 22:01:48 +01:00
# Copyright (c) 2008-2009 Florent MONTHEL and contributors
# Copyright (c) 2006-2008 Anthony GUERIN
# Licensed under the GPL license.
# See http://www.gnu.org/licenses/gpl.html
#
# ------------------- END LICENSE BLOCK -------------------
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)) {
2015-08-17 21:12:54 +02:00
header('Content-Type: text/plain; charset='.PLX_CHARSET);
2014-11-12 22:01:48 +01:00
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 {
2015-08-17 21:12:54 +02:00
header('Content-Type: text/plain; charset='.PLX_CHARSET);
2014-11-12 22:01:48 +01:00
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;
?>