6 * @copyright (c) 2005 phpBB Group
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
9 * Minimum Requirement: PHP 4.3.3
14 if (!defined('IN_PHPBB'))
19 require($phpbb_root_path . 'includes/startup.' . $phpEx);
21 if (file_exists($phpbb_root_path . 'config.' . $phpEx))
23 require($phpbb_root_path . 'config.' . $phpEx);
26 if (!defined('PHPBB_INSTALLED'))
28 // Redirect the user to the installer
29 // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information
30 // available as used by the redirect function
31 $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
32 $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
33 $secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0;
35 $script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
38 $script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
41 // Replace any number of consecutive backslashes and/or slashes with a single slash
42 // (could happen on some proxy setups and/or Windows servers)
43 $script_path = trim(dirname($script_name)) . '/install/index.' . $phpEx;
44 $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);
46 $url = (($secure) ? 'https://' : 'http://') . $server_name;
48 if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80)))
50 // HTTP HOST can carry a port number...
51 if (strpos($server_name, ':') === false)
53 $url .= ':' . $server_port;
58 header('Location: ' . $url);
62 if (defined('DEBUG_EXTRA'))
64 $base_memory_usage = 0;
65 if (function_exists('memory_get_usage'))
67 $base_memory_usage = memory_get_usage();
72 // dl() is deprecated and disabled by default as of PHP 5.3.
73 if (!empty($load_extensions) && function_exists('dl'))
75 $load_extensions = explode(',', $load_extensions);
77 foreach ($load_extensions as $extension)
79 @dl(trim($extension));
84 require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx);
85 require($phpbb_root_path . 'includes/cache.' . $phpEx);
86 require($phpbb_root_path . 'includes/template.' . $phpEx);
87 require($phpbb_root_path . 'includes/session.' . $phpEx);
88 require($phpbb_root_path . 'includes/auth.' . $phpEx);
90 require($phpbb_root_path . 'includes/functions.' . $phpEx);
91 require($phpbb_root_path . 'includes/functions_content.' . $phpEx);
93 require($phpbb_root_path . 'includes/constants.' . $phpEx);
94 require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
95 require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
97 // Set PHP error handler to ours
98 set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
100 // Instantiate some basic classes
103 $template = new template();
104 $cache = new cache();
108 $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false);
110 // We do not need this any longer, unset for safety purposes
113 // Grab global variables, re-cache if necessary
114 $config = $cache->obtain_config();
116 // Add own hook handler
117 require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
118 $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
120 foreach ($cache->obtain_hooks() as $hook)
122 @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);