2001-02-24 00:31:58 +00:00
|
|
|
<?php
|
2007-10-04 11:33:33 +00:00
|
|
|
/**
|
2005-04-09 12:26:45 +00:00
|
|
|
*
|
|
|
|
* @package phpBB3
|
|
|
|
* @version $Id$
|
2007-10-04 11:33:33 +00:00
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
2005-04-09 12:26:45 +00:00
|
|
|
*
|
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
|
|
|
}
|
|
|
|
|
2011-06-14 06:11:35 -04:00
|
|
|
require($phpbb_root_path . 'includes/startup.' . $phpEx);
|
2003-08-23 21:51:31 +00:00
|
|
|
|
2010-09-16 21:57:25 +02:00
|
|
|
if (file_exists($phpbb_root_path . 'config.' . $phpEx))
|
2006-06-10 23:11:03 +00:00
|
|
|
{
|
2010-09-16 21:57:25 +02:00
|
|
|
require($phpbb_root_path . 'config.' . $phpEx);
|
2006-06-10 23:11:03 +00:00
|
|
|
}
|
|
|
|
|
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
|
2012-10-17 22:35:36 -04:00
|
|
|
require($phpbb_root_path . 'includes/functions.' . $phpEx);
|
|
|
|
|
2006-07-07 20:47:25 +00:00
|
|
|
// 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
|
2008-01-29 15:49:15 +00:00
|
|
|
$server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
|
2006-07-07 20:47:25 +00:00
|
|
|
$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');
|
|
|
|
}
|
|
|
|
|
2012-10-17 15:03:06 -04:00
|
|
|
// $phpbb_root_path accounts for redirects from e.g. /adm
|
|
|
|
$script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/index.' . $phpEx;
|
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)
|
|
|
|
$script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);
|
2012-10-17 15:03:06 -04:00
|
|
|
// Eliminate . and .. from the path
|
2012-10-17 15:13:35 -04:00
|
|
|
$script_path = phpbb_clean_path($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)))
|
|
|
|
{
|
2008-01-29 15:49:15 +00:00
|
|
|
// HTTP HOST can carry a port number...
|
|
|
|
if (strpos($server_name, ':') === false)
|
|
|
|
{
|
|
|
|
$url .= ':' . $server_port;
|
|
|
|
}
|
2006-07-07 20:47:25 +00:00
|
|
|
}
|
|
|
|
|
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
|
2009-12-04 11:50:03 +00:00
|
|
|
// dl() is deprecated and disabled by default as of PHP 5.3.
|
|
|
|
if (!empty($load_extensions) && function_exists('dl'))
|
2006-04-29 13:14:33 +00:00
|
|
|
{
|
|
|
|
$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);
|
2007-10-04 18:50:25 +00:00
|
|
|
|
2005-10-02 18:43:11 +00:00
|
|
|
require($phpbb_root_path . 'includes/functions.' . $phpEx);
|
2007-10-04 18:50:25 +00:00
|
|
|
require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
|
|
|
|
|
2005-10-02 18:43:11 +00:00
|
|
|
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
|
2007-08-30 21:29:16 +00:00
|
|
|
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_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
|
2007-11-18 15:37:17 +00:00
|
|
|
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : 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
|
|
|
|
2007-09-22 19:18:13 +00:00
|
|
|
// Add own hook handler
|
|
|
|
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
|
|
|
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
|
|
|
|
|
|
|
|
foreach ($cache->obtain_hooks() as $hook)
|
|
|
|
{
|
2007-09-23 11:04:50 +00:00
|
|
|
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
|
2007-09-22 19:18:13 +00:00
|
|
|
}
|
|
|
|
|
2006-04-28 12:49:44 +00:00
|
|
|
?>
|