function maintenance_message() { global $db, $luna_config, $luna_user; // Send no-cache headers header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :) header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); // For HTTP/1.0 compatibility // Send the Content-type header in case the web server is setup to send something else header('Content-type: text/html; charset=utf-8'); // Include functions require FORUM_ROOT . 'include/draw_functions.php'; // Show the page draw_wall_error($luna_config['o_maintenance_message'], NULL, __('Maintenance', 'luna')); // End the transaction $db->end_transaction(); // Close the db connection (and free up any result data) $db->close(); exit; }
while (@ob_end_clean()) { } $stage = isset($_REQUEST['stage']) ? $_REQUEST['stage'] : ''; $old_charset = isset($_REQUEST['req_old_charset']) ? str_replace('ISO8859', 'ISO-8859', strtoupper($_REQUEST['req_old_charset'])) : 'ISO-8859-1'; $start_at = isset($_REQUEST['start_at']) ? intval($_REQUEST['start_at']) : 0; $query_str = ''; // Show form if (empty($stage)) { if (file_exists(LUNA_CACHE_DIR . 'db_update.lock')) { // Deal with newlines, tabs and multiple spaces $pattern = array("\t", ' ', ' '); $replace = array('    ', '  ', '  '); $message = str_replace($pattern, $replace, __('The forums are temporarily down for maintenance. Please try again in a few minutes.', 'luna')); draw_wall_error($message, NULL, __('Maintenance', 'luna')); } else { draw_wall_error(__('There is an update ready to be installed', 'luna'), '<form id="install" method="post" action="db_update.php"><input type="hidden" name="stage" value="start" /><input class="btn btn-default btn-lg" type="submit" name="start" value="' . __('Start update', 'luna') . '" /></form>', __('Update Luna', 'luna')); } $db->end_transaction(); $db->close(); exit; } switch ($stage) { // Start by updating the database structure case 'start': $query_str = '?stage=preparse_comments'; // If we don't need to update the database, skip this stage if (isset($luna_config['o_database_revision']) && $luna_config['o_database_revision'] >= Version::LUNA_DB_VERSION) { break; } // Change the default style if the old doesn't exist anymore if (!file_exists(LUNA_ROOT . 'themes/' . $luna_config['o_default_style'] . '/style.css')) {
$mysql_info = $db->get_version(); if (version_compare($mysql_info['version'], Version::MIN_MYSQL_VERSION, '<')) { error(sprintf(__('You are running %1$s version %2$s. Luna %3$s requires at least %1$s %4$s to run properly. You must upgrade your %1$s installation before you can continue.', 'luna'), 'MySQL', $mysql_info['version'], Version::FORUM_VERSION, Version::MIN_MYSQL_VERSION)); } $mysql = true; break; case 'pgsql': $pgsql_info = $db->get_version(); if (version_compare($pgsql_info['version'], Version::MIN_PGSQL_VERSION, '<')) { error(sprintf(__('You are running %1$s version %2$s. Luna %3$s requires at least %1$s %4$s to run properly. You must upgrade your %1$s installation before you can continue.', 'luna'), 'PostgreSQL', $pgsql_info['version'], Version::FORUM_VERSION, Version::MIN_PGSQL_VERSION)); } break; } // Check the database, search index and parser revision and the current version if (isset($luna_config['o_database_revision']) && $luna_config['o_database_revision'] >= Version::FORUM_DB_VERSION && isset($luna_config['o_searchindex_revision']) && $luna_config['o_searchindex_revision'] >= Version::FORUM_SI_VERSION && isset($luna_config['o_parser_revision']) && $luna_config['o_parser_revision'] >= Version::FORUM_PARSER_VERSION && array_key_exists('o_core_version', $luna_config) && version_compare($luna_config['o_core_version'], Version::FORUM_CORE_VERSION, '>=')) { draw_wall_error(__('Your forum is already as up-to-date as this script can make it.', 'luna'), '<a class="btn btn-default" href="index.php">Continue</a>', __('Let\'s get started', 'luna')); exit; } // Check style $default_style = $luna_config['o_default_style']; if (!file_exists(FORUM_ROOT . 'themes/' . $default_style . '/style.css')) { $default_style = 'Fifteen'; } // Empty all output buffers and stop buffering while (@ob_end_clean()) { } $stage = isset($_REQUEST['stage']) ? $_REQUEST['stage'] : ''; $old_charset = isset($_REQUEST['req_old_charset']) ? str_replace('ISO8859', 'ISO-8859', strtoupper($_REQUEST['req_old_charset'])) : 'ISO-8859-1'; $start_at = isset($_REQUEST['start_at']) ? intval($_REQUEST['start_at']) : 0; $query_str = ''; // Show form
if (file_exists(FORUM_ROOT . 'lang/English/luna.mo')) { load_textdomain('luna', FORUM_ROOT . 'lang/English/luna.mo'); } else { error('There is no valid language pack \'' . luna_htmlspecialchars($luna_user['language']) . '\' installed. Please reinstall a language of that name'); } // If a config file is in place if (file_exists(FORUM_ROOT . 'config.php')) { // Check to see whether Luna is already installed include FORUM_ROOT . 'config.php'; // This fixes incorrect defined PUN, FluxBB 1.4 and 1.5 and ModernBB 1.6 if (defined('PUN')) { define('FORUM', PUN); } // If FORUM is defined, config.php is probably valid and thus the software is installed if (defined('FORUM')) { draw_wall_error(__('It seems like Luna is already installed.', 'luna'), '<a class="btn btn-default btn-lg" href="index.php">' . __('Continue', 'luna') . '</a>', __('We\'re done here', 'luna')); } exit; } // Define FORUM because email.php requires it define('FORUM', 1); // If the cache directory is not specified, we use the default setting if (!defined('FORUM_CACHE_DIR')) { define('FORUM_CACHE_DIR', FORUM_ROOT . 'cache/'); } // Make sure we are running at least Version::MIN_PHP_VERSION if (!Installer::is_supported_php_version()) { exit(sprintf(__('You are running %1$s version %2$s. Luna %3$s requires at least %1$s %4$s to run properly. You must upgrade your %1$s installation before you can continue.', 'luna'), 'PHP', PHP_VERSION, Version::FORUM_VERSION, Version::MIN_PHP_VERSION)); } if (isset($_POST['generate_config'])) { header('Content-Type: text/x-delimtext; name="config.php"');
if (file_exists(FORUM_ROOT . 'lang/English/luna.mo')) { load_textdomain('luna', FORUM_ROOT . 'lang/English/luna.mo'); } else { error('There is no valid language pack \'' . luna_htmlspecialchars($luna_user['language']) . '\' installed. Please reinstall a language of that name'); } // If a config file is in place if (file_exists(FORUM_ROOT . 'config.php')) { // Check to see whether Luna is already installed include FORUM_ROOT . 'config.php'; // This fixes incorrect defined PUN, FluxBB 1.4 and 1.5 and ModernBB 1.6 if (defined('PUN')) { define('FORUM', PUN); } // If FORUM is defined, config.php is probably valid and thus the software is installed if (defined('FORUM')) { draw_wall_error(__('It seems like Luna is already installed.', 'luna'), '<a class="btn btn-default" href="index.php">Continue</a>', __('Let\'s get started', 'luna')); } exit; } // Define FORUM because email.php requires it define('FORUM', 1); // If the cache directory is not specified, we use the default setting if (!defined('FORUM_CACHE_DIR')) { define('FORUM_CACHE_DIR', FORUM_ROOT . 'cache/'); } // Make sure we are running at least Version::MIN_PHP_VERSION if (!Installer::is_supported_php_version()) { exit(sprintf(__('You are running %1$s version %2$s. Luna %3$s requires at least %1$s %4$s to run properly. You must upgrade your %1$s installation before you can continue.', 'luna'), 'PHP', PHP_VERSION, Version::FORUM_VERSION, Version::MIN_PHP_VERSION)); } if (isset($_POST['generate_config'])) { header('Content-Type: text/x-delimtext; name="config.php"');