- Timestamp:
- 07/15/06 17:17:10 (2 years ago)
- Files:
-
- trunk/_conf/config.php (modified) (2 diffs)
- trunk/_conf/version.php (modified) (1 diff)
- trunk/_fonctions/affichage.php (modified) (5 diffs)
- trunk/_fonctions/class/commentaire.class.php (modified) (8 diffs)
- trunk/_fonctions/class/files.php (modified) (3 diffs)
- trunk/_fonctions/class/imagetoolkit.class.php (modified) (12 diffs)
- trunk/_fonctions/class/luxbumgallery.class.php (modified) (10 diffs)
- trunk/_fonctions/class/luxbumgallerylistdd.class.php (moved) (moved from trunk/_fonctions/class/luxbumgallerylist.class.php)
- trunk/_fonctions/class/luxbumimage.class.php (modified) (28 diffs)
- trunk/_fonctions/class/luxbumindex.class.php (modified) (1 diff)
- trunk/_fonctions/commentaire.php (modified) (1 diff)
- trunk/_fonctions/index.php (modified) (2 diffs)
- trunk/_fonctions/infos_exif.php (modified) (1 diff)
- trunk/_fonctions/luxbum.class.php (modified) (4 diffs)
- trunk/_fonctions/mysql.inc.php (modified) (1 diff)
- trunk/_fonctions/select.php (modified) (1 diff)
- trunk/_fonctions/selection_list.php (modified) (5 diffs)
- trunk/_fonctions/slideshow.php (modified) (3 diffs)
- trunk/_fonctions/vignette.php (modified) (6 diffs)
- trunk/_fonctions_manager/commentaires.php (modified) (2 diffs)
- trunk/_fonctions_manager/galerie.php (modified) (13 diffs)
- trunk/_fonctions_manager/generer_cache.php (added)
- trunk/_fonctions_manager/liste_galeries.php (modified) (10 diffs)
- trunk/_fonctions_manager/outils/diagnostic.php (modified) (1 diff)
- trunk/_fonctions_manager/parametres.php (modified) (5 diffs)
- trunk/_fonctions_manager/tri_galerie.php (added)
- trunk/_fonctions_manager/tri_index.php (added)
- trunk/_images/bg.png (added)
- trunk/_images/fleche_l62.png (added)
- trunk/_images/logo_linux62_photos.png (added)
- trunk/_images/navig/back.gif (modified) (previous)
- trunk/_images/navig/forward.gif (modified) (previous)
- trunk/_images/vide.gif (added)
- trunk/_javascript/scriptaculous (added)
- trunk/_javascript/scriptaculous/builder.js (added)
- trunk/_javascript/scriptaculous/controls.js (added)
- trunk/_javascript/scriptaculous/dragdrop.js (added)
- trunk/_javascript/scriptaculous/effects.js (added)
- trunk/_javascript/scriptaculous/prototype.js (added)
- trunk/_javascript/scriptaculous/scriptaculous.js (added)
- trunk/_javascript/scriptaculous/slider.js (added)
- trunk/_javascript/scriptaculous/unittest.js (added)
- trunk/_structure/affichage.mxt (modified) (1 diff)
- trunk/_structure/commentaire.mxt (modified) (1 diff)
- trunk/_structure/index.mxt (modified) (1 diff)
- trunk/_structure/index_vide.mxt (deleted)
- trunk/_structure/infos_exif.mxt (modified) (1 diff)
- trunk/_structure/slideshow.mxt (modified) (1 diff)
- trunk/_structure/vignette.mxt (modified) (1 diff)
- trunk/_structure/vignette_2col.mxt (deleted)
- trunk/_structure/vignette_3col.mxt (deleted)
- trunk/_structure_manager/commentaires.mxt (modified) (1 diff)
- trunk/_structure_manager/galerie.mxt (modified) (5 diffs)
- trunk/_structure_manager/generer_cache.mxt (added)
- trunk/_structure_manager/header.mxt (modified) (1 diff)
- trunk/_structure_manager/liste_galeries.mxt (modified) (3 diffs)
- trunk/_structure_manager/parametres.mxt (modified) (1 diff)
- trunk/_structure_manager/tri_galerie.mxt (added)
- trunk/_structure_manager/tri_index.mxt (added)
- trunk/_styles/manager.css (modified) (1 diff)
- trunk/_styles/style_dark.css (modified) (10 diffs)
- trunk/_styles/style_light.css (modified) (9 diffs)
- trunk/common.php (modified) (4 diffs)
- trunk/index.php (modified) (7 diffs)
- trunk/manager.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/_conf/config.php
r65 r68 2 2 define ('NOM_GALERIE', 'Galerie d\'images'); 3 3 define ('TEMPLATE_THEME', '2COL'); 4 define ('COLOR_THEME', 'l ight');4 define ('COLOR_THEME', 'l62'); 5 5 define ('USE_REWRITE', 'off'); 6 6 define ('MKDIR_SAFE_MODE', 'off'); … … 9 9 define ('MAX_FILE_SIZE', '2000'); 10 10 define ('SHOW_EXIF', 'on'); 11 define ('SHOW_COMMENTAIRE', 'o ff');11 define ('SHOW_COMMENTAIRE', 'on'); 12 12 define ('DBL_HOST', 'localhost'); 13 define ('DBL_NAME', ' ');14 define ('DBL_LOGIN', ' ');15 define ('DBL_PASSWORD', ' ');13 define ('DBL_NAME', 'luxbum'); 14 define ('DBL_LOGIN', 'luxbum'); 15 define ('DBL_PASSWORD', 'luxbum'); 16 16 define ('DBL_PREFIX', 'luxbum_'); 17 17 define ('SHOW_SLIDESHOW', 'on'); trunk/_conf/version.php
r65 r68 1 1 <?php 2 $luxbum_version='0.5 ';2 $luxbum_version='0.5.1-dev'; 3 3 ?> trunk/_fonctions/affichage.php
r65 r68 10 10 // Parsing des paramètres 11 11 //------------------------------------------------------------------------------ 12 // Méthode rewritée 13 if (USE_REWRITE == 'on') { 14 if (!isset($_GET['photo']) || !isset($_GET['d']) || !isset($_GET['page']) ) { 15 exit('manque des paramètres ON'); 16 } 17 18 $file = $_GET['photo']; 19 $dir = $_GET['d']; 20 $page_courante = $_GET['page']; 21 } 22 // Méthode non rewritée 12 if (ereg ('^/affichage-([0-9]+)-(.+)-(.+)\.html$', $_SERVER['QUERY_STRING'], $argv) ) { 13 $page_courante = $argv[1]; 14 $dir = $argv[2]; 15 $file = $argv[3]; 16 } 23 17 else { 24 if (ereg ('^/affichage-([0-9]+)-(.+)-(.+)\.html$', $_SERVER['QUERY_STRING'], $argv) ) { 25 $page_courante = $argv[1]; 26 $dir = $argv[2]; 27 $file = $argv[3]; 28 } 29 else { 30 exit ('manque des paramètres OFF'); 31 } 32 } 33 34 if (!verif_dir ($dir)) { 35 exit ('nom de dossier incorrect !!'); 36 } 37 else if (!is_dir (luxbum::getDirPath ($dir))) { 38 exit ('dossier incorrect !!'); 39 } 40 else if (!verif_photo ($dir, $file)) { 41 exit ('nom de la photo incorrect !!'); 42 } 18 exit ('manque des paramètres OFF'); 19 } 20 21 // if (!verif::dir ($dir)) { 22 // exit ('nom de dossier incorrect !!'); 23 // } 24 // else if (!is_dir (luxbum::getDirPath ($dir))) { 25 // exit ('dossier incorrect !!'); 26 // } 27 // else if (!verif_photo ($dir, $file)) { 28 // exit ('nom de la photo incorrect !!'); 29 // } 43 30 44 31 function getScriptURL () { … … 93 80 . ucfirst ($luxAff -> getDescription ()); 94 81 95 $page->MxImage ('photo', $luxAff->get AsPreview(), $altTitle,82 $page->MxImage ('photo', $luxAff->getPreviewLink(), $altTitle, 96 83 'title="'.$altTitle.'" '. ($luxAff->getPreviewResizeSize ()), true); 97 84 $page->MxUrl ('lien', $luxAff->getImagePath ()); … … 145 132 $page->MxUrl ('redirect_noscript', $lien_redirect); 146 133 147 if (SHOW_EXIF == 'on' && $luxAff->exifExists ()) {134 if (SHOW_EXIF == 'on' && $luxAff->exifExists ()) { 148 135 $page->MxText ('exif.lien', INDEX_FILE.'?p=infos_exif&d='.$dir.'&photo='.$file); 149 136 } … … 167 154 // Liens suivants et précédents 168 155 169 $nuxThumb = new luxBumGallery List($dir);156 $nuxThumb = new luxBumGallery($dir); 170 157 $nuxThumb->addAllImages (); 171 158 $galleryCount = $nuxThumb->getCount (); … … 184 171 $page_courante++; 185 172 186 // Une seule image dans la gal lerie173 // Une seule image dans la galerie 187 174 if ($galleryCount == 1) { 188 175 $page->MxBloc ('back', 'delete'); trunk/_fonctions/class/commentaire.class.php
r66 r68 24 24 } 25 25 26 /** 27 * 28 */ 26 29 function fillFromPost () { 27 30 // Auteur, obligatoire … … 59 62 } 60 63 64 /** 65 * 66 */ 61 67 function getErreur ($champ) { 62 68 if (array_key_exists ($champ, $this->erreurs)) { … … 66 72 } 67 73 74 /** 75 * 76 */ 68 77 function isValidForm () { 69 78 return (count ($this->erreurs) == 0); 70 79 } 71 80 81 /** 82 * 83 */ 72 84 function fillFromId ($id) { 73 85 global $mysql; … … 87 99 } 88 100 101 /** 102 * 103 */ 89 104 function insertRow () { 90 105 global $mysql; 91 $sql = "INSERT INTO ".DBL_PREFIX."commentaire (galerie_comment, photo_comment, date_comment, " 92 ."auteur_comment, email_comment, site_comment, content_comment, ip_comment, pub_comment) " 93 ."VALUES (" 94 ."'".$this->galerie."', " 95 ."'".$this->photo."', " 96 ."SYSDATE(), " 97 ."'".$this->auteur."'," 98 ."'".$this->email."'," 99 ."'".$this->site."'," 100 ."'".$this->content."'," 101 ."'".$_SERVER['REMOTE_ADDR']."', " 102 ."'1')"; 106 $sql = sprintf ("INSERT INTO ".DBL_PREFIX."commentaire (galerie_comment, photo_comment, date_comment, " 107 ."auteur_comment, email_comment, site_comment, content_comment, ip_comment, pub_comment) " 108 ."VALUES (%s, %s, SYSDATE(), %s,%s, %s, %s, %s, %s)", 109 $mysql->escapeString($this->galerie), 110 $mysql->escapeString($this->photo), 111 $mysql->escapeString($this->auteur), 112 $mysql->escapeString($this->email), 113 $mysql->escapeString($this->site), 114 $mysql->escapeString($this->content), 115 $mysql->escapeString($_SERVER['REMOTE_ADDR']), 116 $mysql->escapeSet (1)); 103 117 $mysql->DbQuery ($sql); 104 118 $this->id = $mysql->DbGetInsertId(); 105 119 } 106 120 121 /** 122 * 123 */ 107 124 function updateRow () { 108 125 global $mysql; 109 $sql = "UPDATE ".DBL_PREFIX."commentaire SET " 110 ."auteur_comment='".$this->auteur."'," 111 ."email_comment='".$this->email."'," 112 ."site_comment='".$this->site."'," 113 ."content_comment='".$this->content."'" 114 ." WHERE id_comment=".$this->id; 126 $sql = sprintf ("UPDATE ".DBL_PREFIX."commentaire SET " 127 ."auteur_comment=%s," 128 ."email_comment=%s," 129 ."site_comment=%s," 130 ."content_comment=%s" 131 ." WHERE id_comment=%d", 132 $mysql->escapeString($this->auteur), 133 $mysql->escapeString($this->email), 134 $mysql->escapeString($this->site), 135 $mysql->escapeString($this->content), 136 $this->id); 115 137 $mysql->DbQuery ($sql); 116 138 } 117 139 140 /** 141 * 142 */ 118 143 function setPublic () { 119 144 global $mysql; 120 if (! is_empty($this->id)) {145 if (!empty($this->id)) { 121 146 $sql = "UPDATE ".DBL_PREFIX."commentaire SET pub_comment='1' WHERE id_comment=".$this->id; 122 147 $mysql->DbQuery ($sql); … … 126 151 } 127 152 153 /** 154 * 155 */ 128 156 function setPrivate () { 129 157 global $mysql; 130 if (!is_empty($this->id)) { 131 $sql = "UPDATE ".DBL_PREFIX."commentaire SET pub_comment='0' WHERE id_comment=".$this->id; 132 $mysql->DbQuery ($sql); 133 return true; 134 } 135 return false; 136 } 137 158 if (!empty($this->id)) { 159 $sql = "UPDATE ".DBL_PREFIX."commentaire SET pub_comment='0' WHERE id_comment=".$this->id; 160 $mysql->DbQuery ($sql); 161 return true; 162 } 163 return false; 164 } 165 166 /** 167 * 168 */ 138 169 function deleteRow () { 139 170 global $mysql; 140 171 if (!empty($this->id)) { 141 $sql = "DELETE FROM ".DBL_PREFIX."commentaire WHERE id_comment=".$this->id; 142 $mysql->DbQuery ($sql); 143 return true; 144 } 145 return false; 146 } 147 172 $sql = "DELETE FROM ".DBL_PREFIX."commentaire WHERE id_comment=".$this->id; 173 $mysql->DbQuery ($sql); 174 return true; 175 } 176 return false; 177 } 178 179 /** 180 * 181 */ 148 182 function renameGalerie ($old, $new) { 149 183 global $mysql; 150 184 if ($mysql->db_link != null) { 151 $query = "UPDATE ".DBL_PREFIX."commentaire " . 152 "SET galerie_comment='$new' " . 153 "WHERE galerie_comment='$old'"; 185 $query = sprintf ("UPDATE ".DBL_PREFIX."commentaire " . 186 "SET galerie_comment=%s " . 187 "WHERE galerie_comment=%s", 188 $mysql->escapeString($new), 189 $mysql->escapeString($old) 190 ); 154 191 $mysql->DbQuery ($query); 155 192 } 156 193 } 157 194 195 /** 196 * 197 */ 158 198 function deleteGalerie ($galerie) { 159 199 global $mysql; 160 200 if ($mysql->db_link != null) { 161 $query = "DELETE FROM ".DBL_PREFIX."commentaire " . 162 "WHERE galerie_comment='$galerie'"; 201 $query = sprintf ("DELETE FROM ".DBL_PREFIX."commentaire " . 202 "WHERE galerie_comment=%s", 203 $mysql->escapeString($galerie)); 163 204 $mysql->DbQuery ($query); 164 205 } 165 206 } 166 207 208 /** 209 * 210 */ 167 211 function deletePhoto ($galerie, $photo) { 168 212 global $mysql; 169 213 if ($mysql->db_link != null) { 170 $query = "DELETE FROM ".DBL_PREFIX."commentaire " . 171 "WHERE galerie_comment='$galerie' AND photo_comment='$photo'"; 214 $query = sprintf ("DELETE FROM ".DBL_PREFIX."commentaire " . 215 "WHERE galerie_comment=%s AND photo_comment=%s", 216 $mysql->escapeString($galerie), 217 $mysql->escapeString($photo)); 172 218 $mysql->DbQuery ($query); 173 219 } … … 175 221 176 222 /*function renamePhoto ($galerie, $old, $new) { 177 global $mysql; 178 $query = "UPDATE ".DBL_PREFIX."commentaire " . 179 "SET photo_comment='$new' " . 180 "WHERE photo_comment='$old' AND galerie_comment='$galerie'"; 181 $mysql->DbQuery ($query); 182 }*/ 183 223 global $mysql; 224 $query = "UPDATE ".DBL_PREFIX."commentaire " . 225 "SET photo_comment='$new' " . 226 "WHERE photo_comment='$old' AND galerie_comment='$galerie'"; 227 $mysql->DbQuery ($query); 228 }*/ 229 230 /** 231 * 232 */ 184 233 function selectQuery ($galerie, $photo) { 185 $query = "SELECT id_comment, date_comment, auteur_comment, email_comment, site_comment, content_comment " 186 ."FROM ".DBL_PREFIX."commentaire " 187 ."WHERE galerie_comment='$galerie' AND photo_comment='$photo' AND pub_comment='1'"; 234 global $mysql; 235 $query = sprintf ("SELECT id_comment, date_comment, auteur_comment, email_comment, site_comment, content_comment " 236 ."FROM ".DBL_PREFIX."commentaire " 237 ."WHERE galerie_comment=%s AND photo_comment=%s AND pub_comment='1'", 238 $mysql->escapeString($galerie), 239 $mysql->escapeString($photo)); 188 240 return $query; 189 241 } 190 242 243 /** 244 * 245 */ 191 246 function tableExists ($prefix) { 192 247 global $mysqlParam; … … 203 258 } 204 259 260 /** 261 * 262 */ 205 263 function createTable ($prefix) { 206 264 global $mysqlParam; … … 208 266 if ($mysqlParam->db_link != null) { 209 267 $mysqlParam->DbQuery ( 210 "CREATE TABLE `$tableName` (" .211 " `id_comment` int(11) NOT NULL auto_increment," .212 " `galerie_comment` varchar(240) NOT NULL default ''," .213 " `photo_comment` varchar(240) NOT NULL default ''," .214 " `date_comment` datetime NOT NULL default '0000-00-00 00:00:00'," .215 " `auteur_comment` varchar(255) NOT NULL default ''," .216 " `email_comment` varchar(255) default NULL," .217 " `site_comment` varchar(255) default NULL," .218 " `content_comment` longtext NOT NULL," .219 " `ip_comment` varchar(15) default NULL," .220 " `pub_comment` set('0','1') NOT NULL default ''," .221 " PRIMARY KEY (`id_comment`)," .222 " KEY `galerie_comment` (`galerie_comment`,`photo_comment`)" .223 ")");268 "CREATE TABLE `$tableName` (" . 269 " `id_comment` int(11) NOT NULL auto_increment," . 270 " `galerie_comment` varchar(240) NOT NULL default ''," . 271 " `photo_comment` varchar(240) NOT NULL default ''," . 272 " `date_comment` datetime NOT NULL default '0000-00-00 00:00:00'," . 273 " `auteur_comment` varchar(255) NOT NULL default ''," . 274 " `email_comment` varchar(255) default NULL," . 275 " `site_comment` varchar(255) default NULL," . 276 " `content_comment` longtext NOT NULL," . 277 " `ip_comment` varchar(15) default NULL," . 278 " `pub_comment` set('0','1') NOT NULL default ''," . 279 " PRIMARY KEY (`id_comment`)," . 280 " KEY `galerie_comment` (`galerie_comment`,`photo_comment`)" . 281 ")"); 224 282 return true; 225 283 } trunk/_fonctions/class/files.php
r59 r68 105 105 function deleteFile ($file) { 106 106 if (files::isDeletable ($file)) { 107 unlink ($file); 108 return true; 107 return unlink ($file); 109 108 } 110 109 return false; … … 121 120 $tab = explode ('/', $name); 122 121 $name = $tab[count($tab) - 1]; 123 mkdir ($name, 0777); 124 rename ($name, $path); 122 $return = @mkdir ($name, 0777) && @rename ($name, $path); 125 123 } 126 124 else { 127 mkdir ($path, 0777);125 $return = @mkdir ($path, 0777); 128 126 } 129 umask ($old_umask);130 return true;127 /*$return = $return && */umask ($old_umask); 128 return $return; 131 129 } 132 130 return false; … … 143 141 return true; 144 142 } 143 144 /** 145 * 146 */ 147 function isPhotoFile ($dir, $file) { 148 return $file[0] != '.' 149 && !is_dir (luxbum::getImage ($dir, $file) ) 150 && eregi ('^.*(' . ALLOWED_FORMAT . ')$', $file); 151 } 145 152 } 146 153 trunk/_fonctions/class/imagetoolkit.class.php
r59 r68 14 14 var $imageHeight; 15 15 var $imageType; 16 var $typeMime = ''; 16 17 17 18 var $imagDest; … … 20 21 21 22 /** 22 * 23 * Constructeur par défaut 24 * @param String $image Chemin complet vers l'image 23 25 */ 24 26 function imagetoolkit ($image) { … … 28 30 29 31 /** 30 * 32 * Retourne la largeur finale de l'image redimensionnée. 33 * @return int Largeur finale de l'image redimensionnée. 31 34 */ 32 35 function getImageDestWidth () { … … 35 38 36 39 /** 37 * 40 * Retourne la hauteur finale de l'image redimensionnée. 41 * @return int Hauteur finale de l'image redimensionnée. 38 42 */ 39 43 function getImageDestHeight () { 40 44 return $this->imageDestHeight; 41 45 } 42 43 /** 44 * 46 47 /** 48 * Retourne le type Mime de l'image 49 * @return String Type mime de l'image 50 */ 51 function getTypeMime () { 52 return $this->typeMime; 53 } 54 55 /** 56 * Remplit les champs principaux de la classe. 57 * Utile ? 45 58 * @access private 46 59 */ 47 60 function setSrcInfos () { 48 49 61 if ($this->image != "") { 50 62 // Lit les dimensions de l'image … … 53 65 $this->imageHeight = $size[1]; 54 66 $this->imageType = $size[2]; 55 } 56 } 57 58 /** 59 * 67 $this->typeMime = $size['mime']; 68 } 69 } 70 71 /** 72 * Crée un handler de l'image suivant son type 60 73 * @access private 74 * @return Handler 61 75 */ 62 76 function imageCreateFromType () { … … 85 99 86 100 /** 87 * 101 * Ecrit l'image redimensionnée. 88 102 * @access private 89 103 */ … … 107 121 108 122 /** 109 * 123 * Fixe une taille finale maximale de redimensionnement. 124 * @param Int $dst_w Largeur maximale 125 * @param int $dst_h Hauteur maximale 110 126 */ 111 127 function setDestSize ($dst_w, $dst_h) { … … 143 159 144 160 /** 145 * 161 * Est ce qu'il faut redimentionner une image ? 146 162 * @access private 163 * @return boolean 147 164 */ 148 165 function canResize () { … … 153 170 // L'original a été modifié ? 154 171 if ($test) { 155 $test = (filemtime ($this->imageDest)>filemtime ($this->image));172 $test = (filemtime($this->imageDest) > filemtime ($this->image)); 156 173 } 157 174 … … 176 193 177 194 /** 178 * 195 * Crée l'image redimentionnée. Il faut préalablement avoir apellé la méthode 196 * setDestSize(...) 197 * @param String $img_dest Chemin où il faut écrire l'image redimensionnée. 179 198 */ 180 199 function createThumb ($img_dest) { 181 200 $this->imageDest = $img_dest; 182 201 183 // echo $this->imageDestWidth.' => '.$this->imageDestHeight.'<br />';184 202 185 203 // Créer la vignette ? 186 204 if (!$this->canResize ()) { 187 188 205 189 206 // Copie dedans l'image initiale redimensionnée … … 244 261 245 262 263 /** 264 * Retourne la version exacte de GD 265 * @return Version exacte de GD 266 */ 246 267 function gdVersionExact () { 247 268 static $gd_version_number = null; … … 269 290 * Get which version of GD is installed, if any. 270 291 * Returns the version (1 or 2) of the GD extension. 292 * @return 1 ou 2 pour GD1 ou GD2 271 293 */ 272 294 function gdVersion ($user_ver = 0) { trunk/_fonctions/class/luxbumgallery.class.php
r59 r68 1 <?php 1 <?php 2 2 3 3 //============================================================================== … … 10 10 class luxBumGallery extends luxBum 11 11 { 12 /**-----------------------------------------------------------------------**/ 13 /** Champs de la classe */ 14 /**-----------------------------------------------------------------------**/ 12 15 var $name, $dir; 13 16 var $preview; 14 17 var $count; 15 18 var $size; 16 17 /** 18 * 19 */ 20 function luxBumGallery ($name, $preview = '') { 21 $this->name = $this->dir = $name; 19 var $sortType; 20 var $sortOrder; 21 var $list = array (); 22 var $sortList = array(); 23 var $sortPosition = 0; 24 25 26 /**-----------------------------------------------------------------------**/ 27 /** Constructeur de classe */ 28 /**-----------------------------------------------------------------------**/ 29 /** 30 * Constructeur par défaut 31 * @param String $dir Dossier de la galerie 32 */ 33 function luxBumGallery ($dir, $preview = '') { 34 $list= split('/', $dir); 35 print_r($list); 36 $this->name = $this->dir = $list[count($list)-1]; 37 $this->setPhotoDir($list[0]);echo "<strong>$this->dir</strong> : <em>$this->photoDir</em>"; 22 38 $this->preview = $preview; 23 39 $this->size = 0; 24 40 $this->count = 0; 25 $this->completeInfos (); 26 $this->completeDefaultImage (); 27 } 28 29 /** 30 * 41 $this->_completeInfos (); 42 $this->_completeDefaultImage (); 43 } 44 45 /** 46 * Remplit les informations suivantes sur la galerie : 47 * - nombre d'images 48 * - taille des images en octets 49 * @access private 50 */ 51 function _completeInfos () { 52 if ($fd = dir ($this->getDirPath($this->dir))) { 53 while ($current_file = $fd->read ()) {echo "$current_file<br>"; 54 if (files::isPhotoFile($this->dir, $current_file)) { 55 $the_file = $this->getImage ($this->dir, $current_file); 56 $this->size += filesize ($the_file); 57 $this->count++; 58 } 59 } 60 $fd->close(); 61 } 62 } 63 64 /**-----------------------------------------------------------------------**/ 65 /** Getter et setter */ 66 /**-----------------------------------------------------------------------**/ 67 /** 68 * Affecte le nom de la galerie 69 * @param string $name Nom de la galerie 31 70 */ 32 71 function setName ($name) { … … 35 74 36 75 /** 37 * 76 * Retourne le nom de la galerie 77 * @return String Nom de la galerie 38 78 */ 39 79 function getName () { 40 return $this->name; 41 } 42 43 /** 44 * 80 return $this->dir; 81 } 82 83 /** 84 * Retourne le "beau" nom de la galerie 85 * @return String Beau nom de la galerie 45 86 */ 46 87 function getNiceName () { 47 return $this->niceName ($this->name); 48 } 49 50 /** 51 * 88 return $this->niceName ($this->dir); 89 } 90 91 /** 92 * Retourne l'image par défaut de la galerie 93 * @return String Chemin vers l'image par défaut de la galerie 52 94 */ 53 95 function getPreview () { … … 56 98 57 99 /** 58 * 100 * Retourne la taille en octets des photos de la galerie 101 * @return int Taille en octets des photos de la galerie 59 102 */ 60 103 function getSize () { … … 63 106 64 107 /** 65 * 108 * Retourne la taille affichable des photos de la galerie 109 * @return int Taille affichable des photos de la galerie 66 110 */ 67 111 function getNiceSize () { … … 70 114 71 115 /** 72 * 116 * Retourne le nombre de photos de la galerie 117 * @return int Nombre de photos de la galerie 73 118 */ 74 119 function getCount () { 75 120 return $this->count; 76 121 } 77 78 /** 122 123 /** 124 * Affecte le type du tri de la galerie 125 * @param String $sortType Type du tri de la galerie 126 */ 127 function setSortType ($sortType) { 128 $this->sortType = $sortType; 129 } 130 131 /** 132 * Retourne le type de tri de la galerie 133 * @return String Type du tri de la galerie 134 */ 135 function getSortType () { 136 return $this->sortType; 137 } 138 139 /** 140 * Affecte le sens du tri (asc / desc) 141 * @param String $sortOrder Sens du tri 142 */ 143 function setSortOrder ($sortOrder) { 144 $this->sortOrder = $sortOrder; 145 } 146 147 /** 148 * Retourne le sens du tri 149 * @return String Sens du tri 150 */ 151 function getSortOrder () { 152 return $this->sortOrder; 153 } 154 155 /** 156 * Affecte la position de la galerie dans l'index 157 * @param String $sortPosition Position de la galerie dans l'index 158 */ 159 function setSortPosition ($sortPosition) { 160 $this->sortPosition = $sortPosition; 161 } 162 163 /** 164 * Retourne la position de la galerie dans l'index 165 * @return String Position de la galerie dans l'index 166 */ 167 function getSortPosition () { 168 return $this->sortPosition; 169 } 170 171 /**-----------------------------------------------------------------------**/ 172 /** Descriptions / dates */ 173 /**-----------------------------------------------------------------------**/ 174 /** 175 * Lit le fichier des dates/descriptions et retourne un tableau 176 * correspondant par rapport au nom de fichier. 79 177 * 80 */ 81 function completeInfos () { 82 $fd = dir ($this->getDirPath ($this->dir)); 83 84 while ($current_file = $fd->read ()) { 85 $the_file = $this->getImage ($this->dir, $current_file); 86 87 if ($current_file[0] != '.' 88 && !is_dir ($the_file) 89 && eregi ('^.*(' . ALLOWED_FORMAT . ')$', $current_file) ) { 90 $this->size += filesize ($the_file); 91 $this->count++; 92 } 93 } 94 $fd->close(); 95 } 96 178 * @return array clé: nomPhoto / valeur: date|description 179 */ 180 function getDescriptions () { 181 $desc = array (); 182 183 if (is_file ($this->getDirPath ($this->dir).DESCRIPTION_FILE)) { 184 $fd = fopen ($this->getDirPath ($this->dir).DESCRIPTION_FILE, 'r+'); 185 while ($line = trim(fgets($fd))) { 186 if ( ereg ('^.*\|.*\|.*$', $line)) { 187 list ($imgName, $imgDescription) = explode ('|', $line, 2); 188 $desc [$imgName] = $imgDescription; 189 } 190 } 191 fclose ($fd); 192 } 193 return $desc; 194 } 195 196 /** 197 * Crée ou met à jour le fichier des descriptions des photos 198 * 199 */ 200 function createOrMajDescriptionFile () { 201 $desc = array (); 202 203 // Recherche des images présentes dans le fichier de description 204 if (is_file ($this->getDirPath ($this->dir) . DESCRIPTION_FILE)) { 205 if ($fd = fopen ($this->getDirPath ($this->dir) . DESCRIPTION_FILE, 'r')) { 206 while ($line = fgets ($fd)) { 207 if (ereg ('^.*\|.*\|.*$', $line)) { 208 list($desc[]) = explode ('|', $line, 2); 209 } 210 } 211 fclose($fd); 212 } 213 } 214 215 // On ajoute les images non présentes dans le fichier de description 216 if ($fd = fopen ($this->getDirPath ($this->dir) . DESCRIPTION_FILE, 'a')) { 217 reset ($this->list); 218 while (list (,$img) = each ($this->list)) { 219 $name = $img->getImageName (); 220 if (!in_array ($name, $desc)) { 221 fputs ($fd, "$name||\n"); 222 } 223 } 224 fclose ($fd); 225 } 226 } 227 228 /** 229 * Écrit les nouvelles descriptions/dates dans le fichier de description 230 */ 231 function updateDescriptionFile () { 232 files::deleteFile ($this->getDirPath ($this->dir) . DESCRIPTION_FILE, 'a'); 233 234 if ($fd = fopen ($this->getDirPath ($this->dir) . DESCRIPTION_FILE, 'a')) { 235 for ($i = 0 ; $i < $this->getCount () ; $i++) { 236 $img = $this->list[$i]; 237 $name = $img->getImageName (); 238 $description = $img->getDescription (); 239 $date = $img->getDate (); 240 fputs ($fd, "$name|$date|$description\n"); 241 } 242 fclose ($fd); 243 } 244 } 245 246 /**-----------------------------------------------------------------------**/ 247 /** Fonctions des sous galeries */ 248 /**-----------------------------------------------------------------------**/ 249 250 var $listSubGallery = array(); 251 252 function isSubGallery ($current_file) { 253 if (!is_dir ($this->getDirPath($this->dir).$current_file)) { 254 return false; 255 } 256 if ($current_file[0] == '.') { 257 return false; 258 }
