Taka sobie rewizja :|

git-svn-id: https://svn.pioder.pl/sg-svn@17 3ed2631f-fe0d-47e0-9194-a46bc0f18ee8
This commit is contained in:
pioder
2009-08-16 10:01:33 +00:00
parent 64c45b8ea1
commit 146f5832dd
2 changed files with 109 additions and 109 deletions

View File

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

View File

@@ -51,7 +51,7 @@ NaglowekXHTML();
<div id="footer"> <div id="footer">
<a id="copyright">Copyright © 2009 ...</a><br /> <a id="copyright">Copyright © 2009 ...</a><br />
<div id="links"> <div id="links">
<a href="index.php">Strona Główna</a> | <a href="gallery.php">Fotogaleria</a> | <a href="download.php">Download</a> | <a href="http://suczawa.ath.cx">Forum</a> <a href="index.php">Strona Główna</a> | <a href="gallery.php">Fotogaleria</a> | <a href="download.php">Download</a> | <a href="http://suczawa.ath.cx">Forum</a> | <a href="admin/">Administracja</a>
</div> </div>
</div> </div>
</div> </div>