Subversion Repositories Applications.galerie

Rev

Rev 3 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 8
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: gallerie.php,v 1.2 2006-12-08 16:00:11 jp_milcent Exp $
24
// CVS : $Id: gallerie.php,v 1.3 2007-11-28 17:22:28 jp_milcent Exp $
25
/**
25
/**
26
* papyrus_bp - gallerie.php
26
* papyrus_bp - gallerie.php
27
*
27
*
28
* Le code provient de "Simple Image Gallery" (in content items) Plugin for Joomla 1.0.x - Version 1.0
28
* Le code provient de "Simple Image Gallery" (in content items) Plugin for Joomla 1.0.x - Version 1.0
29
* License: http://www.gnu.org/copyleft/gpl.html
29
* License: http://www.gnu.org/copyleft/gpl.html
30
* Authors: Fotis Evangelou - George Chouliaras
30
* Authors: Fotis Evangelou - George Chouliaras
31
* Project page at http://www.joomlaworks.gr - Demos at http://demo.joomlaworks.gr
31
* Project page at http://www.joomlaworks.gr - Demos at http://demo.joomlaworks.gr
32
* ***Last update: December 5th, 2006***
32
* ***Last update: December 5th, 2006***
33
*
33
*
34
*@package papyrus_bp
34
*@package papyrus_bp
35
//Auteur original :
35
//Auteur original :
36
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
36
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
37
//Autres auteurs :
37
//Autres auteurs :
38
*@author        Aucun
38
*@author        Aucun
39
*@copyright     Tela-Botanica 1999-2006
39
*@copyright     Tela-Botanica 1999-2006
40
*@version       $Revision: 1.2 $ $Date: 2006-12-08 16:00:11 $
40
*@version       $Revision: 1.3 $ $Date: 2007-11-28 17:22:28 $
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
*/
42
*/
43
 
43
 
44
// +------------------------------------------------------------------------------------------------------+
44
// +------------------------------------------------------------------------------------------------------+
45
// |                                            ENTÊTE du PROGRAMME                                       |
45
// |                                            ENTÊTE du PROGRAMME                                       |
46
// +------------------------------------------------------------------------------------------------------+
46
// +------------------------------------------------------------------------------------------------------+
47
 
47
 
48
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherGallerie';
48
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherGallerie';
49
$GLOBALS['_GEN_commun']['info_applette_balise'] = '\{\{[Gg]allerie(?:\s*(?:(dossier="[^"]+")|(largeur="[^"]+")|(hauteur="[^"]+")|(qualite="[^"]+")|))+\s*\}\}';
49
$GLOBALS['_GEN_commun']['info_applette_balise'] = '\{\{[Gg]allerie(?:\s*(?:(dossier="[^"]+")|(largeur="[^"]+")|(hauteur="[^"]+")|(qualite="[^"]+")|))+\s*\}\}';
50
 
50
 
51
/** Inclusion du fichier de configuration de cette application.*/
51
/** Inclusion du fichier de configuration de cette application.*/
52
require_once GEN_CHEMIN_CLIENT.'gallerie'.GEN_SEP.'configuration'.GEN_SEP.'gall_config.inc.php';
52
require_once GEN_CHEMIN_CLIENT.'gallerie'.GEN_SEP.'configuration'.GEN_SEP.'gall_config.inc.php';
53
 
53
 
