diff options
| author | Nils Adermann <naderman@naderman.de> | 2010-03-02 01:05:33 +0100 |
|---|---|---|
| committer | Nils Adermann <naderman@naderman.de> | 2010-03-02 01:05:33 +0100 |
| commit | ee82970d96e0a6772b24c48aab8ebd1888ec5216 (patch) | |
| tree | 2f284a1671eb3667a4b280b252ecd6e930b5920c /phpBB/common.php | |
| parent | c9f68f0b5c339cf7c0126eef8e7c533a0107bd66 (diff) | |
| parent | 108312d52a447e3ad5a2e8d1682f0439e5443cf0 (diff) | |
| download | forums-ee82970d96e0a6772b24c48aab8ebd1888ec5216.tar forums-ee82970d96e0a6772b24c48aab8ebd1888ec5216.tar.gz forums-ee82970d96e0a6772b24c48aab8ebd1888ec5216.tar.bz2 forums-ee82970d96e0a6772b24c48aab8ebd1888ec5216.tar.xz forums-ee82970d96e0a6772b24c48aab8ebd1888ec5216.zip | |
Merge commit 'release-3.0-B2'
Diffstat (limited to 'phpBB/common.php')
| -rw-r--r-- | phpBB/common.php | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/phpBB/common.php b/phpBB/common.php index ea05515075..c69ee4395e 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -104,14 +104,40 @@ if (defined('IN_CRON')) if (!file_exists($phpbb_root_path . 'config.' . $phpEx)) { - 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>"); + 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>"); } require($phpbb_root_path . 'config.' . $phpEx); if (!defined('PHPBB_INSTALLED')) { - header('Location: install/index.' . $phpEx); + // 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'); + } + + // 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 = trim(dirname($script_name)) . '/install/index.' . $phpEx; + $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); + + $url = (($secure) ? 'https://' : 'http://') . $server_name; + + if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80))) + { + $url .= ':' . $server_port; + } + + $url .= $script_path; + header('Location: ' . $url); exit; } @@ -165,10 +191,11 @@ unset($dbpasswd); $config = $cache->obtain_config(); $dss_seeded = false; -// Warn about install/ directory -if (file_exists($phpbb_root_path . 'install')) +// Disable board if the install/ directory is still present +if (file_exists($phpbb_root_path . 'install') && !defined('ADMIN_START')) { - trigger_error('REMOVE_INSTALL'); + $message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE'; + trigger_error($message); } ?>
\ No newline at end of file |
