2 |
jp_milcent |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 5.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This file is part of papyrus_bp. |
|
|
|
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 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
24 |
// CVS : $Id: gallerie.php,v 1.1 2006-12-07 17:29:20 jp_milcent Exp $
|
|
|
25 |
/**
|
|
|
26 |
* papyrus_bp - gallerie.php
|
|
|
27 |
*
|
|
|
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
|
|
|
30 |
* Authors: Fotis Evangelou - George Chouliaras
|
|
|
31 |
* Project page at http://www.joomlaworks.gr - Demos at http://demo.joomlaworks.gr
|
|
|
32 |
* ***Last update: December 5th, 2006***
|
|
|
33 |
*
|
|
|
34 |
*@package papyrus_bp
|
|
|
35 |
//Auteur original :
|
|
|
36 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
37 |
//Autres auteurs :
|
|
|
38 |
*@author Aucun
|
|
|
39 |
*@copyright Tela-Botanica 1999-2006
|
|
|
40 |
*@version $Revision: 1.1 $ $Date: 2006-12-07 17:29:20 $
|
|
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
42 |
*/
|
|
|
43 |
|
|
|
44 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
45 |
// | ENTÊTE du PROGRAMME |
|
|
|
46 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
47 |
|
|
|
48 |
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherGallerie';
|
|
|
49 |
$GLOBALS['_GEN_commun']['info_applette_balise'] = '\{\{[Gg]allerie(?: (?:(dossier="[^"]+")|(largeur="[^"]+")|(hauteur="[^"]+")|(qualite="[^"]+")))+\}\}';
|
|
|
50 |
|
|
|
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';
|
|
|
53 |
|
|
|
54 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
55 |
// | CORPS du PROGRAMME |
|
|
|
56 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
57 |
/** Fonction afficherCategorie() - Retourne la liste des pages d'une catégorie.
|
|
|
58 |
*
|
|
|
59 |
* Cette fonction retourne la liste des pages appartenant à une catégorie donnée.
|
|
|
60 |
*
|
|
|
61 |
* @param array contient les arguments de la fonction.
|
|
|
62 |
* @param array tableau global de Papyrus.
|
|
|
63 |
* @return string HTML la liste des listes de menus.
|
|
|
64 |
*/
|
|
|
65 |
function afficherGallerie($tab_applette_arguments, $_GEN_commun)
|
|
|
66 |
{
|
|
|
67 |
// Initialisation des variables
|
|
|
68 |
$sortie = '';
|
|
|
69 |
|
|
|
70 |
$tab_arguments = $tab_applette_arguments;
|
|
|
71 |
unset($tab_arguments[0]);
|
|
|
72 |
foreach($tab_arguments as $argument) {
|
|
|
73 |
$tab_parametres = explode('=', trim($argument));
|
|
|
74 |
$options[$tab_parametres[0]] = trim($tab_parametres[1], '"');
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
if (!isset($options['dossier'])) {
|
|
|
78 |
$GLOBALS['_GALLERIE_']['erreur'] = "Applette GALLERIE : le paramètre 'dossier' est obligatoire !";
|
|
|
79 |
}
|
|
|
80 |
if (!isset($options['largeur'])) {
|
|
|
81 |
$options['largeur'] = 160;
|
|
|
82 |
}
|
|
|
83 |
if (!isset($options['hauteur'])) {
|
|
|
84 |
$options['hauteur'] = 160;
|
|
|
85 |
}
|
|
|
86 |
if (!isset($options['qualite'])) {
|
|
|
87 |
$options['qualite'] = 70;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
$noimage = 0;
|
|
|
91 |
// Read directory
|
|
|
92 |
$GLOBALS['_GALLERIE_']['dossier'] = PAP_CHEMIN_RACINE.$options['dossier'];
|
|
|
93 |
if (is_dir($GLOBALS['_GALLERIE_']['dossier'])) {
|
|
|
94 |
if ($dh = opendir($GLOBALS['_GALLERIE_']['dossier'])) {
|
|
|
95 |
while (($f = readdir($dh)) !== false) {
|
|
|
96 |
if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'gif') || (substr(strtolower($f),-3) == 'png')) {
|
|
|
97 |
$noimage++;
|
|
|
98 |
$images[] = array('filename' => $f);
|
|
|
99 |
array_multisort($images, SORT_ASC, SORT_REGULAR);
|
|
|
100 |
}
|
|
|
101 |
}
|
|
|
102 |
closedir($dh);
|
|
|
103 |
}
|
|
|
104 |
} else {
|
|
|
105 |
$GLOBALS['_GALLERIE_']['erreur'] = "Applette GALLERIE : le dossier d'images est introuvable à : ".$GLOBALS['_GALLERIE_']['dossier'];
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
if($noimage) {
|
|
|
109 |
$GLOBALS['_GALLERIE_']['css']['chemin'] = GALL_CHEMIN_STYLES;
|
|
|
110 |
$GLOBALS['_GALLERIE_']['css']['largeur'] = $options['largeur']+10;
|
|
|
111 |
$GLOBALS['_GALLERIE_']['script']['chemin'] = GALL_CHEMIN_SCRIPTS;
|
|
|
112 |
$GLOBALS['_GALLERIE_']['images'] = array();
|
|
|
113 |
foreach($images as $image) {
|
|
|
114 |
if ($image['filename'] != '') {
|
|
|
115 |
$aso_img['fichier_nom'] = $image['filename'];
|
|
|
116 |
$aso_img['url_img'] = $options['dossier'].'/'.$image['filename'];
|
|
|
117 |
$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']).'&width='.$options['largeur'].'&height='.$options['hauteur'].'&quality='.$options['qualite'];
|
|
|
118 |
$GLOBALS['_GALLERIE_']['images'][] = $aso_img;
|
|
|
119 |
}
|
|
|
120 |
}
|
|
|
121 |
}
|
|
|
122 |
// Extrait les variables et les ajoutes à l'espace de noms local
|
|
|
123 |
extract($GLOBALS['_GALLERIE_']);
|
|
|
124 |
// Démarre le buffer
|
|
|
125 |
ob_start();
|
|
|
126 |
// Inclusion du fichier
|
|
|
127 |
include(GALL_CHEMIN_SQUELETTE.GALL_SQUELETTE_LISTE);
|
|
|
128 |
// Récupérer le contenu du buffer
|
|
|
129 |
$sortie = ob_get_contents();
|
|
|
130 |
// Arrête et détruit le buffer
|
|
|
131 |
ob_end_clean();
|
|
|
132 |
|
|
|
133 |
return $sortie;
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
137 |
*
|
|
|
138 |
* $Log: not supported by cvs2svn $
|
|
|
139 |
* Revision 1.2 2006/12/07 16:25:23 jp_milcent
|
|
|
140 |
* Ajout de la gestion de messages d'erreur.
|
|
|
141 |
* Ajout de la gestion des squelettes.
|
|
|
142 |
*
|
|
|
143 |
* Revision 1.1 2006/12/07 15:39:47 jp_milcent
|
|
|
144 |
* Ajout de l'applette Gallerie.
|
|
|
145 |
*
|
|
|
146 |
*
|
|
|
147 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
148 |
*/
|
|
|
149 |
?>
|