54
// +------------------------------------------------------------------------------------------------------+
54
// +------------------------------------------------------------------------------------------------------+
55
// |                                            CORPS du PROGRAMME                                        |
55
// |                                            CORPS du PROGRAMME                                        |
56
// +------------------------------------------------------------------------------------------------------+
56
// +------------------------------------------------------------------------------------------------------+
57
/** Fonction afficherCategorie() - Retourne la liste des pages d'une catégorie.
57
/** Fonction afficherCategorie() - Retourne la liste des pages d'une catégorie.
58
*
58
*
59
* Cette fonction retourne la liste des pages appartenant à une catégorie donnée.
59
* Cette fonction retourne la liste des pages appartenant à une catégorie donnée.
60
*
60
*
61
* @param  array contient les arguments de la fonction.
61
* @param  array contient les arguments de la fonction.
62
* @param  array  tableau global de Papyrus.
62
* @param  array  tableau global de Papyrus.
63
* @return string HTML la liste des listes de menus.
63
* @return string HTML la liste des listes de menus.
64
*/
64
*/
65
function afficherGallerie($tab_applette_arguments, $_GEN_commun)
65
function afficherGallerie($tab_applette_arguments, $_GEN_commun)
66
{
66
{
67
	// Initialisation des variables
67
	// Initialisation des variables
68
    $sortie = '';
68
    $sortie = '';
69
	$GLOBALS['_GALLERIE_']['erreur'] = '';
69
	$GLOBALS['_GALLERIE_']['erreur'] = '';
70
	
70
	
71
	//+----------------------------------------------------------------------------------------------------------------+
71
	//+----------------------------------------------------------------------------------------------------------------+
72
	// Gestion des arguments
72
	// Gestion des arguments
73
	$tab_arguments = $tab_applette_arguments;
73
	$tab_arguments = $tab_applette_arguments;
74
	unset($tab_arguments[0]);
74
	unset($tab_arguments[0]);
75
    foreach($tab_arguments as $argument) {
75
    foreach($tab_arguments as $argument) {
76
	    $tab_parametres = explode('=', trim($argument));
76
	    $tab_parametres = explode('=', trim($argument));
77
	    $options[$tab_parametres[0]] = trim($tab_parametres[1], '"'); 
77
	    $options[$tab_parametres[0]] = trim($tab_parametres[1], '"'); 
78
    }
78
    }
79
 
79
 
80
	//+----------------------------------------------------------------------------------------------------------------+
80
	//+----------------------------------------------------------------------------------------------------------------+
81
    // Gestion des erreurs de paramètrage
81
    // Gestion des erreurs de paramètrage
82
    if (!isset($options['dossier'])) {
82
    if (!isset($options['dossier'])) {
83
        $GLOBALS['_GALLERIE_']['erreur'] = "Applette GALLERIE : le paramètre 'dossier' est obligatoire !";
83
        $GLOBALS['_GALLERIE_']['erreur'] = "Applette GALLERIE : le paramètre 'dossier' est obligatoire !";
84
    }
84
    }
85
    if (!isset($options['largeur'])) {
85
    if (!isset($options['largeur'])) {
86
        $options['largeur'] = 160;
86
        $options['largeur'] = 160;
87
    }
87
    }
88
    if (!isset($options['hauteur'])) {
88
    if (!isset($options['hauteur'])) {
89
        $options['hauteur'] = 160;
89
        $options['hauteur'] = 160;
90
    }
90
    }
91
    if (!isset($options['qualite'])) {
91
    if (!isset($options['qualite'])) {
92
        $options['qualite'] = 70;
92
        $options['qualite'] = 70;
93
    }
93
    }
-
 
94
	if (!isset($options['img_largeur'])) {
-
 
95
        $options['img_largeur'] = 800;
-
 
96
    }
-
 
97
    if (!isset($options['img_hauteur'])) {
-
 
98
        $options['img_hauteur'] = 600;
94
 
99
    }
-
 
100
    if (!isset($options['img_qualite'])) {
-
 
101
        $options['img_qualite'] = 70;
-
 
102
    }
95
    //+----------------------------------------------------------------------------------------------------------------+
103
    //+----------------------------------------------------------------------------------------------------------------+
96
    // Récupération des données	
104
    // Récupération des données	
97
	$noimage = 0;
105
	$noimage = 0;
98
	$GLOBALS['_GALLERIE_']['dossier'] = PAP_CHEMIN_RACINE.$options['dossier'];
106
	$GLOBALS['_GALLERIE_']['dossier'] = PAP_CHEMIN_RACINE.$options['dossier'];
99
	if (is_dir($GLOBALS['_GALLERIE_']['dossier'])) {
107
	if (is_dir($GLOBALS['_GALLERIE_']['dossier'])) {
100
		if ($dh = opendir($GLOBALS['_GALLERIE_']['dossier'])) {
108
		if ($dh = opendir($GLOBALS['_GALLERIE_']['dossier'])) {
101
			while (($f = readdir($dh)) !== false) {
109
			while (($f = readdir($dh)) !== false) {
102
				if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'gif') || (substr(strtolower($f),-3) == 'png')) {
110
				if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'gif') || (substr(strtolower($f),-3) == 'png')) {
103
					$noimage++;
111
					$noimage++;
104
					$images[] = array('filename' => $f);
112
					$images[] = array('filename' => $f);
105
					array_multisort($images, SORT_ASC, SORT_REGULAR); 
113
					array_multisort($images, SORT_ASC, SORT_REGULAR); 
106
				}
114
				}
107
			}
115
			}
108
			closedir($dh);
116
			closedir($dh);
109
		}
117
		}
110
	} else {
118
	} else {
111
		$GLOBALS['_GALLERIE_']['erreur'] = "Applette GALLERIE : le dossier d'images est introuvable à : ".$GLOBALS['_GALLERIE_']['dossier'];
119
		$GLOBALS['_GALLERIE_']['erreur'] = "Applette GALLERIE : le dossier d'images est introuvable à : ".$GLOBALS['_GALLERIE_']['dossier'];
112
	}
120
	}
113
   
121
   
