Ejemplo n.º 1
0
<?php

// Installation Header
require PARENT_APP_PATH . "/includes/install_header.php";
// Run the Form
if (Form::submitted("install-connect-handle")) {
    // Check if all of the input you sent is valid:
    $_POST['handle'] = str_replace("@", "", $_POST['handle']);
    Validate::variable("UniFaction Handle", $_POST['handle'], 1, 22);
    if (Validate::pass()) {
        // Make sure the handle is registered
        if ($response = API_Connect::call(URL::unifaction_com() . "/api/UserRegistered", $_POST['handle'])) {
            Cookie_Server::set("admin-handle", $_POST['handle'], "", 3);
            Alert::saveSuccess("Admin Chosen", "You have designated @" . $_POST['handle'] . " as the admin of your site.");
            header("Location: /install/config-app");
            exit;
        } else {
            Alert::error("Handle Invalid", "That user handle does not exist on UniFaction.");
        }
    }
} else {
    $_POST['handle'] = isset($_POST['handle']) ? Sanitize::variable($_POST['handle']) : "";
}
// Run Global Script
require PARENT_APP_PATH . "/includes/install_global.php";
// Display the Header
require HEADER_PATH;
echo '
<form class="uniform" action="/install/connect-handle" method="post">' . Form::prepare("install-connect-handle");
// Display the Page
echo '
Ejemplo n.º 2
0
}
// Prepare Values
set_time_limit(300);
// Set the timeout limit to 5 minutes.
// Run Header
require SYS_PATH . "/controller/includes/admin_header.php";
// Run Global Script (if applicable)
if (isset($_GET['action']) and $_GET['action'] == "run") {
    Database::initRoot();
    echo "Running Script:<br />";
    // Prepare Valuess
    define("PROTECTED", true);
    // Gather Sites
    $siteList = Database::selectMultiple("SELECT site_handle, site_name FROM network_data", array());
    foreach ($siteList as $site) {
        $apiData = API_Data::get($site['site_handle']);
        $success = API_Connect::call($apiData['site_url'] . "/api/AuthCommand", "system-script", $apiData['site_key']);
        if ($success) {
            echo "<br /><span style='color:green;'>" . $site['site_name'] . " run their instructions SUCCESSFULLY!</span>";
        } else {
            echo "<br /><span style='color:red;'>" . $site['site_name'] . " FAILED! Some or all of the instructions did not run as desired.</span>";
        }
    }
    echo "<br /><br />Script Complete.";
} else {
    echo '
	<p>Are you sure you want to have all sites run the system-wide script "{SYS_PATH}/system-script.php" on the entire universe system?</p>
	<p><a class="button" href="/admin/scripts/run-universe?action=run">Yes, run the script</a></p>';
}
// Display the Footer
require SYS_PATH . "/controller/includes/admin_footer.php";
Ejemplo n.º 3
0
$_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']) : "";
// Run the Form
if (Form::submitted("install-app-config")) {
    // Check if all of the input you sent is valid:
    Validate::variable("Site Handle", $_POST['site-handle'], 3, 22);
    Validate::safeword("Site Name", $_POST['site-name'], 3, 42);
    Validate::url("URL", $_POST['site-url'], 3, 64);
    // Parse the URL input
    $siteURL = URL::parse($_POST['site-url']);
    if (Validate::pass()) {
        // Make sure the site handle isn't taken
        $packet = array("site-handle" => $_POST['site-handle'], "uni-handle" => $ownerHandle, "site-name" => $_POST['site-name'], "site-url" => $siteURL['full']);
        // Call UniFaction's API to register a site with the system
        // If the site fails to register, it will provide an alert explaining why
        $response = API_Connect::call(URL::unifaction_com() . "/api/RegisterSiteHandle", $packet);
        if ($response) {
            // If the database users are provided and there is a database name that we can create, build config settings
            $siteTheme = "default";
            $siteThemeStyle = "default";
            $buildApp = '<?php

// Site-Wide Salt
define("SITE_SALT", "' . $_POST['site-salt'] . '");

// A unique 10-22 alphanumeric value to represent your site
define("SITE_HANDLE", "' . $_POST['site-handle'] . '");

// Set the Application Path (in most cases, this is the same as SITE_PATH)
define("APP_PATH", SITE_PATH);