* ----------------------------------------------------------------------------------- * Note: auto installers should kick in directly at this step and provide all required params. */ track_step('install-start'); $create_sample_contents = param('create_sample_contents', 'string', ''); $config_test_install_all_features = $test_install_all_features; if ($test_install_all_features) { // Allow to use $test_install_all_features from request only when it is enabled in config $test_install_all_features = param('install_all_features', 'boolean', false); } else { $test_install_all_features = false; } // fp> TODO: this test should probably be made more generic and applied to upgrade too. $expected_connection_charset = DB::php_to_mysql_charmap($evo_charset); if ($DB->connection_charset != $expected_connection_charset) { display_install_messages(sprintf(T_('In order to install b2evolution with the %s locale, your MySQL needs to support the %s connection charset.') . ' (mysqli::set_charset(%s))', $current_locale, $evo_charset, $expected_connection_charset)); // sam2kb> TODO: If something is not supported we can display a message saying "do this and that, enable extension X etc. etc... or switch to a better hosting". break; } // Progress bar start_install_progress_bar(T_('Installation in progress'), get_install_steps_count()); echo '<h2>' . T_('Installing b2evolution...') . '</h2>'; // Try to display the messages here because they can be created during checking params of quick installation: $Messages->display(); if (!empty($basic_config_file_result_messages)) { // Display messages that were generated on creating basic config file on quick installation: echo $basic_config_file_result_messages; } if ($config_test_install_all_features && $allow_evodb_reset) { // Allow to quick delete before new installation only when these two settings are enabled in config files $delete_contents = param('delete_contents', 'integer', 0);
</nav> <h3 class="text-muted"><a href="http://b2evolution.net/"><img class="b2evolution_plane_logo" src="rsc/img/b2evolution_254x52.svg" alt="b2evolution CCMS"></a></h3> </div> <!-- InstanceBeginEditable name="Main" --> <?php if (count($errors)) { // Display errors display_install_messages($errors); } if (!empty($message)) { // Display a message display_install_messages($message, 'success'); } echo '<h1>' . T_('Debug tool') . '</h1>'; display_install_messages(sprintf(T_('This tool allows you to configure some debug variables in the file %s'), $file_overrides_name), 'info'); switch ($action) { case 'password_form': /* * ----------------------------------------------------------------------------------- * Form to log in * ----------------------------------------------------------------------------------- */ block_open(T_('Log in to edit the config of debug')); $Form = new Form($_SERVER['PHP_SELF']); $Form->switch_template_parts($booststrap_install_form_params); $Form->begin_form('form-horizontal'); $Form->hidden('action', 'login'); $Form->text('password', '', 16, T_('Password'), T_('Debug password'), 120, '', 'password'); $Form->end_form(array(array('name' => 'submit', 'value' => T_('Log in'), 'class' => 'btn-primary btn-lg'))); block_close();
/** * Update file /conf/_basic_config.php * * @param string Current action, updated by reference * @param array Params * @return boolean TRUE on success */ function update_basic_config_file($params = array()) { global $DB, $db_config, $evo_charset, $conf_path, $default_locale; // These global params should be rewritten by this function on success result global $baseurl, $admin_email, $config_is_done, $action; $params = array_merge(array('db_user' => '', 'db_password' => '', 'db_name' => '', 'db_host' => '', 'db_tableprefix' => '', 'baseurl' => '', 'admin_email' => '', 'print_messages' => true, 'quick_install' => false), $params); if (!$params['print_messages']) { // Start to get all messages instead of printing on screen: ob_start(); // Use this global var to store all messages global $basic_config_file_result_messages; } // Connect to DB: $DB = new DB(array('user' => $params['db_user'], 'password' => $params['db_password'], 'name' => $params['db_name'], 'host' => $params['db_host'], 'aliases' => $db_config['aliases'], 'connection_charset' => empty($db_config['connection_charset']) ? DB::php_to_mysql_charmap($evo_charset) : $db_config['connection_charset'], 'halt_on_error' => false)); if ($DB->error) { // restart conf display_install_messages(T_('It seems that the database config settings you entered don\'t work. Please check them carefully and try again...')); $action = 'start'; } else { $conf_template_filepath = $conf_path . '_basic_config.template.php'; $conf_filepath = $conf_path . '_basic_config.php'; // Read original: $file_loaded = @file($conf_template_filepath); if (empty($file_loaded)) { // This should actually never happen, just in case... display_install_messages(sprintf(T_('Could not load original conf file [%s]. Is it missing?'), $conf_filepath)); if (!$params['print_messages']) { // Return all messages instead of printing on screen $basic_config_file_result_messages = ob_get_clean(); } return false; } // File loaded... $conf = implode('', $file_loaded); // Update conf: $conf = preg_replace(array('#\\$db_config\\s*=\\s*array\\( \\s*[\'"]user[\'"]\\s*=>\\s*[\'"].*?[\'"], ([^\\n\\r]*\\r?\\n) \\s*[\'"]password[\'"]\\s*=>\\s*[\'"].*?[\'"], ([^\\n\\r]*\\r?\\n) \\s*[\'"]name[\'"]\\s*=>\\s*[\'"].*?[\'"], ([^\\n\\r]*\\r?\\n) \\s*[\'"]host[\'"]\\s*=>\\s*[\'"].*?[\'"], ([^\\n\\r]*\\r?\\n) #ixs', "#tableprefix\\s*=\\s*'.*?';#", "#baseurl\\s*=\\s*'.*?';#", "#admin_email\\s*=\\s*'.*?';#", "#config_is_done\\s*=.*?;#"), array("\$db_config = array(\n" . "\t'user' => '" . str_replace(array("'", "\$"), array("\\'", "\\\$"), $params['db_user']) . "',\$1" . "\t'password' => '" . str_replace(array("'", "\$"), array("\\'", "\\\$"), $params['db_password']) . "',\$2" . "\t'name' => '" . str_replace(array("'", "\$"), array("\\'", "\\\$"), $params['db_name']) . "',\$3" . "\t'host' => '" . str_replace(array("'", "\$"), array("\\'", "\\\$"), $params['db_host']) . "',\$4", "tableprefix = '" . str_replace("'", "\\'", $params['db_tableprefix']) . "';", "baseurl = '" . str_replace("'", "\\'", $params['baseurl']) . "';", "admin_email = '" . str_replace("'", "\\'", $params['admin_email']) . "';", 'config_is_done = 1;'), $conf); // Write new contents: if (save_to_file($conf, $conf_filepath, 'w')) { display_install_messages(sprintf(T_('Your configuration file <code>%s</code> has been successfully created.') . '</p>', $conf_filepath), 'success'); $tableprefix = $params['db_tableprefix']; $baseurl = $params['baseurl']; $admin_email = $params['admin_email']; $config_is_done = 1; if (!$params['quick_install']) { // Switch to menu only on standard installation: $action = 'menu'; } } else { ?> <h1><?php echo T_('Config file update'); ?> </h1> <p><strong><?php printf(T_('We cannot automatically create or update your config file [%s]!'), $conf_filepath); ?> </strong></p> <p><?php echo T_('There are two ways to deal with this:'); ?> </p> <ul> <li><strong><?php echo T_('You can allow the installer to create the config file by changing permissions for the /conf directory:'); ?> </strong> <ol> <li><?php printf(T_('Make sure there is no existing and potentially locked configuration file named <code>%s</code>. If so, please delete it.'), $conf_filepath); ?> </li> <li><?php printf(T_('<code>chmod 777 %s</code>. If needed, see the <a %s>online manual about permissions</a>.'), $conf_path, 'href="' . get_manual_url('directory-and-file-permissions') . '" target="_blank"'); ?> </li> <li><?php echo T_('Come back to this page and refresh/reload.'); ?> </li> </ol> <br /> </li> <li><strong><?php echo T_('Alternatively, you can update the config file manually:'); ?> </strong> <ol> <li><?php echo T_('Create a new text file with a text editor.'); ?> </li> <li><?php echo T_('Copy the contents from the box below.'); ?> </li> <li><?php echo T_('Paste them into your local text editor. <strong>ATTENTION: make sure there is ABSOLUTELY NO WHITESPACE after the final <code>?></code> in the file.</strong> Any space, tab, newline or blank line at the end of the conf file may prevent cookies from being set when you try to log in later.'); ?> </li> <li><?php echo T_('Save the file locally under the name <code>_basic_config.php</code>'); ?> </li> <li><?php echo T_('Upload the file to your server, into the <code>/_conf</code> folder.'); ?> </li> <li><?php printf(T_('<a %s>Call the installer from scratch</a>.'), 'href="index.php?locale=' . $default_locale . '"'); ?> </li> </ol> </li> </ul> <p><?php echo T_('This is how your _basic_config.php should look like:'); ?> </p> <blockquote> <pre><?php echo htmlspecialchars($conf); ?> </pre> </blockquote> <?php if (!$params['print_messages']) { // Return all messages instead of printing on screen $basic_config_file_result_messages = ob_get_clean(); } return false; } } if (!$params['print_messages']) { // Return all messages instead of printing on screen $basic_config_file_result_messages = ob_get_clean(); } return true; }