1) { $wstr="WIDTH=$width"; $wstr_pass="&width=$width"; } else { $width=""; $wstr=""; $wstr_pass=""; } if (!isset($path)) $path=""; if (strstr($path = rawurldecode($path),"..")) $path=""; $wdp2=$path; if (strlen($wdp2) < 1) $wdp2=$defaultroottitle; if (isset($img)) { if (strstr($img = rawurldecode($img),"/")) $img=""; } else $img=""; if (isset($text)) { if (strstr($text = rawurldecode($text),"/")) $text=""; } else $text=""; echo "" . "" . "$sitename - $wdp2" . "\n"; echo "
$topline
"; echo "
"; if (isset($setrescale) && $setrescale!="") // rescale selection { echo ""; } else if ($text != "") { echo ""; } else if ($img != "") { echo ""; } else { // browse mode echo ""; // image listing reset($fnlist); $tablestat=0; if ($path=="") $newwd=""; else $newwd=rawurlencode($path); $thumbnaildir = ".thumbnails/" . $path; 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) { $tablestat=1; echo ""; } else if ($tablestat == 1) { $tablestat=2; } else if ($tablestat == 2) { echo ""; $tablestat=1; } $fnu=rawurlencode($fn); $stfn = substr($fn,0,strlen($fn)-strlen(strrchr($fn,"."))); echo ""; } } if ($tablestat != 0) { if ($tablestat == 1) echo ""; echo ""; } // 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 ""; } echo "
" . " images to" . " pixels wide.  "; if ($path!="") echo ""; if ($text!="") echo ""; if ($img!="") echo ""; echo "
(Leave blank for no rescaling)"; echo "
"; // current path display if ($path=="") { echo " /$sitename/
"; } else { echo " "; $pd_arr=split("/","$sitename/" . $path); $parent=""; for($g=sizeof($pd_arr)-1;$g>=0;$g--) { $pd=""; for($i=1;$i$parent"; } echo "/
"; } if (!eregi("\.(asm|inc|c|cpp|h|phps)$",$text)) $fnt=substr($text,0,strlen($text)-strlen(strrchr($text,"."))); else $fnt=$text; echo "
$fnt

"; if ($path!="") $pathstr=str_replace("%2F","/",rawurlencode($path)) . "/"; else $pathstr=""; echo "
";
    if ($path == "") $openfile = $text;
    else $openfile = $path . "/" . $text;
    $fp=fopen($openfile,"r");
    if (eregi("\.(asm|inc|c|cpp|phps|h)$",$text)) { 
      while ($line = fgets($fp,1024)) 
      {
        $line = str_replace('&','&',$line);
        $line = str_replace('<','<',$line);
        $line = str_replace('>','>',$line);
        echo $line;
      }
    }
    else
    {
      while ($line = fgets($fp,1024)) 
      {
        echo $line;
      }
    }
    fclose($fp);
    echo "
"; if ($path=="") $newwd=""; else $newwd=rawurlencode($path); $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)) { $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); while ($fntmp = key($fnlist)) { next($fnlist); $n++; if ($fntmp == $fixedimg) { break; } $lastfn=$fntmp; } $nextfn=key($fnlist); // current path display if ($path=="") { echo " /$sitename/
"; } else { echo " "; $pd_arr=split("/","$sitename/" . $path); $parent=""; for($g=sizeof($pd_arr)-1;$g>=0;$g--) { $pd=""; for($i=1;$i$parent"; } echo "/
"; } if (strlen($lastfn) > 0) // print previous img { $lastfn=rawurlencode($lastfn); echo "$previmagestr   "; } echo $fixedimg . " ($n/$t)"; if (strlen($nextfn)>0) // next image { $nextfn=rawurlencode($nextfn); if (strlen($nextfn) > 0) echo "   $nextimagestr"; } echo "
"; if ($path == "") $txtfile=$fn . ".txt"; else $txtfile="$path/$fn.txt"; if (substr($txtfile,0,1)!=".") $txtfile="." . $txtfile; if (file_exists($txtfile) && $file=fopen($txtfile,"r")) { echo ""; while ($line = fgets($file,4096)) { echo "$line
"; } echo "
"; fclose($file); } $fixedimg=rawurlencode($fixedimg); $newpath = $path; if ($newpath != "") $newpath .= "/"; echo "    

