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.

75 lines
2.7 KiB

  1. <?php
  2. require_once('init.php'); #init stuff
  3. $page=(isset($_GET['page']))?intval($_GET['page']):1; #check which page should be loaded
  4. $xhtml = preg_match('/application\/xhtml\+xml(?![+a-z])(;q=(0\.\d{1,3}|[01]))?/i',
  5. $_SERVER['HTTP_ACCEPT'], $xhtml) && (isset($xhtml[2])?$xhtml[2]:1) > 0 ||
  6. strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false ||
  7. strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false;
  8. header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround
  9. echo '<?xml version="1.0" encoding="utf-8"?>';
  10. ?>
  11. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  12. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
  13. <head>
  14. <title>Galeria zdjęć</title>
  15. <link type="text/css" href="style.css" rel="stylesheet" />
  16. <script type="text/javascript" src="script.js"></script>
  17. </head>
  18. <body>
  19. <div id="page">
  20. <img src="images/logo.png" width="800px" alt="Logo strony" />
  21. <div id="content">
  22. <div id="images">
  23. <?php
  24. if (!$result = $DB->query('SELECT * FROM photos LIMIT '.(($page-1)*PERPAGE).' , '.PERPAGE)) {
  25. showError('MySQL error');
  26. }
  27. while($row = $result->fetch_assoc() ){
  28. ?>
  29. <div class="image_outer">
  30. <a target="blank" href="display.php?id=<?=$row['id']?>">
  31. <img class="image" height="100px" alt="Zdjęcie: <?=$row['photo_name']?>" src="<?=$row['thumb_name']?>" id="image_<?=$row['id']?>" />
  32. </a>
  33. </div>
  34. <?
  35. }
  36. ?>
  37. </div>
  38. <?
  39. if (!$result = $DB->query('SELECT COUNT(id) AS count FROM photos')) {
  40. showError('MySQL error');
  41. }
  42. $row = $result->fetch_assoc();
  43. $count = $row['count'];
  44. $pcount=ceil($result[0]/PERPAGE);
  45. ?>
  46. <div id="pages">Strony:
  47. <?if($page==1)
  48. echo'&lt;&lt;&#160;&lt;&#160;|&#160;';
  49. else
  50. echo '<a href="gallery.php?page=1">&lt;&lt;</a>&#160;<a href="gallery.php?page='.($page-1).'">&lt;</a>&#160;|&#160;';
  51. for($i=1; $i<$page; $i++) {
  52. echo '<a href="gallery.php?page='.$i.'">'.$i.'</a>&#160;|&#160;';
  53. }
  54. echo $page.'&#160;|&#160;';
  55. for($i=$page+1; $i<=$pcount; $i++) {
  56. echo '<a href="gallery.php?page='.$i.'">'.$i.'</a>&#160;|&#160;';
  57. }
  58. if($page==$pcount)
  59. echo '&gt;&#160;&gt;&gt;';
  60. else
  61. echo '<a href="gallery.php?page='.($page+1).'">&gt;</a>&#160;<a href="gallery.php?page='.$pcount.'">&gt;&gt;</a>';
  62. ?>
  63. </div>
  64. </div>
  65. <div id="footer">
  66. <a id="copyright">Copyright © 2009 ...</a><br />
  67. <div id="links">
  68. <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>
  69. </div>
  70. </div>
  71. </div>
  72. </body>
  73. </html>