Subversion Repositories Applications.papyrus

Rev

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

Rev 1087 Rev 1127
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: pap_url.class.php,v 1.4 2006-10-11 18:04:11 jp_milcent Exp $
24
// CVS : $Id: pap_url.class.php,v 1.4.2.1 2006-12-08 20:07:43 jp_milcent Exp $
25
/**
25
/**
26
* Classe de gestion des url de Papyrus
26
* Classe de gestion des url de Papyrus
27
*
27
*
28
* Permet de gérer la réecriture des url.
28
* Permet de gérer la réecriture des url.
29
*
29
*
30
*@package Papyrus
30
*@package Papyrus
31
*@subpackage Classes
31
*@subpackage Classes
32
//Auteur original :
32
//Auteur original :
33
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
34
//Autres auteurs :
34
//Autres auteurs :
35
*@author        Aucun
35
*@author        Aucun
36
*@copyright     Tela-Botanica 2000-2004
36
*@copyright     Tela-Botanica 2000-2004
37
*@version       $Revision: 1.4 $ $Date: 2006-10-11 18:04:11 $
37
*@version       $Revision: 1.4.2.1 $ $Date: 2006-12-08 20:07:43 $
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
*/
39
*/
40
 
40
 
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
// |                                            ENTETE du PROGRAMME                                       |
42
// |                                            ENTETE du PROGRAMME                                       |
43
// +------------------------------------------------------------------------------------------------------+
43
// +------------------------------------------------------------------------------------------------------+
44
 
44
 
45
 
45
 
46
 
46
 
