getConfig(); $dbh = &$site->getDatabase(); $common = new HTMLPage($config, "common"); $common->setHomePage(); $action = ((isset($_GET['action']))?($_GET['action']):((isset($_POST['action'])?($_POST['action']):('')))); switch($action) { case 'view': $galleries = Gallery::fetch($dbh, 'name', $_POST['name']); if(count($galleries) != 1) { header('location: ' . $_SERVER["PHP_SELF"] . '?name=' . $_POST['name'] . '¬found=1'); } $gallery = $galleries[0]; header('location: gallery.php?galleryID=' . $gallery->getID()); exit; break; default: $page = new HTMLPage($config, "private"); $common->displayParsedTemplate("header"); if($_GET['notfound']) { $page->setAttribute('error', 'visibility', 1); $page->addVar('error', 'ERROR', "Unable to locate a gallery named '" . $_GET['name'] . "'"); $page->addVar('main', 'NAME', $_GET['name']); } $page->displayParsedTemplate("main"); $common->displayParsedTemplate("footer"); } ?>