Silnik strony + galerii zdjęć Suczawa 2009
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

109 lines
3.4 KiB

<?php
/**
* @package Galeria Suczawa 2009
* @file display.php
* @version $Id$
**/
require_once('./init.php'); #init stuff
$id=(isset($_GET['id'])) ? intval($_GET['id']) : 1; #check which photo should be loaded
NaglowekXHTML();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
<head>
<title>Podgląd zdjęcia nr <?=$id?></title>
<link type="text/css" href="style.css" rel="stylesheet" />
<meta http-equiv="Content-Type" content="<?=$xhtml?'application/xhtml+x':'text/ht'?>ml; charset=utf-8" />
<script type="text/javascript">
<!-- <[CDATA[ -->
path='http://<?=$_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI'])?>';
<!-- ]]> -->
</script>
<script type="text/javascript" src="script.js"></script>
</head>
<body onload="init()">
<div id="display">
<?
$sql = "SELECT * FROM `photos` WHERE id='$id'";
if (!$result = $DB->query($sql))
{
showError('Nie mozna pobrac informacji o zdjeciu!');
}
if ($result->num_rows == 0)
{
$row = array(
'author' => '--',
'description' => 'Zdjęcie usunięte',
'photo_name' => 'no_image.png',
'id' => $i
);
}
else
{
$row = $result->fetch_assoc();
$row['author'] = ($row['author']=='') ? 'Autor nieznany' : $row['author'];
$row['description'] = ($row['description']=='') ? 'Brak opisu' : $row['description'];
}
?>
<div id="current">
<a href="images/upload/<?=htmlspecialchars($row['photo_name'])?>"><img id="curr_image" height="300px" alt="ZdjÄ_cie" src="images/upload/<?=htmlspecialchars($row['photo_name'])?>" /></a>
<br/>
<b>Autor: </b><a id="author"><?=htmlspecialchars($row['author'])?></a><br />
<b>Opis: </b><a id="description"><?=nl2br(htmlspecialchars($row['description']))?></a>
</div>
<?
$prev = $DB->query('SELECT COUNT(id) FROM photos WHERE id<'.$id)->fetch_row(); #check if there are some previous photos
$prev=$prev[0];
if($prev>0) {
$prev=$DB->query('SELECT * FROM photos WHERE id<'.$id.' ORDER BY id DESC LIMIT 1;')->fetch_assoc(); #if yes, get the previous photo's data
?>
<div id="prev">
<a onclick="javascript:prev()">
<img id="prev_image" height="100px" alt="<?=$prev['id']?>" src="images/upload/<?=$prev['thumb_name']?>" /><br/>
</a>
<a onclick="javascript:prev()">Poprzednie zdjęcie</a>
</div>
<?
}
else {
?>
<div id="prev" style="display: none">
<a onclick="javascript:prev()">
<img id="prev_image" height="100px" alt="" src="" /><br/>
</a>
<a onclick="javascript:prev()">Poprzednie zdjęcie</a>
</div>
<?
}
$next = $DB->query('SELECT COUNT(id) FROM photos WHERE id>'.$id)->fetch_row(); #check if there are some next photos
$next=$next[0];
if($next>0) {
$next=$DB->query('SELECT * FROM photos WHERE id>'.$id.' ORDER BY id ASC LIMIT 1;')->fetch_assoc(); #if yes, get the next photo's data
?>
<div id="next">
<a onclick="javascript:next()">
<img id="next_image" height="100px" alt="<?=$next['id']?>" src="images/upload/<?=$next['thumb_name']?>" /><br/>
</a>
<a onclick="javascript:next()">Następne zdjęcie</a>
</div>
<?
}
else {
?>
<div id="next" style="display: none">
<a onclick="javascript:next()">
<img id="next_image" height="100px" alt="" src="" /><br/>
</a>
<a onclick="javascript:next()">Następne zdjęcie</a>
</div>
<?
}
?>
</div>
</body>
</html>