/trunk/papyrus/configuration/pap_config_avancee.inc.php |
---|
22,7 → 22,7 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// | | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: pap_config_avancee.inc.php,v 1.23 2006-10-11 18:04:11 jp_milcent Exp $ |
// CVS : $Id: pap_config_avancee.inc.php,v 1.24 2006-10-18 10:18:04 jp_milcent Exp $ |
/** |
* Page de configuration avancée de Papyrus |
* |
36,7 → 36,7 |
*@author Alexandre GRANIER <alex@tela-botanica.org> |
*@author Laurent COUDOUNEAU <laurent.coudouneau@ema.fr> |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.23 $ $Date: 2006-10-11 18:04:11 $ |
*@version $Revision: 1.24 $ $Date: 2006-10-18 10:18:04 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
113,7 → 113,7 |
define('GEN_SITE_DEFAUT', 'admin'); |
// +------------------------------------------------------------------------------------------------------+ |
// Paramétrage réecriture d'URL et erreur 404 |
// Paramétrage réecriture d'URL et erreur HTTP |
/** Mot signalant une réecriture d'url présent à la base de l'url. */ |
define('PAP_URL_REECRITURE_MENU', 'page'); |
/** Mot signalant une réecriture d'url présent à la base de l'url. */ |
122,10 → 122,10 |
// Si vous utilisez "/", vous devrez indiquer le chemin depuis la racine pour les chemins présent dans les squelettes. |
// Exemple : "/sites/commun..." et non "sites/commun..." |
define('PAP_URL_REECRITURE_SEP', ':'); |
/** Chemin et nom du fichier affichant une erreur 404.*/ |
define('PAP_FICHIER_ERREUR_404', PAP_CHEMIN_RACINE.'sites/commun/%s/http_erreurs/erreur404.php'); |
/** Chemin et nom du fichier affichant une erreur 404.*/ |
define('PAP_URL_ERREUR_404', '%ssites/commun/%s/http_erreurs/erreur404.php?url=%s'); |
/** Chemin et nom du fichier affichant une erreur HTTP.*/ |
define('PAP_FICHIER_ERREUR_HTTP', PAP_CHEMIN_RACINE.'sites/commun/%s/http_erreurs/erreur%s.php'); |
/** Chemin et nom du fichier affichant une erreur HTTP.*/ |
define('PAP_URL_ERREUR_HTTP', '%ssites/commun/%s/http_erreurs/erreur%s.php?url=%s'); |
// +------------------------------------------------------------------------------------------------------+ |
/** Séparateur dans les chemins d'accès aux fichiers.*/ |
212,6 → 212,9 |
); |
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
* $Log: not supported by cvs2svn $ |
* Revision 1.23 2006/10/11 18:04:11 jp_milcent |
* Gestion avancée de la réecriture d'URL. |
* |
* Revision 1.22 2006/10/05 13:17:47 ddelon |
* Changement Version Papyrus : 0.21 --> 0.24 |
* |
/trunk/papyrus/pap_initialise_info.inc.php |
---|
21,7 → 21,7 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// | | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: pap_initialise_info.inc.php,v 1.25 2006-10-11 18:04:11 jp_milcent Exp $ |
// CVS : $Id: pap_initialise_info.inc.php,v 1.26 2006-10-18 10:18:05 jp_milcent Exp $ |
/** |
*Initialisation de Papyrus : vérification et récupération de paramètres généraux. |
* |
41,7 → 41,7 |
*@author Alexandre GRANIER <alex@tela-botanica.org> |
*@author Laurent COUDOUNEAU <laurent.coudouneau@ema.fr> |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.25 $ $Date: 2006-10-11 18:04:11 $ |
*@version $Revision: 1.26 $ $Date: 2006-10-18 10:18:05 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
64,58 → 64,43 |
// +------------------------------------------------------------------------------------------------------+ |
// +------------------------------------------------------------------------------------------------------+ |
// Gestion de la réecriture d'url et des url erreur 404 |
if ((! isset($_GET[GEN_URL_CLE_SITE]) || empty($_GET[GEN_URL_CLE_SITE])) && (! isset($_GET[GEN_URL_CLE_MENU]) || empty($_GET[GEN_URL_CLE_MENU])) ) { |
if (defined('PAP_URL_REECRITURE') AND PAP_URL_REECRITURE == '1') { |
$tab_type_reecriture = array('MENU', 'SITE'); |
foreach ($tab_type_reecriture as $reecriture) { |
if (PAP_URL_REECRITURE_SEP == '/') { |
$masque_reecriture = '/^(\/.*?)'.constant('PAP_URL_REECRITURE_'.$reecriture).'\\'.PAP_URL_REECRITURE_SEP.'([^\/]+?)(?:\?(.*)|)$/'; |
} else { |
$masque_reecriture = '/^(\/.*?)'.constant('PAP_URL_REECRITURE_'.$reecriture).PAP_URL_REECRITURE_SEP.'([^\/]+?)(?:\?(.*)|)$/'; |
if ((defined('PAP_URL_REECRITURE') AND PAP_URL_REECRITURE == '1' && (! isset($_GET[GEN_URL_CLE_SITE]) || empty($_GET[GEN_URL_CLE_SITE])) && (! isset($_GET[GEN_URL_CLE_MENU]) || empty($_GET[GEN_URL_CLE_MENU]))) ) { |
$tab_type_reecriture = array('MENU', 'SITE'); |
foreach ($tab_type_reecriture as $reecriture) { |
if (PAP_URL_REECRITURE_SEP == '/') { |
$masque_reecriture = '/^(\/.*?)'.constant('PAP_URL_REECRITURE_'.$reecriture).'\\'.PAP_URL_REECRITURE_SEP.'([^\/]+?)(?:\?(.*)|)$/'; |
} else { |
$masque_reecriture = '/^(\/.*?)'.constant('PAP_URL_REECRITURE_'.$reecriture).PAP_URL_REECRITURE_SEP.'([^\/]+?)(?:\?(.*)|)$/'; |
} |
if (preg_match($masque_reecriture, rawurldecode($_SERVER['REQUEST_URI']), $tab_raccourci)) { |
$chemin_vers_papyrus = $tab_raccourci[1]; |
$raccourci = $tab_raccourci[2]; |
$parametres = ''; |
if (isset($tab_raccourci[3])) { |
$parametres = $tab_raccourci[3]; |
} |
if (preg_match($masque_reecriture, rawurldecode($_SERVER['REQUEST_URI']), $tab_raccourci)) { |
$chemin_vers_papyrus = $tab_raccourci[1]; |
$raccourci = $tab_raccourci[2]; |
$parametres = ''; |
if (isset($tab_raccourci[3])) { |
$parametres = $tab_raccourci[3]; |
if ($reecriture == 'SITE') { |
/** Inclusion de la bibliothèque de fonctions servant au site pour la réecriture d'url. */ |
require_once GEN_CHEMIN_BIBLIO.'pap_site.fonct.php'; |
} |
// Nous cherchons à savoir si le raccourci est entièrement numérique ou pas. |
if (preg_match('/^[0-9]+$/', $raccourci)) { |
// Nous vérifions si nous utilisons les codes numériques ou alphanumérique dans les url |
if (constant('GEN_URL_ID_TYPE_'.$reecriture) != 'int') { |
$_GET[constant('GEN_URL_CLE_'.$reecriture)] = call_user_func('GEN_retourner'.$reecriture.'CodeAlpha', $db, $raccourci); |
} else { |
$_GET[constant('GEN_URL_CLE_'.$reecriture)] = $raccourci; |
} |
if ($reecriture == 'SITE') { |
/** Inclusion de la bibliothèque de fonctions servant au site pour la réecriture d'url. */ |
require_once GEN_CHEMIN_BIBLIO.'pap_site.fonct.php'; |
} |
// Nous cherchons à savoir si le raccourci est entièrement numérique ou pas. |
if (preg_match('/^[0-9]+$/', $raccourci)) { |
// Nous vérifions si nous utilisons les codes numériques ou alphanumérique dans les url |
if (constant('GEN_URL_ID_TYPE_'.$reecriture) != 'int') { |
$_GET[constant('GEN_URL_CLE_'.$reecriture)] = call_user_func('GEN_retourner'.$reecriture.'CodeAlpha', $db, $raccourci); |
} else { |
$_GET[constant('GEN_URL_CLE_'.$reecriture)] = $raccourci; |
} |
} else { |
// Nous vérifions si nous utilisons les codes numériques ou alphanumérique dans les url |
if (constant('GEN_URL_ID_TYPE_'.$reecriture) != 'int') { |
$_GET[constant('GEN_URL_CLE_'.$reecriture)] = $raccourci; |
} else { |
// Nous vérifions si nous utilisons les codes numériques ou alphanumérique dans les url |
if (constant('GEN_URL_ID_TYPE_'.$reecriture) != 'int') { |
$_GET[constant('GEN_URL_CLE_'.$reecriture)] = $raccourci; |
} else { |
$_GET[constant('GEN_URL_CLE_'.$reecriture)] = call_user_func('GEN_retourner'.$reecriture.'CodeNum', $db, $raccourci); |
} |
$_GET[constant('GEN_URL_CLE_'.$reecriture)] = call_user_func('GEN_retourner'.$reecriture.'CodeNum', $db, $raccourci); |
} |
} |
} |
} |
// Aucune information n'a été trouvée, redirection vers la page de gestion des erreurs 404 |
if ((! isset($_GET[GEN_URL_CLE_SITE]) || empty($_GET[GEN_URL_CLE_SITE])) && (! isset($_GET[GEN_URL_CLE_MENU]) || empty($_GET[GEN_URL_CLE_MENU]))) { |
// Utilisation de la fonction statique de Pear HTTP pour négocier l'i18n. |
$aso_i18n_possible = array(GEN_I18N_ID_DEFAUT => true); |
$i18n = HTTP::negotiateLanguage($aso_i18n_possible, GEN_I18N_ID_DEFAUT); |
if (file_exists(sprintf(PAP_FICHIER_ERREUR_404, $i18n))) { |
header ('Location: '.sprintf(PAP_URL_ERREUR_404, $chemin_vers_papyrus, $i18n, $_SERVER['REQUEST_URI'])); |
} else { |
header('Location: /'); |
} |
exit(0); |
} |
} |
// +------------------------------------------------------------------------------------------------------+ |
497,6 → 482,9 |
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
* $Log: not supported by cvs2svn $ |
* Revision 1.25 2006/10/11 18:04:11 jp_milcent |
* Gestion avancée de la réecriture d'URL. |
* |
* Revision 1.24 2006/03/02 10:49:49 ddelon |
* Fusion branche multilinguisme dans branche principale |
* |
/trunk/erreur_http.php |
---|
New file |
0,0 → 1,103 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This file is part of Papyrus. | |
// | | |
// | Foobar 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 2 of the License, or | |
// | (at your option) any later version. | |
// | | |
// | Foobar 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 Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: erreur_http.php,v 1.1 2006-10-18 10:18:05 jp_milcent Exp $ |
/** |
* Gestion des erreurs HTTP |
* |
* Permet d'afficher les pages d'erreur HTTP présentes dans Papyrus |
* |
*@package Papyrus |
//Auteur original : |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2005 |
*@version $Revision: 1.1 $ $Date: 2006-10-18 10:18:05 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// Définission de constantes |
/** Chemin et nom du fichier de configuration principal de Papyrus.*/ |
define('PAP_FICHIER_CONFIG', 'papyrus/configuration/pap_config.inc.php'); |
/** Chemin et nom du fichier de configuration avancée de Papyrus.*/ |
define('PAP_FICHIER_CONFIG_AVANCEE', 'papyrus/configuration/pap_config_avancee.inc.php'); |
/** Chemin et nom du fichier Pear HTTP.*/ |
define('PAP_FICHIER_PEAR_HTTP', 'api/pear/HTTP.php'); |
// +------------------------------------------------------------------------------------------------------+ |
// | CORPS du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// Nous vérifions que ce fichier n'est pas accédé directement |
if (!isset($_SERVER['REDIRECT_STATUS'])) { |
header('Location: /'); |
} |
// +------------------------------------------------------------------------------------------------------+ |
// Recherche du chemin vers papyrus. |
preg_match('/^(\/.*?)([^\/]+?)(?:\?(.*)|)$/', $_SERVER['REQUEST_URI'], $tab_raccourci); |
$raccourci = $tab_raccourci[2]; |
$chemin_papyrus = $tab_raccourci[1]; |
$parametres = ''; |
if (isset($tab_raccourci[2])) { |
$parametres = $tab_raccourci[2]; |
} |
// Inclusion des fichiers, si échec on redirige vers la racine du site |
if (file_exists(PAP_FICHIER_CONFIG) && file_exists(PAP_FICHIER_CONFIG_AVANCEE) && file_exists(PAP_FICHIER_PEAR_HTTP)) { |
/** Inclusion du fichier de configuration de Papyrus permettant de se conecter à la base de données. */ |
require_once PAP_FICHIER_CONFIG; |
/** Inclusion du fichier de configuration de Papyrus permettant d'avoir des infos sur la structure de l'url. */ |
require_once PAP_FICHIER_CONFIG_AVANCEE; |
/** Inclusion de l'objet PEAR servant à négocier le language avec le navigateur client. */ |
require_once PAP_FICHIER_PEAR_HTTP; |
} else { |
header('Location: /'); |
} |
// Utilisation de la fonction statique de Pear HTTP pour négocier l'i18n. |
$aso_i18n_possible = array(GEN_I18N_ID_DEFAUT => true); |
$i18n = HTTP::negotiateLanguage($aso_i18n_possible, GEN_I18N_ID_DEFAUT); |
// Redirection vers le fichier erreur de Papyrus s'il existe |
$fichier_erreur = sprintf(PAP_FICHIER_ERREUR_HTTP, $i18n, $_GET['erreur']); |
if (file_exists($fichier_erreur)) { |
header ('Location: '.sprintf(PAP_URL_ERREUR_HTTP, $chemin_papyrus, $i18n, $_GET['erreur'], $_SERVER['REQUEST_URI'])); |
} else { |
echo 'ERREUR Papyrus : Impossible de trouver le fichier de l\'erreur '.$_GET['erreur'].'<br />'. |
'Chemin fichier erreur : '.$fichier_erreur.' <br />'. |
'Veuillez le créer ou supprimer l\'entrée correspondante dans le fichier .htaccess.<br />'. |
'Ligne n° : '. __LINE__ .'<br />'. |
'Fichier : '. __FILE__ ; |
} |
exit(0); |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.5 2006/10/18 09:27:32 jp_milcent |
* Gestion des erreurs 404 uniquement. |
* |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |
/trunk/.htaccess |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |