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. * @package generator
  14. * @author Stephan Raabe
  15. */
  16.  
  17. $url_complete = getCompleteUrl();
  18. $input = $site_home;
  19. $lang = "";
  20. $url_mode = "id";
  21. $mode = "?id=";
  22. if (isset($_GET["id"]))
  23. {
  24. $input = $_GET["id"];
  25. }
  26. else
  27. {
  28. $input = $site_home;
  29. $link = connectDB();
  30. $query = "SELECT page_path FROM ".$db_praefix."page WHERE page_path = '$input'";
  31. $result = mysql_query($query);
  32. if (mysql_num_rows($result) == 0)
  33. {
  34. $query = "SELECT page_path FROM ".$db_praefix."page WHERE page_parent = 0";
  35. $result = mysql_query($query);
  36. $home_arr = mysql_fetch_array($result);
  37. $input = $home_arr["page_path"];
  38. }
  39. closeDB($link);
  40. }
  41. $page = get_page($input);
  42. if ($page["page_rows"] == 1)
  43. {
  44. $path = get_path($url_mode);
  45. $start_key = $path[0]["page_key"];
  46. $page_lang = $path[0]["page_lang"];
  47. $homepage = get_homepage($start_key);
  48. $primary = get_primary($path,$start_key,$url_mode);
  49. $siblings = get_siblings($page,$url_mode);
  50. $childs = get_childs($page["page_key"],$url_mode);
  51. if ($page_lang != "")
  52. {
  53. $lang = "/".$page_lang;
  54. }
  55. else
  56. {
  57. $lang = "";
  58. }
  59. }
  60.  
  61. /**
  62. * checks the syntax of the url
  63. */
  64. function checkUrl()
  65. {
  66. global $url_complete,$site_url;
  67. $url_complete = htmlentities($url_complete);
  68. $pos1 = strpos ($url_complete, "<");
  69. $pos2 = strpos ($url_complete, ">");
  70. $pos3 = strpos ($url_complete, "%3c");
  71. $pos4 = strpos ($url_complete, "%3e");
  72. if (($pos1 === false) && ($pos2 === false) && ($pos3 === false) && ($pos4 === false))
  73. {
  74. }
  75. else
  76. {
  77. Header("Location: $site_url");
  78. }
  79. }
  80.  
  81. /**
  82. * returns the complete url
  83. */
  84. function getCompleteUrl()
  85. {
  86. if (isset($_SERVER["PHP_SELF"]))
  87. {
  88. $url_complete = $_SERVER["PHP_SELF"];
  89. }
  90. else
  91. {
  92. $url_complete = "";
  93. }
  94. if (isset($_SERVER["QUERY_STRING"]))
  95. {
  96. $url_complete .= "?".$_SERVER["QUERY_STRING"];
  97. }
  98. else
  99. {
  100. $url_complete .= "";
  101. }
  102. return $url_complete;
  103. }
  104. ?>

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