Rock for Animals
'; ?> if (!$nastr) $nastr=2500; if (!$page) $page=1; $base = "fotky/"; if(!$adresar) $adresar=""; if(strlen($adresar)>0)$adresar = $adresar . "/"; $i = 0; function scandir_by_mtime($folder) { $dircontent = scandir($folder); $files = array(); $dirs = array(); $titles = array(); foreach($dircontent as $filename) { if (strtolower(substr($filename,-3)) == "jpg" && strtolower(substr($filename,-9)) != "thumb.jpg") { $exif = @exif_read_data($folder.$filename); $dat = $exif['DateTimeOriginal']; $dat .= filemtime($folder.$filename); $dat .= $filename; $titles[$dat] = date("H:i:s j.n.Y",mktime(substr($exif['DateTimeOriginal'],11,2),substr($exif['DateTimeOriginal'],14,2),substr($exif['DateTimeOriginal'],17,2),substr($exif['DateTimeOriginal'],5,2),substr($exif['DateTimeOriginal'],8,2),substr($exif['DateTimeOriginal'],0,4))); $files[$dat] = $filename; } elseif (is_dir($folder.$filename) AND substr($filename,-4,1) != "." && $filename != "." && $filename != "..") { $dat = $filename; $dirs[$dat] = $filename; } elseif ((strtolower(substr($filename,-3)) == "avi" && strtolower(substr($filename,-9)) != "thumb.avi") || (strtolower(substr($filename,-3)) == "mov" && strtolower(substr($filename,-9)) != "thumb.mov") || (strtolower(substr($filename,-3)) == "wmv" && strtolower(substr($filename,-9)) != "thumb.wmv")) { $dat = filemtime($folder.$filename) . $filename; $files[$dat] = $filename; } } function natksort(&$aToBeSorted) { $aResult = array(); $aKeys = array_keys($aToBeSorted); //natcasesort($aKeys); rsort($aKeys); foreach ($aKeys as $sKey) { $aResult[$sKey] = $aToBeSorted[$sKey]; } $aToBeSorted = $aResult; return True; } if (!ksort($files)) return false; if (!natksort($dirs)) return false; return array($files,$dirs,$titles); } $dir = scandir_by_mtime($base . $adresar); if (is_file($base . $adresar . "desc.txt")) $nazev = join ('', file($base . $adresar . "desc.txt")); else $nazev = str_replace("_"," ",$adresar); $nazev = str_replace("/","",$nazev); //hlavicka($nazev); $pocet = count($dir[0]) + count($dir[1]); $h=0; foreach ($dir[0] as $key => $file ){ $h++; if ($h <= ($page*$nastr) AND $h > (($page*$nastr)-$nastr) ) { if (strtolower(substr($file,-3)) == "jpg") { $size = @getimagesize ("$base$adresar$file.thumb.jpg"); $text = stat("$base$adresar$file"); $text = $users[$text[4]]; $fotky[$h] = "
\"{$file}\"
\n"; } else { $text = stat("$base$adresar$file"); $text = $users[$text[4]]; $fotky[$h] = "
\"{$file}\"
\n"; } } } function spocitej($adresar) { $d = opendir($base . $adresar); while (false!==($file = readdir($d))) { if (strtolower(substr($file,-3)) == "jpg" && strtolower(substr($file,-9)) != "thumb.jpg") { $pocet++; } } closedir($d); return $pocet; } function celkem($adresar) { global $base; $d = opendir($base . $adresar); while (false!==($file = readdir($d))) { //if (is_dir($base . $adresar . $file)) echo ""; else echo ""; if (strtolower(substr($file,-3)) == "jpg" && strtolower(substr($file,-9)) != "thumb.jpg") { $celkem++; } elseif (is_dir($base . $adresar . $file) AND $file != "." && $file != "..") { $celkem += celkem($adresar . $file); } } closedir($d); return $celkem; } $timecelkem_start = microtime(true); $celkem = celkem(""); $timecelkem_end = microtime(true); $time = $timecelkem_end - $timecelkem_start; echo "\n\n"; $h=$pocet+1; foreach ($dir[1] as $file ){ $h--; if ($h <= (($pocet-($page*$nastr))+$nastr) AND $h > ($pocet-($page*$nastr)) ) { if (is_file($base . $adresar . $file . "/desc.txt")) $popis[$h] = join ('', file($base . $adresar . $file . "/desc.txt")); else { $popis[$h] = str_replace("_"," ",$file); $popis[$h] = ereg_replace("^[0-9]{2}([0-9]{2})-0?([0-9]{1,2})-0?([0-9]{1,2}) (.*)$", "\\3.\\2.\\1 \\4",$popis[$h]); } $prd = spocitej("$base$adresar$file"); //if ($nastr == 25) $fotky[$h] = "
\"{$popis[$h]}\"
{$popis[$h]}
Pocet fotek: $prd
\n"; //else // $fotky[$h] = "
\"{$popis[$h]}\"
{$popis[$h]}
Po?et fotek: $prd
\n"; } } /* $predchozi = $page-1; $dalsi = $page+1; for($r = 1; $r <= ceil($pocet/$nastr); $r++) { if($r==$page){ $stranky .= "{$r}"; } else { if ($nastr == 25) $stranky .= "{$r}"; else $stranky .= "{$r}"; } } $leftt = "\"P?edchoz?\""; $rightt = "\"Dal??\""; $aleft = "$left"; $aright= "$right"; if ($nastr == 25) $navigace .= " "; else $navigace .= " "; if ( $pocet <= $nastr) { $navigace .= "{$left}{$stranky}{$right}"; } elseif ($page == 1 and $pocet > $nastr) { $navigace .= "{$left}{$stranky}{$aright}"; } elseif ($page < $pocet/$nastr and $page > 1) { $navigace .= "{$aleft}\n{$stranky}{$aright}"; } elseif ($page >= $pocet/$nastr) { $navigace .= "{$aleft}\n{$stranky}{$right}"; } if (!$nazev) $nazev = "Fotogalerie - xchat - setk�n� (nejen) z�wisl�k?"; echo '
' . $navigace . '
'; */ if (count($fotky) > 0) { foreach($fotky as $key => $value) { echo $value; $i++; } } /* echo '
'; */ ?>