| 1037 | 
           jp_milcent | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           /*vim: set expandtab tabstop=4 shiftwidth=4: */
  | 
        
        
            | 
            | 
           3 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           4 | 
           // | PHP version 4.1                                                                                      |
  | 
        
        
            | 
            | 
           5 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           6 | 
           // | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
  | 
        
        
            | 
            | 
           7 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           8 | 
           // | This file is part of Papyrus.                                                                        |
  | 
        
        
            | 
            | 
           9 | 
           // |                                                                                                      |
  | 
        
        
            | 
            | 
           10 | 
           // | Foobar is free software; you can redistribute it and/or modify                                       |
  | 
        
        
            | 
            | 
           11 | 
           // | it under the terms of the GNU General Public License as published by                                 |
  | 
        
        
            | 
            | 
           12 | 
           // | the Free Software Foundation; either version 2 of the License, or                                    |
  | 
        
        
            | 
            | 
           13 | 
           // | (at your option) any later version.                                                                  |
  | 
        
        
            | 
            | 
           14 | 
           // |                                                                                                      |
  | 
        
        
            | 
            | 
           15 | 
           // | Foobar is distributed in the hope that it will be useful,                                            |
  | 
        
        
            | 
            | 
           16 | 
           // | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
  | 
        
        
            | 
            | 
           17 | 
           // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
  | 
        
        
            | 
            | 
           18 | 
           // | GNU General Public License for more details.                                                         |
  | 
        
        
            | 
            | 
           19 | 
           // |                                                                                                      |
  | 
        
        
            | 
            | 
           20 | 
           // | You should have received a copy of the GNU General Public License                                    |
  | 
        
        
            | 
            | 
           21 | 
           // | along with Foobar; if not, write to the Free Software                                                |
  | 
        
        
            | 
            | 
           22 | 
           // | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
  | 
        
        
            | 
            | 
           23 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
           | 1041 | 
           jp_milcent | 
           24 | 
           // CVS : $Id: erreur_http.php,v 1.2 2006-10-26 16:29:52 jp_milcent Exp $
  | 
        
        
           | 1037 | 
           jp_milcent | 
           25 | 
           /**
  | 
        
        
            | 
            | 
           26 | 
           * Gestion des erreurs HTTP
  | 
        
        
            | 
            | 
           27 | 
           *
  | 
        
        
            | 
            | 
           28 | 
           * Permet d'afficher les pages d'erreur HTTP présentes dans Papyrus
  | 
        
        
            | 
            | 
           29 | 
           *
  | 
        
        
            | 
            | 
           30 | 
           *@package Papyrus
  | 
        
        
            | 
            | 
           31 | 
           //Auteur original :
  | 
        
        
            | 
            | 
           32 | 
           *@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
  | 
        
        
            | 
            | 
           33 | 
           //Autres auteurs :
  | 
        
        
            | 
            | 
           34 | 
           *@author        Aucun
  | 
        
        
            | 
            | 
           35 | 
           *@copyright     Tela-Botanica 2000-2005
  | 
        
        
           | 1041 | 
           jp_milcent | 
           36 | 
           *@version       $Revision: 1.2 $ $Date: 2006-10-26 16:29:52 $
  | 
        
        
           | 1037 | 
           jp_milcent | 
           37 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           38 | 
           */
  | 
        
        
            | 
            | 
           39 | 
              | 
        
        
            | 
            | 
           40 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           41 | 
           // |                                            ENTETE du PROGRAMME                                       |
  | 
        
        
            | 
            | 
           42 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           43 | 
           // Définission de constantes
  | 
        
        
            | 
            | 
           44 | 
           /** Chemin et nom du fichier de configuration principal de Papyrus.*/
  | 
        
        
            | 
            | 
           45 | 
           define('PAP_FICHIER_CONFIG', 'papyrus/configuration/pap_config.inc.php');
  | 
        
        
            | 
            | 
           46 | 
           /** Chemin et nom du fichier de configuration avancée de Papyrus.*/
  | 
        
        
            | 
            | 
           47 | 
           define('PAP_FICHIER_CONFIG_AVANCEE', 'papyrus/configuration/pap_config_avancee.inc.php');
  | 
        
        
            | 
            | 
           48 | 
           /** Chemin et nom du fichier Pear HTTP.*/
  | 
        
        
            | 
            | 
           49 | 
           define('PAP_FICHIER_PEAR_HTTP', 'api/pear/HTTP.php');
  | 
        
        
            | 
            | 
           50 | 
              | 
        
        
            | 
            | 
           51 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           52 | 
           // |                                            CORPS du PROGRAMME                                        |
  | 
        
        
            | 
            | 
           53 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           54 | 
           // Nous vérifions que ce fichier n'est pas accédé directement
  | 
        
        
            | 
            | 
           55 | 
           if (!isset($_SERVER['REDIRECT_STATUS'])) {
  | 
        
        
            | 
            | 
           56 | 
           	header('Location: /');
  | 
        
        
            | 
            | 
           57 | 
           }
  | 
        
        
            | 
            | 
           58 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           59 | 
           // Recherche du chemin vers papyrus.
  | 
        
        
            | 
            | 
           60 | 
           preg_match('/^(\/.*?)([^\/]+?)(?:\?(.*)|)$/', $_SERVER['REQUEST_URI'], $tab_raccourci);
  | 
        
        
            | 
            | 
           61 | 
           $raccourci = $tab_raccourci[2];
  | 
        
        
            | 
            | 
           62 | 
           $chemin_papyrus = $tab_raccourci[1];
  | 
        
        
            | 
            | 
           63 | 
           $parametres = '';
  | 
        
        
            | 
            | 
           64 | 
           if (isset($tab_raccourci[2])) {
  | 
        
        
            | 
            | 
           65 | 
               $parametres = $tab_raccourci[2];
  | 
        
        
            | 
            | 
           66 | 
           }
  | 
        
        
            | 
            | 
           67 | 
           // Inclusion des fichiers, si échec on redirige vers la racine du site
  | 
        
        
            | 
            | 
           68 | 
           if (file_exists(PAP_FICHIER_CONFIG) && file_exists(PAP_FICHIER_CONFIG_AVANCEE) && file_exists(PAP_FICHIER_PEAR_HTTP)) {
  | 
        
        
            | 
            | 
           69 | 
               /** Inclusion du fichier de configuration de Papyrus permettant de se conecter à la base de données. */
  | 
        
        
            | 
            | 
           70 | 
               require_once PAP_FICHIER_CONFIG;
  | 
        
        
            | 
            | 
           71 | 
               /** Inclusion du fichier de configuration de Papyrus permettant d'avoir des infos sur la structure de l'url. */
  | 
        
        
            | 
            | 
           72 | 
               require_once PAP_FICHIER_CONFIG_AVANCEE;
  | 
        
        
            | 
            | 
           73 | 
               /** Inclusion de l'objet PEAR servant à négocier le language avec le navigateur client. */
  | 
        
        
            | 
            | 
           74 | 
               require_once PAP_FICHIER_PEAR_HTTP;
  | 
        
        
            | 
            | 
           75 | 
           } else {
  | 
        
        
            | 
            | 
           76 | 
           	header('Location: /');
  | 
        
        
            | 
            | 
           77 | 
           }
  | 
        
        
            | 
            | 
           78 | 
           // Utilisation de la fonction statique de Pear HTTP pour négocier l'i18n.
  | 
        
        
            | 
            | 
           79 | 
           $aso_i18n_possible = array(GEN_I18N_ID_DEFAUT => true);
  | 
        
        
            | 
            | 
           80 | 
           $i18n = HTTP::negotiateLanguage($aso_i18n_possible, GEN_I18N_ID_DEFAUT);
  | 
        
        
            | 
            | 
           81 | 
           // Redirection vers le fichier erreur de Papyrus s'il existe
  | 
        
        
            | 
            | 
           82 | 
           $fichier_erreur = sprintf(PAP_FICHIER_ERREUR_HTTP, $i18n, $_GET['erreur']);
  | 
        
        
            | 
            | 
           83 | 
           if (file_exists($fichier_erreur)) {
  | 
        
        
           | 1041 | 
           jp_milcent | 
           84 | 
               header ('Location: '.sprintf(PAP_URL_ERREUR_HTTP, $i18n, $_GET['erreur'], $_SERVER['REQUEST_URI']));
  | 
        
        
           | 1037 | 
           jp_milcent | 
           85 | 
           } else {
  | 
        
        
            | 
            | 
           86 | 
               echo 	'ERREUR Papyrus : Impossible de trouver le fichier de l\'erreur '.$_GET['erreur'].'<br />'.
  | 
        
        
            | 
            | 
           87 | 
           			'Chemin fichier erreur : '.$fichier_erreur.' <br />'.
  | 
        
        
            | 
            | 
           88 | 
           			'Veuillez le créer ou supprimer l\'entrée correspondante dans le fichier .htaccess.<br />'.
  | 
        
        
            | 
            | 
           89 | 
           			'Ligne n° : '. __LINE__ .'<br />'.
  | 
        
        
            | 
            | 
           90 | 
           			'Fichier : '. __FILE__ ;
  | 
        
        
            | 
            | 
           91 | 
           }
  | 
        
        
            | 
            | 
           92 | 
           exit(0);
  | 
        
        
            | 
            | 
           93 | 
              | 
        
        
            | 
            | 
           94 | 
           /* +--Fin du code ----------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           95 | 
           *
  | 
        
        
            | 
            | 
           96 | 
           * $Log: not supported by cvs2svn $
  | 
        
        
           | 1041 | 
           jp_milcent | 
           97 | 
           * Revision 1.1  2006/10/18 10:18:05  jp_milcent
  | 
        
        
            | 
            | 
           98 | 
           * Gestion des erreurs HTTP par Papyrus.
  | 
        
        
            | 
            | 
           99 | 
           *
  | 
        
        
           | 1037 | 
           jp_milcent | 
           100 | 
           * Revision 1.5  2006/10/18 09:27:32  jp_milcent
  | 
        
        
            | 
            | 
           101 | 
           * Gestion des erreurs 404 uniquement.
  | 
        
        
            | 
            | 
           102 | 
           *
  | 
        
        
            | 
            | 
           103 | 
           *
  | 
        
        
            | 
            | 
           104 | 
           * +-- Fin du code ----------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           105 | 
           */
  | 
        
        
            | 
            | 
           106 | 
           ?>
  |