3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * * @package install * @version $Id$ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ /**#@+ * @ignore */ define('IN_PHPBB', true); define('IN_INSTALL', true); /**#@-*/ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); // @todo Review this test and see if we can find out what it is which prevents PHP 4.2.x from even displaying the page with requirements on it if (version_compare(PHP_VERSION, '4.3.3') < 0) { die('You are running an unsupported PHP version. Please upgrade to PHP 4.3.3 or higher before trying to install phpBB 3.0'); } function phpbb_require_updated($path, $optional = false) { global $phpbb_root_path; $new_path = $phpbb_root_path . 'install/update/new/' . $path; $old_path = $phpbb_root_path . $path; if (file_exists($new_path)) { require($new_path); } else if (!$optional || file_exists($old_path)) { require($old_path); } } phpbb_require_updated('includes/startup.' . $phpEx); // Try to override some limits - maybe it helps some... @set_time_limit(0); $mem_limit = @ini_get('memory_limit'); if (!empty($mem_limit)) { $unit = strtolower(substr($mem_limit, -1, 1)); $mem_limit = (int) $mem_limit; if ($unit == 'k') { $mem_limit = floor($mem_limit / 1024); } else if ($unit == 'g') { $mem_limit *= 1024; } else if (is_numeric($unit)) { $mem_limit = floor((int) ($mem_limit . $unit) / 1048576); } $mem_limit = max(128, $mem_limit) . 'M'; } else { $mem_limit = '128M'; } @ini_set('memory_limit', $mem_limit); // Include essential scripts require($phpbb_root_path . 'includes/functions.' . $phpEx); phpbb_require_updated('includes/functions_content.' . $phpEx, true); include($phpbb_root_path . 'includes/auth.' . $phpEx); include($phpbb_root_path . 'includes/session.' . $phpEx); include($phpbb_root_path . 'includes/template.' . $phpEx); include($phpbb_root_path . 'includes/acm/acm_file.' . $phpEx); include($phpbb_root_path . 'includes/cache.' . $phpEx); include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/functions_install.' . $phpEx); // Try and load an appropriate language if required $language = basename(request_var('language', '')); if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) { $accept_lang_ary = explode(',', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])); foreach ($accept_lang_ary as $accept_lang) { // Set correct format ... guess full xx_yy form $accept_lang = substr($accept_lang, 0, 2) . '_' . substr($accept_lang, 3, 2); if (file_exists($phpbb_root_path . 'language/' . $accept_lang) && is_dir($phpbb_root_path . 'language/' . $accept_lang)) { $language = $accept_lang; break; } else { // No match on xx_yy so try xx $accept_lang = substr($accept_lang, 0, 2); if (file_exists($phpbb_root_path . 'language/' . $accept_lang) && is_dir($phpbb_root_path . 'language/' . $accept_lang)) { $language = $accept_lang; break; } } } } // No appropriate language found ... so let's use the first one in the language // dir, this may or may not be English if (!$language) { $dir = @opendir($phpbb_root_path . 'language'); if (!$dir) { die('Unable to access the language directory'); exit; } while (($file = readdir($dir)) !== false) { $path = $phpbb_root_path . 'language/' . $file; if (!is_file($path) && !is_link($path) && file_exists($path . '/iso.txt')) { $language = $file; break; } } closedir($dir); } if (!file_exists($phpbb_root_path . 'language/' . $language) || !is_dir($phpbb_root_path . 'language/' . $language)) { die('No language found!'); } // And finally, load the relevant language files include($phpbb_root_path . 'language/' . $language . '/common.' . $phpEx); include($phpbb_root_path . 'language/' . $language . '/acp/common.' . $phpEx); include($phpbb_root_path . 'language/' . $language . '/acp/board.' . $phpEx); include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx); include($phpbb_root_path . 'language/' . $language . '/posting.' . $phpEx); // usually we would need every single constant here - and it would be consistent. For 3.0.x, use a dirty hack... :( // Define needed constants define('CHMOD_ALL', 7); define('CHMOD_READ', 4); define('CHMOD_WRITE', 2); define('CHMOD_EXECUTE', 1); $mode = request_var('mode', 'overview'); $sub = request_var('sub', ''); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); $user = new user(); $auth = new auth(); $cache = new cache(); $template = new template();

preferences:
34.06 ms | 425 KiB | 5 Q