Subversion Repositories Sites.tela-botanica.org

Rev

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

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