47
// +------------------------------------------------------------------------------------------------------+
47
// +------------------------------------------------------------------------------------------------------+
48
// |                                            CORPS du PROGRAMME                                        |
48
// |                                            CORPS du PROGRAMME                                        |
49
// +------------------------------------------------------------------------------------------------------+
49
// +------------------------------------------------------------------------------------------------------+
50
class Pap_URL extends Net_URL {
50
class Pap_URL extends Net_URL {
51
    /** Identifiant du menu
51
    /** Identifiant du menu
52
    *
52
    *
53
    * @var integer
53
    * @var integer
54
    */
54
    */
55
    var $id;
55
    var $id;
56
    /** Chaine contenant le permalien.
56
    /** Chaine contenant le permalien.
57
    *
57
    *
58
    * @var string
58
    * @var string
59
    */
59
    */
60
    var $permalien = '';
60
    var $permalien = '';
61
    /** Booléen indiquant si on affiche ou pas un permalien.
61
    /** Booléen indiquant si on affiche ou pas un permalien.
62
    *
62
    *
63
    * @var boolean
63
    * @var boolean
64
    */
64
    */
65
    var $permalien_bool;
65
    var $permalien_bool;
66
    /** Chaine indiquant le type d'url.
66
    /** Chaine indiquant le type d'url.
67
    *
67
    *
68
    * @var string
68
    * @var string
69
    */
69
    */
70
    var $url_type = 'MENU';
70
    var $url_type = 'MENU';
71
    /** Code numérique du menu courant
71
    /** Code numérique du menu courant
72
    *
72
    *
73
    * @var integer
73
    * @var integer
74
    */
74
    */
75
    var $code_num;
75
    var $code_num;
76
    /** Code alphanumérique du menu courant
76
    /** Code alphanumérique du menu courant
77
    *
77
    *
78
    * @var string
78
    * @var string
79
    */
79
    */
80
    var $code_alpha;
80
    var $code_alpha;
81
    /**
81
    /**
82
    * PHP4 Constructeur
82
    * PHP4 Constructeur
83
    *
83
    *
84
    * @see __construct()
84
    * @see __construct()
85
    */
85
    */
86
    function Pap_URL($url = null, $useBrackets = true)
86
    function Pap_URL($url = null, $useBrackets = true)
87
    {
87
    {
88
        $this->__construct($url, $useBrackets);
88
        $this->__construct($url, $useBrackets);
89
		// Gestion de la réecriture d'url
89
		// Gestion de la réecriture d'url
90
		if (defined('PAP_URL_REECRITURE') AND PAP_URL_REECRITURE == '1') {
90
		if (defined('PAP_URL_REECRITURE') AND PAP_URL_REECRITURE == '1') {
91
			$this->setPermalienBool(true);
91
			$this->setPermalienBool(true);
92
		}
92
		}
93
    }
93
    }
94
    /** Méthode setId() - Définit l'id du menu courant
94
    /** Méthode setId() - Définit l'id du menu courant
95
    * 
95
    * 
96
    * @param integer l'identifiant du menu courant.
96
    * @param integer l'identifiant du menu courant.
97
    * @return mixed false en cas d'erreur 
97
    * @return mixed false en cas d'erreur 
98
    * @access public
98
    * @access public
99
    */
99
    */
100
    function setId($id)
100
    function setId($id)
101
    {
101
    {
102
        // Nous transformons en entier l'identifiant
102
        // Nous transformons en entier l'identifiant
103
        settype($id, "integer");
103
        settype($id, "integer");
104
        // Nous vérifions que l'identifiant est bien un entier
104
        // Nous vérifions que l'identifiant est bien un entier
105
        if (is_integer($id)) {
105
        if (is_integer($id)) {
106
            $this->id = $id;
106
            $this->id = $id;
107
        } else {
107
        } else {
108
            return false;
108
            return false;
109
        }
109
        }
110
    }
110
    }
111
    /** Méthode getId() - Retourne l'id du menu courant
111
    /** Méthode getId() - Retourne l'id du menu courant
112
    * 
112
    * 
113
    * @return integer l'identifiant du menu courant.
113
    * @return integer l'identifiant du menu courant.
114
    * @access public
114
    * @access public
115
    */
115
    */
116
    function getId()
116
    function getId()
117
    {
117
    {
118
        return $this->id;
118
        return $this->id;
119
    }
119
    }
120
    /** Méthode setPermalien() - Définit le permaliens
120
    /** Méthode setPermalien() - Définit le permaliens
121
    * 
121
    * 
122
    * @param string valeur
122
    * @param string valeur
123
    * @return mixed false en cas d'erreur 
123
    * @return mixed false en cas d'erreur 
124
    * @access public
124
    * @access public
125
    */
125
    */
126
    function setPermalien($chaine = '')
126
    function setPermalien($chaine = '')
127
    {
127
    {
128
        // Nous vérifions que l'identifiant est bien un entier
128
        // Nous vérifions que l'identifiant est bien un entier
129
        if (is_string($chaine) && $chaine != '') {
129
        if (is_string($chaine) && $chaine != '') {
130
            if ($this->permalien != '') {
130
            if ($this->permalien != '') {
131
            	$this->permalien .= PAP_URL_REECRITURE_SEP;
131
            	$this->permalien .= PAP_URL_REECRITURE_SEP;
132
            } else {
132
            } else {
133
            	$this->permalien = constant('PAP_URL_REECRITURE_'.$this->getUrlType()).PAP_URL_REECRITURE_SEP;
133
            	$this->permalien = constant('PAP_URL_REECRITURE_'.$this->getUrlType()).PAP_URL_REECRITURE_SEP;
134
            }
134
            }
135
            $this->permalien .= $chaine;
135
            $this->permalien .= $chaine;
136
        } else if ($chaine == '') {
136
        } else if ($chaine == '') {
137
        	$this->permalien = '';
137
        	$this->permalien = '';
138
        } else {
138
        } else {
139
            return false;
139
            return false;
140
        }
140
        }
141
    }
141
    }
142
    /** Méthode getPermalien() - Retourne le permalien
142
    /** Méthode getPermalien() - Retourne le permalien
143
    * 
143
    * 
144
    * @return string le permalien
144
    * @return string le permalien
145
    * @access public
145
    * @access public
146
    */
146
    */
147
    function getPermalien()
147
    function getPermalien()
148
    {
148
    {
149
        return $this->permalien;
149
        return $this->permalien;
150
    }
150
    }
151
    /** Méthode setUrlType() - Définit le type d'URL
151
    /** Méthode setUrlType() - Définit le type d'URL
152
    * 
152
    * 
153
    * @param string type d'URL (SITE ou MENU)
153
    * @param string type d'URL (SITE ou MENU)
154
    * @return mixed false en cas d'erreur 
154
    * @return mixed false en cas d'erreur 
155
    * @access public
155
    * @access public
156
    */
156
    */
157
    function setUrlType($type)
157
    function setUrlType($type)
158
    {
158
    {
159
        // Nous vérifions que l'identifiant est bien un entier
159
        // Nous vérifions que l'identifiant est bien un entier
160
        if (is_string($type) && ($type == 'MENU' || $type == 'SITE')) {
160
        if (is_string($type) && ($type == 'MENU' || $type == 'SITE')) {
161
            $this->url_type = $type;
161
            $this->url_type = $type;
162
        } else {
162
        } else {
163
            return false;
163
            return false;
164
        }
164
        }
165
    }
165
    }
166
    /** Méthode getUrlType() - Retourne le type de l'URL
166
    /** Méthode getUrlType() - Retourne le type de l'URL
167
    * 
167
    * 
168
    * @return string le type d'URL
168
    * @return string le type d'URL
169
    * @access public
169
    * @access public
170
    */
170
    */
171
    function getUrlType()
171
    function getUrlType()
172
    {
172
    {
173
        return $this->url_type;
173
        return $this->url_type;
174
    }
174
    }
175
    /** Méthode setPermalienBool() - Définit le type d'utilisation des permaliens
175
    /** Méthode setPermalienBool() - Définit le type d'utilisation des permaliens
176
    * 
176
    * 
177
    * @param boolean true ou false
177
    * @param boolean true ou false
178
    * @return mixed false en cas d'erreur 
178
    * @return mixed false en cas d'erreur 
179
    * @access public
179
    * @access public
180
    */
180
    */
181
    function setPermalienBool($bool)
181
    function setPermalienBool($bool)
182
    {
182
    {
183
        // Nous vérifions que l'identifiant est bien un entier
183
        // Nous vérifions que l'identifiant est bien un entier
184
        if (is_bool($bool)) {
184
        if (is_bool($bool)) {
185
            $this->permalien_bool = $bool;
185
            $this->permalien_bool = $bool;
186
        } else {
186
        } else {
187
            return false;
187
            return false;
188
        }
188
        }
189
    }
189
    }
190
    /** Méthode getPermalienBool() - Retourne booléen indiquant si on utilise ou pas les permaliens
190
    /** Méthode getPermalienBool() - Retourne booléen indiquant si on utilise ou pas les permaliens
191
    * 
191
    * 
192
    * @return boolean true ou false
192
    * @return boolean true ou false
193
    * @access public
193
    * @access public
194
    */
194
    */
195
    function getPermalienBool()
195
    function getPermalienBool()
196
    {
196
    {
197
        return $this->permalien_bool;
197
        return $this->permalien_bool;
198
    }
198
    }
199
    /** Méthode setCodeAlpha() - Définit le code alphanumérique de l'url
199
    /** Méthode setCodeAlpha() - Définit le code alphanumérique de l'url
200
    * 
200
    * 
201
    * @param string le code alphanumérique pour l'url du menu
201
    * @param string le code alphanumérique pour l'url du menu
202
    * @return mixed false en cas d'erreur 
202
    * @return mixed false en cas d'erreur 
203
    * @access public
203
    * @access public
204
    */
204
    */
205
    function setCodeAlpha($code_alpha)
205
    function setCodeAlpha($code_alpha)
206
    {
206
    {
207
        if (is_string($code_alpha)) {
207
        if (is_string($code_alpha)) {
208
            $this->code_alpha = $code_alpha;
208
            $this->code_alpha = $code_alpha;
209
        } else {
209
        } else {
210
            return false;
210
            return false;
211
        }
211
        }
212
    }
212
    }
213
    /** Méthode getCodeNum() - Retourne le code numérique de l'url
213
    /** Méthode getCodeNum() - Retourne le code numérique de l'url
214
    * 
214
    * 
215
    * @return string le code numérique pour l'url du menu
215
    * @return string le code numérique pour l'url du menu
216
    * @access public
216
    * @access public
217
    */
217
    */
218
    function getCodeNum()
218
    function getCodeNum()
219
    {
219
    {
220
        return $this->code_num;
220
        return $this->code_num;
221
    }
221
    }
222
    /** Méthode setCodeNum() - Définit le code numérique de l'url
222
    /** Méthode setCodeNum() - Définit le code numérique de l'url
223
    * 
223
    * 
224
    * @param string le code numérique pour l'url du menu
224
    * @param string le code numérique pour l'url du menu
225
    * @return mixed false en cas d'erreur 
225
    * @return mixed false en cas d'erreur 
226
    * @access public
226
    * @access public
227
    */
227
    */
228
    function setCodeNum($code_num)
228
    function setCodeNum($code_num)
229
    {
229
    {
230
        if (is_integer($code_num)) {
230
        if (is_integer($code_num)) {
231
            $this->code_num = $code_num;
231
            $this->code_num = $code_num;
232
        } else {
232
        } else {
233
            return false;
233
            return false;
234
        }
234
        }
235
    }
235
    }
236
    
236
    
237
    /** Méthode getCodeAlpha() - Retourne le code alphanumérique de l'url
237
    /** Méthode getCodeAlpha() - Retourne le code alphanumérique de l'url
238
    * 
238
    * 
239
    * @return string le code alphanumérique pour l'url du menu
239
    * @return string le code alphanumérique pour l'url du menu
240
    * @access public
240
    * @access public
241
    */
241
    */
242
    function getCodeAlpha()
242
    function getCodeAlpha()
243
    {
243
    {
244
        return $this->code_alpha;
244
        return $this->code_alpha;
245
    }
245
    }
246
    /**
246
    /**
247
    * Méthode getURL() - Retourne l'url
247
    * Méthode getURL() - Retourne l'url
248
    *
248
    *
249
    * @return string l'url complète.
249
    * @return string l'url complète.
250
    * @access public
250
    * @access public
251
    */
251
    */
252
    function getURL()
252
    function getURL()
253
    {
253
    {
254
        // Identifiant de la langue choisie
254
        // Identifiant de la langue choisie
255
        if ( (isset($GLOBALS['_GEN_commun']['i18n'])) && (!empty($GLOBALS['_GEN_commun']['i18n'])) ) {
255
        if ( (isset($GLOBALS['_GEN_commun']['i18n'])) && (!empty($GLOBALS['_GEN_commun']['i18n'])) ) {
256
        	if ($GLOBALS['_GEN_commun']['i18n'] != GEN_I18N_ID_DEFAUT) {
256
        	if ($GLOBALS['_GEN_commun']['i18n'] != GEN_I18N_ID_DEFAUT) {
257
            	$this->addQueryString(GEN_URL_CLE_I18N, $GLOBALS['_GEN_commun']['i18n']);
257
            	$this->addQueryString(GEN_URL_CLE_I18N, $GLOBALS['_GEN_commun']['i18n']);
258
        	}
258
        	}
259
        }
259
        }
260
            
260
            
261
        // Nous regardons si un id de menu existe
261
        // Nous regardons si un id de menu existe
262
        if ($this->getId() != '') {
262
        if ($this->getId() != '') {
263
            // Préparation des noms des champs des codes pour le site et le menu
263
            // Préparation des noms des champs des codes pour le site et le menu
264
            $champs_code_site = (GEN_URL_ID_TYPE_SITE == 'int') ? 'gs_code_num' : 'gs_code_alpha';
264
            $champs_code_site = (GEN_URL_ID_TYPE_SITE == 'int') ? 'gs_code_num' : 'gs_code_alpha';
265
            $champs_code_menu = (GEN_URL_ID_TYPE_MENU == 'int') ? 'gm_code_num' : 'gm_code_alpha';
265
            $champs_code_menu = (GEN_URL_ID_TYPE_MENU == 'int') ? 'gm_code_num' : 'gm_code_alpha';
266
            if ($this->getUrlType() == 'MENU') {
266
            if ($this->getUrlType() == 'MENU') {
267
	            // Récupération du nom de l'entrée du menu à afficher
267
	            // Récupération du nom de l'entrée du menu à afficher
268
	            $requete =  'SELECT gm_code_alpha, gm_code_num, gm_ce_i18n, gm_ce_site '.
268
	            $requete =  'SELECT gm_code_alpha, gm_code_num, gm_ce_i18n, gm_ce_site '.
269
	                        'FROM gen_menu '.
269
	                        'FROM gen_menu '.
270
	                        'WHERE gm_id_menu = '.$this->id.' ';
270
	                        'WHERE gm_id_menu = '.$this->id.' ';
271
	            
271
	            
272
	            $resultat = $GLOBALS['_GEN_commun']['pear_db']->query($requete);
272
	            $resultat = $GLOBALS['_GEN_commun']['pear_db']->query($requete);
273
	            (DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '';
273
	            (DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '';
274
	            
274
	            
275
	            $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
275
	            $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
276
	            $resultat->free();
276
	            $resultat->free();
277
	            // Nous vérifions si nous avons à faire à un menu commun ou pas
277
	            // Nous vérifions si nous avons à faire à un menu commun ou pas
278
	            if ($ligne['gm_ce_site'] != 0) {
278
	            if ($ligne['gm_ce_site'] != 0) {
279
	                // Récupération des infos sur le site
279
	                // Récupération des infos sur le site
280
	                $bln_url_site = false;
280
	                $bln_url_site = false;
281
	                $requete_site = 'SELECT gs_code_alpha, gs_code_num '.
281
	                $requete_site = 'SELECT gs_code_alpha, gs_code_num '.
282
	                                'FROM gen_site '.
282
	                                'FROM gen_site '.
283
	                                'WHERE gs_id_site = '.$ligne['gm_ce_site'].' ';
283
	                                'WHERE gs_id_site = '.$ligne['gm_ce_site'].' ';
284
	                
284
	                
285
	                $resultat_site = $GLOBALS['_GEN_commun']['pear_db']->query($requete_site);
285
	                $resultat_site = $GLOBALS['_GEN_commun']['pear_db']->query($requete_site);
286
	                (DB::isError($resultat_site)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_site->getMessage(), $requete_site)) : '';
286
	                (DB::isError($resultat_site)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_site->getMessage(), $requete_site)) : '';
287
	                
287
	                
288
	                $ligne_site = $resultat_site->fetchRow(DB_FETCHMODE_ASSOC);
288
	                $ligne_site = $resultat_site->fetchRow(DB_FETCHMODE_ASSOC);
289
	                $resultat_site->free();
289
	                $resultat_site->free();
290
	            } else {
290
	            } else {
291
	                // Menu commun
291
	                // Menu commun
292
	                $bln_url_site = true;
292
	                $bln_url_site = true;
293
	                $ligne_site[$champs_code_site] = $GLOBALS['_GEN_commun']['info_site']->$champs_code_site;
293
	                $ligne_site[$champs_code_site] = $GLOBALS['_GEN_commun']['info_site']->$champs_code_site;
294
	            }
294
	            }
295
	            $this->addQueryString(GEN_URL_CLE_MENU, $ligne[$champs_code_menu]);
295
	            $this->addQueryString(GEN_URL_CLE_MENU, $ligne[$champs_code_menu]);
296
            	$this->setCodeAlpha($ligne['gm_code_alpha']);
296
            	$this->setCodeAlpha($ligne['gm_code_alpha']);
297
            	$this->setCodeNum($ligne['gm_code_num']);
297
            	$this->setCodeNum($ligne['gm_code_num']);
298
            } else if ($this->getUrlType() == 'SITE') {
298
            } else if ($this->getUrlType() == 'SITE') {
299
            	$bln_url_site = true;
299
            	$bln_url_site = true;
300
            	$requete_site = 'SELECT gs_code_alpha, gs_code_num '.
300
            	$requete_site = 'SELECT gs_code_alpha, gs_code_num '.
301
                                'FROM gen_site '.
301
                                'FROM gen_site '.
302
                                'WHERE gs_id_site = '.$this->getId().' ';
302
                                'WHERE gs_id_site = '.$this->getId().' ';
303
                
303
                
304
                $resultat_site = $GLOBALS['_GEN_commun']['pear_db']->query($requete_site);
304
                $resultat_site = $GLOBALS['_GEN_commun']['pear_db']->query($requete_site);
305
                (DB::isError($resultat_site)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_site->getMessage(), $requete_site)) : '';
305
                (DB::isError($resultat_site)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat_site->getMessage(), $requete_site)) : '';
306
                
306
                
307
                $ligne_site = $resultat_site->fetchRow(DB_FETCHMODE_ASSOC);
307
                $ligne_site = $resultat_site->fetchRow(DB_FETCHMODE_ASSOC);
308
                $resultat_site->free();
308
                $resultat_site->free();
309
            	$this->setCodeAlpha($ligne_site['gs_code_alpha']);
309
            	$this->setCodeAlpha($ligne_site['gs_code_alpha']);
310
            	$this->setCodeNum($ligne_site['gs_code_num']);
310
            	$this->setCodeNum($ligne_site['gs_code_num']);
-
 
311
            	// Suppression de l'éventuel identifiant de menu passé dans l'url...
-
 
312
            	$this->removeQueryString(GEN_URL_CLE_MENU);
-
 
313
            } else {
-
 
314
            	$message = 	'ERREUR Papyrus : le type d\'url est inconnu : seul "MENU" et "SITE" existent. <br />'.
-
 
315
			            	'Type : '.$this->getUrlType().' <br />'.
-
 
316
			            	'Ligne n° : '. __LINE__ .'<br />'.
-
 
317
			            	'Fichier : '. __FILE__ ;
-
 
318
            	trigger_error($message, E_USER_ERROR);
311
            }
319
            }
312
            
320
            
313
            // Préparation de l'url de l'entrée
321
            // Préparation de l'url de l'entrée
314
            if ($bln_url_site) {
322
            if ($bln_url_site) {
315
                $this->addQueryString(GEN_URL_CLE_SITE, $ligne_site[$champs_code_site]);
323
                $this->addQueryString(GEN_URL_CLE_SITE, $ligne_site[$champs_code_site]);
316
            }
324
            }
317
            
325
            
318
            if ( (isset($GLOBALS['_GEN_commun']['url_i18n'])) && (!empty($GLOBALS['_GEN_commun']['url_i18n'])) ) {
326
            if ( (isset($GLOBALS['_GEN_commun']['url_i18n'])) && (!empty($GLOBALS['_GEN_commun']['url_i18n'])) ) {
319
                $this->addQueryString(GEN_URL_CLE_I18N, $GLOBALS['_GEN_commun']['url_i18n']);
327
                $this->addQueryString(GEN_URL_CLE_I18N, $GLOBALS['_GEN_commun']['url_i18n']);
320
            }
328
            }
321
            
329
            
322
            if ( (isset($GLOBALS['_GEN_commun']['url_date'])) && (!empty($GLOBALS['_GEN_commun']['url_date'])) ) {
330
            if ( (isset($GLOBALS['_GEN_commun']['url_date'])) && (!empty($GLOBALS['_GEN_commun']['url_date'])) ) {
323
                $this->addQueryString(GEN_URL_CLE_DATE, $GLOBALS['_GEN_commun']['url_date']);
331
                $this->addQueryString(GEN_URL_CLE_DATE, $GLOBALS['_GEN_commun']['url_date']);
324
            }
332
            }
325
            
333
            
326
            if ( (isset($GLOBALS['_GEN_commun']['url_format'])) && (!empty($GLOBALS['_GEN_commun']['url_format'])) ) {
334
            if ( (isset($GLOBALS['_GEN_commun']['url_format'])) && (!empty($GLOBALS['_GEN_commun']['url_format'])) ) {
327
                $this->addQueryString(GEN_URL_CLE_FORMAT, $GLOBALS['_GEN_commun']['url_format']);
335
                $this->addQueryString(GEN_URL_CLE_FORMAT, $GLOBALS['_GEN_commun']['url_format']);
328
            }
336
            }
329
        }
337
        }
330
        
338
        
331
		// Construction du permalien ou pas
339
		// Construction du permalien ou pas
332
        if ($this->getPermalienBool()) {
340
        if ($this->getPermalienBool()) {
333
            // Récupération du chemin jusqu'au fichier principal de Papyrus
341
            // Récupération du chemin jusqu'au fichier principal de Papyrus
334
            $this->path = (dirname($this->path) == DIRECTORY_SEPARATOR) ? DIRECTORY_SEPARATOR : dirname($this->path).DIRECTORY_SEPARATOR;
342
            $this->path = (dirname($this->path) == DIRECTORY_SEPARATOR) ? DIRECTORY_SEPARATOR : dirname($this->path).DIRECTORY_SEPARATOR;
335
            // On vide le permalien construite par les appels à getUrl() avant de le remplir
343
            // On vide le permalien construite par les appels à getUrl() avant de le remplir
336
            $this->setPermalien();
344
            $this->setPermalien();
337
            if (constant('GEN_URL_RACCOURCI_ID_TYPE_'.$this->getUrlType()) == 'int') {
345
            if (constant('GEN_URL_RACCOURCI_ID_TYPE_'.$this->getUrlType()) == 'int') {
338
                $this->setPermalien($this->getCodeNum());
346
                $this->setPermalien($this->getCodeNum());
339
            } else {
347
            } else {
340
                $this->setPermalien($this->getCodeAlpha());
348
                $this->setPermalien($this->getCodeAlpha());
341
            }
349
            }
342
			$this->removeQueryString(GEN_URL_CLE_SITE);
350
			$this->removeQueryString(GEN_URL_CLE_SITE);
343
            $this->removeQueryString(GEN_URL_CLE_MENU);
351
            $this->removeQueryString(GEN_URL_CLE_MENU);
344
            $querystring = $this->getQueryString();
352
            $querystring = $this->getQueryString();
345
        } else {
353
        } else {
346
            $querystring = $this->getQueryString();
354
            $querystring = $this->getQueryString();
347
        }
355
        }
348
        
356
        
349
        // Construction de l'url
357
        // Construction de l'url
350
        $this->url = $this->protocol . '://'
358
        $this->url = $this->protocol . '://'
351
                   . $this->user . (!empty($this->pass) ? ':' : '')
359
                   . $this->user . (!empty($this->pass) ? ':' : '')
352
                   . $this->pass . (!empty($this->user) ? '@' : '')
360
                   . $this->pass . (!empty($this->user) ? '@' : '')
353
                   . $this->host . ($this->port == $this->getStandardPort($this->protocol) ? '' : ':' . $this->port)
361
                   . $this->host . ($this->port == $this->getStandardPort($this->protocol) ? '' : ':' . $this->port)
354
                   . $this->path
362
                   . $this->path
355
                   . $this->getPermalien()
363
                   . $this->getPermalien()
356
                   . (!empty($querystring) ? '?' . $querystring : '')
364
                   . (!empty($querystring) ? '?' . $querystring : '')
357
                   . (!empty($this->anchor) ? '#' . $this->anchor : '');
365
                   . (!empty($this->anchor) ? '#' . $this->anchor : '');
358
        
366
        
359
        return $this->url;
367
        return $this->url;
360
    }
368
    }
