<?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");

$lang       = xcConfig::get("lang");

 

$folder      = xgFactory::createItem($url);

$parent      = $folder->getParent();

$columnCount = xcConfig::get("gallery-column-count");

 

//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";

 

if($lang == "english"){

      echo '            <img id="top" src="background_top_english.jpg" />';

}

else{

      echo '            <img id="top" src="background_top_german.jpg"/>';

}

// Table

echo"\n           <div id=\"gallery\">";

 

echo "\n                <table id=\"galleryTable\">\n";

 

// Pictures

$itemNr = 0;

foreach (($folder->getChildren(xcConfig::get("gallery-flat"))) 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."".$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++;

}

 

 

echo "                  </table>\n        </div>";

 

echo "\n          <img id=\"bottom\" src=\"background_bottom.jpg\" />";

      if($lang == "english"){

            echo "                       <div id=\"sourceCodelinks\">";

            echo "                             <a href=\"sourceCodeGallery.html\" target=\"_blank\">Source Code</a>&nbsp;&nbsp;&nbsp;\n";

            echo "                             <a href=\"configGallery.html\" target=\"_blank\">Config File</a>\n";

            echo "                       </div>";

      }

      else {

            echo "                       <div id=\"sourceCodelinks\">";

            echo "                             <a href=\"sourceCodeGallery.html\" target=\"_blank\">Quelltext</a>&nbsp;&nbsp;&nbsp;\n";

            echo "                             <a href=\"configGallery.html\" target=\"_blank\">Konfigurationsdatei</a>\n";

            echo "                       </div>";

      }

     

echo"\n     </div>";

 

// 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 "\n</body>\n";

echo "</html>";

 

?>