Location: PHPKode > projects > Buzzword > buzzword-0.8.12/gallery/index.php
<?php

/*
 * buzzword
 * Copyright (c) 2003 Jon Tai
 *
 * $Id: index.php,v 1.10 2003/12/11 05:20:34 jon Exp $
 *
 * This file is part of buzzword.
 *
 * buzzword is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * buzzword is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with buzzword; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

require_once './config.inc';

$gallery = new gallery_gallery(import_gallery_gallery_key());
if (!$gallery->exists())
    display_error('gallery does not exist');

// scan gallery for new images and/or sub-galleries
$gallery->rescan();

// if gallery contains images, display them
if (count(get_gallery_images($gallery->gallery_key))) {
    header('Location: gallery.php?g='.$gallery->gallery_key);
    exit;
}

$BUZZWORD_BREADCRUMBS = get_gallery_breadcrumbs($gallery);
include_once '../includes/header.inc';

?>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td id="content">
<h1><?php echo $gallery->get_display_title(); ?></h1>
<div class="content-container">
<?php echo $gallery->get_display_description(); ?>
<?php

$subgalleries = get_gallery_galleries($gallery->gallery_key);
foreach ($subgalleries as $subgallery) {
    $highlight = new gallery_image($subgallery->highlight);

?>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2" class="gallery-title">
<span class="h2"><a href="index.php?g=<?php echo $subgallery->gallery_key; ?>"><?php echo $subgallery->get_display_title(); ?></a></span>
</td>
</tr>
<tr>
<td class="gallery-highlight">
<?php if ($highlight->exists()) { ?>
<a href="index.php?g=<?php echo $subgallery->gallery_key; ?>"><img 
 src="thumb.php?i=<?php echo $highlight->image_key; ?>" <?php echo $highlight->get_alt(); ?> 
 border="0" <?php echo $highlight->get_thumb_size(); ?>></a>
<?php } else { ?>
<a href="index.php?g=<?php echo $subgallery->gallery_key; ?>"><div 
 class="gallery-no-highlight" style="width: <?php echo get_pref('gallery_thumb_width'); ?>px; height: <?php echo round(get_pref('gallery_thumb_width') * 3 / 4); ?>px;"></div></a>
<?php } ?>
</td>
<td class="gallery-description">
<?php echo $subgallery->get_display_description(); ?>
</td>
</tr>
</table>
<?php

}

?>
</div>
</td>
<td id="sidebar">
<h1>this gallery</h1>
<div class="sidebar-container">
<p>
<?php

if ($gallery->gallery_key > 0) {
    echo 'created '.$gallery->get_display_date_created().' at '.$gallery->get_display_time_created()."<br>\n";
    if ($gallery->created != $gallery->modified)
        echo 'updated '.$gallery->get_display_date_modified().' at '.$gallery->get_display_time_modified()."<br>\n";
}

?>
</p>
<p>
<?php

echo str_plural(count($subgalleries), 'sub-gallery', 'sub-galleries')." in this gallery<br>\n";

?>
</p>
</div>
<h1>other galleries</h1>
<div class="sidebar-container">
<p>
<?php 

echo get_sidebar_gallery_galleries($gallery);

?>
</p>
</div>
<?php

echo relevance_hook('gallery_gallery', $gallery->gallery_key);

?>
<?php if (defined('ADMIN_LOGGED_IN')) { ?>
<h1>administration</h1>
<div class="sidebar-container">
<p>
<?php if ($gallery->gallery_key > 0) { ?>
<a href="editgallery.php?g=<?php echo $gallery->gallery_key; ?>">edit gallery</a><br>
<?php } ?>
<a href="../admin/preferences.php">preferences</a><br>
<a href="../admin/index.php?admin-logout=1">log out</a><br>
</p>
</div>
<?php } ?>
</td>
</tr>
</table>
<?php

include_once '../includes/footer.inc';

?>
Return current item: Buzzword