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
*
2008-05-26 12:03:22 +00:00
* Minimum Requirement : PHP 5.2 . 0 +
2008-12-26 16:29:21 +00:00
*
* Within this file the framework with all components as well as all phpBB - specific things will be loaded
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
}
2009-01-13 18:32:51 +00:00
// Init Framework - do not change to require_once ;)
require PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT ;
2006-04-29 13:14:33 +00:00
2008-12-26 16:29:21 +00:00
// Run through remaining Framework states
2009-01-20 16:54:15 +00:00
if ( ! phpbb :: $base_config [ 'config_set' ] || ! phpbb :: $base_config [ '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
2008-01-29 15:57:56 +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' );
}
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)
2008-05-29 12:25:56 +00:00
$script_path = trim ( dirname ( $script_name )) . '/install/index.' . PHP_EXT ;
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 )))
{
2008-01-29 15:57:56 +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
2008-12-26 16:29:21 +00:00
// Set PHP error handler to ours
set_error_handler ( defined ( 'PHPBB_MSG_HANDLER' ) ? PHPBB_MSG_HANDLER : 'msg_handler' );
// enforce the use of the request class
phpbb_request :: disable_super_globals ();
// @todo Syndicate config variables somehow and check them here. It would be also nice to not have so many global vars from the config file (means: re-think layout of config file, maybe require phpbb:: to be set)
2009-01-20 16:54:15 +00:00
if ( ! empty ( phpbb :: $base_config [ 'dbms' ]))
2006-04-29 13:14:33 +00:00
{
2008-12-26 16:29:21 +00:00
// Register DB object.
2009-01-20 16:54:15 +00:00
phpbb :: assign ( 'db' , phpbb_db_dbal :: connect ( phpbb :: $base_config [ 'dbms' ], phpbb :: $base_config [ 'dbhost' ], phpbb :: $base_config [ 'dbuser' ], phpbb :: $base_config [ 'dbpasswd' ], phpbb :: $base_config [ 'dbname' ], phpbb :: $base_config [ 'dbport' ], false , defined ( 'PHPBB_DB_NEW_LINK' ) ? PHPBB_DB_NEW_LINK : false ));
2006-04-29 13:14:33 +00:00
}
2004-09-16 18:33:22 +00:00
2008-12-26 16:29:21 +00:00
// We do not need the db password any longer, unset for safety purposes
2009-01-20 16:54:15 +00:00
if ( ! empty ( phpbb :: $base_config [ 'dbpasswd' ]))
2006-04-29 13:14:33 +00:00
{
2009-01-20 16:54:15 +00:00
unset ( phpbb :: $base_config [ 'dbpasswd' ]);
2003-02-25 16:49:45 +00:00
}
2008-12-26 16:29:21 +00:00
// Register Cache Manager
phpbb :: register ( 'acm' );
2007-10-04 18:50:25 +00:00
2008-12-26 16:29:21 +00:00
// Grab global variables
phpbb_cache :: obtain_config ();
2005-10-02 18:43:11 +00:00
2008-12-26 16:29:21 +00:00
// Register Template
phpbb :: register ( 'template' );
2002-07-14 14:45:26 +00:00
2008-12-26 16:29:21 +00:00
// Register permission class
phpbb :: register ( 'acl' );
2008-11-24 00:20:33 +00:00
2008-12-26 16:29:21 +00:00
// Register user object
2008-12-30 17:20:50 +00:00
phpbb :: register ( 'user' , false , false , phpbb :: $config [ 'auth_method' ], PHPBB_ROOT_PATH . 'language/' );
2003-06-21 15:14:47 +00:00
2008-12-26 16:29:21 +00:00
// Register API
2008-12-30 17:20:50 +00:00
// phpbb::register('api');
2005-03-21 22:43:07 +00:00
2008-12-26 16:29:21 +00:00
// Register Plugins
phpbb :: $plugins -> init ( PHPBB_ROOT_PATH . 'plugins/' );
2003-01-20 05:12:38 +00:00
2008-12-26 16:29:21 +00:00
// Setup Plugins
phpbb :: $plugins -> setup ();
2007-09-22 19:18:13 +00:00
2006-04-28 12:49:44 +00:00
?>