Example #1
0
function displayFields()
{
    okPrint(_('Your server meets all the installation requirements'));
    global $data;
    ?>
	<form action="install.php?stage=2" method="post" class="validate">
		<h1>Configuration Information</h1>
		<p>The following information should match the data found in the configuration file before the installation can start:</p>
		<div class="row">
			<div class="column grid_4">
				<fieldset>
					<legend>Configuration File</legend>
					<?php 
    displayField('Configuration File', 'config_file');
    ?>
				</fieldset>
				<fieldset>
					<legend>Database Information</legend>
					<?php 
    displayField('Database Name', 'db_name');
    displayField('Database User Name', 'db_username');
    displayField('Database User Password', 'db_password');
    displayField('Database Server', 'db_server');
    displayField('Database Prefix', 'db_prefix');
    ?>
				</fieldset>
			</div>
			<div class="column grid_4">
				<fieldset>
					<legend>Application Information</legend>
					<?php 
    displayField('Application Name', 'application_name');
    ?>
				</fieldset>
				<fieldset>
					<legend>Admin User Information</legend>
					<?php 
    displayField('Admin User Name', 'admin_username');
    displayField('Admin password', 'admin_password');
    displayField('Admin Email', 'admin_email');
    ?>
				</fieldset>
			</div>
			<div class="column grid_4 last">
				<fieldset>
					<legend>Install</legend>
					<p>
						<button type="submit" name="step1" value="step1"><span class="save"></span><span>Continue Install...</span></button>
						<button type="reset"><span class="reset"></span><span>Reset</span></button>
					</p>
				</fieldset>
			</div>
		</div>
	</form>
	<?php 
}
Example #2
0
function displayFields()
{
    global $data, $doit;
    okPrint(_('<i class="icon-ok"></i> Your server meets all the upgrade requirements.'));
    if ($doit == false) {
        warningPrint('<i class="icon-warning-sign"></i> Upgrade is in developer mode, set $doit = true.');
    }
    ?>
	<form action="upgrade.php?stage=2" method="post" class="validate">
		<h2>Configuration Information</h2>
        <p class="text-warning">
            The following information <strong>should match</strong> the data found in the
            <strong>configuration file</strong> before the upgrade can start:
        </p>
		<div class="row">
			<div class="span4">
				<fieldset>
					<legend>Configuration File</legend>
					<?php 
    displayField('Configuration File', 'config_file');
    ?>
				</fieldset>
			</div>
			<div class="span4">
				<fieldset>
					<legend>Database Information</legend>
					<?php 
    displayField('Database Name', 'db_name');
    displayField('Database User Name', 'db_username');
    displayField('Database User Password', 'db_password');
    displayField('Database Server', 'db_server');
    displayField('Database Prefix', 'db_prefix');
    ?>
				</fieldset>
			</div>
			<div class="span4">
				<fieldset>
					<legend>Upgrade</legend>
					<p>
						<button type="submit" name="step1" value="step1" class="btn btn-primary">Continue Upgrade</button>
					</p>
				</fieldset>
			</div>
		</div>
	</form>
	<?php 
}
Example #3
0
function displayFields()
{
    okPrint(_('Your server meets all the upgrade requirements'));
    warningPrint(_('<strong>Please remeber to update your .htaccess file to the latest version else you will see a blank screen when trying to access your site.</strong>'));
    global $data;
    ?>
	<form action="upgrade.php?stage=2" method="post" class="validate">
		<h1>Configuration Information</h1>
		<p>The following information should match the data found in the configuration file before the upgrade can start:</p>
		<div class="row">
			<div class="column grid_4">
				<fieldset>
					<legend>Configuration File</legend>
					<?php 
    displayField('Configuration File', 'config_file');
    ?>
				</fieldset>
			</div>
			<div class="column grid_4">
				<fieldset>
					<legend>Database Information</legend>
					<?php 
    displayField('Database Name', 'db_name');
    displayField('Database User Name', 'db_username');
    displayField('Database User Password', 'db_password');
    displayField('Database Server', 'db_server');
    displayField('Database Prefix', 'db_prefix');
    ?>
				</fieldset>
			</div>
			<div class="column grid_4 last">
				<fieldset>
					<legend>Upgrade</legend>
					<p>
						<button type="submit" name="step1" value="step1"><span class="save"></span><span>Continue Upgrade...</span></button>
						<button type="reset"><span class="reset"></span><span>Reset</span></button>
					</p>
				</fieldset>
			</div>
		</div>
	</form>
	<?php 
}
Example #4
0
/**
 * @date 20120306 (v1.1) (greg) support in-query relaxed error code
 *
 * To state that a sql query can fail on certains code, start the query with a special comment :
 *			/ *[1061]* /CREATE UNIQUE INDEX `index` USING BTREE ON `pds_core_menu_structure`(`menu_id`) ;
 * (remove the space between slashes and stars)
 * multiple codes can be separated with commas, NO SPACES allowed
 *
 * Common MySQL error codes:
 *
 * [1061] Duplicate key name 'index'
 * [1091] Can't DROP 'field'; check that column/key exists
 * [1068] Multiple primary key defined
 */
