PageRenderTime 50ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/lib/common.php

https://bitbucket.org/GlitchMr/abxd
PHP | 106 lines | 75 code | 23 blank | 8 comment | 9 complexity | 23cd38e8f5bee4f5466bbd4b9d702315 MD5 | raw file
  1. <?php
  2. // AcmlmBoard XD support - Main hub
  3. // Leaving this error in until Niko's new installer is there to whine about it instead. -- Kawa
  4. if(ini_get('register_globals'))
  5. die("<p>PHP, as it is running on this server, has the <code>register_globals</code> setting turned on. This is something of a security hazard, and is a <a href=\"http://en.wikipedia.org/wiki/Deprecation\" target=\"_blank\">deprecated function</a>. For more information on this topic, please refer to the <a href=\"http://php.net/manual/en/security.globals.php\" target=\"_blank\">PHP manual</a>.</p><p>At any rate, the ABXD messageboard software is designed to run with <code>register_globals</code> turned <em>off</em>. If your provider allows the use of <code>.htaccess</code> files, you can try adding the line <code>php_flag register_globals off</code> to an <code>.htaccess</code> file in your board's root directory, though we suggest placing it on your website root directory (often something like <code>public_html</code>). If not, ask your provider to edit <code>php.ini</code> accordingly and make the internet a little safer for all of us.</p>");
  6. // I can't believe there are PRODUCTION servers that have E_NOTICE turned on. What are they THINKING? -- Kawa
  7. error_reporting(E_ALL ^ E_NOTICE | E_STRICT);
  8. if(!is_file("lib/database.php"))
  9. die(header("Location: install.html"));
  10. // Deslash GPC variables if we have magic quotes on
  11. if (get_magic_quotes_gpc())
  12. {
  13. function AutoDeslash($val)
  14. {
  15. if (is_array($val))
  16. return array_map('AutoDeslash', $val);
  17. else if (is_string($val))
  18. return stripslashes($val);
  19. else
  20. return $val;
  21. }
  22. $_REQUEST = array_map('AutoDeslash', $_REQUEST);
  23. $_GET = array_map('AutoDeslash', $_GET);
  24. $_POST = array_map('AutoDeslash', $_POST);
  25. $_COOKIE = array_map('AutoDeslash', $_COOKIE);
  26. }
  27. include("salt.php");
  28. include("settingsfile.php");
  29. include("links.php");
  30. include("mysql.php");
  31. include("mysqlfunctions.php");
  32. include("settingssystem.php");
  33. Settings::load();
  34. Settings::checkPlugin("main");
  35. include("feedback.php");
  36. include("language.php");
  37. include("snippets.php");
  38. class KillException extends Exception { }
  39. date_default_timezone_set("GMT");
  40. $timeStart = usectime();
  41. if(!isset($title))
  42. $title = "";
  43. //HAX below ~Dirbaio
  44. //TODO: CLEAN IT!
  45. //$userSelectSU = "su.id suid, su.name suname, su.displayname sudisplayname, su.powerlevel supowerlevel, su.sex susex, su.birthday subirthday";
  46. $userSelect = "id, name, displayname, powerlevel, sex, birthday";
  47. $userSelectSU = "su.id suid, su.name suname, su.displayname sudisplayname, su.powerlevel supowerlevel, su.sex susex, su.birthday subirthday";
  48. $userSelectLU = "lu.id luid, lu.name luname, lu.displayname ludisplayname, lu.powerlevel lupowerlevel, lu.sex lusex, lu.birthday lubirthday";
  49. $userSelectUsers = "users.id as uid, users.name, users.displayname, users.powerlevel, users.sex, users.birthday";
  50. function startsWith($haystack, $needle)
  51. {
  52. $length = strlen($needle);
  53. return (substr($haystack, 0, $length) === $needle);
  54. }
  55. function UserStructure($row, $prefix)
  56. {
  57. $result = array();
  58. foreach($row as $key=>$value)
  59. {
  60. if(startsWith($key, $prefix))
  61. $result[substr($key, strlen($prefix))] = $value;
  62. }
  63. return $result;
  64. }
  65. //END DIRBAIO'S HAX
  66. //WARNING: These things need to be kept in a certain order of execution.
  67. $thisURL = $_SERVER['SCRIPT_NAME'];
  68. if($q = $_SERVER['QUERY_STRING'])
  69. $thisURL .= "?$q";
  70. include("notifications.php");
  71. include("loguser.php");
  72. include("permissions.php");
  73. include("pluginsystem.php");
  74. include("bbcode.php");
  75. include("bbcode_callbacks.php");
  76. include("post.php");
  77. include("onlineusers.php");
  78. $theme = $loguser['theme'];
  79. include("write.php");
  80. include('lib/layout.php');
  81. include("lists.php");
  82. $bucket = "init"; include('lib/pluginloader.php');