<?php
include_once("../scripts/pf_constants.php");
include_once(PF_SCRIPTS_DIR."pf_configparser.php");
include_once(PF_SCRIPTS_DIR."pf_theme_manager.php");
include_once("thumbnail_lister.php");
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<?php
$albumName = $_GET['album'];
$albumLocation = "";
$albumTheme = "";
$cp = new ConfigReader(PF_CONFIG_FILE);
$albums = $cp->getChildren("settings/albums");
if($albums) {
$albumExists = FALSE;
foreach($albums as $album) {
if($album['attributes']['name'] == $albumName) {
$albumLocation = $album['attributes']['location'];
$albumTheme = $album['attributes']['theme'];
$albumExists = TRUE;
}
}
if(!$albumExists) {
print("There is no album called $albumName.");
return;
}
}
else {
print("There are no albums");
return;
}
$_SESSION['albumLocation'] = $albumLocation;
if(isset($_SESSION['albumLocation'])) {
chdir($_SERVER['DOCUMENT_ROOT'].'/'.$_SESSION['albumLocation']);
$_SESSION['imageList'] = array_merge(glob('*.png'), glob('*.jpg'), glob('*.jpeg'), glob('*.gif'));
}
$_SESSION['imageCount'] = 0;
$availableThemes = getThemeList();
if(!array_key_exists($albumTheme, $availableThemes))
$albumTheme = PF_DEFAULT_THEME;
$albumThemeLocation = $availableThemes[$albumTheme];
$_SESSION['albumThemeLocation'] = $albumThemeLocation;
$_SESSION['albumName'] = $albumName;
define(ALBUM_TITLE, $albumName);
define(COMMON_STYLE, "style.css");
define(CLIENT_STYLE, $albumThemeLocation.PF_THEME_STYLE_FILE);
define(CLIENT_JS, PF_REL_INSTALL_DIR."client/".PF_CLIENT_JS);
define(JUICE, PF_REL_INSTALL_DIR."client/juice_client.js");
define(CURRENT_IMAGE, $_SESSION['albumLocation'].'/'.$_SESSION['imageList'][$_SESSION['imageCount']]);
include($_SERVER['DOCUMENT_ROOT'].$albumThemeLocation."index.html");
?>