";
if (isset($_GET["sd"])) {
$tmp=$_GET["sd"]."/";
$dir_handle = @opendir("$tmp") or die("Unable to open $tmp");
while (false !== ($file = readdir($dir_handle))) {
// read image file list into $content
$tmp2=$tmp.$file."/";
if (is_dir($tmp2) and $file!==".." and $file!==".") {
$content = $content . "," . $file;
}
}
$test2=explode(",", $content); //convert $content to an array
sort($test2); //sort the array
$content=implode(",", $test2); //put it back as a string
$test = preg_split('/[,]/',$content, -1, PREG_SPLIT_NO_EMPTY);
$ss="";
$sscount=1; //used to make the links to the images
$catcount=1; //used to number the subdirectories
$textcontent="";
print "\n
";
echo trim($tmp, "\/");
print " \n- ";
print "
\n";
foreach ($test as $content) {
$tmp3=$tmp.$file.$content."/";
$dir_handle = @opendir("$tmp3") or die("Unable to open $tmp3");
while (false !== ($file = readdir($dir_handle))) {
if (preg_match('/\.(txt|nfo)$/i',$file)) {
$textcontent = $textcontent . "," . $file;
}
}
$texttest = preg_split('/[,]/',$textcontent, -1, PREG_SPLIT_NO_EMPTY);
$dir_handle = @opendir("$tmp3") or die("Unable to open $tmp3");
//makes the table rows displaying the subdirectory names
print "
$catcount |
$content |
";
//this loop is used to make the links to the screenshots.
while (false !== ($file = readdir($dir_handle))) {
if (preg_match('/\.(jpg|gif|png)$/i',$file)) {
$contentlen = strlen($file);
$breakpoint = strrpos($file, '.');
$shortver = substr($file, 0, $breakpoint);
// Find a matching caption file if it exists
foreach ($texttest as $textcontent) {
$textbreakpoint = strrpos($textcontent, '.');
$textshortver = substr($textcontent, 0, $textbreakpoint);
if (strcasecmp($textshortver,$shortver)==0) {
//read in the comment file, remove the whitespace from the start and end as well as remove any html tags
$display = str_replace($dropthese, " ",(strip_tags(trim(file_get_contents("$tmp3$textcontent")))));
}
}
if (!isset($display)){ $display = "No Caption"; } // if no caption file is found it will say no caption.
print "- [$sscount
-
";if (extension_loaded('gd')){print "";}print "
] ";
unset($display); //reset caption
// This is set to make the screen shot listings wrap at the given number of entries.
if (floatval($sscount/$wrapamount)==intval($sscount/$wrapamount)){print " \n";}
++$sscount;
}
}
print " | \n \n";
$sscount=1;
++$catcount;
}
print "
|
";
}
print "\n
|
|