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.

96 lines
2.2 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. $xhtml=true;
  10. #wyświetl błąd
  11. function blad($msg)
  12. {
  13. die('
  14. <h1>Blad Galerii Zdjec Suczawa 2009!</h1>
  15. <span style="color: red; font-weight: bold; font-size: 12pt">'.$msg.'</span>');
  16. }
  17. function NaglowekXHTML()
  18. {
  19. global $xhtml;
  20. $xhtml = preg_match('/application\/xhtml\+xml(?![+a-z])(;q=(0\.\d{1,3}|[01]))?/i',
  21. $_SERVER['HTTP_ACCEPT'], $xhtml) && (isset($xhtml[2])?$xhtml[2]:1) > 0 ||
  22. strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false ||
  23. strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false;
  24. header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround
  25. echo '<?xml version="1.0" encoding="utf-8"?>';
  26. }
  27. function GenerujListeStron()
  28. {
  29. global $cnt;
  30. global $page;
  31. $content = '';
  32. if ($page>1)
  33. {
  34. $content .= '<a href="?page=1" title="Pierwsza strona">&laquo;</a>';
  35. $content .= '&nbsp;&nbsp;<a href="?page='.($page-1).'" title="Poprzednia strona">&lt;</a> ';
  36. }
  37. #wygeneruj strony
  38. for ($i=1;$i<=$cnt;$i++)
  39. {
  40. if ($i==$page)
  41. {
  42. if ($i == $cnt)
  43. {
  44. $content .= '<span style="text-decoration: underline">'.$i.'</span>';
  45. }
  46. else
  47. {
  48. $content .= '<span style="text-decoration: underline">'.$i.'</span>'.' | ';
  49. }
  50. }
  51. else
  52. {
  53. if ($i == $cnt)
  54. {
  55. $content .= '<a href="?page='.$i.'">'.$i.'</a> ';
  56. }
  57. else
  58. {
  59. $content .= '<a href="?page='.$i.'">'.$i.'</a> | ';
  60. }
  61. }
  62. }
  63. #dodaj linka "+1 strona" oraz do ostatniej
  64. if ($page<$cnt)
  65. {
  66. $content .= '<a href="?page='.($page+1).'" title="Następna strona">&gt;</a>';
  67. $content .= '&nbsp;&nbsp;<a href="?page='.$cnt.'" title="Ostatnia strona">&raquo;</a>';
  68. }
  69. #dodaj linka do ostatniej strony
  70. echo $content;
  71. }
  72. function Przekieruj($url='index.php', $tresc='')
  73. {
  74. if ($tresc!='')
  75. {
  76. die('
  77. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  78. <meta http-equiv="refresh" content="2; url='.$url.'" />
  79. '.$tresc);
  80. }
  81. else
  82. {
  83. die('<meta http-equiv="refresh" content="0; url='.$url.'" />');
  84. }
  85. }
  86. ?>