Example #1
0
            ?>
			<div class="checkbox" style="margin-top:15px">
				<label>
					<input accept=""type="checkbox" name="install_all_features" id="install_all_features" value="1" />
					<?php 
            echo T_('Also install all test features.');
            ?>
				</label>
			</div>
			<?php 
        }
        ?>
			<div class="checkbox" style="margin:15px 0 15px">
				<label>
					<input type="checkbox" name="local_installation" id="local_installation" value="1"<?php 
        echo check_local_installation() ? ' checked="checked"' : '';
        ?>
 />
					<?php 
        echo T_('This is a local / test / intranet installation.');
        ?>
				</label>
			</div>

			<p class="evo_form__install_buttons">
			<?php 
        if ($test_install_all_features && $allow_evodb_reset && ($old_db_version = get_db_version())) {
            // We can allow to delete DB before installation
            ?>
				<input type="hidden" name="delete_contents" value="1" />
				<button id="cancel_button" type="submit" class="btn btn-danger btn-lg"><?php 
/**
 * Install new DB.
 */
function install_newdb()
{
    global $new_db_version, $admin_url, $baseurl, $install_login, $random_password, $create_sample_contents;
    /*
     * -----------------------------------------------------------------------------------
     * NEW DB: Create a plain new db structure + sample contents
     * -----------------------------------------------------------------------------------
     */
    require_once dirname(__FILE__) . '/_functions_create.php';
    if ($old_db_version = get_db_version()) {
        echo '<p class="text-warning"><strong><evo:warning>' . T_('OOPS! It seems b2evolution is already installed!') . '</evo:warning></strong></p>';
        if ($old_db_version < $new_db_version) {
            echo '<p>' . sprintf(T_('Would you like to <a %s>upgrade your existing installation now</a>?'), 'href="?action=evoupgrade"') . '</p>';
        }
        return;
    }
    /**
     * 1 - If current installation is local, test or intranet
     *     Used to turn off gravatar and all ping plugins
     *
     * @var integer
     */
    $local_installation = param('local_installation', 'integer', $create_sample_contents == 'all' ? intval(check_local_installation()) : 0);
    echo '<h2>' . T_('Creating b2evolution tables...') . '</h2>';
    evo_flush();
    create_tables();
    // Update the progress bar status
    update_install_progress_bar();
    echo '<h2>' . T_('Creating minimum default data...') . '</h2>';
    evo_flush();
    create_default_data();
    if ($create_sample_contents) {
        global $Settings, $test_install_all_features;
        echo '<h2>' . T_('Installing sample contents...') . '</h2>';
        evo_flush();
        // We're gonna need some environment in order to create the demo contents...
        load_class('settings/model/_generalsettings.class.php', 'GeneralSettings');
        load_class('users/model/_usersettings.class.php', 'UserSettings');
        /**
         * @var GeneralSettings
         */
        $Settings = new GeneralSettings();
        /**
         * @var UserCache
         */
        $UserCache =& get_UserCache();
        // Create $current_User object.
        // (Assigning by reference does not work with "global" keyword (PHP 5.2.8))
        $GLOBALS['current_User'] =& $UserCache->get_by_ID(1);
        create_demo_contents();
    }
    // Update the progress bar status
    update_install_progress_bar();
    track_step('install-success');
    $install_result_title = T_('Installation successful!');
    $install_result_body = '<p><strong>' . sprintf(T_('Now you can <a %s>log in</a> with the following credentials:'), 'href="' . $admin_url . '"') . '</strong></p>' . '<table>' . '<tr><td>' . T_('Login') . ': &nbsp;</td><td><strong><evo:login>' . (isset($install_login) ? $install_login : '******') . '</evo:login></strong></td></tr>' . '<tr><td>' . T_('Password') . ': &nbsp;</td><td><strong><evo:password>' . $random_password . '</evo:password></strong></td></tr>' . '</table>' . '<br /><p>' . T_('Note that password carefully! It is a <em>random</em> password that is given to you when you install b2evolution. If you lose it, you will have to delete the database tables and re-install anew.') . '</p>';
    // Display installation data and instructions
    echo '<h2>' . $install_result_title . '</h2>';
    echo $install_result_body;
    // Modal window with installation data and instructions
    display_install_result_window($install_result_title, $install_result_body);
}