361
    
369
    
362
    /** Méthode retournant la valeur d'un paramêtre de l'URL.
370
    /** Méthode retournant la valeur d'un paramêtre de l'URL.
363
    *
371
    *
364
    * @return mixed la valeur du paramêtre demandé ou false
372
    * @return mixed la valeur du paramêtre demandé ou false
365
    * @access public
373
    * @access public
366
    */
374
    */
367
    function retournerUnParametre($parametre)
375
    function retournerUnParametre($parametre)
368
    {
376
    {
369
        if (!empty($this->querystring)) {
377
        if (!empty($this->querystring)) {
370
            if (isset($this->querystring[$parametre])) {
378
            if (isset($this->querystring[$parametre])) {
371
                return $this->querystring[$parametre];
379
                return $this->querystring[$parametre];
372
            }
380
            }
373
        }
381
        }
374
        
382
        
375
        return FALSE;
383
        return FALSE;
376
    }
384
    }
377
 
385
 
378
}
386
}
379
 
387
 
380
// +------------------------------------------------------------------------------------------------------+
388
// +------------------------------------------------------------------------------------------------------+
381
// |                                            PIED du PROGRAMME                                         |
389
// |                                            PIED du PROGRAMME                                         |
382
// +------------------------------------------------------------------------------------------------------+
390
// +------------------------------------------------------------------------------------------------------+
383
 
