|
<?php
|
|
require_once('init.php'); #init stuff
|
|
$page=(isset($_GET['page']))?intval($_GET['page']):1; #check which page should be loaded
|
|
|
|
$xhtml = preg_match('/application\/xhtml\+xml(?![+a-z])(;q=(0\.\d{1,3}|[01]))?/i',
|
|
$_SERVER['HTTP_ACCEPT'], $xhtml) && (isset($xhtml[2])?$xhtml[2]:1) > 0 ||
|
|
strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false ||
|
|
strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false;
|
|
header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround
|
|
echo '<?xml version="1.0" encoding="utf-8"?>';
|
|
?>
|
|
|
|
<!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>Galeria zdjęć</title>
|
|
<link type="text/css" href="style.css" rel="stylesheet" />
|
|
<script type="text/javascript" src="script.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="page">
|
|
<img src="images/logo.png" width="800px" alt="Logo strony" />
|
|
<div id="content">
|
|
<div id="images">
|
|
<?php
|
|
if (!$result = $DB->query('SELECT * FROM photos LIMIT '.(($page-1)*PERPAGE).' , '.PERPAGE)) {
|
|
showError('MySQL error');
|
|
}
|
|
while($row = $result->fetch_assoc() ){
|
|
?>
|
|
<div class="image_outer">
|
|
<a target="blank" href="display.php?id=<?=$row['id']?>">
|
|
<img class="image" height="100px" alt="Zdjęcie: <?=$row['photo_name']?>" src="<?=$row['thumb_name']?>" id="image_<?=$row['id']?>" />
|
|
</a>
|
|
</div>
|
|
<?
|
|
}
|
|
?>
|
|
</div>
|
|
<?
|
|
if (!$result = $DB->query('SELECT COUNT(id) AS count FROM photos')) {
|
|
showError('MySQL error');
|
|
}
|
|
$row = $result->fetch_assoc();
|
|
$count = $row['count'];
|
|
$pcount=ceil($result[0]/PERPAGE);
|
|
?>
|
|
<div id="pages">Strony:
|
|
<?if($page==1)
|
|
echo'<< < | ';
|
|
else
|
|
echo '<a href="gallery.php?page=1"><<</a> <a href="gallery.php?page='.($page-1).'"><</a> | ';
|
|
for($i=1; $i<$page; $i++) {
|
|
echo '<a href="gallery.php?page='.$i.'">'.$i.'</a> | ';
|
|
}
|
|
echo $page.' | ';
|
|
for($i=$page+1; $i<=$pcount; $i++) {
|
|
echo '<a href="gallery.php?page='.$i.'">'.$i.'</a> | ';
|
|
}
|
|
if($page==$pcount)
|
|
echo '> >>';
|
|
else
|
|
echo '<a href="gallery.php?page='.($page+1).'">></a> <a href="gallery.php?page='.$pcount.'">>></a>';
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div id="footer">
|
|
<a id="copyright">Copyright © 2009 ...</a><br />
|
|
<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>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|