// blorpscript v1.5.9 // (this one was modified by steve gedikian) // last modified 9/10/00 // copyright (c) 2000 justin frankel // source distributed under the gnu general public license. // let me know if you find any security holes (I think I got most of them) // (justin@landoleet.org) // todo: figure out what to do with gif thumbnails. for now you have to // manually create them (damned unisys) // this is the one real config item in this file. specifies how the page // should reference itself. $thisfn="index.phtml"; // load configuration include '.blorpconfig.php'; if (isset($width) && strlen($width) > 1) { $wstr="WIDTH=$width"; $wstr_pass="&width=$width"; } else { $width=""; $wstr=""; $wstr_pass=""; } if (!isset($path)) $path=""; if (strstr($path = rawurldecode($path),"..")) $path=""; if (substr($path,0,1)=="/") $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 "
" . "" . "| (Leave blank for no rescaling)"; echo " | |||||||
"; } else { echo " "; $pd_arr=split("/","$sitename/" . $path); $parent=""; for($g=sizeof($pd_arr)-1;$g>=0;$g--) { $pd=""; for($i=1;$i "; } 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 " | |||||||
"); } $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); 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 "; } 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 " | |||||||
";
// read directory
$openpath = ($path=="") ? "." : $path;
if (!is_dir($openpath) || !($dp=opendir($openpath)))
{
if (!$dp=opendir("."))
die("Error in URL (" . $path . "). Click here. | |||||||
| ";
if ($path=="")
{
$thumbnailfile = $thumbnaildir . $fn;
$createfn=$fn;
}
else
{
$thumbnailfile = $thumbnaildir . "/" . $fn;
$createfn=$path . "/" . $fn;
}
$sizestr="";
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";
}
if (!file_exists($thumbnailfile))
{
if (eregi("\.(jpg|jpeg)$",$fn))
$im = imagecreatefromjpeg($createfn);
else if (eregi("\.png$",$fn))
$im = imagecreatefrompng($createfn);
if ($im != "")
{
if (!file_exists($thumbnaildir))
{
$oldumask = umask(0);
mkdir($thumbnaildir,0770);
umask($oldumask);
}
if (file_exists($thumbnailfile)) unlink($thumbnailfile);
$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,50);
else if (eregi("\.png$",$fn))
imagepng($im2,$thumbnailfile);
ImageDestroy($im);
ImageDestroy($im2);
}
}
if ($path=="") $wdtmp="";
else $wdtmp=str_replace("%2F","/",rawurlencode($path . "/"));
if ($sizestr=="") echo " | ";
}
}
if ($tablestat != 0)
{
if ($tablestat == 1) echo ""; 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 " | |||||||