Subversion Repositories Applications.papyrus

Rev

Rev 1968 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1968 Rev 2074
Line 1... Line 1...
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 5.1                                                                                      |
4
// | PHP version 5.1																						|
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org)                                    |
6
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org)								|
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of papyrus_bp.                                                                         |
8
// | This file is part of papyrus_bp.																	|
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: lien.php,v 1.2 2008-11-14 11:22:24 jp_milcent Exp $
-
 
25
/**
24
/**
26
* papyrus_bp - lien.php
25
* papyrus_bp - lien.php
27
*
26
*
28
* Description :
27
* Description :
29
*
28
*
30
*@package papyrus_bp
29
*@package papyrus_bp
31
//Auteur original :
30
//Auteur original :
32
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
31
*@author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
//Autres auteurs :
32
//Autres auteurs :
34
*@author        Aucun
33
*@author		Aucun
35
*@copyright     Tela-Botanica 1999-2006
34
*@copyright	 Tela-Botanica 1999-2006
36
*@version       $Revision: 1.2 $ $Date: 2008-11-14 11:22:24 $
35
*@version	   $Id$
37
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
38
*/
37
*/
Line 39... Line 38...
39
 
38
 
40
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTÊTE du PROGRAMME                                       |
40
// |											ENTÊTE du PROGRAMME									   |
42
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
43
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherLien';
42
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherLien';
Line 44... Line 43...
44
$GLOBALS['_GEN_commun']['info_applette_balise'] = '\{\{[Ll]ien(?:\s*(?:((?:menu|site)="[^"]+")|(titre="[^"]+")|))+\s*\}\}';
43
$GLOBALS['_GEN_commun']['info_applette_balise'] = '\{\{[Ll]ien(?:\s*(?:((?:menu|site)="[^"]+")|(titre="[^"]+")|))+\s*\}\}';
45
 
44
 
46
// --------------------------------------------------------------------------------------------------------
45
// --------------------------------------------------------------------------------------------------------
Line 47... Line 46...
47
/** Inclusion du fichier de configuration de cette application.*/
46
/** Inclusion du fichier de configuration de cette application.*/
48
require_once GEN_CHEMIN_APPLETTE.'lien'.GEN_SEP.'configuration'.GEN_SEP.'lien_configuration.inc.php';
47
require_once GEN_CHEMIN_APPLETTE.'lien'.GEN_SEP.'configuration'.GEN_SEP.'lien_configuration.inc.php';
49
 
48
 
