Example #1
0
     break;
 case 'config':
     if (!$installer->config_exists()) {
         $errors['err'] = __('Configuration file does NOT exist. Follow steps below to add one.');
     } elseif (!$installer->config_writable()) {
         $errors['err'] = __('Write access required to continue');
     } else {
         $_SESSION['ost_installer']['s'] = 'install';
     }
     break;
 case 'install':
     if ($installer->install($_POST)) {
         $_SESSION['info'] = array('name' => ucfirst($_POST['fname'] . ' ' . $_POST['lname']), 'email' => $_POST['admin_email'], 'URL' => URL);
         //TODO: Go to subscribe step.
         $_SESSION['ost_installer']['s'] = 'done';
     } elseif (!($errors = $installer->getErrors()) || !$errors['err']) {
         $errors['err'] = __('Error installing osTicket - correct the errors below and try again.');
     }
     break;
 case 'subscribe':
     if (!trim($_POST['name'])) {
         $errors['name'] = __('Required');
     }
     if (!$_POST['email']) {
         $errors['email'] = __('Required');
     } elseif (!Validator::is_valid_email($_POST['email'])) {
         $errors['email'] = __('Invalid');
     }
     if (!$_POST['alerts'] && !$_POST['news']) {
         $errors['notify'] = __('Check one or more');
     }
Example #2
0
}
//Always rewrite config file in case MySQL details changed (e.g. ip address)
echo "Updating configuration file\n";
if (!($configFile = file_get_contents($vars['config']))) {
    err("Failed to load configuration file: {$vars['config']}");
}
$configFile = str_replace("define('OSTINSTALLED',FALSE);", "define('OSTINSTALLED',TRUE);", $configFile);
$configFile = str_replace('%ADMIN-EMAIL', $vars['admin_email'], $configFile);
$configFile = str_replace('%CONFIG-DBHOST', $vars['dbhost'], $configFile);
$configFile = str_replace('%CONFIG-DBNAME', $vars['dbname'], $configFile);
$configFile = str_replace('%CONFIG-DBUSER', $vars['dbuser'], $configFile);
$configFile = str_replace('%CONFIG-DBPASS', $vars['dbpass'], $configFile);
$configFile = str_replace('%CONFIG-PREFIX', $vars['prefix'], $configFile);
$configFile = str_replace('%CONFIG-SIRI', $vars['siri'], $configFile);
if (!file_put_contents($installer->getConfigFile(), $configFile)) {
    err("Failed to write configuration file");
}
//Perform database installation if required
if (!$db_installed) {
    echo "Installing database. Please wait...\n";
    if (!$installer->install($vars)) {
        $errors = $installer->getErrors();
        echo "Database installation failed. Errors:\n";
        foreach ($errors as $e) {
            echo "  {$e}\n";
        }
        exit(1);
    } else {
        echo "Database installation successful\n";
    }
}
Example #3
0
	<script type="text/javascript">
			jQuery('#progressbar').progressbar({
				value: 0
			});
	</script>
	
	<div id="installerLog" class="installStatus">
		
	</div>
<?php 
$vn_progress = 0;
// parameters: profile dir, profile name, admin email, overwrite y/n, profile debug mode y/n
$vo_installer = new Installer("profiles/xml/", $ps_profile, $ps_email, $pb_overwrite, $pb_debug);
// if profile validation against XSD failed, we already have an error here
if ($vo_installer->numErrors()) {
    caSetMessage("There were errors parsing the profile(s): " . join("; ", $vo_installer->getErrors()));
} else {
    caIncrementProgress($vn_progress, "Performing preinstall tasks");
    $vo_installer->performPreInstallTasks();
    caIncrementProgress($vn_progress, "Loading schema");
    $vo_installer->loadSchema('caGetTableToBeLoaded');
    if ($vo_installer->numErrors()) {
        caSetMessage("There were errors loading the database schema: " . join("; ", $vo_installer->getErrors()));
    } else {
        $vn_progress += 7;
        caIncrementProgress($vn_progress, "Processing locales");
        $vo_installer->processLocales();
        caIncrementProgress($vn_progress, "Processing lists");
        $vo_installer->processLists('caGetListToBeLoaded');
        $vn_progress += 7;
        caIncrementProgress($vn_progress, "Processing relationship types");
Example #4
0
				});

				$('#goto_03_back').click(function() {
					$('#goto_03').click()
				});

				$('#goto_04').click(function() {
					$('#goto').val(4);
					$('#form').submit();
				});

				/**
				 * Validation Errors
				 */
				<?php if(Installer::hasErrors($step)) { ?>
					<?php foreach(Installer::getErrors($step) as $field => $error) { ?>
						$('<?php echo '#' . str_pad($step, 2, '0', STR_PAD_LEFT) . '_' . $field ?>').bubble({
							msg: '<?php echo $error ?>',
							direction: 'e',
							width: 300,
							height: 100,
							type: 'error'
						});
					<?php } ?>
				<?php } ?>
			});

			//-->
		</script>
	</head>
	<body>