"; echo " \r\n"; } else { echo " \r\n"; } } function AddBackDir($dir) { if ($dir == "") $diraddon = ""; else $diraddon = "?dir=$dir"; echo " \r\n"; } function AddSubDir($dir) { if ($dir == "") $diraddon = ""; else $diraddon = "?dir=$dir"; $bUpdated = false; $imclass = 'imgset_block'; if (file_exists($dir."/index.upd")) { // directory updated $imclass = 'imgset_hotblock'; $bUpdated = true; } echo "
"; if (file_exists($dir."/index.txt")) { echo "
"; readfile($dir."/index.txt",'r'); echo ""; } if ($bUpdated) { echo "
"; readfile($dir."/index.upd",'r'); echo "
"; } echo "
\r\n "; } $dir = $HTTP_GET_VARS['dir']; if (!strcmp($dir, "")) { $dir = "./"; } else if (!strchr($dir, "/")) { $dir = $dir . "/"; } $img = $HTTP_GET_VARS['img']; $iconscnt = 4; $currphoto = 0; if (!strcmp($img, "")) { $noveimg = "P1210144.JPG"; $img = ""; $currphoto = -1; } $thumbsdir = $dir."/thumb/"; $photos = array(); $photosthumb = array(); $photoscnt = 0; $dirs = array(); $dirscnt = 0; // get list of photos $d = @dir($dir); if($d){ while (false !== ($entry = $d->read())) { $img_file = $entry; if (is_file($dir.'/'.$img_file) && substr($entry,0,1) != '.' && strtolower($entry) !== 'index.html' && strtolower($entry) !== 'index.jpg') { if (eregi("bmp|gif|jpg|png", $img_file ) && (strstr($img_file, '.txt') == "") && (strstr($img_file, '.break') == "") ) { $photos[$photoscnt] = $img_file; $photoscnt++; } } else if (is_dir($dir.'/'.$entry) && substr($entry,0,1) != '.' && strtolower($entry) !== $thumbsdir) { if (file_exists($dir.'/'.$entry.'/index.jpg')) { $dirs[$dirscnt] = $entry; $dirscnt++; } } } $d->close(); } else { echo 'Invalid Album'; } sort($photos); sort($dirs); // check thubnails for ($i = 0; $i < $photoscnt; $i++) { if (!strcmp($photos[$i], $img)) { $currphoto = $i; } if (!file_exists($thumbsdir.$photos[$i])) { // TODO: create thumbs ... $photosthumb[$i] = $dir.$photos[$i]; } else { $photosthumb[$i] = $thumbsdir.$photos[$i]; } } if ($currphoto != -1) { ?> "; if ($dirscnt > 0) { echo "
"; for ($i = 0; $i < $dirscnt; $i++) { AddSubDir($dirs[$i]); if (($i+1) % 4 == 0) { if (($i+1) % 8 == 0) echo "
 
"; else echo "
 
"; } } echo "

"; } if ($photoscnt > 50) { echo "
"; echo "1"; } $j = 1; for ($i = 0; $i < $photoscnt; $i++) { if ($i % 50 == 0 && $i > 0) { echo "
".($i/50+1).""; $j = 1; } if (!strcmp($noveimg, $photos[$i])) { echo "["; Addimage($dir, $photos[$i], $photosthumb[$i], false); echo "]"; } else { Addimage($dir, $photos[$i], $photosthumb[$i], false); } if (file_exists($dir.'/'.$photos[$i].".break")) { echo "
"; readfile($dir.'/'.$photos[$i].'.break', 'r'); echo "
"; $j = 0; } if ($j % 10 == 0) { echo "
"; } $j++; } if ($photoscnt > 50) { echo "
"; } if ($dir != "./" && $dir != "") { $updir = dirname($dir."/"); if ($updir == ".") { $updir = ""; } //echo "[[".$dir."---".$updir."index.txt]]]"; if (file_exists($updir."index.txt")) { echo "
"; AddBackDir($updir); echo "
"; } } echo ""; echo "
by martin bujnak
copyright 2005-2008
\r\n"; } else { echo "
\r\n"; // head buttons... echo "
\r\n"; if (0) { // first echo "First "; // prev if ($currphoto > 0) { echo "[[ Prev ]]"; } echo " "; // top echo "Top"; echo " "; // next if ($photoscnt > 1 && $currphoto < $photoscnt - 1) { echo "[[ Next ]]"; } // last echo " Last\r\n"; echo "

\r\n"; } $cols = 1; // main image echo "\r\n"; if ($currphoto > 0) { $cols++; echo ""; } echo "\r\n"; if ($photoscnt > 1 && $currphoto < $photoscnt - 1) { $cols++; echo "\r\n"; } echo "
 "; Addimage($dir, $photos[$currphoto], $photosthumb[$currphoto], true); if (file_exists($photos[$currphoto].'.txt')) { $descfile = $dir.$photos[$currphoto].'.txt'; echo "
"; readfile($descfile,'r'); echo "
\r\n"; } echo "
 
\r\n"; //echo "main img".$photos[$currphoto]."
"; echo "

\r\n"; // tbumbs $a = $currphoto - $iconscnt; $b = $currphoto + $iconscnt; if ($a < 0) { $b = $b - $a; $a = 0; } if ($b >= $photoscnt) { $a = $a - ($b - $photoscnt + 1); } if ($a < 0) $a = 0; $b = $a + 2*$iconscnt; if ($b >= $photoscnt) $b = $photoscnt - 1; //echo "$a ... $b
"; echo "
"; echo "the first   "; for ($i = $a; $i <= $b; $i++) { Addimage($dir, $photos[$i], $photosthumb[$i], false); } echo "   all "; echo " the last "; echo "
\r\n"; echo "\r\n"; echo "
\r\n"; echo "
by martin bujnak
copyright 2005-2008
\r\n"; echo "
\r\n"; } ?>