50
// Inclusion des fichiers de traduction de l'applette LIEN de Papyrus
49
// Inclusion des fichiers de traduction de l'applette LIEN de Papyrus
51
if (file_exists(LIEN_CHEMIN_LANGUE.'lien_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
50
if (file_exists(LIEN_CHEMIN_LANGUE.'lien_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
52
    /** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
51
	/** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
53
    require_once LIEN_CHEMIN_LANGUE.'lien_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
52
	require_once LIEN_CHEMIN_LANGUE.'lien_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
54
} else {
53
} else {
Line 55... Line 54...
55
    /** Inclusion du fichier de traduction par défaut.*/
54
	/** Inclusion du fichier de traduction par défaut.*/
56
    require_once LIEN_CHEMIN_LANGUE.'lien_langue_'.LIEN_I18N_DEFAUT.'.inc.php';
55
	require_once LIEN_CHEMIN_LANGUE.'lien_langue_'.LIEN_I18N_DEFAUT.'.inc.php';
57
}
56
}
58
 
57
 
59
 
58
 
60
// +------------------------------------------------------------------------------------------------------+
59
// +------------------------------------------------------------------------------------------------------+
61
// |                                            CORPS du PROGRAMME                                        |
60
// |											CORPS du PROGRAMME										|
Line 70... Line 69...
70
* @return string XHTML le lien.
69
* @return string XHTML le lien.
71
*/
70
*/
72
function afficherLien($tab_applette_arguments, $_GEN_commun)
71
function afficherLien($tab_applette_arguments, $_GEN_commun)
73
{
72
{
74
	// Initialisation des variables
73
	// Initialisation des variables
75
    $sortie = '';
74
	$sortie = '';
76
	$niveau = null;
75
	$niveau = null;
77
	$GLOBALS['_LIEN_']['url'] = '';
76
	$GLOBALS['_LIEN_']['url'] = '';
78
	$GLOBALS['_LIEN_']['titre'] = LIEN_LG_ERREUR_TITRE;
77
	$GLOBALS['_LIEN_']['titre'] = LIEN_LG_ERREUR_TITRE;
79
    $GLOBALS['_LIEN_']['erreurs'] = array();
78
	$GLOBALS['_LIEN_']['erreurs'] = array();
Line 80... Line 79...
80
 
79
 
81
	//+----------------------------------------------------------------------------------------------------------------+
80
	//+----------------------------------------------------------------------------------------------------------------+
82
	// Gestion des arguments
81
	// Gestion des arguments
83
    $tab_arguments = $tab_applette_arguments;
82
	$tab_arguments = $tab_applette_arguments;
84
	unset($tab_arguments[0]);
83
	unset($tab_arguments[0]);
85
    foreach($tab_arguments as $argument) {
84
	foreach($tab_arguments as $argument) {
86
	    $tab_parametres = explode('=', $argument);
85
		$tab_parametres = explode('=', $argument);
87
	    $options[$tab_parametres[0]] = trim($tab_parametres[1], '"'); 
86
		$options[$tab_parametres[0]] = trim($tab_parametres[1], '"'); 
Line 88... Line 87...
88
    }
87
	}
89
	
88
	
90
	//+----------------------------------------------------------------------------------------------------------------+
89
	//+----------------------------------------------------------------------------------------------------------------+
91
    // Gestion des erreurs de paramètrage
90
	// Gestion des erreurs de paramètrage
92
    if (!isset($options['menu']) && !isset($options['site']) ) {
91
	if (!isset($options['menu']) && !isset($options['site']) ) {
93
        $GLOBALS['_LIEN_']['erreur'] = LIEN_LG_ERREUR_SITE_MENU;
92
		$GLOBALS['_LIEN_']['erreur'] = LIEN_LG_ERREUR_SITE_MENU;
94
    } else {
93
	} else {
95
    	if (isset($options['menu'])) {
94
		if (isset($options['menu'])) {
96
    		$niveau = 'menu';
95
			$niveau = 'menu';
97
    		$identifiant = $options['menu']; 
96
			$identifiant = $options['menu']; 
98
    	} else if (isset($options['site'])) {
97
		} else if (isset($options['site'])) {
99
    		$niveau = 'site';
98
			$niveau = 'site';
100
    		$identifiant = $options['site'];
99
			$identifiant = $options['site'];
Line 101... Line 100...
101
    	} 
100
		} 
102
    }
101
	}
103
 
102
 
104
    //+----------------------------------------------------------------------------------------------------------------+
103
	//+----------------------------------------------------------------------------------------------------------------+
105
    // Récupération des données
104
	// Récupération des données
106
	$bdd =& $GLOBALS['_GEN_commun']['pear_db'];
105
	$bdd =& $GLOBALS['_GEN_commun']['pear_db'];
107
	$id_langue = $GLOBALS['_GEN_commun']['i18n']; //identifiant de la langue choisie
106
	$id_langue = $GLOBALS['_GEN_commun']['i18n']; //identifiant de la langue choisie
Line 117... Line 116...
117
			$aso_site = GEN_lireInfoSiteI18nCodeAlpha($bdd, GEN_retournerSiteCodeAlpha($bdd, $identifiant), $langue_url, DB_FETCHMODE_ASSOC);
116
			$aso_site = GEN_lireInfoSiteI18nCodeAlpha($bdd, GEN_retournerSiteCodeAlpha($bdd, $identifiant), $langue_url, DB_FETCHMODE_ASSOC);
118
		} else {
117
		} else {
119
			$aso_site = GEN_lireInfoSiteI18nCodeAlpha($bdd, $identifiant, $langue_url, DB_FETCHMODE_ASSOC);
118
			$aso_site = GEN_lireInfoSiteI18nCodeAlpha($bdd, $identifiant, $langue_url, DB_FETCHMODE_ASSOC);
120
		}
119
		}
Line 121... Line 120...
121
		
120
		
122
        if (isset($options['titre'])) {
121
		if (isset($options['titre'])) {
123
        	$GLOBALS['_LIEN_']['titre'] = $options['titre'];
122
			$GLOBALS['_LIEN_']['titre'] = $options['titre'];
124
        } else {
123
		} else {
125
        	if (!empty($aso_site['gs_titre'])) {
124
			if (!empty($aso_site['gs_titre'])) {
126
				$GLOBALS['_LIEN_']['titre'] = $aso_site['gs_titre'];
125
				$GLOBALS['_LIEN_']['titre'] = $aso_site['gs_titre'];
127
        	} else {
126
			} else {
128
				$GLOBALS['_LIEN_']['titre'] = $aso_site['gs_nom'];
127
				$GLOBALS['_LIEN_']['titre'] = $aso_site['gs_nom'];
129
        	}
128
			}
130
        }
129
		}
131
    	$une_url->setUrlType('SITE');
130
		$une_url->setUrlType('SITE');
132
    	$une_url->setId($aso_site['gs_id_site']);
131
		$une_url->setId($aso_site['gs_id_site']);
133
	}
132
	}
134
	// Les menus
133
	// Les menus