391
 
384
 
392
 
385
 
393
 
386
/* +--Fin du code ----------------------------------------------------------------------------------------+
394
/* +--Fin du code ----------------------------------------------------------------------------------------+
387
*
395
*
388
* $Log: not supported by cvs2svn $
396
* $Log: not supported by cvs2svn $
-
 
397
* Revision 1.4  2006/10/11 18:04:11  jp_milcent
-
 
398
* Gestion avancée de la réecriture d'URL.
-
 
399
*
389
* Revision 1.3  2006/03/02 10:49:49  ddelon
400
* Revision 1.3  2006/03/02 10:49:49  ddelon
390
* Fusion branche multilinguisme dans branche principale
401
* Fusion branche multilinguisme dans branche principale
391
*
402
*
392
* Revision 1.2.2.1  2005/12/27 15:56:00  ddelon
403
* Revision 1.2.2.1  2005/12/27 15:56:00  ddelon
393
* Fusion Head vers multilinguisme (wikini double clic)
404
* Fusion Head vers multilinguisme (wikini double clic)
394
*
405
*
395
* Revision 1.2  2005/04/18 16:40:50  jpm
406
* Revision 1.2  2005/04/18 16:40:50  jpm
396
* Modifications pour contrôler les permaliens.
407
* Modifications pour contrôler les permaliens.
397
*
408
*
398
* Revision 1.1  2005/04/14 13:56:25  jpm
409
* Revision 1.1  2005/04/14 13:56:25  jpm
399
* Ajout de la classe URL de Papyrus.
410
* Ajout de la classe URL de Papyrus.
400
*
411
*
401
*
412
*
402
* +-- Fin du code ----------------------------------------------------------------------------------------+
413
* +-- Fin du code ----------------------------------------------------------------------------------------+
403
*/
414
*/
404
?>
415
?>