"; while (($file = readdir($dir)) !== false) { $filename[$filecount]=$file; $filecount++; } closedir($dir); $filec=0; for ($i=0;$i<$filecount;$i++) { if (is_dir($photopath.$path."/".$filename[$i])&&$filename[$i]!=".") { if ($filename[$i]==".."&&$path!="") { $tmppath=preg_replace("/(.*)(\\/.*)$/","\\1",$path); echo "
..
"; $rowcount=1; } else { if ($filename[$i]!="..") { $tmppath=preg_replace("/\\+/","%2B",$path."/".$filename[$i]); $tmppath=preg_replace("/\\s/","%20",$tmppath); $tmppath=preg_replace("/\\(/","%28",$tmppath); $tmppath=preg_replace("/\\)/","%29",$tmppath); echo "
".$filename[$i]."

".getcomments($path."/".$filename[$i])."\n"; $filec++; $rowcount++; if ($rowcount==$photo_rowpics) {echo "";$rowcount=0;} } } } } for ($i=0;$i<$filecount;$i++) { if (!is_dir($photopath.$path."/".$filename[$i])) { if (accepted_file($filename[$i])!="") { $tmppath=preg_replace("/\\+/","%2B",$path."/".$filename[$i]); $tmppath=preg_replace("/\\s/","%20",$tmppath); $tmppath=preg_replace("/\\(/","%28",$tmppath); $tmppath=preg_replace("/\\)/","%29",$tmppath); echo "
".$filename[$i]."

".getcomments($path."/".$filename[$i])."\n"; $filec++; $rowcount++; if ($rowcount==$photo_rowpics) {echo "";$rowcount=0;} } } } if ($filec==0) {echo "Пусто.";} for ($i=$rowcount;$i<$photo_rowpics;$i++) {echo " ";} echo ""; } else { if (file_exists($photopath.$path)) { if (accepted_file($path)!="") { list($name,$extension)=split("//",preg_replace("/(.+)(\\.)([^\\.]*)$/","\\1//\\3",$path)); if (pic_is_thumbable($extension)==""&&$thumb!=0) { $error=1; } else { list($other,$fname)=split("//",preg_replace("/(.+)(\\/)([^\\/]*)$/","\\1//\\3",$path)); if ($other==$path) {$fname=$path;$other="";} $other=preg_replace("/\\s/","%20",$other); $other=preg_replace("/\\+/","%2B",$other); $other=preg_replace("/\\(/","%28",$other); $other=preg_replace("/\\)/","%29",$other); if ($thumb==0&&pic_is_thumbable($extension)!="") { print_fotoheader(); $path=preg_replace("/\\s/","%20",$path); $path=preg_replace("/\\(/","%28",$path); $path=preg_replace("/\\)/","%29",$path); print "< Назад


".$fname."
".getcomments($path); } else { if (pic_is_thumbable($extension)=="") { $name=$fname; if ($_SERVER["HTTP_RANGE"]!="") { list ($temp,$bytesline)=split("=",$_SERVER["HTTP_RANGE"]); list ($restartfrom,$temp)=split("-",$bytesline); if ($restartfrom==0){$restartfrom="";} } $fsize=filesize($photopath.$path); $ftime=filectime($photopath.$path); if ($restartfrom!="") { header("HTTP/1.0 206 Partial Content"); } header("Last-Modified: ".gmdate("D, d M Y H:i:s \G\M\T",$ftime)); header("Content-Type: application/zip"); header("Content-Disposition: attachment; filename=\"".$name."\""); header("Accept-ranges: bytes"); $dl=fopen($photopath.$path,"rb"); if ($restartfrom!="") { header("Content-Length: ".($fsize-$restartfrom)); header("Content-Range: bytes ".$restartfrom."-".($fsize-1)."/".$fsize); fseek($dl,$restartfrom); } else { header("Content-Length: ".$fsize); } set_time_limit(0); while (!feof($dl)) { $newline=fgets($dl); echo "$newline"; } fclose($dl); } else { show_picture($photopath.$path,$thumb); } } } } else { $error=2; } } else { $error=3; } if ($error!=0) { print_fotoheader(); echo "Произошла ошибка! $error Пожалуйста, напишите об этом вебмастеру: admin@spectrals.org"; } } } if ($download==1) {print_footer("");} function getcomments($filepath) { global $photocomments_fname; global $photocomments_desc; global $photocomments_count; $stringdesc=""; for ($i=0;$i<$photocomments_count;$i++) { if (strtolower($photocomments_fname[$i])==strtolower($filepath)) {$stringdesc.=$photocomments_desc[$i]."
";} } return ($stringdesc); } function accepted_file ($fname) { global $photo_acceptedtypes; list($name,$extension)=split("//",preg_replace("/(.+)(\\.)([^\\.]*)$/","\\1//\\3",strtolower($fname))); foreach(split(" ",strtolower($photo_acceptedtypes)) as $ext) { if ($ext==$extension) { return $ext; } } return ""; } function pic_is_thumbable($extension) { switch (strtolower($extension)) { case "jpg":return("jpeg");break; case "jpeg":return("jpeg");break; case "gif":return("gif");break; default:return ("");break; } } function print_fotoheader() { global $download; global $title; $download=1; print_header(""); echo "

$title

\n"; } function show_picture($filename,$thumb) { global $photo_thumbwidth; $error=0; $extension=accepted_file(strtolower($filename)); switch (pic_is_thumbable($extension)) { case "gif":$im = @imagecreatefromgif ($filename);break; default:$im = @imagecreatefromjpeg ($filename);break; } $im2= @imagecreatetruecolor($photo_thumbwidth, round($photo_thumbwidth*imagesy($im)/imagesx($im))); if (!$im) {$error=1;} else { if ($thumb==1) {imagecopyresized ($im2, $im, 0, 0, 0, 0, $photo_thumbwidth, round($photo_thumbwidth*imagesy($im)/imagesx($im)), imagesx($im), imagesy($im));} else {imagecopy ($im2, $im, 0, 0, 0, 0, imagesx($im), imagesy($im));} switch (pic_is_thumbable($extension)) { case "gif":imagegif (($thumb==1)?$im2:$im);break; default:imagejpeg (($thumb==1)?$im2:$im);break; } } if ($error==1) { print_fotoheader(); echo "Произошла ошибка! Пожалуйста, напишите об этом вебмастеру: admin@spectrals.org"; } } ?>