function stuffMYSQL()
{
    global $data, $doit, $type, $db_version, $version;
    // Going deeper, lets see if we can make a db connection.
    $connect_mysql = mysql_connect($data['db_server'], $data['db_username'], $data['db_password']);
    if (empty($connect_mysql)) {
        addError(kMYSQLconnect, sprintf(_('Unable to connect to the MySQL database %s, please make sure you entered all the relevant details correctly and that the MySQL server is currently running.'), mysql_error()));
        return false;
    }
    // Check if we can select our database.
    if (!mysql_select_db($data['db_name'])) {
        addError(kMYSQLselectDB, sprintf(_('Unable to select the specified database (%s). please make sure you entered all the relevant details correctly. The database should exists and be accessible by the user provided'), $data['db_name']));
        return false;
    }
    // Check if the databas is not perhaps already installed.
    $tables = @mysql_list_tables($data['db_name']);
    $tables = @mysql_numrows($tables);
    if ($type == 'install') {
        if (!empty($tables)) {
            addError(kMYSQLnotempty, _('There are tables in this database already, perhaps a previous PHPDevShell installation?. This Installation script can not be used over an existing PHPDevShell installation.'));
            return false;
        }
    } else {
        if ($type == 'upgrade') {
            if (empty($tables)) {
                addError(kMYSQLempty, _('There are no existing tables in this database, are you sure PHPDevShell is installed?.'));
                return false;
            }
            $phpds_db_ver = get_db_version();
            if ($phpds_db_ver == $db_version) {
                addError(kMYSQLuptodate, sprintf(_('<strong><span style="color: green">This specific upgrade version does not require database updates, system is running the latest current db version DB-%s which is used for %s. Try again when next update is released.</span></strong>'), $phpds_db_ver, $version));
                return false;
            }
        }
    }
    // Check if the database version is up to date.
    if (mysql_get_server_info() < '5.0') {
        addError(kMYSQLversion, sprintf(_('This version of PHPDevShell only supports MySQL version %s and later. You are currently running version %s.'), '5.0', mysql_get_server_info()));
        return false;
    }
    displayDBfilling();
    print "\n\n";
    ob_flush();
    flush();
    // Installation can now commence!
    $queries = get_queries();
    // Loop and execute queries.
    $i = 0;
    $max = count($queries);
    mysql_query('START TRANSACTION');
    $e = mysql_errno();
    if (!$e) {
        foreach ($queries as $query) {
            if (!empty($query) && $doit) {
                if (!mysql_query($query)) {
                    $em = mysql_error();
                }
                usleep(1000);
            } else {
                usleep(1000);
            }
            if (connection_aborted()) {
                error_log('aborted');
                exit;
            }
            if ($e = mysql_errno()) {
                $matches = array();
                if (preg_match('#^\\s*/\\*\\[([\\d\\,]+)\\]\\*/(.*)$#', $query, $matches)) {
                    $accepted = explode(',', $matches[1]);
                    if (in_array($e, $accepted)) {
                        noticePrint(_('Accepting error') . ' ' . $e . ' ("' . $matches[2] . '")');
                    } else {
                        break;
                    }
                } else {
                    break;
                }
            }
            $i++;
            $p = intval($i * 100 / $max);
            if (!empty($debug_queries)) {
                if (strpos($query, '#') === false) {
                    messagePrint($query . " <strong>({$p}%)</strong>");
                } else {
                    okPrint($query . " <strong>({$p}%)</strong>");
                }
            }
            if ($i % 10 == 0) {
                print "<script type=\"text/javascript\">updateProgress({$p});</script>\n\n";
                ob_flush();
                flush();
            }
        }
    }
    if ($e) {
        mysql_query('ROLLBACK');
        $error = sprintf(_('An error occured trying to send the queries (query %d/%d).'), $i, $max);
        $error .= '<br />' . _('The error was') . ': [' . $e . '] ' . $em;
        $error .= '<br />' . _('The offending query was') . ': "' . $query . '"';
        addError(kMYSQLquery, $error);
        return false;
    }
    print "<script type=\"text/javascript\">updateProgress(100);</script>\n\n";
    ob_flush();
    flush();
    mysql_query('COMMIT');
    return true;
}
Example #5
0
function displayFields()
{
    global $data, $doit;
    okPrint(_('<i class="icon-ok"></i> Your server meets all the installation requirements.'));
    if ($doit == false) {
        warningPrint('<i class="icon-warning-sign"></i> Installer is in developer mode, set $doit = true.');
    }
    ?>
	<form action="install.php?stage=2" method="post" class="validate">
		<h2>Configuration Information</h2>
		<p class="text-warning">
            The following information <strong>should match</strong> the data found in the
            <strong>configuration file</strong> before the installation can start:
        </p>
		<div class="row">
			<div class="span4">
				<fieldset>
					<legend>Configuration File</legend>
					<?php 
    displayField('Configuration File', 'config_file');
    ?>
				</fieldset>
				<fieldset>
					<legend>Database Information</legend>
					<?php 
    displayField('Database Name', 'db_name');
    displayField('Database User Name', 'db_username');
    displayField('Database User Password', 'db_password');
    displayField('Database Server', 'db_server');
    displayField('Database Prefix', 'db_prefix');
    ?>
				</fieldset>
			</div>
			<div class="span4">
				<fieldset>
					<legend>Application Information</legend>
					<?php 
    displayField('Application Name', 'application_name');
    ?>
				</fieldset>
				<fieldset>
					<legend>Admin User Information</legend>
					<?php 
    displayField('Admin User Name', 'admin_username');
    displayField('Admin password', 'admin_password');
    displayField('Admin Email', 'admin_email');
    ?>
				</fieldset>
			</div>
			<div class="span4">
				<fieldset>
					<legend>Action</legend>
					<p>
                        <label for="sample-data" class="checkbox">
                        <input id="sample-data" type="checkbox" name="sample-data"> Install sample data
                        </label><br>
						<button type="submit" name="step1" value="step1" class="btn btn-primary">Continue Install</button>
					</p>
				</fieldset>
			</div>
		</div>
	</form>
	<?php 
}