Пример #1
0
<?php

include_once 'CORALInstaller.php';
$installer = new CORALInstaller();
$version = $_REQUEST['version'];
if (!$version || !$installer->isUpdateReady($version)) {
    header('Location: index.php');
    exit;
}
$update = $installer->getUpdate($version);
if ($_POST["submit"]) {
    $database_username = trim($_POST['database_username']);
    $database_password = trim($_POST['database_password']);
    if ($database_username) {
        $installer->connect($database_username, $database_password);
        if ($installer->error) {
            $installer->addErrorMessage($installer->error);
        }
    }
    if ($installer->hasPermissions($update["privileges"])) {
        $sql_file = "protected/update_{$version}.sql";
        if (!file_exists($sql_file)) {
            $installer->addErrorMessage("Could not open sql file: " . $sql_file . ".  If this file does not exist you must download new install files.");
        } else {
            //run the file - checking for errors at each SQL execution
            $f = fopen($sql_file, "r");
            $contents = fread($f, filesize($sql_file));
            $statements = explode(';', $contents);
            //Process the sql file by statements
            foreach ($statements as $statement) {
                if (strlen(trim($statement)) > 3) {
Пример #2
0
<?php

include_once 'CORALInstaller.php';
$installer = new CORALInstaller();
if ($installer->installed()) {
    header('Location: index.php');
    exit;
}
//this script runs entire installation process in 5 steps
//take "step" variable to determine which step the current is
$step = $_POST['step'];
//perform field validation(steps 3-5) and database connection tests (steps 3 and 4) and send back to previous step if not working
$errorMessage = array();
if ($step == "3") {
    //first, validate all fields are filled in
    $database_host = trim($_POST['database_host']);
    $database_username = trim($_POST['database_username']);
    $database_password = trim($_POST['database_password']);
    $database_name = trim($_POST['database_name']);
    if (!$database_host) {
        $errorMessage[] = 'Host name is required';
    }
    if (!$database_name) {
        $errorMessage[] = 'Database name is required';
    }
    if (!$database_username) {
        $errorMessage[] = 'User name is required';
    }
    if (!$database_password) {
        $errorMessage[] = 'Password is required';
    }
Пример #3
0
<?php

include_once 'CORALInstaller.php';
$installer = new CORALInstaller();
if (!$installer->installed()) {
    header('Location: install.php');
    exit;
} else {
    if ($next_version = $installer->getNextUpdateVersion()) {
        header('Location: update.php?version=' . $next_version);
        exit;
    }
}
$installer->header('CORAL Maintenance');
?>
  <?php 
$installer->displayMessages();
?>
  <?php 
$installer->displayErrorMessages();
?>
  <h3>CORAL Usage</h3>
	<p>Your CORAL Usage Module is correctly installed and there are no pending updates.</p>
  <p><a href="..">Go to Usage Module</a></p>
<?php 
$installer->footer();
Пример #4
0
<?php

include_once 'CORALInstaller.php';
$installer = new CORALInstaller();
if ($installer->installed()) {
    header('Location: index.php');
    exit;
}
//this script runs entire installation process in 5 steps
//take "step" variable to determine which step the current is
$step = $_POST['step'];
//perform field validation(steps 3-5) and database connection tests (steps 3 and 4) and send back to previous step if not working
$errorMessage = array();
if ($step == "3") {
    //first, validate all fields are filled in
    $database_host = trim($_POST['database_host']);
    $database_username = trim($_POST['database_username']);
    $database_password = trim($_POST['database_password']);
    $database_name = trim($_POST['database_name']);
    if (!$database_host) {
        $errorMessage[] = 'Host name is required';
    }
    if (!$database_name) {
        $errorMessage[] = 'Database name is required';
    }
    if (!$database_username) {
        $errorMessage[] = 'User name is required';
    }
    if (!$database_password) {
        $errorMessage[] = 'Password is required';
    }