<?php
// BM DESIGN - HTTP://WWW.B-M-D.NL/
// (C) BM DESIGN - HTTP://WWW.B-M-D.NL/
// ----------- start configuratie ------------
define(GALLERY_ROOT, "./");
define(THUMB_ROOT, "");
define(STAND_ALONE, TRUE);
define(HIGH_QUALITY_THUMB, true);
define(THUMB_MAX_WIDTH, 160);
define(THUMB_MAX_HEIGHT, 160);
define(ENLARGE_SMALL_IMAGES, FALSE);
define(SHOW_IMAGE_NAME, true);
define(IMAGE_UNDERSCORE_AS_SPACE, TRUE);
define(SHOW_IMAGE_EXTENSION, FALSE);
define(SHOW_IMAGE_TITLE, FALSE);
define(IMAGE_IN_NEW_WINDOW, true);
define(IMAGE_DESCRIPTION_EXT, ".txt");
define(SHOW_DIR_NAME, TRUE);
define(DIR_UNDERSCORE_AS_SPACE, TRUE);
define(DIR_IMAGE_FILE, "_thumb.jpg");
define(DIR_DESCRIPTION_FILE, "_desc.txt");
define(DIR_NAME_FILE, "_name.txt");
define(SHOW_FILES, true);
$file_exclude = array();
$file_ext_exclude = array(".php", ".txt");
define(FILE_UNDERSCORE_AS_SPACE, TRUE);
define(SHOW_FILE_EXTENSION, false);
define(FILE_IN_NEW_WINDOW, TRUE);
define(GALLERY_NAME, "titel");
define(HOME_TEXT, "Home");
define(CLICK_IMAGE, "- Klik op de foto om terug te gaan naar het albumoverzicht -");
define(PREVIOUS_TEXT, "<< Vorige");
define(NEXT_TEXT, "Volgende >>");
define(USE_JAVA, TRUE);
define(SORT_DIVIDER, "--");
define(GALLERY_COLUMNS, 4);
define(TABLE_BORDER_WIDTH, 1);
define(THUMB_BORDER_WIDTH, 1);
define(THUMB_TD_PADDING, 7);
define(THUMB_TD_SPACING, 15);
define(THUMB_TD_BORDER_WIDTH, 1);
define(WINDOW_EXTRA_WIDTH, 80);
define(WINDOW_EXTRA_HEIGHT, 125);
define(TEXT_HEIGHT, 16);
define(SCROLLBAR_WIDTH, 17);
$color_body_back = "#202020";
$color_body_text = "#808080";
$color_dir_link = "#b0b0b0";
$color_dir_link_hover = "#ffffff";
$color_img_link = "#b0b0b0";
$color_img_link_hover = "#ffffff";
$color_body_link = "#909090";
$color_body_link_hover = "#ffffff";
$color_table_link = "#b0b0b0";
$color_table_link_hover = "#ffffff";
$color_thumb_border = "#ffffff";
$color_thumb_td_border = "#505050";
$color_thumb_td = "#303030";
$color_dir_thumb_border = "#ffffff";
$color_dir_thumb_td_border = "#505050";
$color_dir_thumb_td = "#000000";
$color_table_back = "#000000";
$color_table_text = "#808080";
$color_table_border = "#505050";
$color_table_header = "#363636";
$color_table_header_text = "#cccccc";
$color_table_desc = "#363636";
$color_table_desc_text = "#b0b0b0";
// ----------- eind configuratie ------------
function bmdesign_css_link()
{
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $_SERVER[PHP_SELF] . "?bmd=css\">";
}
function bmdesign_html_start($head="", $body="")
{
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html><head>";
bmdesign_css_link();
echo "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"><title>" . htmlentities(GALLERY_NAME) . "</title>" . $head . "</head><body" . $body . " class=\"bmdesign\"><div align=\"center\">";
}
function bmdesign_html_end()
{
echo "</div></body></html>";
}
function bmdesign_image_type($file)
{
$type = strtolower(substr($file, strrpos($file, ".")));
if ($type == ".jpg" or $type == ".jpeg")
{
return "jpeg";
}
elseif ($type == ".png")
{
return "png";
}
return FALSE;
}
function bmdesign_thumb($image_dir, $image_file)
{
if (THUMB_ROOT != "")
{
$thumb_file = THUMB_ROOT . $image_dir . $image_file;
}
else
{
$thumb_file = "";
}
$thumb_type = bmdesign_image_type($thumb_file);
if (file_exists($thumb_file) and $thumb_type)
{
$file_pointer = fopen($thumb_file, "rb");
header("Content-type: image/" . $thumb_type);
fpassthru($file_pointer);
fflush();
exit;
}
else
{
$img_type = bmdesign_image_type($image_file);
if ($img_type == "jpeg")
{
if (!$image = @imagecreatefromjpeg(GALLERY_ROOT . $image_dir . $image_file))
{
exit;
}
}
elseif ($img_type == "png")
{
if (!$image = @imagecreatefrompng(GALLERY_ROOT . $image_dir . $image_file))
{
exit;
}
}
else
{
exit;
}
$image_size = getimagesize(GALLERY_ROOT . $image_dir . $image_file);
$image_width = $image_size[0];
$image_height = $image_size[1];
if (($image_width < THUMB_MAX_WIDTH) and ($image_height < THUMB_MAX_HEIGHT) and !ENLARGE_SMALL_IMAGES)
{
$thumb_height = $image_height;
$thumb_width = $image_width;
}
else
{
$aspect_x = $image_width / THUMB_MAX_WIDTH;
$aspect_y = $image_height / THUMB_MAX_HEIGHT;
if ($aspect_x > $aspect_y)
{
$thumb_width = THUMB_MAX_WIDTH;
$thumb_height = $image_height / $aspect_x;
}
else
{
$thumb_height = THUMB_MAX_HEIGHT;
$thumb_width = $image_width / $aspect_y;
}
}
$thumb = @imagecreatetruecolor($thumb_width, $thumb_height);
if (HIGH_QUALITY_THUMB)
{
imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, imagesx($image), imagesy($image));
}
else
{
imagecopyresized($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, imagesx($image), imagesy($image));
}
imagedestroy($image);
if (THUMB_ROOT != "")
{
if (!is_dir(THUMB_ROOT . $image_dir))
{
mkdir(THUMB_ROOT . $image_dir, 0777, TRUE);
}
if ($img_type == "jpeg")
{
imagejpeg($thumb, $thumb_file);
}
elseif ($img_type == "png")
{
imagepng($thumb, $thumb_file);
}
}
header("Content-type: image/" . $thumb_type);
if ($img_type == "jpeg")
{
imagejpeg($thumb);
}
elseif ($img_type == "png")
{
imagepng($thumb);
}
imagedestroy($thumb);
}
}
function bmdesign_file($file_to_print, $only_first_line = FALSE, $br_for_new_line = TRUE)
{
if ($lines = @file($file_to_print))
{
reset($lines);
if ($only_first_line)
{
return htmlentities($lines[0]);
}
else
{
$result="";
while (list($key, $line) = each($lines))
{
$result .= ($result != "" ? ($br_for_new_line ? "<br>" : "") : "") . htmlentities($line);
}
}
}
else
{
return "";
}
return $result;
}
function bmdesign_first_image($image_dir)
{
$directory_handle = @opendir(GALLERY_ROOT . $image_dir);
$dirs = array();
$images = array();
while($var = readdir($directory_handle))
{
if (is_dir(GALLERY_ROOT . GALLERY . $var))
{
if ($var != "." and $var != "..")
{
$dirs[] = $var;
}
}
else
{
if (bmdesign_image_type($var))
{
$images[] = $var;
}
}
}
sort ($dirs);
reset ($dirs);
sort ($images);
reset ($images);
if (isset($images[0]))
{
$result = array("dir"=>$image_dir, "file"=>$images[0]);
return $result;
}
else
{
foreach ($dirs as $subdir)
{
$subresult = bmdesign_first_image($image_dir . $subdir . "/");
if (isset($subresult[file]))
{
return $subresult;
}
}
}
}
function bmdesign_image()
{
global $images;
if (PREVIOUS_TEXT != "")
{
$next_previous = "";
$img_nr = array_search(IMAGE, $images);
if ($img_nr > 0)
{
$next_previous .= "<a href=\"" . $_SERVER[PHP_SELF] . "?bmd=imageform&gallery=" . GALLERY . "&image=" . $images[($img_nr-1)] . "\">" . PREVIOUS_TEXT . "</a>";
}
if ($img_nr < (count($images)-1))
{
if ($next_previous != "")
{
$next_previous .= " | ";
}
$next_previous .= "<a href=\"" . $_SERVER[PHP_SELF] . "?bmd=imageform&gallery=" . GALLERY . "&image=" . $images[($img_nr+1)] . "\">" . NEXT_TEXT . "</a>";
}
}
$image_file = GALLERY_ROOT . GALLERY . IMAGE;
$description_file = substr($image_file, 0, strrpos($image_file, ".")) . IMAGE_DESCRIPTION_EXT;
$desc = bmdesign_file($description_file);
$text_space = substr_count(strtolower($desc), "<br>") * TEXT_HEIGHT;
if ($desc)
{
$text_space += TEXT_HEIGHT;
}
if (CLICK_IMAGE != "")
{
$text_space += TEXT_HEIGHT;
}
if ((PREVIOUS_TEXT != "") and ($next_previous != ""))
{
$text_space += TEXT_HEIGHT;
}
if (USE_JAVA and IMAGE_IN_NEW_WINDOW)
{
$add_to_head ="<script language=\"JavaScript\" TYPE=\"text/javascript\">
<!--
function windowchange()
{
var posx, posy, width, height;
self.focus();
if (document.images)
{
width = document.images['fullimage'].width+".WINDOW_EXTRA_WIDTH.";
height = document.images['fullimage'].height+".(WINDOW_EXTRA_HEIGHT+$text_space).";
if (width > window.screen.availWidth)
{
width = window.screen.availWidth;
height=height+".SCROLLBAR_WIDTH.";
}
if (height > window.screen.availHeight)
{
height = window.screen.availHeight;
width=width+".SCROLLBAR_WIDTH.";
}
if (width > window.screen.availWidth) width = window.screen.availWidth;
posx = (window.screen.availWidth-width) / 2;
posy = (window.screen.availHeight-height) / 2;
window.moveTo(0,0);
window.resizeTo(width,height);
window.moveTo(posx,posy);
window.focus();
}
return true;
}
//-->
</script>";
}
else
{
$add_to_head = "";
}
if (IMAGE_IN_NEW_WINDOW or STAND_ALONE)
{
bmdesign_html_start($add_to_head, ((USE_JAVA and IMAGE_IN_NEW_WINDOW) ? " OnLoad=\"javascript:windowchange();\"" : ""));
}
if (!(IMAGE_IN_NEW_WINDOW and !USE_JAVA))
{
echo "<a href=\"" . (IMAGE_IN_NEW_WINDOW ? (USE_JAVA ? "javascript:window.close()" : "") : ((USE_JAVA and (PREVIOUS_TEXT == "")) ? "javascript:history.go(-1)" : $_SERVER[PHP_SELF] . "?gallery=" . GALLERY)) . "\">";
}
echo "<img id=\"fullimage\" alt=\"\" src=\"" . $_SERVER[PHP_SELF] . "?bmd=image&gallery=" . GALLERY . "&image=" . IMAGE . "\">";
if (CLICK_IMAGE != "")
{
echo "<br><small>" . htmlentities(CLICK_IMAGE) . "</small>";
}
if (!(IMAGE_IN_NEW_WINDOW and !USE_JAVA))
{
echo "</a>";
}
if ($desc)
{
echo "<br>" . $desc;
}
if (PREVIOUS_TEXT != "")
{
echo "<br><small>" . $next_previous . "</small>";
}
if (IMAGE_IN_NEW_WINDOW or STAND_ALONE)
{
bmdesign_html_end();
}
}
function bmdesign()
{
global $dirs, $images, $files;
if ($_GET[bmd] == "imageform")
{
bmdesign_image();
}
else
{
$total_columns = (GALLERY_COLUMNS * 2) + 1;
$img_width = THUMB_MAX_WIDTH + (THUMB_BORDER_WIDTH * 2);
$img_td_width = $img_width + ((THUMB_TD_BORDER_WIDTH + THUMB_TD_PADDING) * 2);
$table_width = (($img_td_width + THUMB_TD_SPACING) * GALLERY_COLUMNS) + THUMB_TD_SPACING + (TABLE_BORDER_WIDTH * 2);
$write_width = (($img_td_width + THUMB_TD_SPACING) * GALLERY_COLUMNS) + THUMB_TD_SPACING - 10;
$spacing_row = "<tr><td class=\"empty\" colspan=" . $total_columns . " height=" . THUMB_TD_SPACING . "></td></tr>";
$spacing_col = "<td class=\"empty\" width=" . THUMB_TD_SPACING . "></td>";
$empty_cell = "<td class=\"empty\" width=" . $img_td_width . "></td>";
if (STAND_ALONE)
{
bmdesign_html_start();
}
echo "<table class=\"bmdesign\" cellspacing=0 width=" . $table_width . ">";
if (GALLERY_NAME != "")
{
echo "<tr><th colspan=" . $total_columns . ">" . htmlentities(GALLERY_NAME) . "</th></tr>";
}
if (HOME_TEXT != "")
{
echo "<tr><td width=" . $write_width . " colspan=" . $total_columns . ">";
$links = explode("/", GALLERY);
echo "[<a href=\"" . $_SERVER[PHP_SELF] . "\">" . htmlentities(HOME_TEXT) . "</a>]";
if (GALLERY != "" and is_array($links))
{
for ($i=0; $i <= sizeof($links) - 1; $i++)
{
if ($links[$i] != "")
{
echo " -> [<a href=\"" . $_SERVER[PHP_SELF] . "?gallery=";
$gal_link = "";
for ($u = 0; $u <= $i; $u++)
{
$gal_link .= $links[$u] . "/";
}
echo $gal_link;
$name = bmdesign_file(GALLERY_ROOT . $gal_link . DIR_NAME_FILE, TRUE);
if ($name)
{
$display_name = $name;
}
else
{
$break_pos = strpos($links[$i], SORT_DIVIDER);
if ($break_pos !== FALSE)
{
$display_name = substr($links[$i], $break_pos + strlen(SORT_DIVIDER));
}
else
{
$display_name = $links[$i];
}
if (DIR_UNDERSCORE_AS_SPACE)
{
$display_name = str_replace("_", " ", $display_name);
}
}
echo "\">" . $display_name . "</a>]";
}
}
}
echo "</td></tr>";
}
$desc = bmdesign_file(GALLERY_ROOT . GALLERY . DIR_DESCRIPTION_FILE);
if ($desc)
{
echo "<tr><td width=" . $write_width . " class=\"desc\" colspan=" . $total_columns . ">" . $desc . "</td></tr>";
}
echo $spacing_row . "<tr>";
if (sizeof($dirs) > 0)
{
$cols = 0;
for($x = 0; $x < sizeof($dirs); $x++)
{
$cols++;
if ($cols > GALLERY_COLUMNS)
{
echo $spacing_col . "</tr>" . $spacing_row . "<tr>";
$cols = 1;
}
$name = bmdesign_file(GALLERY_ROOT . GALLERY . $dirs[$x] . "/" . DIR_NAME_FILE, TRUE);
if ($name)
{
$display_name = $name;
}
else
{
$break_pos = strpos($dirs[$x], SORT_DIVIDER);
if ($break_pos !== FALSE)
{
$display_name = substr($dirs[$x], $break_pos + strlen(SORT_DIVIDER));
}
else
{
$display_name = $dirs[$x];
}
if (DIR_UNDERSCORE_AS_SPACE)
{
$display_name = str_replace("_", " ", $display_name);
}
}
echo $spacing_col . "<td width=" . $img_width . " class=\"dir\"><a href=\"" . $_SERVER[PHP_SELF] . "?gallery=" . GALLERY . $dirs[$x] . "/\"><img alt=\"\" title=\"" . (SHOW_IMAGE_TITLE ? bmdesign_file(GALLERY_ROOT . GALLERY . $dirs[$x] . "/" . DIR_DESCRIPTION_FILE, FALSE, FALSE) : "") . "\" src=\"" . $_SERVER[PHP_SELF] . "?bmd=dirthumb&gallery=" . GALLERY . $dirs[$x] . "/\">" . (SHOW_DIR_NAME ? "<br>[" . $display_name . "]" : "") . "</a></td>";
}
}
if (sizeof($images) > 0)
{
for($x = 0; $x < sizeof($images); $x++)
{
$cols++;
if ($cols > GALLERY_COLUMNS)
{
echo $spacing_col . "</tr>" . $spacing_row . "<tr>";
$cols = 1;
}
$break_pos = strpos($images[$x], SORT_DIVIDER);
if ($break_pos !== FALSE)
{
$display_name = substr($images[$x], $break_pos + strlen(SORT_DIVIDER));
}
else
{
$display_name = $images[$x];
}
if (IMAGE_UNDERSCORE_AS_SPACE)
{
$display_name = str_replace("_", " ", $display_name);
}
if (!SHOW_IMAGE_EXTENSION)
{
$display_name = substr($display_name, 0, strrpos($display_name, "."));
}
echo $spacing_col . "<td width=" . $img_width . " class=\"img\">";
if (USE_JAVA and IMAGE_IN_NEW_WINDOW)
{
echo "<a href=\"javascript:void(null)\" onClick=\"javascript:window.open('" . $_SERVER[PHP_SELF] . "?bmd=imageform&gallery=" . GALLERY . "&image=" . $images[$x] . "', '', 'toolbar=no, menubar=no, location=no, scrollbars=yes, resizable=yes');\">";
}
else
{
echo "<a" . (IMAGE_IN_NEW_WINDOW ? " target=\"_blank\"" : "") . " href=\"" . $_SERVER[PHP_SELF] . "?bmd=imageform&gallery=" . GALLERY . "&image=" . $images[$x] . "\">";
}
echo "<img alt=\"\" title=\"" . (SHOW_IMAGE_TITLE ? bmdesign_file(substr(GALLERY_ROOT . GALLERY . $images[$x], 0, strrpos(GALLERY_ROOT . GALLERY . $images[$x], ".")) . IMAGE_DESCRIPTION_EXT, FALSE, FALSE) : "") . "\" src=\"" . $_SERVER[PHP_SELF] . "?bmd=thumb&gallery=" . GALLERY . "&image=" . $images[$x] . "\">" . (SHOW_IMAGE_NAME ? "<br><small>" . $display_name . "</small>" : "") . "</a></td>";
}
}
if (sizeof($files) > 0)
{
for($x = 0; $x < sizeof($files); $x++)
{
$cols++;
if ($cols > GALLERY_COLUMNS)
{
echo $spacing_col . "</tr>" . $spacing_row . "<tr>";
$cols = 1;
}
$break_pos = strpos($files[$x], SORT_DIVIDER);
if ($break_pos !== FALSE)
{
$display_name = substr($files[$x], $break_pos + strlen(SORT_DIVIDER));
}
else
{
$display_name = $files[$x];
}
if (FILE_UNDERSCORE_AS_SPACE)
{
$display_name = str_replace("_", " ", $display_name);
}
if (!SHOW_FILE_EXTENSION)
{
$display_name = substr($display_name, 0, strrpos($display_name, "."));
}
echo $spacing_col . "<td width=" . $img_width . " class=\"img\"><a " . (FILE_IN_NEW_WINDOW ? "target=\"_blank\" " : "") . "href=\"" . GALLERY_ROOT . GALLERY . $files[$x] . "\">" . $display_name . "</a></td>";
}
}
echo str_repeat($spacing_col . $empty_cell, (GALLERY_COLUMNS - $cols));
echo $spacing_col . "</tr>" . $spacing_row . "</table>";
echo "<small><a target=\"_blank\" href=\"http://www.b-m-d.nl/\">[ BM DESIGN ]</a></small>";
if (STAND_ALONE)
{
bmdesign_html_end();
}
}
}
if ($_GET[bmd] == "css")
{
header("Content-type: text/css");
echo "
body.bmdesign
{
background : $color_body_back;
color: $color_body_text;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: normal;
margin : 15px;
}
body.bmdesign a:active, body.bmdesign a:link, body.bmdesign a:visited, body.bmdesign a:focus
{
color : $color_body_link;
text-decoration : none;
}
body.bmdesign a:hover
{
color : $color_body_link_hover;
text-decoration : none;
}
body.bmdesign small
{
font-size: 10px;
font-weight: normal;
}
body.bmdesign img
{
border: none;
margin : 10px;
}
table.bmdesign td.dir a:active, table.bmdesign td.dir a:link, table.bmdesign td.dir a:visited, table.bmdesign td.dir a:focus
{
color : $color_dir_link;
text-decoration : none;
}
table.bmdesign td.dir a:hover
{
color : $color_dir_link_hover;
text-decoration : none;
}
table.bmdesign td.img a:active, table.bmdesign td.img a:link, table.bmdesign td.img a:visited, table.bmdesign td.img a:focus
{
color : $color_img_link;
text-decoration : none;
}
table.bmdesign td.img a:hover
{
color : $color_img_link_hover;
text-decoration : none;
}
table.bmdesign a:active, table.bmdesign a:link, table.bmdesign a:visited, table.bmdesign a:focus
{
color : $color_table_link;
text-decoration : none;
}
table.bmdesign a:hover
{
color : $color_table_link_hover;
text-decoration : none;
}
table.bmdesign
{
border : ".TABLE_BORDER_WIDTH."px solid $color_table_border;
background : $color_table_back;
color: $color_table_text;
font-size: 14px;
text-align : center;
vertical-align : top;
margin : 0px;
padding : 0px;
}
table.bmdesign td
{
border : none;
border-bottom : ".TABLE_BORDER_WIDTH."px solid $color_table_border;
color: $color_table_text;
padding : 5px;
}
table.bmdesign td.img
{
border : ".THUMB_TD_BORDER_WIDTH."px solid $color_thumb_td_border;
background : $color_thumb_td;
padding : ".THUMB_TD_PADDING."px;
}
table.bmdesign td.dir
{
border : ".THUMB_TD_BORDER_WIDTH."px solid $color_dir_thumb_td_border;
background : $color_dir_thumb_td;
padding : ".THUMB_TD_PADDING."px;
}
table.bmdesign td.empty
{
border : none;
background : $color_table_back;
padding : 0px;
}
table.bmdesign td.desc
{
background : $color_table_desc;
color: $color_table_desc_text;
}
table.bmdesign th
{
border : none;
border-bottom : ".TABLE_BORDER_WIDTH."px solid $color_table_border;
background : $color_table_header;
color: $color_table_header_text;
font-size: 18px;
font-weight: bold;
text-align : center;
padding : 5px;
}
table.bmdesign td.dir img
{
border : ".THUMB_BORDER_WIDTH."px solid $color_dir_thumb_border;
margin : 0px;
}
table.bmdesign td.img img
{
border : ".THUMB_BORDER_WIDTH."px solid $color_thumb_border;
margin : 0px;
}
";
exit;
}
define(GALLERY, trim($_GET[gallery]));
define(IMAGE, trim($_GET[image]));
if (strpos(GALLERY . IMAGE, "..") !== FALSE)
{
exit("No access!");
}
if ($_GET[bmd] == "thumb")
{
bmdesign_thumb(GALLERY, IMAGE);
exit;
}
if ($_GET[bmd] == "dirthumb")
{
if ((DIR_IMAGE_FILE != "") and file_exists(GALLERY_ROOT . GALLERY . DIR_IMAGE_FILE))
{
bmdesign_thumb(GALLERY, DIR_IMAGE_FILE);
exit;
}
else
{
$first_image = bmdesign_first_image(GALLERY);
bmdesign_thumb($first_image[dir], $first_image[file]);
exit;
}
}
if ($_GET[bmd] == "image")
{
$image_file = GALLERY_ROOT . GALLERY . IMAGE;
$img_type = bmdesign_image_type($image_file);
if (file_exists($image_file) and $img_type)
{
$file_pointer=fopen($image_file, "rb");
header("Content-type: image/" . $img_type);
header("Content-Disposition: inline; filename=" . IMAGE);
fpassthru($file_pointer);
fflush();
}
exit;
}
if (($_GET[bmd] != "imageform") or (PREVIOUS_TEXT != ""))
{
$dirs = array();
$images = array();
$files = array();
$directory_handle = @opendir(GALLERY_ROOT . GALLERY);
if ($directory_handle != FALSE)
{
while($var = readdir($directory_handle))
{
if (is_dir(GALLERY_ROOT . GALLERY . $var))
{
if ($var != "." and $var != "..")
{
$dirs[] = $var;
}
}
else
{
if (bmdesign_image_type($var))
{
if ($var != DIR_IMAGE_FILE)
{
$images[] = $var;
}
}
elseif (SHOW_FILES)
{
if (!in_array(strtolower($var), $file_exclude) and !((strrpos($var, ".") !== FALSE) and in_array(strtolower(substr($var, strrpos($var, "."))), $file_ext_exclude)))
{
$files[] = $var;
}
}
}
}
sort ($dirs);
reset ($dirs);
sort ($images);
reset ($images);
sort ($files);
reset ($files);
}
}
if (($_GET[bmd] == "imageform") and IMAGE_IN_NEW_WINDOW)
{
bmdesign_image();
exit;
}
if (STAND_ALONE)
{
bmdesign();
}
?>