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.

78 lines
1.9 KiB

  1. <?php
  2. /**
  3. * @package Galeria Suczawa 2009
  4. * @file functions.php
  5. * @version $Id$
  6. * @author PioDer <pioder@wp.pl>
  7. * @link http://suczawa.ath.cx/
  8. **/
  9. #wyświetl błąd
  10. function blad($msg)
  11. {
  12. die('
  13. <h1>Blad Galerii Zdjec Suczawa 2009!</h1>
  14. <span style="color: red; font-weight: bold; font-size: 12pt">'.$msg.'</span>');
  15. }
  16. function NaglowekXHTML()
  17. {
  18. $xhtml = preg_match('/application\/xhtml\+xml(?![+a-z])(;q=(0\.\d{1,3}|[01]))?/i',
  19. $_SERVER['HTTP_ACCEPT'], $xhtml) && (isset($xhtml[2])?$xhtml[2]:1) > 0 ||
  20. strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false ||
  21. strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false;
  22. header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround
  23. echo '<?xml version="1.0" encoding="utf-8"?>';
  24. }
  25. function GenerujListeStron()
  26. {
  27. global $cnt;
  28. global $page;
  29. $content = '';
  30. if ($page>1)
  31. {
  32. $content .= '<a href="?page=1" title="Pierwsza strona">&laquo;</a>';
  33. $content .= '&nbsp;&nbsp;<a href="?page='.($page-1).'" title="Poprzednia strona">&lt;</a> ';
  34. }
  35. #wygeneruj strony
  36. for ($i=1;$i<=$cnt;$i++)
  37. {
  38. if ($i==$page)
  39. {
  40. if ($i == $cnt)
  41. {
  42. $content .= '<span style="text-decoration: underline">'.$i.'</span>';
  43. }
  44. else
  45. {
  46. $content .= '<span style="text-decoration: underline">'.$i.'</span>'.' | ';
  47. }
  48. }
  49. else
  50. {
  51. if ($i == $cnt)
  52. {
  53. $content .= '<a href="?page='.$i.'">'.$i.'</a> ';
  54. }
  55. else
  56. {
  57. $content .= '<a href="?page='.$i.'">'.$i.'</a> | ';
  58. }
  59. }
  60. }
  61. #dodaj linka "+1 strona" oraz do ostatniej
  62. if ($page<$cnt)
  63. {
  64. $content .= '<a href="?page='.($page+1).'" title="Następna strona">&gt;</a>';
  65. $content .= '&nbsp;&nbsp;<a href="?page='.$cnt.'" title="Ostatnia strona">&raquo;</a>';
  66. }
  67. #dodaj linka do ostatniej strony
  68. echo $content;
  69. }
  70. ?>