PageRenderTime 24ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/index.php

https://bitbucket.org/nexea/x00n
PHP | 139 lines | 118 code | 0 blank | 21 comment | 0 complexity | 12902406b8789bbe2a4f9074ae234056 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**********************************************************************************
  3. * index.php *
  4. ***********************************************************************************
  5. * x00n: BitTorrent Tracker *
  6. * Open-Source Project Inspired by NeXEA (webmaster@tylerperroux.com) *
  7. * =============================================================================== *
  8. * Software Version: x00n 1.0 *
  9. * Software by: x00n Dev Team (http://www.x00n.com/dev/) *
  10. * Copyright 2008-2009 by: x00n Dev Team/NeXEA (http://www.x00n.com/ *
  11. * Support, News, Updates at: http://www.x00n.com *
  12. ***********************************************************************************
  13. * This program is free software; you may redistribute it and/or modify it under *
  14. * the terms of the provided license as published by the GNU Foundation *
  15. * *
  16. * This program is distributed in the hope that it is and will be useful, but *
  17. * WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
  18. * or FITNESS FOR A PARTICULAR PURPOSE. *
  19. * *
  20. * See the "LICENSE" file for details of the GNU General Public License. *
  21. * The latest version can always be found at http://www.x00n.com *
  22. **********************************************************************************/
  23. $entities = array(
  24. "\"" => "&quot;",
  25. ";"=>"&#059;",
  26. "'"=>"&#039;",
  27. "<"=>"&lt;",
  28. ">"=>"&gt;",
  29. "`" => "&acute;",
  30. "\\"=>"&#092;",
  31. "=" => "&#61;",
  32. "^"=>"&#094;"
  33. );
  34. if (isset($_POST)) {
  35. foreach($_POST as $var => $val) {
  36. if (!is_array($val)) {
  37. $_POST[$var] = trim(strtr(stripslashes($val), $entities));
  38. }
  39. }
  40. }
  41. unset($entities, $var, $val);
  42. /*
  43. Alright everything is done through this file. For security nothing should
  44. be executed without first getting authorized by being run through this file.
  45. Everything is based on the the x00nLoad() function and is formatted like so:
  46. 'action-in-url' => array('Source-File.php', 'FunctionToCall'),
  47. Then, you can access the FunctionToCall() function from Source-File.php
  48. with the URL index.php?action=action-in-url. Relatively simple, no?(SMF)
  49. */
  50. $x00n_version = 'x00n 1.5 BETA';
  51. //Let's get this started
  52. define('x00n', 1);
  53. //Bye, Bye magic quotes
  54. @set_magic_quotes_runtime(0);
  55. //Here's our Error reporting
  56. error_reporting(E_ALL ^ E_NOTICE);
  57. //Get's the time for the script since everything is run from here.
  58. $time_start = microtime();
  59. // Make sure some things simply do not exist.
  60. foreach (array('db_character_set') as $variable)
  61. if (isset($GLOBALS[$variable]))
  62. unset($GLOBALS[$variable]);
  63. //Now let's get our DB and other settings
  64. require_once(dirname(__FILE__) . '/Settings.php');
  65. // Load the functions...
  66. require_once(dirname(__FILE__) . '/lib/Library.php');
  67. dbconn();
  68. // And important includes.
  69. /*
  70. Future Files to include Themes, and other things
  71. require_once($sourcedir . '/QueryString.php');
  72. require_once($sourcedir . '/Subs.php');
  73. require_once($sourcedir . '/Errors.php');
  74. require_once($sourcedir . '/Load.php');
  75. require_once($sourcedir . '/Security.php');
  76. */
  77. // What function shall we execute? (done like this for memory's sake.)
  78. call_user_func(x00nLoad());
  79. // The main controlling function.
  80. function x00nLoad()
  81. {
  82. global $user_info, $HTTP_SERVER_VARS;
  83. // Special case: session keep-alive.
  84. if (isset($_GET['action']) && $_GET['action'] == 'keepalive')
  85. die;
  86. userlogin();
  87. // Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
  88. $actionArray = array(
  89. 'browse' => array('Browse.php', 'BrowseTorrents'),
  90. 'details' => array('Browse.php', 'TorrentDetails'),
  91. 'edittorrent' => array('Browse.php', 'TorrentEdit'),
  92. 'edittorrent2' => array('Browse.php', 'TorrentEdit2'),
  93. 'login' => array('Login.php', 'Login'),
  94. 'login2' => array('Login.php', 'Login2'),
  95. 'logout' => array('Login.php', 'Logout'),
  96. 'faq' => array('Help.php', 'FAQ'),
  97. 'forums' => array('Forums.php', 'LoadForum'),
  98. 'inbox' => array('Users.php', 'Inbox'),
  99. 'mytorrents' => array('Torrents.php', 'userTorrents'),
  100. 'ok' => array('Register.php', 'confirm'),
  101. 'profile' => array('Users.php', 'Profile'),
  102. 'profile2' => array('Users.php', 'Profile2'),
  103. 'ratetorrent' => array('Rating.php', 'RateTorrent'),
  104. 'register' => array('Register.php', 'Register'),
  105. 'register2' => array('Register.php', 'Register2'),
  106. 'stats' => array('Custom.php', 'Stats'),
  107. 'upload' => array('Upload.php', 'Upload'),
  108. 'upload2' => array('Upload.php', 'Upload2'),
  109. 'who' => array('Who.php', 'Who'),
  110. '.xml' => array('Feeds.php', 'LoadFeed'),
  111. );
  112. if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']]))
  113. {
  114. // Fall through to the board index then...
  115. require_once('Sources/x00nIndex.php');
  116. return 'x00nIndex';
  117. }
  118. // Otherwise, it was set - so let's go to that action.
  119. require_once('Sources/' . $actionArray[$_REQUEST['action']][0]);
  120. return $actionArray[$_REQUEST['action']][1];
  121. $title = $actionArray[$_REQUEST['action']][1];
  122. }
  123. ?>