// Create the user. $user = new user(); // Get and set the language. $language = !empty($qi_config['qi_lang']) ? $qi_config['qi_lang'] : 'en'; // If there is a language selected in the dropdown menu it's sent as GET, then igonre the hidden POST field. if (isset($_GET['lang'])) { $language = request_var('lang', $language); } else { if (!empty($_POST['sel_lang'])) { $language = request_var('sel_lang', $language); } } $user->lang = file_exists($quickinstall_path . 'language/' . $language) ? $language : 'en'; qi::add_lang(array('qi', 'phpbb'), $quickinstall_path . 'language/' . $user->lang . '/'); // Probably best place to validate the settings $error = validate_settings($qi_config); $mode = empty($error) ? $mode : ($mode == 'update_settings' ? 'update_settings' : 'settings'); if ($qi_install || $mode == 'update_settings' || $mode == 'settings') { require $quickinstall_path . 'includes/qi_settings.' . $phpEx; } // Just put these here temporary. I'll change to use the constants later... Maybe tomorrow or so... $qi_config['version_check'] = false; $qi_config['qi_version'] = QI_VERSION; $qi_config['phpbb_version'] = PHPBB_VERSION; $qi_config['automod_version'] = AUTOMOD_VERSION; // If we get here and the extension isn't loaded it should be safe to just go ahead and load it $available_dbms = get_available_dbms($dbms); if (!isset($available_dbms[$dbms]['DRIVER'])) { trigger_error("The {$dbms} dbms is either not supported, or the php extension for it could not be loaded.", E_USER_ERROR); } // Load the appropriate database class if not already loaded
/** * update_settings * Saves config to file. * * @param array * @return string, error */ function update_settings(&$config) { global $quickinstall_path, $phpEx, $user; // The config cant be empty if (empty($config)) { return $user->lang['CONFIG_EMPTY']; } $error = validate_settings($config); if (!empty($error)) { return $error; } // Let's make sure our boards dir ends with a slash. $config['boards_dir'] = substr($config['boards_dir'], -1) == '/' ? $config['boards_dir'] : $config['boards_dir'] . '/'; $cfg_string = ''; foreach ($config as $key => $value) { $cfg_string .= $key . '=' . $value . "\n"; } if (!empty($config['qi_lang']) && $config['qi_lang'] != $user->lang['USER_LANG']) { if (file_exists($quickinstall_path . 'language/' . $config['qi_lang'])) { $user->lang = $config['qi_lang']; qi::add_lang(array('qi', 'phpbb'), $quickinstall_path . 'language/' . $config['qi_lang'] . '/'); } } file_put_contents($quickinstall_path . 'qi_config.cfg', $cfg_string); }