2001-02-24 00:31:58 +00:00
|
|
|
<?php
|
2005-04-09 12:26:45 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package phpBB3
|
|
|
|
* @version $Id$
|
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
|
*
|
2006-01-04 07:51:04 +00:00
|
|
|
* Minimum Requirement: PHP 4.3.3
|
2005-04-09 12:26:45 +00:00
|
|
|
*/
|
|
|
|
|
2005-08-17 15:57:50 +00:00
|
|
|
/**
|
|
|
|
*/
|
2003-01-21 14:33:07 +00:00
|
|
|
if (!defined('IN_PHPBB'))
|
2002-03-18 23:45:24 +00:00
|
|
|
{
|
2004-09-01 15:47:46 +00:00
|
|
|
exit;
|
2002-03-18 23:45:24 +00:00
|
|
|
}
|
|
|
|
|
2003-08-27 16:32:44 +00:00
|
|
|
$starttime = explode(' ', microtime());
|
|
|
|
$starttime = $starttime[1] + $starttime[0];
|
|
|
|
|
2006-05-28 17:18:47 +00:00
|
|
|
// Report all errors, except notices
|
|
|
|
error_reporting(E_ALL ^ E_NOTICE);
|
2006-04-29 13:31:32 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Remove variables created by register_globals from the global scope
|
|
|
|
* Thanks to Matt Kavanagh
|
|
|
|
*/
|
|
|
|
function deregister_globals()
|
|
|
|
{
|
|
|
|
$not_unset = array(
|
2006-06-06 20:53:46 +00:00
|
|
|
'GLOBALS' => true,
|
|
|
|
'_GET' => true,
|
|
|
|
'_POST' => true,
|
|
|
|
'_COOKIE' => true,
|
|
|
|
'_REQUEST' => true,
|
|
|
|
'_SERVER' => true,
|
|
|
|
'_SESSION' => true,
|
|
|
|
'_ENV' => true,
|
|
|
|
'_FILES' => true,
|
|
|
|
'phpEx' => true,
|
|
|
|
'phpbb_root_path' => true
|
2006-04-29 13:31:32 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// Not only will array_merge and array_keys give a warning if
|
|
|
|
// a parameter is not an array, array_merge will actually fail.
|
|
|
|
// So we check if _SESSION has been initialised.
|
|
|
|
if (!isset($_SESSION) || !is_array($_SESSION))
|
|
|
|
{
|
|
|
|
$_SESSION = array();
|
|
|
|
}
|
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
// Merge all into one extremely huge array; unset this later
|
2006-04-29 13:31:32 +00:00
|
|
|
$input = array_merge(
|
|
|
|
array_keys($_GET),
|
|
|
|
array_keys($_POST),
|
|
|
|
array_keys($_COOKIE),
|
|
|
|
array_keys($_SERVER),
|
|
|
|
array_keys($_SESSION),
|
|
|
|
array_keys($_ENV),
|
|
|
|
array_keys($_FILES)
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach ($input as $varname)
|
|
|
|
{
|
|
|
|
if (isset($not_unset[$varname]))
|
|
|
|
{
|
|
|
|
// Hacking attempt. No point in continuing.
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
unset($GLOBALS[$varname]);
|
|
|
|
}
|
|
|
|
|
|
|
|
unset($input);
|
|
|
|
}
|
2006-04-26 18:22:28 +00:00
|
|
|
|
2006-04-22 16:18:40 +00:00
|
|
|
// If we are on PHP >= 6.0.0 we do not need some code
|
2006-04-28 12:49:44 +00:00
|
|
|
if (version_compare(phpversion(), '6.0.0-dev', '>='))
|
2006-03-06 23:45:21 +00:00
|
|
|
{
|
2006-05-05 17:56:33 +00:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2006-04-22 16:18:40 +00:00
|
|
|
define('STRIP', false);
|
2006-03-06 23:45:21 +00:00
|
|
|
}
|
2006-04-22 16:18:40 +00:00
|
|
|
else
|
2003-08-23 21:51:31 +00:00
|
|
|
{
|
2006-04-22 16:18:40 +00:00
|
|
|
set_magic_quotes_runtime(0);
|
2006-03-06 23:45:21 +00:00
|
|
|
|
2006-04-22 16:18:40 +00:00
|
|
|
// Be paranoid with passed vars
|
|
|
|
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
|
2006-03-06 23:45:21 +00:00
|
|
|
{
|
2006-04-29 13:31:32 +00:00
|
|
|
deregister_globals();
|
2006-03-06 23:45:21 +00:00
|
|
|
}
|
|
|
|
|
2006-04-22 16:18:40 +00:00
|
|
|
define('STRIP', (get_magic_quotes_gpc()) ? true : false);
|
2003-08-23 21:51:31 +00:00
|
|
|
}
|
|
|
|
|
2005-04-30 14:28:07 +00:00
|
|
|
if (defined('IN_CRON'))
|
|
|
|
{
|
|
|
|
chdir($phpbb_root_path);
|
2006-08-17 04:26:07 +00:00
|
|
|
if (@function_exists('getcwd'))
|
|
|
|
{
|
|
|
|
$phpbb_root_path = getcwd() . '/';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// This is a best guess
|
|
|
|
$phpbb_root_path = pathinfo($_SERVER['SCRIPT_FILENAME'], PATHINFO_DIRNAME) . '/';
|
|
|
|
}
|
2005-04-30 14:28:07 +00:00
|
|
|
}
|
|
|
|
|
2006-06-10 23:11:03 +00:00
|
|
|
if (!file_exists($phpbb_root_path . 'config.' . $phpEx))
|
|
|
|
{
|
2006-07-23 21:26:53 +00:00
|
|
|
die("<p>The config.$phpEx file could not be found.</p><p><a href=\"{$phpbb_root_path}install/index.$phpEx\">Click here to install phpBB</a></p>");
|
2006-06-10 23:11:03 +00:00
|
|
|
}
|
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
require($phpbb_root_path . 'config.' . $phpEx);
|
2006-04-29 13:14:33 +00:00
|
|
|
|
|
|
|
if (!defined('PHPBB_INSTALLED'))
|
2002-04-20 00:22:29 +00:00
|
|
|
{
|
2006-07-07 20:47:25 +00:00
|
|
|
// Redirect the user to the installer
|
|
|
|
// We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information
|
|
|
|
// available as used by the redirect function
|
|
|
|
$server_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME');
|
|
|
|
$server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
|
|
|
|
$secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0;
|
|
|
|
|
|
|
|
$script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
|
|
|
|
if (!$script_name)
|
|
|
|
{
|
|
|
|
$script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
|
|
|
|
}
|
|
|
|
|
2006-07-23 20:59:41 +00:00
|
|
|
// Replace any number of consecutive backslashes and/or slashes with a single slash
|
|
|
|
// (could happen on some proxy setups and/or Windows servers)
|
2006-07-07 21:50:24 +00:00
|
|
|
$script_path = trim(dirname($script_name)) . '/install/index.' . $phpEx;
|
2006-07-23 20:59:41 +00:00
|
|
|
$script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);
|
2006-07-07 20:47:25 +00:00
|
|
|
|
|
|
|
$url = (($secure) ? 'https://' : 'http://') . $server_name;
|
|
|
|
|
|
|
|
if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80)))
|
|
|
|
{
|
|
|
|
$url .= ':' . $server_port;
|
|
|
|
}
|
|
|
|
|
2006-07-07 21:50:24 +00:00
|
|
|
$url .= $script_path;
|
2006-07-07 20:47:25 +00:00
|
|
|
header('Location: ' . $url);
|
2006-04-29 13:14:33 +00:00
|
|
|
exit;
|
|
|
|
}
|
2001-08-09 22:21:55 +00:00
|
|
|
|
2006-04-29 13:14:33 +00:00
|
|
|
if (defined('DEBUG_EXTRA'))
|
|
|
|
{
|
|
|
|
$base_memory_usage = 0;
|
|
|
|
if (function_exists('memory_get_usage'))
|
2004-09-16 18:33:22 +00:00
|
|
|
{
|
2006-04-29 13:14:33 +00:00
|
|
|
$base_memory_usage = memory_get_usage();
|
2004-09-16 18:33:22 +00:00
|
|
|
}
|
2006-04-29 13:14:33 +00:00
|
|
|
}
|
2004-09-16 18:33:22 +00:00
|
|
|
|
2006-04-29 13:14:33 +00:00
|
|
|
// Load Extensions
|
|
|
|
if (!empty($load_extensions))
|
|
|
|
{
|
|
|
|
$load_extensions = explode(',', $load_extensions);
|
2003-02-25 16:49:45 +00:00
|
|
|
|
2006-04-29 13:14:33 +00:00
|
|
|
foreach ($load_extensions as $extension)
|
2003-02-25 16:49:45 +00:00
|
|
|
{
|
2006-04-29 13:14:33 +00:00
|
|
|
@dl(trim($extension));
|
2003-02-25 16:49:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-02 18:43:11 +00:00
|
|
|
// Include files
|
|
|
|
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx);
|
2006-06-14 18:59:12 +00:00
|
|
|
require($phpbb_root_path . 'includes/cache.' . $phpEx);
|
2005-10-02 18:43:11 +00:00
|
|
|
require($phpbb_root_path . 'includes/template.' . $phpEx);
|
|
|
|
require($phpbb_root_path . 'includes/session.' . $phpEx);
|
2006-01-04 07:51:04 +00:00
|
|
|
require($phpbb_root_path . 'includes/auth.' . $phpEx);
|
2005-10-02 18:43:11 +00:00
|
|
|
require($phpbb_root_path . 'includes/functions.' . $phpEx);
|
|
|
|
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
2006-04-29 13:14:33 +00:00
|
|
|
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
|
2006-09-17 22:02:28 +00:00
|
|
|
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
2005-10-02 18:43:11 +00:00
|
|
|
|
2002-10-26 12:36:38 +00:00
|
|
|
// Set PHP error handler to ours
|
|
|
|
set_error_handler('msg_handler');
|
2002-07-14 14:45:26 +00:00
|
|
|
|
2003-01-21 14:33:07 +00:00
|
|
|
// Instantiate some basic classes
|
2003-06-21 15:14:47 +00:00
|
|
|
$user = new user();
|
|
|
|
$auth = new auth();
|
2003-08-06 18:33:03 +00:00
|
|
|
$template = new template();
|
2005-10-02 18:43:11 +00:00
|
|
|
$cache = new cache();
|
2006-04-29 13:14:33 +00:00
|
|
|
$db = new $sql_db();
|
2003-06-21 15:14:47 +00:00
|
|
|
|
2006-04-29 13:14:33 +00:00
|
|
|
// Connect to DB
|
|
|
|
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false);
|
2005-03-21 22:43:07 +00:00
|
|
|
|
2006-04-29 13:14:33 +00:00
|
|
|
// We do not need this any longer, unset for safety purposes
|
|
|
|
unset($dbpasswd);
|
2003-01-20 05:12:38 +00:00
|
|
|
|
2006-04-29 13:14:33 +00:00
|
|
|
// Grab global variables, re-cache if necessary
|
|
|
|
$config = $cache->obtain_config();
|
2006-04-28 12:49:44 +00:00
|
|
|
|
|
|
|
?>
|