Subversion Repositories Applications.papyrus

Rev

Rev 1041 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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