/index.php
PHP | 139 lines | 118 code | 0 blank | 21 comment | 0 complexity | 12902406b8789bbe2a4f9074ae234056 MD5 | raw file
Possible License(s): GPL-2.0
- <?php
- /**********************************************************************************
- * index.php *
- ***********************************************************************************
- * x00n: BitTorrent Tracker *
- * Open-Source Project Inspired by NeXEA (webmaster@tylerperroux.com) *
- * =============================================================================== *
- * Software Version: x00n 1.0 *
- * Software by: x00n Dev Team (http://www.x00n.com/dev/) *
- * Copyright 2008-2009 by: x00n Dev Team/NeXEA (http://www.x00n.com/ *
- * Support, News, Updates at: http://www.x00n.com *
- ***********************************************************************************
- * This program is free software; you may redistribute it and/or modify it under *
- * the terms of the provided license as published by the GNU Foundation *
- * *
- * This program is distributed in the hope that it is and will be useful, but *
- * WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
- * or FITNESS FOR A PARTICULAR PURPOSE. *
- * *
- * See the "LICENSE" file for details of the GNU General Public License. *
- * The latest version can always be found at http://www.x00n.com *
- **********************************************************************************/
- $entities = array(
- "\"" => """,
- ";"=>";",
- "'"=>"'",
- "<"=>"<",
- ">"=>">",
- "`" => "´",
- "\\"=>"\",
- "=" => "=",
- "^"=>"^"
- );
-
- if (isset($_POST)) {
- foreach($_POST as $var => $val) {
- if (!is_array($val)) {
- $_POST[$var] = trim(strtr(stripslashes($val), $entities));
- }
- }
- }
- unset($entities, $var, $val);
- /*
- Alright everything is done through this file. For security nothing should
- be executed without first getting authorized by being run through this file.
- Everything is based on the the x00nLoad() function and is formatted like so:
-
- 'action-in-url' => array('Source-File.php', 'FunctionToCall'),
-
- Then, you can access the FunctionToCall() function from Source-File.php
- with the URL index.php?action=action-in-url. Relatively simple, no?(SMF)
- */
- $x00n_version = 'x00n 1.5 BETA';
- //Let's get this started
- define('x00n', 1);
-
- //Bye, Bye magic quotes
- @set_magic_quotes_runtime(0);
-
- //Here's our Error reporting
- error_reporting(E_ALL ^ E_NOTICE);
-
- //Get's the time for the script since everything is run from here.
- $time_start = microtime();
-
- // Make sure some things simply do not exist.
- foreach (array('db_character_set') as $variable)
- if (isset($GLOBALS[$variable]))
- unset($GLOBALS[$variable]);
-
- //Now let's get our DB and other settings
- require_once(dirname(__FILE__) . '/Settings.php');
- // Load the functions...
- require_once(dirname(__FILE__) . '/lib/Library.php');
- dbconn();
- // And important includes.
- /*
- Future Files to include Themes, and other things
- require_once($sourcedir . '/QueryString.php');
- require_once($sourcedir . '/Subs.php');
- require_once($sourcedir . '/Errors.php');
- require_once($sourcedir . '/Load.php');
- require_once($sourcedir . '/Security.php');
- */
-
- // What function shall we execute? (done like this for memory's sake.)
- call_user_func(x00nLoad());
-
-
- // The main controlling function.
- function x00nLoad()
- {
-
- global $user_info, $HTTP_SERVER_VARS;
- // Special case: session keep-alive.
- if (isset($_GET['action']) && $_GET['action'] == 'keepalive')
- die;
- userlogin();
- // Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
- $actionArray = array(
- 'browse' => array('Browse.php', 'BrowseTorrents'),
- 'details' => array('Browse.php', 'TorrentDetails'),
- 'edittorrent' => array('Browse.php', 'TorrentEdit'),
- 'edittorrent2' => array('Browse.php', 'TorrentEdit2'),
- 'login' => array('Login.php', 'Login'),
- 'login2' => array('Login.php', 'Login2'),
- 'logout' => array('Login.php', 'Logout'),
- 'faq' => array('Help.php', 'FAQ'),
- 'forums' => array('Forums.php', 'LoadForum'),
- 'inbox' => array('Users.php', 'Inbox'),
- 'mytorrents' => array('Torrents.php', 'userTorrents'),
- 'ok' => array('Register.php', 'confirm'),
- 'profile' => array('Users.php', 'Profile'),
- 'profile2' => array('Users.php', 'Profile2'),
- 'ratetorrent' => array('Rating.php', 'RateTorrent'),
- 'register' => array('Register.php', 'Register'),
- 'register2' => array('Register.php', 'Register2'),
- 'stats' => array('Custom.php', 'Stats'),
- 'upload' => array('Upload.php', 'Upload'),
- 'upload2' => array('Upload.php', 'Upload2'),
- 'who' => array('Who.php', 'Who'),
- '.xml' => array('Feeds.php', 'LoadFeed'),
-
- );
-
- if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']]))
- {
- // Fall through to the board index then...
- require_once('Sources/x00nIndex.php');
- return 'x00nIndex';
- }
-
- // Otherwise, it was set - so let's go to that action.
- require_once('Sources/' . $actionArray[$_REQUEST['action']][0]);
- return $actionArray[$_REQUEST['action']][1];
- $title = $actionArray[$_REQUEST['action']][1];
- }
-
- ?>