<?php
require_once('config.php');
require_once($config["lib-path"].'xcConfig.class.php');
require_once($config["lib-path"].'xgFactory.class.php');
require_once($config["lib-path"].'xcPaginator.class.php');
$root = xcConfig::get("root-path");
$url = xcConfig::get("url");
$folder = xgFactory::createItem($url);
$parent = $folder->getParent();
$columnCount = xcConfig::get("gallery-column-count");
$pageinator = new xcPaginator($folder->getChildren(xcConfig::get("gallery-flat")));
//xgFactory::createItem($url);
// Head
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
echo "<html>\n";
echo "<head>\n";
echo " <title>".$folder->getTitle()."</title>\n";
echo " <link rel=\"alternate\" href=\"".$root."rss.php?url=".$url."\" type=\"application/rss+xml\" title=\"".$folder->getTitle()."\" id=\"gallery\" />\n";
echo " <link rel=\"stylesheet\" href=\"gallery.css\" media=\"all\" />\n";
echo " <style type=\"text/css\">\n";
echo " .mbf-item { display: none; }\n";
echo " </style>\n";
echo "</head>\n";
echo "<body>\n";
// Title
echo " <div id=\"content\">\n";
echo " <h1>";
// Updir Link
if ($parent != null) {
echo "<a href=\"".$root."gallery.php?url=".$parent->getLink()."\">";
echo "<img src='".xcConfig::get("image-path")."updir.jpg' border=0>";
echo "</a>";
}
echo $folder->getTitle()."</h1>\n";
// Table
echo " <hr size=\"1\" style=\"color:#ccc\" />\n";
echo " <table class=\"gallery\">\n";
// Pagination Links
if ($pageinator->needPageination()) {
echo "<tr><th colspan='".$columnCount."'>";
echo $pageinator->getPageLinks($root."gallery.php?url=".$folder->getLink()."&");
echo "</th></tr>";
}
// Pictures
$itemNr = 0;
foreach ($pageinator->getEntries() as $item) {
// new row
if ($itemNr % $columnCount == 0) {
echo " <tr>\n";
}
// display item
if ($item instanceof xgFolder) {
echo " <td><a href=\"".$root."gallery.php?url=".$item->getLink()."\">\n";
echo " <img src=\"".$root."image.php?url=".$item->getThumbnailUrl()."\">\n";
} else {
echo " <td><a href=\"".$root."image.php?url=".$item->getLink()."\">\n";
echo " <img src=\"".$root."image.php?url=".$item->getThumbnailUrl()."\">\n";
}
echo " <span class=\"mbf-item\">#gallery ".$item->getGUID()."</span>\n";
echo " </a></td>\n";
// end of row
if ($itemNr % $columnCount == $columnCount - 1) {
echo " </tr>\n";
}
$itemNr++;
}
// Pagination Links
if ($pageinator->needPageination()) {
echo "<tr><th colspan='".$columnCount."'>";
echo $pageinator->getPageLinks($root."gallery.php?url=".$folder->getLink()."&");
echo "</th></tr>";
}
echo " </table>\n";
echo " </div>\n";
// Error div
if (xcConfig::hasErrors()) {
echo " <div id=\"errors\">\n";
echo "<b>ERROR LOG</b>";
echo "<hr size=\"1\" style=\"color:#ccc\" />\n";
foreach (xcConfig::getErrors() as $error) {
echo $error."<br />";
}
echo " </div>\n";
}
echo "</body>\n";
echo "</html>\n";
?>