Example #1
0
<?php

// Installation Header
require PARENT_APP_PATH . "/includes/install_header.php";
// Make sure you have a designated handle
if (!($ownerHandle = Cookie_Server::get("admin-handle", ""))) {
    header("Location: /install/connect-handle");
    exit;
}
// If the form was not submitted, set the $_POST values to the default configuration values.
// This will allow us to auto-fill the form with useful data, rather than leaving them all empty.
if (!isset($_POST['site-salt']) and isset(Config::$siteConfig['database'])) {
    $_POST['site-salt'] = SITE_SALT;
    $_POST['site-handle'] = SITE_HANDLE;
    $_POST['site-url'] = SITE_URL;
    $_POST['site-name'] = Config::$siteConfig['Site Name'];
    $_POST['site-domain'] = FULL_DOMAIN;
    $_POST['site-database-name'] = Database::$databaseName;
}
// Prepare Installation Values
$buildApp = "";
$randSalt = Security_Hash::random(82, 80);
$randSalt = str_replace('"', '', $randSalt);
$randSalt = str_replace('$', '', $randSalt);
// Prepare POST Values: make sure that every $_POST value has a default value provided.
$_POST['site-salt'] = isset($_POST['site-salt']) ? Sanitize::text($_POST['site-salt']) : $randSalt;
$_POST['site-handle'] = isset($_POST['site-handle']) ? Sanitize::variable($_POST['site-handle']) : "";
$_POST['site-url'] = isset($_POST['site-url']) ? Sanitize::variable($_POST['site-url'], ":/.") : $_SERVER['SERVER_NAME'];
$_POST['site-name'] = isset($_POST['site-name']) ? Sanitize::text($_POST['site-name']) : "";
$_POST['site-domain'] = isset($_POST['site-domain']) ? Sanitize::variable($_POST['site-domain'], ":/.") : "";
$_POST['site-database-name'] = isset($_POST['site-database-name']) ? Sanitize::variable($_POST['site-database-name']) : "";