135
	if ($niveau == "menu") {
134
	if ($niveau == "menu") {
136
		if (preg_match('/^[0-9]+$/', $identifiant)) {
135
		if (preg_match('/^[0-9]+$/', $identifiant)) {
137
			$aso_menu = GEN_lireInfoMenu($bdd, GEN_retournerIdMenuParCodeNum($bdd, $identifiant), DB_FETCHMODE_ASSOC);
136
			$aso_menu = GEN_lireInfoMenu($bdd, GEN_retournerIdMenuParCodeNum($bdd, $identifiant), DB_FETCHMODE_ASSOC);
138
		} else {
137
		} else {
139
			$aso_menu = GEN_lireInfoMenu($bdd, GEN_retournerIdMenuParCodeNum($bdd, GEN_retournerMenuCodeNum($bdd, $identifiant)), DB_FETCHMODE_ASSOC);
138
			$aso_menu = GEN_lireInfoMenu($bdd, GEN_retournerIdMenuParCodeNum($bdd, GEN_retournerMenuCodeNum($bdd, $identifiant)), DB_FETCHMODE_ASSOC);
140
		}
139
		}
141
        if (isset($options['titre'])) {
140
		if (isset($options['titre'])) {
142
        	$GLOBALS['_LIEN_']['titre'] = $options['titre'];
141
			$GLOBALS['_LIEN_']['titre'] = $options['titre'];
143
        } else {
142
		} else {
144
        	if (!empty($aso_menu['gm_titre'])) {
143
			if (!empty($aso_menu['gm_titre'])) {
145
				$GLOBALS['_LIEN_']['titre'] = $aso_menu['gm_titre'];
144
				$GLOBALS['_LIEN_']['titre'] = $aso_menu['gm_titre'];
146
            } elseif (!empty($aso_menu['gm_titre_alternatif'])) {
145
			} elseif (!empty($aso_menu['gm_titre_alternatif'])) {
147
				$GLOBALS['_LIEN_']['titre'] = $aso_menu['gm_titre_alternatif'];
146
				$GLOBALS['_LIEN_']['titre'] = $aso_menu['gm_titre_alternatif'];
148
            } elseif (!empty($aso_menu['gm_nom'])) {
147
			} elseif (!empty($aso_menu['gm_nom'])) {
149
				$GLOBALS['_LIEN_']['titre'] = $aso_menu['gm_nom'];
148
				$GLOBALS['_LIEN_']['titre'] = $aso_menu['gm_nom'];
150
            }
149
			}
151
        }
150
		}
152
    	$une_url->setId($aso_menu['gm_id_menu']);
151
		$une_url->setId($aso_menu['gm_id_menu']);
153
    }
152
	}
154
	    
153
		
155
	if ($langue_url != GEN_I18N_ID_DEFAUT) {
154
	if ($langue_url != GEN_I18N_ID_DEFAUT) {
156
		$une_url->addQueryString(GEN_URL_CLE_I18N, $langue_url);
155
		$une_url->addQueryString(GEN_URL_CLE_I18N, $langue_url);
157
	} 
156
	} 
158
	$GLOBALS['_LIEN_']['url'] = $une_url->getURL();
157
	$GLOBALS['_LIEN_']['url'] = $une_url->getURL();
Line 159... Line 158...
159
	$GLOBALS['_LIEN_']['titre'] = htmlentities($GLOBALS['_LIEN_']['titre']);
158
	$GLOBALS['_LIEN_']['titre'] = htmlentities($GLOBALS['_LIEN_']['titre']);
160
	
159
	
161
	//+----------------------------------------------------------------------------------------------------------------+
160
	//+----------------------------------------------------------------------------------------------------------------+
162
    // Extrait les variables et les ajoutes à l'espace de noms local
161
	// Extrait les variables et les ajoutes à l'espace de noms local
163
	// Gestion des squelettes
162
	// Gestion des squelettes
164
	extract($GLOBALS['_LIEN_']);
163
	extract($GLOBALS['_LIEN_']);
165
	// Démarre le buffer
164
	// Démarre le buffer
Line 171... Line 170...
171
	// Arrête et détruit le buffer
170
	// Arrête et détruit le buffer
172
	ob_end_clean();
171
	ob_end_clean();
Line 173... Line 172...
173
	
172
	
174
	//+----------------------------------------------------------------------------------------------------------------+
173
	//+----------------------------------------------------------------------------------------------------------------+
175
	// Sortie
174
	// Sortie
176
    return $sortie;
175
	return $sortie;
177
}
-
 
178
 
-
 
179
/* +--Fin du code ----------------------------------------------------------------------------------------+
-
 
180
*
-
 
181
* $Log: not supported by cvs2svn $
-
 
182
* Revision 1.1  2006-12-08 20:08:59  jp_milcent
-
 
183
* Ajout de l'apllette Lien.
-
 
184
*
-
 
185
*
-
 
186
* +-- Fin du code ----------------------------------------------------------------------------------------+
-
 
187
*/
176
}
188
?>
177
?>