// wngrootBrowser 1.0 beta 8!
// Jan 16th 2003 - image and file gallery - simple fast php
// Very messy hack job, stfu ! buggy
// All hash vals uppercase for simplicity!
///////////////////////////////////////////
// EDIT THE FOLLOWING
//////////////////////////////////////////
// change me to this files name!
$thisfile = "index.php";
$id = $_GET["id"];
$img = $_GET["img"];
// enter rejected file extensions, ie dont show these
$rejected['PHP'] = 1;
$rejected['TMP'] = 1;
$rejected['SWP'] = 1;
// enter icon mapings
$icons['ZIP'] = "/icons/generic.gif";
$icons['MP3'] = "/icons/generic.gif";
$icons['TXT'] = "/icons/generic.gif";
// enter the default icon
$icon_default = "/icons/generic.gif";
// enter the icon for dirs
$icon_dir = "/icons/dir.gif";
// enter the icon for images
$icon_img = "/icons/generic.gif"
/////////////////////////////////////////
// DONT TOUCH !
////////////////////////////////////////
?>
$currentdir = getcwd();
$filearray = opendir($currentdir);
while ($file = readdir($filearray)) {
if (is_file($file)) {
$imageinfo = getimagesize($file);
if ($imageinfo[2]!="") {
$files[] = $file;
$imageinfox[] = $imageinfo[0];
$imageinfoy[] = $imageinfo[1];
$filenamearray = explode (".", $file);
$ext[] = "IMG";
$filesize[] = filesize($file);
$filedate[] = filemtime($file);
}
else {
$filenamearray = explode (".", $file);
if ($rejected[strtoupper($filenamearray[sizeof($filenamearray)-1])] != 1) {
$ext[] = strtoupper($filenamearray[sizeof($filenamearray)-1]);
$imageinfoy[] = "DIR";
$imageinfox[] = "DIR";
$files[] = $file;
$filesize[] = filesize($file);
$filedate[] = filemtime($file);
}
}
} else {
$curpos++;
$ext[] = "DIR";
$files[] = $file;
$imageinfox[] = "DIR";
$imageinfoy[] = "DIR";
$filenamearray = explode (".", $file);
$filedate[] = filemtime($file);
$filesize[] = filesize($file);
}
}
$max = count($files);
array_multisort($files, $filedate, $ext, $imageinfox, $imageinfoy, $filesize);
$imgcnt=1;
while (list($key, $value) = each($ext)) {
if($value=="IMG"){
$imgid[$imgcnt]=$key;
$imgcnt++;
}}
if (!isset($img)) {
$output = "\n";
$output .= "\n";
$output .= "\n";
$output .= "name";
$output .= " | \n";
$output .= "\n";
$output .= "dimensions\n";
$output .= " | \n";
$output .= "\n";
$output .= "size\n";
$output .= " | \n";
$output .= "\n";
$output .= "date\n";
$output .= " | \n";
$output .= "
\n";
$imgcnt=0;
$output .= " ../ | \n";
$output .= " | \n";
$output .= " | \n";
$output .= "
\n";
$dirs=$files;
while (list($key, $value) = each($dirs)) {
if ($ext[$key] == "DIR" && $value != '.' && $value != '..') {
$output .= " $value/ | \n";
$output .= " | \n";
$output .= " | \n";
$output .= "".date( "m/d/Y", $filedate[$key])." | \n";
$output .= "
\n";
}
}
while (list($key, $value) = each($files)) {
if ($ext[$key] == "IMG")
$icon = $icon_img;
else if ($icons[$ext[$key]])
$icon = $icons[$ext[$key]];
else $icon = $icon_default;
if ($ext[$key] == "IMG") {
$imgcnt++;
$output .= " $value | \n";
$output .= "$imageinfox[$key]x$imageinfoy[$key] | \n";
$kb = $filesize[$key]/1024;
$kbs = split('\.', $kb);
$output .= "$kbs[0] kb | \n";
$output .= "".date( "m/d/Y", $filedate[$key])." | \n";
$output .= "
\n";
}
else if ($ext[$key] != "DIR") {
$output .= " $value | \n";
$output .= " | \n";
$kb = $filesize[$key]/1024;
$kbs = split('\.', $kb);
$kbs[0] = $kbs[0]." kb";
$output .= "$kbs[0] | \n";
$output .= "".date( "m/d/Y", $filedate[$key])." | \n";
$output .= "
\n";
}
}
$output .= "\n";
$output .= "
\n";
}
else if (isset($id)) {
$output = "\n";
$output .= "\n";
$idback = $id-1;
$back=$imgid[$idback];
if ($id>1) {$output .= "prev |\n";}
$output .= " | ";
$output .= " index | \n";
$output .= "\n";
$idfor = $id+1;
$forward = $imgid[$idfor];
if ($id<$imgcnt-1) {$output .= "| next \n";}
$output .= " |
---|
\n";
$output .= "";
$output .= "\n";
$output .= "
$files[$img] is $imageinfox[$img]x$imageinfoy[$img]";
$output .= " in $filesize[$img] bytes, created on ".date( "m/d/Y", $filedate[$img])."
";
$output .= "\n";
}
echo $output . "";
closedir($filearray);
?>