"; break; case "LOGOUT" : echo "- Admin mode disabled -
"; break; case "HELP" : echo "DEL #n : delete comment number #n
"; echo "LOGOUT : logout (remove password cookie)
"; echo "DELFILE : remove current image/text file.
"; echo "DELDESC : remove description of current image/text file
"; echo "DESC ... : describe current image/text file ....
"; echo "HELP : display commands
"; break; case "DEL" : if ( intval($opr) > 0 ) { $cfilename = ".comments/" . $filename . ".txt"; if ( file_exists($cfilename) ) { $cfile_content = file($cfilename); $hohoho=@fopen($cfilename, "w"); $flag=0; if ( flock($hohoho,2) ) { while ( list($key, $line) = each($cfile_content) ) { if ( intval($opr) != ($key+1) ) fwrite($hohoho, $line ); else $flag++; } fclose($hohoho); chmod($cfilename, 0664); if ( $flag > 0) { echo "Comment #$opr deleted
"; break; } } else { echo "Cannot write comment file $cfilename
"; break; } } else { echo "Cannot find any comments
"; break; } } echo "Cannot delete line# $opr from comments
"; break; case "DELFILE" : if ( $img!="" || $text!="" ) { if ( unlink($filename) ) { unlink( ".comments/" . $filename . ".txt" ); if ($text == "") { unlink ( ".thumbnails/" . $filename ); } echo "File $filename deleted.
"; break; } echo "Cannot delete file $filename (permission?)
"; break; } case "DELDESC" : // pre-load .index.txt file if ($path != "") $idxfile=$path . "/.index.txt"; else $idxfile=".index.txt"; if (file_exists($idxfile)) { $idx_content=file($idxfile); $flag=0; while ( list($key,$line) = each($idx_content)) { list($tmp_filename,$tmp_filedesc)=split('<>',trim($line),2); $flag-=eregi("!--FileDesc--!", $line); if ($tmp_filename == $nameonly && $flag < 0 ) { $flag=$key; break; } } reset($idx_content); if ($flag > 0) { $hohoho=@fopen($idxfile, "w"); if ( flock($hohoho,2) ) { while ( list($key,$line) = each($idx_content)) { if ($flag != $key) fwrite($hohoho, $line ); } fclose($hohoho); chmod($idxfile, 0664); echo "$filename description deleted
"; break; } echo "Cannot open $idxfile for writing
"; } } echo "Cannot find description
"; break; case "DESC" : // pre-load .index.txt file if ($path != "") $idxfile=$path . "/.index.txt"; else $idxfile=".index.txt"; if (file_exists($idxfile)) { $idx_content=file($idxfile); $flag=0; while ( list($key,$line) = each($idx_content)) { list($tmp_filename,$tmp_filedesc)=split('<>',trim($line),2); $flag+=eregi("!--FileDesc--!", $line); if ($tmp_filename == $nameonly && $flag >0 ) { $idx_content[$key]= $nameonly . "<>" . $opr . "\n"; $flag=-1; break; } } reset($idx_content); $hohoho=@fopen($idxfile, "w"); if ( flock($hohoho,2) ) { while ( list($key,$line) = each($idx_content)) { fwrite($hohoho, $line ); } if ( $flag == 0 ) { fwrite($hohoho, "\n!--FileDesc--!\n" . $nameonly . "<>" . $opr . "\n"); } elseif ($flag > 0 ) { if ( eregi( "\n" , $idx_content[sizeof($idx_content)-1] ) == 0) { fwrite($hohoho, "\n" ); } fwrite($hohoho, $nameonly . "<>" . $opr . "\n" ); } fclose($hohoho); chmod($idxfile, 0664); echo "$filename description changed
"; } else { echo "Cannot open $idxfile for writing
"; } } else { $hohoho=@fopen($idxfile, "w"); if ( flock($hohoho,2) ) { fwrite($hohoho, "\n!--FileDesc--!\n" . $nameonly . "<>" . $opr . "\n"); fclose($hohoho); chmod($idxfile, 0664); echo "$idxfile successfully created
"; } else echo "Cannot open $idxfile for writing
"; } break; } } return 1; } // comment function function do_comments($name) { global $path, $img, $text, $addauthor, $addcomment, $REMOTE_ADDR, $comments_logall, $cookieAuthor, $cookiePass, $adminpassword,$thisfn; $cResult = -1; if ( substr($addcomment , 0, 1) == "_" ) { $cResult = do_commands( substr($addcomment, 1) ); } $CommentContent=""; if ($path=="") $commentdir = ".comments"; else $commentdir = ".comments/" . $path; if (!file_exists($commentdir)) { $oldumask = umask(0); mkdir($commentdir,0777); umask($oldumask); } $cfn=$commentdir . "/" . $name . ".txt"; $setperms=file_exists($cfn); $commentfp=@fopen($cfn,$addauthor == "" ? "r":"a+"); // ±â·ÏµÈ ÁÖ¼® °è»ê if ($commentfp) { fseek($commentfp,0); if (flock($commentfp,1)) { $rhostcnt=0; $linenum=1; while ($line = fgets($commentfp,1024)) { list ($rhost, $datestr, $ctext, $cctext) = split('<>',trim($line),4); if ($REMOTE_ADDR == $rhost) $rhostcnt=$rhostcnt+1; else $rhostcnt=0; if ($REMOTE_ADDR == $rhost && $cctext == $addcomment) $addcomment=""; $rhost=split('\.',$rhost,4); if ($cookiePass == $adminpassword) { $CommentContent.= $linenum . " [DEL] : "; $linenum++; } $CommentContent.= "$datestr   $ctext : $cctext
"; } if ($addcomment != "" && $cResult < 0) { $datestr=date("Y/m/d H:i"); if (flock($commentfp,2)) { fseek($commentfp,0,SEEK_END); fwrite($commentfp,"$REMOTE_ADDR<>$datestr<>$addauthor<>$addcomment\n"); $rhost=split('\.',$REMOTE_ADDR,4); if ($cookiePass == $adminpassword) { $CommentContent.= "" . $linenum++ . " : "; } $CommentContent.= "$datestr   $addauthor : $addcomment
"; } if ($comments_logall) { $fp=fopen(".comments/all","a+"); if ($fp) { if (flock($fp,2)) { fseek($fp,0,SEEK_END); fwrite($fp,"$path/$name: $REMOTE_ADDR@$datestr '$addauthor' '$addcomment'\n"); } fclose($fp); chmod(".comments/all",0664); } } } } fclose($commentfp); if (!$setperms) chmod($cfn,0664); } // display comments $sty_comment = file ('sty_comment.html'); $patterns=array("/!--ThisFn--!/", "/!--Comments--!/", "/!--PathVal--!/", "/!--ImgVal--!/", "/!--TextVal--!/", "/!--PassVal--!/"); $replace=array("\"" . $thisfn . "\"", $CommentContent, "\"" . rawurlencode($path) . "\"", "\"" . rawurlencode($img) . "\"", "\"" . rawurlencode($text) . "\""); while (list ( , $line) = each ($sty_comment)) { echo preg_replace( $patterns, $replace , $line); } if ($cookieAuthor!="") { echo "\n"; } } function display_current_path($thispath,$linkcurrent) { global $sitename, $CurrentPath; if ($thispath=="") { if (!$linkcurrent) $CurrentPath.="$sitename/"; else $CurrentPath.="$sitename/"; } else { $pd_arr=explode("/","$sitename/" . $thispath); $parent=""; if ($linkcurrent) $end=0; else $end=1; for($g=sizeof($pd_arr)-1;$g>=$end;$g--) { $pd=""; for($i=1;$i$parent"; } if (!$linkcurrent) { $CurrentPath.="/"; $CurrentPath.=$pd_arr[sizeof($pd_arr)-1]; $CurrentPath.="/"; } else $CurrentPath.="/"; } } // end functions error_reporting(E_PARSE); if (isset($width)) { if ($width=="") setcookie("$resizecookiename"); else { $width .= "x" . $height; setcookie("$resizecookiename", $width); } } else { if ($resizecookiename) $width=$$resizecookiename; else $width=""; } if (isset($addauthor)) { $addauthor=substr($addauthor,0,400); $addauthor=str_replace("\\'","'",$addauthor); $addauthor=str_replace('\"','"',$addauthor); $addauthor=str_replace('&','&',$addauthor); $addauthor=str_replace('<','<',$addauthor); $addauthor=str_replace('>','>',$addauthor); $addcomment=substr($addcomment,0,400); $addcomment=str_replace("\\'","'",$addcomment); $addcomment=str_replace('\"','"',$addcomment); $addcomment=str_replace('&','&',$addcomment); $addcomment=str_replace('<','<',$addcomment); $addcomment=str_replace('>','>',$addcomment); setcookie("cookieAuthor", $addauthor); $cookieAuthor=$addauthor; } if (isset($addcomment)) { if (substr($addcomment, 0,1)=="_" ) { if ( $adminpassword == substr($addcomment, 1) ) { setcookie("cookiePass", $adminpassword ); $cookiePass=$adminpassword; } elseif ( strtoupper(substr($addcomment, 1)) == "LOGOUT" ) { setcookie("cookiePass", "x"); } } } if (!isset($path)) $path=""; else $path=rawurldecode($path); if (strstr($path,"..") || substr($path,0,1) == "/" || substr($path,0,1) == ".") $path=""; $wdp2=$path; if (strlen($wdp2) < 1) $wdp2=$defaultroottitle; if (isset($img)) { if (strstr($img = rawurldecode($img),"/")) $img=""; if (substr($img,0,1) == ".") $img=""; } else $img=""; if (isset($text)) { if (strstr($text = rawurldecode($text),"/")) $text=""; if (substr($text,0,1) == ".") $text=""; } else $text=""; // reading header echo "\n"; $sty_header = file ('sty_header.html'); $patterns=array("/!--TitleComment--!/", "/!--TopLine--!/", "/!--ThisFn--!/"); $replace=array($wdp2, $topline, "\"" . $thisfn . "\""); while (list ( , $line) = each ($sty_header)) { echo preg_replace( $patterns, $replace , $line); } $wasrescale=0; // rescale process if (isset($setrescale) && $setrescale!="") // rescale selection { if ($path!="") $HiddenForm= ""; if ($text!="") $HiddenForm= ""; if ($img!="") $HiddenForm= ""; $sty_rescale = file ('sty_rescale.html'); $patterns=array("/!--TopLine--!/", "/!--DontTouch--!/", "/!--ThisFn--!/"); $replace=array($topline, $HiddenForm, "\"" . $thisfn . "\""); while (list ( , $line) = each ($sty_rescale)) { echo preg_replace( $patterns, $replace , $line); } $wasrescale=1; } // // case of textfile // else if ($text != "") { $CurrentPath=""; display_current_path($path,1); if (!eregi("\.(java|asm|inc|c|cpp|h|phps|php-source)$",$text)) $fnt=substr($text,0,strlen($text)-strlen(strrchr($text,"."))); else $fnt=$text; if ($path!="") $pathstr=str_replace("%2F","/",rawurlencode($path)) . "/"; else $pathstr=""; $sty_text = file ('sty_text.html'); $patterns=array("/!--TopLine--!/", "/!--DisplayPath--!/", "/!--FileName--!/"); $replace=array($topline, $CurrentPath, $fnt); while (list ( , $line) = each ($sty_text)) { if (eregi("!--ContentPart_This_Line_Will_Not_Be_Displayed--!", $line)) break; echo preg_replace( $patterns, $replace , $line); } if ($path == "") $openfile = $text; else $openfile = $path . "/" . $text; $fp=fopen($openfile,"r"); if ($fp) { if (eregi("\.(java|asm|inc|c|cpp|phps|h|php-source)$",$text)) { while ($line = fgets($fp,1024)) { $line = str_replace('&','&',$line); $line = str_replace('<','<',$line); $line = str_replace('>','>',$line); $line = str_replace("\t",' ',$line); echo $line; } } else { while ($line = fgets($fp,1024)) echo $line; } fclose($fp); } while (list ( , $line) = each ($sty_text)) { if (eregi("!--CommentPart_This_Line_Will_Not_Be_Displayed--!", $line)) { do_comments($text); continue; } echo preg_replace( $patterns, $replace , $line); } } // // case of image file // else if ($img != "") { if ($path=="") $newwd=""; else $newwd=rawurlencode($path); // pre-load .index.txt file if ($path != "") $idxfile=$path . "/.index.txt"; else $idxfile=".index.txt"; if (file_exists($idxfile)) { $idx_content=file($idxfile); } $flag=0; $filedescription[]=array(); while ( list(,$line) = each($idx_content)) { if ($flag>0) { list($tmp_filename,$tmp_filedesc)=split('<>',trim($line),2); $filedescription[$tmp_filename] = $tmp_filedesc; } $flag+=eregi("!--FileDesc--!", $line); } //^ $openpath = ($path=="") ? "." : $path; $dp=opendir("./" . $openpath); if (!$dp) { die("Error in URL (" . $openpath . "). Click here.
"); } $t=(int)0; while ($fnt = readdir($dp)) { $full_fn=$wd."/".$fnt; if (!is_dir($full_fn) && eregi("\.(jpg|jpeg|gif|png)$",$fnt)) { if(substr($fnt,0,1) != ".") { $t++; $fnlist[$fnt]=""; } } } if (!isset($fnlist)) { die("Error in URL (no images found) (" . $openpath . "). Click here.
"); } closedir($dp); ksort($fnlist); reset($fnlist); $lastfn=""; $n=(int)0; $fixedimg=str_replace("\\'","'",$img); $fixedimg=str_replace('\"','"',$fixedimg); while ($fntmp = key($fnlist)) { next($fnlist); $n++; if ($fntmp == $fixedimg) { break; } $lastfn=$fntmp; } if (!$fntmp) { die("Error in URL (image not found) (" . $openpath . "). Click here.
"); } $nextfn=key($fnlist); $CurrentPath=""; display_current_path($path,0); $nameposstr=""; if (strlen($lastfn) > 0) // print previous img { $lastfn=rawurlencode($lastfn); $nameposstr .= "$previmagestr  "; } if ( isset($filedescription[$img]) ) { $tmpstfn = explode ("|", $filedescription[$img]) ; $nameposstr .= $tmpstfn[0]; } else { $nameposstr .= substr($img,0,strlen($fixedimg)-strlen(strrchr($img,"."))) ; } $nameposstr .= " ($n/$t)"; if (strlen($nextfn)>0) // next image { $nextfn=rawurlencode($nextfn); $nameposstr .= "  $nextimagestr"; } $newpath = str_replace("%2F","/",rawurlencode($path)); if ($newpath != "") $newpath .= "/"; $wstr=""; if ($width != "") { $tmp=GetImageSize($path . "/" . $fixedimg); $tmp2=explode("x",$width); if ($tmp2[1]!=0 && $tmp2[1]!="") { $outw=0; if ($tmp[0] >= $tmp2[0]) { $outw=$tmp2[0]; $outh=$tmp2[0]*$tmp[1]/$tmp[0]; } else $outh=$tmp[1]; if ($outh > $tmp2[1]) { $outh=$tmp2[1]; $outw=$tmp2[1]*$tmp[0]/$tmp[1]; } if ($outw != 0) $wstr="WIDTH=$outw HEIGHT=$outh"; } else // rescale by width only { if ($tmp[0] >= $width) { $outw=$width; $outh=$width*$tmp[1]/$tmp[0]; $wstr="WIDTH=$outw HEIGHT=$outh"; } } } $fixedimg=rawurlencode($fixedimg); $sty_img = file ('sty_img.html'); $patterns=array("/!--TopLine--!/", "/!--DisplayPath--!/", "/!--ImageHere--!/", "/!--Indicator--!/"); $replace=array($topline, $CurrentPath, "", $nameposstr); while (list ( , $line) = each ($sty_img)) { if (eregi("!--DescriptionPart_This_Line_Will_Not_Be_Displayed--!", $line)) { if ( isset($tmpstfn) ) { for ($counterX = 1 ; $counterX < sizeof($tmpstfn) ; $counterX++ ) echo "$tmpstfn[$counterX]
"; } continue; } if (eregi("!--CommentPart_This_Line_Will_Not_Be_Displayed--!", $line)) { do_comments($img); continue; } echo preg_replace( $patterns, $replace , $line); } } // // browsing directory // else { // browse mode $CurrentPath=""; display_current_path($path,0); // if using convert, find where convert is (you could just manually configure it, too) if ($thumbnails == "convert" && $my_convert_path == "") { // if using win32, you will have to change this to $my_convert_path = "path_to_convert.exe" instead. @exec("which convert", $tmp); $my_convert_path= $tmp[0]; if ($my_convert_path=="") $thumbnails="none"; } // read directory $openpath = ($path=="") ? "." : $path; if (!is_dir($openpath) || !($dp=opendir($openpath))) { if (!$dp=opendir(".")) die("Error in URL (" . $path . "). Click here.
"); else $path=""; } while ($fn = readdir($dp)) { if(substr($fn,0,1) != ".") { $fnlist[$fn]=""; } }; if (!isset($fnlist)) $fnlist[""]=""; closedir($dp); ksort($fnlist); reset($fnlist); /////////// $sty_dir = file ('sty_dir.html'); $patterns=array("/!--TopLine--!/", "/!--DisplayPath--!/"); $replace=array($topline, $CurrentPath); // pre-load .index.txt file if ($path != "") $idxfile=$path . "/.index.txt"; else $idxfile=".index.txt"; if (file_exists($idxfile)) { $idx_content=file($idxfile); } $flag=0; $filedescription[]=array(); while ( list(,$line) = each($idx_content)) { if ($flag>0) { list($tmp_filename,$tmp_filedesc)=split('<>',trim($line),2); $filedescription[$tmp_filename] = $tmp_filedesc; } $flag+=eregi("!--FileDesc--!", $line); } while (list ( , $line) = each ($sty_dir)) { if (eregi("!--DirectoryDescriptionPart_This_Line_Will_Not_Be_Displayed--!", $line)) { // display index text if ( isset($idx_content) ) { reset($idx_content); list(,$line)=each($idx_content); if ($line) { echo "
" . chop($line) . "
"; while ( list(,$line)=each($idx_content) ) { if (eregi("!--FileDesc--!", $line)) break; echo chop($line) . "\n"; } } } else { $tt=strrchr($wdp2,"/"); if (!$tt || strlen($tt)<1) $tt=$wdp2; else $tt=substr($tt,1); echo "
" . $tt . "
\n"; } continue; } if (eregi("!--DirectoryListing_This_Line_Will_Not_Be_Displayed--!", $line)) { // directory listing reset($fnlist); if ($path=="") $newwd=""; else $newwd=rawurlencode($path . "/"); $tablestat=2; while ($fn = key($fnlist)) { next($fnlist); if ($path == "") $full_fn="./".$fn; else $full_fn=$path."/".$fn; if (is_dir($full_fn)) { // check for thumbnail if ($path == "") $pfn=$fn . "/.dir.jpg"; else $pfn=$path."/".$fn . "/.dir.jpg"; $newfn=rawurlencode($fn); if ($tablestat==2) { echo ""; $tablestat=0; } echo "" .""; // check .index.txt for directory title if ($path == "") $idx_file=$fn . "/.index.txt"; else $idx_file=$path."/".$fn . "/.index.txt"; if (!strstr($idx_file,"..") && file_exists($idx_file) && $file=fopen($idx_file,"r")) { $line = fgets($file,4096); if ($line) $idx_fn=chop($line); fclose($file); } if (file_exists($pfn)) { $pfn=str_replace("%2F","/",rawurlencode($pfn)); echo "
"; } if ($idx_fn!="") echo "$idx_fn
"; else echo "$fn/"; $idx_fn=""; echo ""; $tablestat=$tablestat+1; } } if ($tablestat==1) { echo " "; } continue; } if (eregi("!--ImageListing_This_Line_Will_Not_Be_Displayed--!", $line)) { // image listing reset($fnlist); $tablestat=0; if ($path=="") $newwd=""; else $newwd=rawurlencode($path); if ($path=="") $thumbnaildir = ".thumbnails"; else $thumbnaildir = ".thumbnails/" . $path; if (!file_exists($thumbnaildir)) { $oldumask = umask(0); mkdir($thumbnaildir,0770); umask($oldumask); } while ($fn = key($fnlist)) { next($fnlist); if ($path=="") $full_fn=$fn; else $full_fn=$path."/".$fn; if (!is_dir($full_fn) && eregi("\.(jpg|jpeg|gif|png)$",$fn)) { if ($tablestat == 0) echo ""; else if ($tablestat == 3) { echo ""; $tablestat=0; } $tablestat=$tablestat+1; $fnu=rawurlencode($fn); $stfn = substr($fn,0,strlen($fn)-strlen(strrchr($fn,"."))); echo "". ""; $thumbnailfile = $thumbnaildir . "/" . $fn; if ($path=="") $createfn=$fn; else $createfn=$path . "/" . $fn; $sizestr=""; if ($path == "") $txtfile=".$fn" . ".txt"; else $txtfile="$path/.$fn" . ".txt"; if (!strstr($txtfile,"..") && file_exists($txtfile) && $file=fopen($txtfile,"r")) { $line = fgets($file,4096); if ($line) $stfn=chop($line); fclose($file); } if ($thumbnails != "none") { $dothumbnail=1; if (!file_exists($thumbnailfile)) { if ($thumbnails == "gd") { if (eregi("\.gif$",$fn)) { $thumbnailfile=$createfn; $tmp=GetImageSize($createfn); $newh=$thumbnailheight; $neww=$newh/$tmp[1] * $tmp[0]; if ($neww > $tmp[0]) { $neww=$tmp[0]; $newh=$tmp[1]; } if ($neww > $maxthumbnailwidth) { $neww=$maxthumbnailwidth; $newh=$neww/$tmp[0] * $tmp[1]; } $sizestr="WIDTH=$neww HEIGHT=$newh"; } else { if (eregi("\.(jpg|jpeg)$",$fn)) $im = imagecreatefromjpeg($createfn); else if (eregi("\.png$",$fn)) $im = imagecreatefrompng($createfn); if ($im != "") { $newh=$thumbnailheight; $neww=$newh/imagesy($im) * imagesx($im); if ($neww > imagesx($im)) { $neww=imagesx($im); $newh=imagesy($im); } if ($neww > $maxthumbnailwidth) { $neww=$maxthumbnailwidth; $newh=$neww/imagesx($im) * imagesy($im); } $im2=ImageCreate($neww,$newh); ImageCopyResized($im2,$im,0,0,0,0,$neww,$newh, imagesx($im),imagesy($im)); if (eregi("\.(jpg|jpeg)$",$fn)) imagejpeg($im2,$thumbnailfile, $ThumbQuality); else if (eregi("\.png$",$fn)) imagepng($im2,$thumbnailfile); ImageDestroy($im); ImageDestroy($im2); } } } else if ($thumbnails == "convert") // imagemagick thumbnails { $tmp=GetImageSize($createfn); $newh=$thumbnailheight; $neww=$newh/$tmp[1] * $tmp[0]; if ($neww > $tmp[0]) { $neww=$tmp[0]; $newh=$tmp[1]; } if ($neww > $maxthumbnailwidth) { $neww=$maxthumbnailwidth; $newh=$neww/$tmp[0] * $tmp[1]; } @exec($my_convert_path . ' -filter Lanczos -geometry ' . round($neww) . "x" . $newh . ' -quality '. $ThumbQuality . ' "' . $createfn . '" "' . $thumbnailfile . '"'); } else $dothumbnail=0; } } // $thumbnails != "none" else $dothumbnail=0; if ( $stfn == substr($fn,0,strlen($fn)-strlen(strrchr($fn,".") ) ) ) { $tmpstfn = explode ("|", $filedescription[$fn]) ; $stfn = isset($filedescription[$fn]) ? $tmpstfn[0] : $stfn; } if ($dothumbnail) { if ($path=="") $wdtmp=""; else $wdtmp=str_replace("%2F","/",rawurlencode($path . "/")); if ($sizestr=="") echo "\"\"
$stfn"; else echo "\"\"
$stfn"; } else echo "$stfn"; echo "
"; } } if ($tablestat != 0) { if ($tablestat == 1) echo " "; if ($tablestat == 1 || $tablestat == 2) echo " "; echo ""; } continue; } if (eregi("!--AudioListing_This_Line_Will_Not_Be_Displayed--!", $line)) { // audio listing $tablestat=0; reset($fnlist); if ($path=="") $newwd=""; else $newwd=str_replace("%2F","/",rawurlencode($path)); while ($fn = key($fnlist)) { next($fnlist); if ($path=="") $full_fn=$fn; else $full_fn=$path."/".$fn; $fs=floor(filesize($full_fn)/1000); if (!is_dir($full_fn) && eregi("\.(wav|mp2|mp3)$",$fn)) { $fnu=rawurlencode($fn); if ($tablestat == 0) { $tablestat=1; echo "
";
	        }
			if (isset ($filedescription[$fn]) )
		        echo "AUDIO: ($fs"."k) $fn - ". $filedescription[$fn] ."\n";
	        else echo "AUDIO: ($fs"."k) $fn\n";
	      }
	    }
			continue;
		}
		if (eregi("!--MovieListing_This_Line_Will_Not_Be_Displayed--!", $line)) {
	    // movie listing
			reset($fnlist);
			while ($fn = key($fnlist))
			{
				next($fnlist);
				if ($path=="") $full_fn=$fn;
				else $full_fn=$path."/".$fn;
				$fs=floor(filesize($full_fn)/1000);
				if (!is_dir($full_fn) && eregi("\.(avi|wmv|asf|asx|rm|ra|mov|mpg|mpeg)$",$fn)) { 
					$fnu=rawurlencode($fn);
					if ($tablestat == 0) {
						$tablestat=1;
						echo "
";
					}
					if (isset ($filedescription[$fn]) )
						echo "VIDEO: ($fs"."k) $fn - ". $filedescription[$fn] ."\n";
					else
						echo "VIDEO: ($fs"."k) $fn\n";
				}
			}
			continue;
		}
		if (eregi("!--TextListing_This_Line_Will_Not_Be_Displayed--!", $line)) {
	    // text listing
	    reset($fnlist);
	    while ($fn = key($fnlist))
	    {
	      next($fnlist);
	      $full_fn=$wd."/".$fn;
	      if (!is_dir($full_fn) && eregi("\.TXT$",$fn)) {
	        $fnu=rawurlencode($fn);
	        if ($tablestat == 0) {
	          $tablestat=1;
	          echo "
";
	        }
			if (isset ($filedescription[$fn]) )
				echo "TEXT: " . substr($fn,0,strlen($fn)-4) . " - ". $filedescription[$fn] ."\n";
	        else echo "TEXT: " . substr($fn,0,strlen($fn)-4) . "\n";
	      }
	    }
			continue;
		}
		if (eregi("!--CodeListing_This_Line_Will_Not_Be_Displayed--!", $line)) {
	    // code listing
	    reset($fnlist);
	    if ($path=="") $newwd="";
	    else $newwd=rawurlencode($path);
	    while ($fn = key($fnlist))
	    {
	      next($fnlist);
	      if ($path=="") $full_fn=$fn;
	      else $full_fn=$path."/".$fn;
	      if (!is_dir($full_fn) && eregi("\.(java|asm|inc|c|cpp|phps|php-source|h)$",$fn)) { 
	        $fnu=rawurlencode($fn);
	        if ($tablestat == 0) {
	          $tablestat=1;
	          echo "
";
	        }
			if (isset ($filedescription[$fn]) )
				echo "CODE: $fn - ". $filedescription[$fn] ."\n";
			else echo "CODE: $fn\n";
	      }
	    }
			continue;
		}
		if (eregi("!--ArchiveListing_This_Line_Will_Not_Be_Displayed--!", $line)) {
	    // archive listing
	    reset($fnlist);
	    if ($path=="") $newwd="";
	    else $newwd=str_replace("%2F","/",rawurlencode($path));
	    while ($fn = key($fnlist))
	    {
	      next($fnlist);
	      if ($path=="") $full_fn=$fn;
	      else $full_fn=$path."/".$fn;
	      $fs=floor(filesize($full_fn)/1000);
	      if (!is_dir($full_fn) && eregi("\.(exe|zip|ace|rar|arj|arc|lzh|lha|tar|gz|tar|tgz|tar|bz)$",$fn)) { 
	        $fnu=rawurlencode($fn);
	        if ($tablestat == 0) {
	          $tablestat=1;
	          echo "
";
	        }
			if (isset ($filedescription[$fn]) )
				echo "ARCH: ($fs"."k) $fn - ". $filedescription[$fn] ."\n";
	        else echo "ARCH: ($fs"."k) $fn\n";
	      }
	    }
			continue;
		}
		if (eregi("!--CommentPart_This_Line_Will_Not_Be_Displayed--!", $line)) {
			if ( !file_exists($path == "" ? ".nodircomments" : ($path . "/.nodircomments"))) do_comments(".index");
			continue;
		}
		echo preg_replace( $patterns, $replace , $line);
	}

/////////

    if ($tablestat == 1) echo "";

  }

  //
  // post processing
  //
  
  echo "";
  
  $RescaleMSG="";
  if ($wasrescale==0 && $width!="") $RescaleMSG.= "Maximum display size: ";
  $RescaleMSG.=  "";
  if ($wasrescale!=0) $RescaleMSG.=  "back";
  else if ($width != "") $RescaleMSG.=  "$width";
  else $RescaleMSG.= "Set maximum display size";
  
	$sty_footer = file ('sty_footer.html');
 	$patterns=array("/!--RescaleMSG--!/");
	$replace=array($RescaleMSG);
	while (list ( , $line) = each ($sty_footer)) {
		echo preg_replace( $patterns, $replace , $line);
	}
	echo "";
?>