114
   if($noimage) {
122
   if($noimage) {
115
   		$GLOBALS['_GALLERIE_']['css']['chemin'] = GALL_CHEMIN_STYLES;
123
   		$GLOBALS['_GALLERIE_']['css']['chemin'] = GALL_CHEMIN_STYLES;
116
   		$GLOBALS['_GALLERIE_']['css']['largeur'] = $options['largeur']+10;
124
   		$GLOBALS['_GALLERIE_']['css']['largeur'] = $options['largeur']+10;
117
   		$GLOBALS['_GALLERIE_']['script']['chemin'] = GALL_CHEMIN_SCRIPTS;
125
   		$GLOBALS['_GALLERIE_']['script']['chemin'] = GALL_CHEMIN_SCRIPTS;
118
   		$GLOBALS['_GALLERIE_']['images'] = array();
126
   		$GLOBALS['_GALLERIE_']['images'] = array();
119
   		foreach($images as $image) {
127
   		foreach($images as $image) {
120
			if ($image['filename'] != '') {
128
			if ($image['filename'] != '') {
121
				$aso_img['fichier_nom'] = $image['filename'];
129
				$aso_img['fichier_nom'] = $image['filename'];
122
				$aso_img['url_img'] = $options['dossier'].'/'.$image['filename'];
130
				$aso_img['url_img'] = preg_replace('/papyrus\.php$/', '', PAP_URL).GALL_CHEMIN_SCRIPTS.'showthumb.php?img='.urlencode(PAP_CHEMIN_RACINE.$options['dossier'].'/'.$image['filename']).'&amp;width='.$options['img_largeur'].'&amp;height='.$options['img_hauteur'].'&amp;quality='.$options['img_qualite'];
123
				$aso_img['url_img_mini'] = preg_replace('/papyrus\.php$/', '', PAP_URL).GALL_CHEMIN_SCRIPTS.'showthumb.php?img='.urlencode(PAP_CHEMIN_RACINE.$options['dossier'].'/'.$image['filename']).'&amp;width='.$options['largeur'].'&amp;height='.$options['hauteur'].'&amp;quality='.$options['qualite']; 
131
				$aso_img['url_img_mini'] = preg_replace('/papyrus\.php$/', '', PAP_URL).GALL_CHEMIN_SCRIPTS.'showthumb.php?img='.urlencode(PAP_CHEMIN_RACINE.$options['dossier'].'/'.$image['filename']).'&amp;width='.$options['largeur'].'&amp;height='.$options['hauteur'].'&amp;quality='.$options['qualite']; 
124
				$GLOBALS['_GALLERIE_']['images'][] = $aso_img;
132
				$GLOBALS['_GALLERIE_']['images'][] = $aso_img;
125
			}
133
			}
126
     	}
134
     	}
127
	}
135
	}
128
	
136
	
129
	//+----------------------------------------------------------------------------------------------------------------+
137
	//+----------------------------------------------------------------------------------------------------------------+
130
	// Gestion des squelettes
138
	// Gestion des squelettes
131
    // Extrait les variables et les ajoutes à l'espace de noms local
139
    // Extrait les variables et les ajoutes à l'espace de noms local
132
	extract($GLOBALS['_GALLERIE_']);
140
	extract($GLOBALS['_GALLERIE_']);
133
	// Démarre le buffer
141
	// Démarre le buffer
134
	ob_start();
142
	ob_start();
135
	// Inclusion du fichier
143
	// Inclusion du fichier
136
	include(GALL_CHEMIN_SQUELETTE.GALL_SQUELETTE_LISTE);
144
	include(GALL_CHEMIN_SQUELETTE.GALL_SQUELETTE_LISTE);
137
	// Récupérer le  contenu du buffer
145
	// Récupérer le  contenu du buffer
138
	$sortie = ob_get_contents();
146
	$sortie = ob_get_contents();
139
	// Arrête et détruit le buffer
147
	// Arrête et détruit le buffer
140
	ob_end_clean();
148
	ob_end_clean();
141
 
149
 
142
	//+----------------------------------------------------------------------------------------------------------------+
150
	//+----------------------------------------------------------------------------------------------------------------+
143
	// Sortie
151
	// Sortie
144
	return $sortie;
152
	return $sortie;
145
}
153
}
146
 
154
 
147
/* +--Fin du code ----------------------------------------------------------------------------------------+
155
/* +--Fin du code ----------------------------------------------------------------------------------------+
148
*
156
*
149
* $Log: not supported by cvs2svn $
157
* $Log: not supported by cvs2svn $
-
 
158
* Revision 1.2  2006-12-08 16:00:11  jp_milcent
-
 
159
* Correction bogue : variable indéfinie.
-
 
160
*
150
* Revision 1.1  2006/12/07 17:29:20  jp_milcent
161
* Revision 1.1  2006/12/07 17:29:20  jp_milcent
151
* Ajout de l'applette Gallerie dans Client car elle n'a pas un rapport direct avec Papyrus.
162
* Ajout de l'applette Gallerie dans Client car elle n'a pas un rapport direct avec Papyrus.
152
*
163
*
153
* Revision 1.2  2006/12/07 16:25:23  jp_milcent
164
* Revision 1.2  2006/12/07 16:25:23  jp_milcent
154
* Ajout de la gestion de messages d'erreur.
165
* Ajout de la gestion de messages d'erreur.
155
* Ajout de la gestion des squelettes.
166
* Ajout de la gestion des squelettes.
156
*
167
*
157
* Revision 1.1  2006/12/07 15:39:47  jp_milcent
168
* Revision 1.1  2006/12/07 15:39:47  jp_milcent
158
* Ajout de l'applette Gallerie.
169
* Ajout de l'applette Gallerie.
159
*
170
*
160
*
171
*
161
* +-- Fin du code ----------------------------------------------------------------------------------------+
172
* +-- Fin du code ----------------------------------------------------------------------------------------+
162
*/
173
*/
163
?>
174
?>