Subversion Repositories Sites.tela-botanica.org

Rev

Rev 415 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
415 jpm 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 wikini.                                                                         |
9
// |                                                                                                      |
10
// | wikini 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
// | wikini 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$
25
/**
26
* wikini - galerie.php
27
*
28
* Description :
29
*
30
*@package wikini
31
//Auteur original :
32
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
//Autres auteurs :
34
*@author        Aucun
35
*@copyright     Tela-Botanica 1999-2007
36
*@version       $Revision$ $Date$
37
// +------------------------------------------------------------------------------------------------------+
38
*/
39
 
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTÊTE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
43
// Définition de constantes
44
define('DS', DIRECTORY_SEPARATOR);
45
/** Constante "dynamique" stockant le chemin absolue de base de l'application recherche de plante.*/
46
define('GAL_CHEMIN_APPLI', dirname(realpath(__FILE__)).DS);
47
/** Constante "dynamique" stockant le chemin relatif de base de l'application recherche de plante.*/
48
define('GAL_CHEMIN_APPLI_RELATIF', str_replace($_SERVER['DOCUMENT_ROOT'], '', GAL_CHEMIN_APPLI));
49
 
50
// Initialisation des variables
51
$sortie = '';
52
$GLOBALS['_GALLERIE_']['erreur'] = '';
53
 
54
// Inclusion du fichier de config de l'action
55
require_once GAL_CHEMIN_APPLI.'galerie'.DS.'configuration'.DS.'gal_config.inc.php';
56
 
57
//+----------------------------------------------------------------------------------------------------------------+
58
// Récupération des paramêtres et gestion des erreurs de paramètrage
59
if (!$this->GetParameter('dossier')) {
60
	$options['dossier'] = null;
61
	$GLOBALS['_GALERIE_']['erreur'] = "Applette GALERIE : le paramètre 'dossier' est obligatoire !";
62
} else {
63
	$options['dossier'] = rtrim($this->GetParameter('dossier'), '/');
64
}
65
if (!$this->GetParameter('id')) {
66
	$options['id'] = microtime();
67
	//$GLOBALS['_GALERIE_']['erreur'] = "Applette GALERIE : le paramètre 'id' est obligatoire !";
68
} else {
69
	$options['id'] = $this->GetParameter('id');
70
}
71
if (!$this->GetParameter('largeur')) {
72
    $options['largeur'] = 160;
73
} else {
74
	$options['largeur'] = $this->GetParameter('largeur');
75
}
76
if (!$this->GetParameter('hauteur')) {
77
    $options['hauteur'] = 160;
78
} else {
79
	$options['hauteur'] = $this->GetParameter('hauteur');
80
}
81
if (!isset($options['qualite'])) {
82
    $options['qualite'] = 70;
83
}
84
if (!isset($options['img_largeur'])) {
85
    $options['img_largeur'] = 800;
86
}
87
if (!isset($options['img_hauteur'])) {
88
    $options['img_hauteur'] = 600;
89
}
90
if (!isset($options['img_qualite'])) {
91
    $options['img_qualite'] = 70;
92
}
434 jpm 93
if (!isset($options['squelette'])) {
94
    $options['squelette'] = GAL_SQUELETTE_LISTE;
95
}
415 jpm 96
// +------------------------------------------------------------------------------------------------------+
97
// |                                            CORPS du PROGRAMME                                        |
98
// +------------------------------------------------------------------------------------------------------+
99
//+----------------------------------------------------------------------------------------------------------------+
100
// Récupération des données
101
$noimage = 0;
102
$GLOBALS['_GALERIE_']['id'] = $options['id'];
103
$GLOBALS['_GALERIE_']['dossier'] = GAL_CHEMIN_RACINE.$options['dossier'];
104
if (is_dir($GLOBALS['_GALERIE_']['dossier'])) {
105
	if ($dh = opendir($GLOBALS['_GALERIE_']['dossier'])) {
106
		while (($f = readdir($dh)) !== false) {
107
			if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'gif') || (substr(strtolower($f),-3) == 'png')) {
108
				$noimage++;
109
				$images[] = array('filename' => $f);
110
				array_multisort($images, SORT_ASC, SORT_REGULAR);
111
			}
112
		}
113
		closedir($dh);
114
	}
115
} else {
116
	$GLOBALS['_GALERIE_']['erreur'] = "Applette GALERIE : le dossier d'images est introuvable à : ".$GLOBALS['_GALERIE_']['dossier'];
117
}
118
 
119
if($noimage) {
120
	$GLOBALS['_GALERIE_']['css']['chemin'] = GAL_CHEMIN_STYLES_RELATIF;
434 jpm 121
	$GLOBALS['_GALERIE_']['css']['largeur'] = $options['largeur'];
415 jpm 122
	$GLOBALS['_GALERIE_']['script']['chemin'] = GAL_CHEMIN_SCRIPTS_RELATIF;
123
	$GLOBALS['_GALERIE_']['images'] = array();
124
	foreach($images as $image) {
125
		if ($image['filename'] != '') {
126
			$aso_img['fichier_nom'] = $image['filename'];
434 jpm 127
			$aso_img['url_img'] = 'http://'.$_SERVER['HTTP_HOST'].GAL_CHEMIN_SCRIPTS_RELATIF.'showthumb.php?img='.urlencode(GAL_CHEMIN_RACINE.$options['dossier'].DS.$image['filename']).'&amp;width='.$options['img_largeur'].'&amp;height='.$options['img_hauteur'].'&amp;quality='.$options['img_qualite'].'&amp;centrage=0';
128
			$aso_img['url_img_mini'] = 'http://'.$_SERVER['HTTP_HOST'].GAL_CHEMIN_SCRIPTS_RELATIF.'showthumb.php?img='.urlencode(GAL_CHEMIN_RACINE.$options['dossier'].DS.$image['filename']).'&amp;width='.$options['largeur'].'&amp;height='.$options['hauteur'].'&amp;quality='.$options['qualite'].'&amp;centrage=1';
415 jpm 129
			$GLOBALS['_GALERIE_']['images'][] = $aso_img;
130
		}
131
 	}
132
}
133
 
134
//+----------------------------------------------------------------------------------------------------------------+
135
// Gestion des squelettes
136
// Extrait les variables et les ajoutes à l'espace de noms local
137
extract($GLOBALS['_GALERIE_']);
138
// Démarre le buffer
139
ob_start();
140
// Inclusion du fichier
434 jpm 141
include GAL_CHEMIN_SQUELETTE.$options['squelette'];
415 jpm 142
// Récupérer le  contenu du buffer
143
$sortie = ob_get_contents();
144
// Arrête et détruit le buffer
145
ob_end_clean();
146
 
147
//+----------------------------------------------------------------------------------------------------------------+
148
// Sortie
149
echo $sortie;
150
 
151
/* +--Fin du code ----------------------------------------------------------------------------------------+
152
*
153
* $Log$
154
*
155
* +-- Fin du code ----------------------------------------------------------------------------------------+
156
*/
157
?>