$val) $val2 .=$val.'
'; return $val2; } $pictures = true; //while(list($key, $value) = each($HTTP_GET_VARS)) while(list($key, $value) = each($_GET)) { if (strtolower($key) == "pictures") $pictures = $value == 'no' ? false : true; } if ($pictures) doecho('Cacher les images

'); else doecho('Montrer les images

'); // Variable initialization $galleries = array(); $newgal = ''; $newphoto = ''; $languages = ''; $isnewgallery = true; $template = ''; // Configuration parsing $handle = @fopen($rootpath."galeries.txt", "r"); if ($handle) { while (!feof($handle)) { $buffer = fgets($handle, 4096); if (substr($buffer, 0, 3) == '---') { $galleries[sizeof($galleries)] = new gallery(); $newgal = &$galleries[sizeof($galleries) - 1]; $isnewgallery = true; continue; } // Chercher si c'est un commentaire $p = strpos($buffer, '#'); if ($p === 0) continue; // Chercher si on a une valeur $p = strpos($buffer, '='); if ($p > 0) { $name = trim(substr($buffer, 0, $p)); $val = trim(substr($buffer, $p+1)); switch ($name) { case 'REP': $newgal->dir = $val; break; case 'PHOTO': $isnewgallery = false; $newgal->photos[sizeof($newgal->photos)] = new photo(); $newphoto = &$newgal->photos[sizeof($newgal->photos) - 1]; $newphoto->filename = $val; break; case 'LANGUES': if ($languages != '') doecho('Les langues sont définies plus d\'une fois!
'); $languages = explode(',', $val); break; case 'TEMPLATE': if ($template != '') doecho('Le modèle est défini plus d\'une fois!
'); $template = $val; break; case 'DISPO': if ($isnewgallery) { doecho('DISPO concerne les bijoux, pas les galeries!
'); } else { $newphoto->dispo = true; } break; case 'PRIX': if ($isnewgallery) { doecho('PRIX concerne les bijoux, pas les galeries!
'); } else { if (strpos($val, '-') !== 0) { $newphoto->prix = $val; } } break; case 'REF': if ($isnewgallery) { doecho('REF concerne les bijoux, pas les galeries!
'); } else { $newphoto->ref = $val; } break; case 'AFFICHER': if ($val == 'NON' ) { if ($isnewgallery) { $newgal->display = false; } else { $newphoto->display = false; } } else { doecho('AFFICHER doit être suivi de NON!
'); } break; default: if ($isnewgallery) $newgal->name[$name] = $val; else $newphoto->name[$name] = $val; } } } fclose($handle); } // Test if languages are defined if ($languages == '') exit('Il faut mettre une ligne qui définit les langues. Exemple:
LANGUES=F,ES,CA'); else { doecho('Langues définies:
'); foreach ($languages as $lan) { doecho($lan.'
'); } } // Test if all galleries are OK for ($i=0; $ibuggy = false; doecho('

'); // Prepare diagnostic doecho(''); if (!$gal->display) { doecho('La galerie n\'est pas affichée!!!
'); } doecho(''); if ($gal->dir == '') { doecho('Galerie sans répertoire

'); $gal->buggy = true; } doecho('

'.array_to_string($gal->name).'

'); // Test if gallery languages are defined according to LANGUES field (in $languages) foreach ($languages as $lan) { if (!array_key_exists($lan, $gal->name)) { doecho('Langue '.$lan.' pas trouvé

'); $gal->buggy = true; } } // Check directory doecho('Répertoire: '.$rootpath.$gal->dir.'
'); if (!file_exists($rootpath.$gal->dir)) { doecho(' Ce répertoire n\'existe pas!
'); $gal->buggy = true; } doecho('
'); doecho("".sizeof($gal->photos).' PHOTOS
'); doecho("
"); // Test photos if (!$gal->buggy) foreach ($gal->photos as $photo) { doecho('
'); doecho(''.$photo->filename.'
'); if (!$photo->display) doecho('LA PHOTO N\'EST PAS AFFICHÉE!!!
'); if ($photo->ref != '') doecho('Réf: '.$photo->ref.'
'); if ($photo->prix != '') doecho('Prix:'.$photo->prix.'
'); // Check descriptions in all defined languages foreach ($languages as $lan) { if (!array_key_exists($lan, $photo->name)) { doecho('Langue '.$lan.' pas trouvée!
'); $gal->buggy = true; } } // Check descriptions in all languages $photonames = array_keys($photo->name); foreach ($photonames as $name) { doecho($name.' -> '.$photo->name[$name].'
'); $textecheck = explode('/',$photo->name[$name]); if (count($textecheck) < 2) { doecho('Il manque une partie du texte (vérifier /)!
'); $gal->buggy = true; } } // Check thumbnail if (!$gal->buggy) if (file_exists($rootpath.$gal->dir.'/thumbnails/'.$photo->filename)) { if ($pictures) doecho('

'); } else { doecho(' La vignette n\'existe pas!
'); $gal->buggy = true; } // Check image file if (!$gal->buggy) if (file_exists($rootpath.$gal->dir.'/images/'.$photo->filename)) { if ($pictures) doecho('
'); } else { doecho(' Le fichier n\'existe pas!
'); $gal->buggy = true; } } doecho('
'); if ($gal->buggy) { doecho(''); } else { doecho(''); } } if (!$noecho) { ?>