Source for file page.php

Documentation is available at page.php

  1. <?
  2. /**
  3. * page.php
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. * @author Stephan Raabe
  14. */
  15.  
  16. $url_complete = getCompleteUrl();
  17. $input = $site_home;
  18. $lang = "";
  19. $url_mode = "id";
  20. $mode = "?id=";
  21. if (isset($_GET["id"]))
  22. {
  23. $input = $_GET["id"];
  24. }
  25. else
  26. {
  27. $input = $site_home;
  28. $link = connectDB();
  29. $query = "SELECT page_path FROM ".$db_praefix."page WHERE page_path = '$input'";
  30. $result = mysql_query($query);
  31. if (mysql_num_rows($result) == 0)
  32. {
  33. $query = "SELECT page_path FROM ".$db_praefix."page WHERE page_parent = 0";
  34. $result = mysql_query($query);
  35. $home_arr = mysql_fetch_array($result);
  36. $input = $home_arr["page_path"];
  37. }
  38. closeDB($link);
  39. }
  40. $page = get_page($input);
  41. if ($page["page_rows"] == 1)
  42. {
  43. $path = get_path($url_mode);
  44. $start_key = $path[0]["page_key"];
  45. $page_lang = $path[0]["page_lang"];
  46. $homepage = get_homepage($start_key);
  47. $primary = get_primary($path,$start_key,$url_mode);
  48. $siblings = get_siblings($page,$url_mode);
  49. $childs = get_childs($page["page_key"],$url_mode);
  50. if ($page_lang != "")
  51. {
  52. $lang = "/".$page_lang;
  53. }
  54. else
  55. {
  56. $lang = "";
  57. }
  58. }
  59.  
  60. /**
  61. * checks the syntax of the url
  62. */
  63. function checkUrl()
  64. {
  65. global $url_complete,$site_url;
  66. $url_complete = htmlentities($url_complete);
  67. $pos1 = strpos ($url_complete, "<");
  68. $pos2 = strpos ($url_complete, ">");
  69. $pos3 = strpos ($url_complete, "%3c");
  70. $pos4 = strpos ($url_complete, "%3e");
  71. if (($pos1 === false) && ($pos2 === false) && ($pos3 === false) && ($pos4 === false))
  72. {
  73. }
  74. else
  75. {
  76. Header("Location: $site_url");
  77. }
  78. }
  79.  
  80. /**
  81. * returns the complete url
  82. */
  83. function getCompleteUrl()
  84. {
  85. if (isset($_SERVER["PHP_SELF"]))
  86. {
  87. $url_complete = $_SERVER["PHP_SELF"];
  88. }
  89. else
  90. {
  91. $url_complete = "";
  92. }
  93. if (isset($_SERVER["QUERY_STRING"]))
  94. {
  95. $url_complete .= "?".$_SERVER["QUERY_STRING"];
  96. }
  97. else
  98. {
  99. $url_complete .= "";
  100. }
  101. return $url_complete;
  102. }
  103. ?>

Documentation generated on Tue, 16 Aug 2005 17:32:22 +0200 by phpDocumentor 1.3.0RC3