"; echo "
"; echo "
";

    // 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); // display index text if ($path != "") $idxfile=$path . "/.index.txt"; else $idxfile=".index.txt"; if (file_exists($idxfile) && $file=fopen($idxfile,"r")) { $line = fgets($file,4096); if ($line) { echo "" . chop($line) . "\n"; while ($line = fgets($file,4096)) echo chop($line) . "\n"; echo "\n"; } fclose($file); } else { $temp=strrchr($wdp2,"/"); if (!$temp) $temp=$wdp2; else $temp=substr($temp,1); echo "" . $temp . "\n\n"; } // current path display echo $pathindents; if ($path=="") { echo "/$sitename/\n"; } else { $pd_arr=split("/","$sitename/" . $path); $parent=""; for($g=sizeof($pd_arr)-1;$g>=1;$g--) { $pd=""; for($i=1;$i$parent"; } echo "/" . $pd_arr[sizeof($pd_arr)-1] . "/\n"; } // directory 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)) { $newfn=rawurlencode($fn); echo "$pathindents$subdirindent$fn\n"; } } echo "
"; if (eregi("\.(jpg|jpeg)$",$fn)) { if ($path=="") $thumbnailfile = $thumbnaildir . $fn; else $thumbnailfile = $thumbnaildir . "/" . $fn; if (!file_exists($thumbnailfile) || (isset($thumbnailpass) && crypt($thumbnailpass,substr($tnregenpass,0,2))==$tnregenpass)) { if ($path=="") $createfn=$fn; else $createfn=$path . "/" . $fn; $im = imagecreatefromjpeg($createfn); if ($im != "") { if (!file_exists($thumbnaildir)) { $oldumask = umask(0); mkdir($thumbnaildir,0770); umask($oldumask); } if (file_exists($thumbnailfile)) unlink($thumbnailfile); $newh=100; $neww=$newh/imagesy($im) * imagesx($im); $im2=ImageCreate($neww,$newh); ImageCopyResized($im2,$im,0,0,0,0,$neww,$newh, imagesx($im),imagesy($im)); imagejpeg($im2,$thumbnailfile,50); ImageDestroy($im); ImageDestroy($im2); } } if ($path=="") $wdtmp=""; else $wdtmp=str_replace("%2F","/",rawurlencode($path . "/")); echo "\"\" $stfn"; } else echo "$stfn"; echo "
";
        }
        echo "AUDIO: $fn ($fs"."k)\n";
      }
    }

    // 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|mov|mpg|mpeg)$",$fn)) { 
        $fnu=rawurlencode($fn);
        if ($tablestat == 0) {
          $tablestat=1;
          echo "
";
        }
        echo "VIDEO: $fn ($fs"."k)\n";
      }
    }

    // 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("\.(asm|inc|c|cpp|phps|h)$",$fn)) { 
        $fnu=rawurlencode($fn);
        if ($tablestat == 0) {
          $tablestat=1;
          echo "
";
        }
        echo "CODE: $fn\n";
      }
    }

    // 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 "
";
        }
        echo "TEXT: " . substr($fn,0,strlen($fn)-4) . "\n";
      }
    }
    if ($tablestat == 1) echo "
"; echo $bottomlinestart; echo "image rescaling "; if ($width!="") echo "set to "; else echo "is turned "; echo ""; if (strstr($width,"%")) echo "$width wide"; else if ($width != "") echo "$width pixels wide"; else echo "off"; echo " - $copyrightstring
"; echo $bottomlineend; echo "\n"; exit; ?>