| 434 | 
           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.'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'] = $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 | 
           }
  | 
        
        
            | 
            | 
           93 | 
              | 
        
        
            | 
            | 
           94 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           95 | 
           // |                                            CORPS du PROGRAMME                                        |
  | 
        
        
            | 
            | 
           96 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           97 | 
           //+----------------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           98 | 
           // Récupération des données
  | 
        
        
            | 
            | 
           99 | 
           $noimage = 0;
  | 
        
        
            | 
            | 
           100 | 
           $GLOBALS['_GALERIE_']['id'] = $options['id'];
  | 
        
        
            | 
            | 
           101 | 
           $GLOBALS['_GALERIE_']['dossier'] = GAL_CHEMIN_RACINE.$options['dossier'];
  | 
        
        
            | 
            | 
           102 | 
           if (is_dir($GLOBALS['_GALERIE_']['dossier'])) {
  | 
        
        
            | 
            | 
           103 | 
           	if ($dh = opendir($GLOBALS['_GALERIE_']['dossier'])) {
  | 
        
        
            | 
            | 
           104 | 
           		while (($f = readdir($dh)) !== false) {
  | 
        
        
            | 
            | 
           105 | 
           			if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'gif') || (substr(strtolower($f),-3) == 'png')) {
  | 
        
        
            | 
            | 
           106 | 
           				$noimage++;
  | 
        
        
            | 
            | 
           107 | 
           				$images[] = array('filename' => $f, 'hauteur' => $h, 'largeur' => $w);
  | 
        
        
            | 
            | 
           108 | 
           				array_multisort($images, SORT_ASC, SORT_REGULAR);
  | 
        
        
            | 
            | 
           109 | 
           			}
  | 
        
        
            | 
            | 
           110 | 
           		}
  | 
        
        
            | 
            | 
           111 | 
           		closedir($dh);
  | 
        
        
            | 
            | 
           112 | 
           	}
  | 
        
        
            | 
            | 
           113 | 
           } else {
  | 
        
        
            | 
            | 
           114 | 
           	$GLOBALS['_GALERIE_']['erreur'] = "Applette GALERIE : le dossier d'images est introuvable à : ".$GLOBALS['_GALERIE_']['dossier'];
  | 
        
        
            | 
            | 
           115 | 
           }
  | 
        
        
            | 
            | 
           116 | 
              | 
        
        
            | 
            | 
           117 | 
           if($noimage) {
  | 
        
        
            | 
            | 
           118 | 
           	$GLOBALS['_GALERIE_']['css']['chemin'] = GAL_CHEMIN_STYLES_RELATIF;
  | 
        
        
            | 
            | 
           119 | 
           	$GLOBALS['_GALERIE_']['css']['largeur'] = $options['largeur'];
  | 
        
        
            | 
            | 
           120 | 
           	$GLOBALS['_GALERIE_']['script']['chemin'] = GAL_CHEMIN_SCRIPTS_RELATIF;
  | 
        
        
            | 
            | 
           121 | 
           	$GLOBALS['_GALERIE_']['images'] = array();
  | 
        
        
            | 
            | 
           122 | 
           	foreach($images as $image) {
  | 
        
        
            | 
            | 
           123 | 
           		if ($image['filename'] != '') {
  | 
        
        
            | 
            | 
           124 | 
           			$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']).'&width='.$options['img_largeur'].'&height='.$options['img_hauteur'].'&quality='.$options['img_qualite'];
  | 
        
        
            | 
            | 
           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']).'&width='.$options['img_largeur'].'&height='.$options['img_hauteur'].'&quality='.$options['qualite'];
  | 
        
        
            | 
            | 
           127 | 
           			$GLOBALS['_GALERIE_']['images'][] = $aso_img;
  | 
        
        
            | 
            | 
           128 | 
           		}
  | 
        
        
            | 
            | 
           129 | 
            	}
  | 
        
        
            | 
            | 
           130 | 
           }
  | 
        
        
            | 
            | 
           131 | 
              | 
        
        
            | 
            | 
           132 | 
           //+----------------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           133 | 
           // Gestion des squelettes
  | 
        
        
            | 
            | 
           134 | 
           // Extrait les variables et les ajoutes à l'espace de noms local
  | 
        
        
            | 
            | 
           135 | 
           extract($GLOBALS['_GALERIE_']);
  | 
        
        
            | 
            | 
           136 | 
           // Démarre le buffer
  | 
        
        
            | 
            | 
           137 | 
           ob_start();
  | 
        
        
            | 
            | 
           138 | 
           // Inclusion du fichier
  | 
        
        
            | 
            | 
           139 | 
           include GAL_CHEMIN_SQUELETTE.GAL_SQUELETTE_LISTE;
  | 
        
        
            | 
            | 
           140 | 
           // Récupérer le  contenu du buffer
  | 
        
        
            | 
            | 
           141 | 
           $sortie = ob_get_contents();
  | 
        
        
            | 
            | 
           142 | 
           // Arrête et détruit le buffer
  | 
        
        
            | 
            | 
           143 | 
           ob_end_clean();
  | 
        
        
            | 
            | 
           144 | 
              | 
        
        
            | 
            | 
           145 | 
           //+----------------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           146 | 
           // Sortie
  | 
        
        
            | 
            | 
           147 | 
           echo $sortie;
  | 
        
        
            | 
            | 
           148 | 
              | 
        
        
            | 
            | 
           149 | 
           /* +--Fin du code ----------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           150 | 
           *
  | 
        
        
            | 
            | 
           151 | 
           * $Log$
  | 
        
        
            | 
            | 
           152 | 
           *
  | 
        
        
            | 
            | 
           153 | 
           * +-- Fin du code ----------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           154 | 
           */
  | 
        
        
            | 
            | 
           155 | 
           ?>
  |