EOT;
// process path here - is set if mod_rewrite is in use
if (!empty($_REQUEST["path"])) {
// the followling line calculates the path in the album and excludes any subdirectories if
// Plogger is installed in one
$path = join("/",array_diff(explode("/",$_SERVER["REQUEST_URI"]),explode("/",$_SERVER["PHP_SELF"])));
$resolved_path = resolve_path($path);
if (is_array($resolved_path)) {
$_GET["level"] = $resolved_path["level"];
$_GET["id"] = $resolved_path["id"];
// get page number from url, if present
$parts = parse_url($_SERVER["REQUEST_URI"]);
if (isset($parts["query"])) {
parse_str($parts["query"],$query_parts);
if (!empty($query_parts["page"])) $_GET["page"] = $query_parts["page"];
};
$path = $parts["path"];
};
};
if ($_GET["level"] == "slideshow")
$inHead .= generate_slideshow_js($_GET["id"], "album");
/*
else if ($level == "slideshow")
$inHead .= generate_slideshow_js($id, "album");
*/
// Set sorting session variables if they are passed
if (isset($_GET['sortby'])) $_SESSION['plogger_sortby'] = $_GET['sortby'];
if (isset($_GET['sortdir'])) $_SESSION['plogger_sortdir'] = $_GET['sortdir'];
// This file contains the main gallery function the_gallery();
// this function is placed in the HTML document directly.
// The function does not take any arguments, it reads directly from
// the HTTP_GET_VARS array.
// The three GET parameters that it accepts are
// $level = "collection", "album", or "picture"
// $id = id number of collection, album, or picture
// $n = starting element (for pagination) go from n to n + max_thumbs (in global config)
function the_gallery_head() {
global $inHead;
echo $inHead;
}
function the_gallery(){
$start = microtime();
global $TABLE_PREFIX;
global $config;
$output = '';
$level = isset($_GET["level"]) ? $_GET["level"] : '';
$allowed_levels = array('collection','album','picture','slideshow','search');
if (!in_array($level,$allowed_levels)) {
$level = 'collections';
};
$id = isset($_GET["id"]) ? intval($_GET["id"]) : 0;
$_REQUEST["id"] = $id;
$_REQUEST["level"] = $level;
$page = isset($_GET["page"]) ? intval($_GET["page"]) : 1;
$num = 0;
// this is needed to get pagination work
$total_items = 0;
// Output highest level container division
$output .= '
';
}
function generate_jump_menu() {
global $TABLE_PREFIX;
global $config;
$output = '';
$output .= '';
return $output;
}
function generate_exif_table($id, $condensed=0){
global $TABLE_PREFIX;
global $config;
$query = "SELECT * FROM `".$TABLE_PREFIX."pictures` WHERE `id`='".$id."'";
$result = run_query($query);
if (mysql_num_rows($result) > 0){
$row = mysql_fetch_assoc($result);
foreach($row as $key => $val) if (trim($row[$key]) == '') $row[$key] = ' ';
$table_data = '
Afbeeldingsgrootte:
'.$size.' kbytes
Genomen op:
'.$row["EXIF_date_taken"].'
Camera model:
'.$row["EXIF_camera"].'
Sluitertijd:
'.$row["EXIF_shutterspeed"].'
Focus lengte:
'.$row["EXIF_focallength"].'
Zoombereik:
'.$row["EXIF_aperture"].'
';
}
else {
$table_data .= '>
Afmetingen:
'.$width .' x ' .$height.'
Afbeeldingsgrootte
'.$size.' kbytes
Genomen op:
'.$row["EXIF_date_taken"].'
Camera model:
'.$row["EXIF_camera"].'
Sluitertijd:
'.$row["EXIF_shutterspeed"].'
Focus lengte:
'.$row["EXIF_focallength"].'
Zoombereik:
'.$row["EXIF_aperture"].'
';
}
}
return $table_data;
}
function display_comments($id) {
global $TABLE_PREFIX;
global $config;
$output = "";
$error_message = "";
if ($config["allow_comments"] == 1) {
// this function takes the photo id and selects all relevent comments
// it then displays them with an ordered HTML list.
// get comments from table
$query = "SELECT *, UNIX_TIMESTAMP(`date`) AS `unix_date` FROM `".$TABLE_PREFIX."comments` WHERE parent_id = '$id'";
$result = run_query($query) or die(mysql_error());
$output .= "
Commentaren:
";
if (mysql_num_rows($result) == 0) {
$output .= "
';
}
return $output;
}
// generate header produces the Gallery Name, The Jump Menu, and the Breadcrumb trail at the top of the image
function generate_header() {
global $config;
//$output = '
';
return $output;
}
function generate_sortby($level,$id){
$output = '';
if ($level == "album"){
$output .= '
';
return $output;
}
// generates correclt urls depending on whether mod_rewrite is in use or not
// level - type of the url to generate
// id - used for id=xx urls
// name - used for mod_rewrite URL-s, both should be passed as arguments, so this
// function doesn't have to query the database
// benchmark timing
function getmicrotime($t) {
list($usec, $sec) = explode(" ",$t);
return ((float)$usec + (float)$sec);
}
function generate_slideshow_interface() {
global $config;
$large_link = '';
$prev_url = '';
$next_url = '';
$stop_url = '';
$play_url = '';
$output = '
';
// activate slideshow object using javascript block
$output .= '';
return $output;
}
// function for generating the slideshow javascript
function generate_slideshow_js($id, $mode) {
global $TABLE_PREFIX;
global $config;
// output the link to the slideshow javascript
$output = '';
// get all pictures within album sorted by default sort order
if ($mode == "collection")
$sql = "SELECT * FROM ".$TABLE_PREFIX."pictures WHERE parent_collection = '".$id."'";
elseif ($mode == "album")
$sql = "SELECT * FROM ".$TABLE_PREFIX."pictures WHERE parent_album = '".$id."'";
else
$sql = "SELECT * FROM ".$TABLE_PREFIX."pictures";
// determine sort ordering
switch ($_SESSION["plogger_sortby"]){
case 'number_of_comments':
$sql .= " ORDER BY `num_comments`";
break;
case 'caption':
$sql .= " ORDER BY `caption` ";
break;
case 'date_taken':
$sql .= " ORDER BY `EXIF_date_taken` ";
break;
case 'filename':
$sql .= " ORDER BY `path` ";
break;
case 'date':
default:
$sql .= " ORDER BY `date_submitted` ";
break;
}
switch ($_SESSION["plogger_sortdir"]){
case 'ASC':
$sql .= " ASC";
break;
case 'DESC':
case 'default':
$sql .= " DESC";
break;
}
$result = run_query($sql);
$output .= '';
return $output;
}
?>