Example #1
0
<?php

// Run Permissions
require SYS_PATH . "/controller/includes/admin_perm.php";
// Make sure that only management or higher is allowed
if (Me::$clearance < 7) {
    header("Location: /admin");
    exit;
}
if (Form::submitted("email-send-admin")) {
    Validate::email($_POST['email']);
    Validate::input("Subject", $_POST['title'], 1, 22);
    Validate::text("Message", $_POST['message'], 1, 3500);
    if (Validate::pass()) {
        Email_Send::standard($_POST['email'], $_POST['title'], $_POST['message']);
        Alert::saveSuccess("Email Sent", "You have successfully sent an email to " . $_POST['email']);
        header("Location: /admin/Email/Email List");
        exit;
    }
}
// Run Header
require SYS_PATH . "/controller/includes/admin_header.php";
echo '
<form action="/admin/Email/Send Email" method="post">' . Form::prepare("email-send-admin") . '
	<p>Email: <input type="text" name="email" value="" /></p>
	<p>Subject: <input type="text" name="title" value="" maxlength="22" /></p>
	<p>Message: <textarea name="message"></textarea></p>
	<p><input type="submit" name="submit" value="Send Email" /></p>
</form>';
// Display the Footer
require SYS_PATH . "/controller/includes/admin_footer.php";
            unset($args[$key]);
        } else {
            $args[$key] = Sanitize::text($val);
        }
    }
    if (Validate::pass()) {
        // If we're in edit mode, edit the existing task
        if ($editID) {
            if (Cron::edit($editID, $_POST['title'], $_POST['method'], $args, $_POST['run_cycle'], $_POST['date_start'], $_POST['date_end'])) {
                Alert::saveSuccess("Edited Task", "You have successfully edited the cron task.");
                header("Location: /admin/cron");
                exit;
            }
        } else {
            if (Cron::create($_POST['title'], $_POST['method'], $args, $_POST['run_cycle'], $_POST['date_start'], $_POST['date_end'])) {
                Alert::saveSuccess("Created Task", "You have successfully created a cron task.");
                header("Location: /admin/cron");
                exit;
            }
        }
    }
} else {
    // If we're in edit mode
    if ($editID) {
        // Make sure the task we're editing exists (or redirect)
        if (!($cronData = Cron::getData($editID))) {
            header("Location: /admin/cron");
            exit;
        }
        // Set default values to the task being edited
        if (!isset($_POST['method'])) {
Example #3
0
}
';
            // If you automatically updated the configuration files
            if (isset($_POST['auto-submit'])) {
                if (File::move(SITE_PATH . "/config.php", SITE_PATH . "/config-backup.php")) {
                    File::write(SITE_PATH . "/config.php", $buildApp);
                    Alert::saveSuccess("Config Updated", "Configuration has been automatically updated.");
                    header("Location: /install/setup-database");
                    exit;
                } else {
                    Alert::error("Automatic Update", "Issue with Automatic Update: attempt to backup config.php failed. The engine does not have proper permissions to rename the file. You may need to perform a manual update instead.", 5);
                }
            }
            // If you manually updated the configuration files
            if (isset($_POST['manual-submit'])) {
                Alert::saveSuccess("Config Updated", "You performed a manual update.");
                header("Location: /install/setup-database");
                exit;
            }
        } else {
            if (API_Connect::$alert != "") {
                Alert::error("API Issue", API_Connect::$alert);
            } else {
                Alert::error("API Connection", "Unable to connect to the Site Registration API. Please try again shortly.", 4);
            }
        }
    }
}
// Run Global Script
require PARENT_APP_PATH . "/includes/install_global.php";
// Display the Header
<?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 '
Example #5
0
            echo '
			</form>';
        }
        echo '<div><a href="/model/' . $class . '">Search Records</a></div>';
        break;
        // Display Forms
    // Display Forms
    case "view":
        $lookupID = isset($url[3]) ? $url[3] : null;
        // Check if deletion is allowed and handle permissions
        // Make sure the class exists before calling it
        if (method_exists($class, 'readForm')) {
            // If the link to delete the record was submitted, run the deletion sequence
            if (Link::clicked("DeletedRecord")) {
                if ($class::delete($lookupID)) {
                    Alert::saveSuccess("Record Deleted", "The record was successfully deleted.");
                    header("Location: /model/" . $class);
                    exit;
                }
            }
            // Load the appropriate CRUD form
            $tableData = $class::readForm($lookupID);
            // If this is the delete page, show an option to delete it
            $tableData['footer'] = ['' => '', 'Option Next' => '<a href="/model/' . $class . '/view/' . $lookupID . '&' . Link::prepare("DeletedRecord") . '" onclick="return confirm(\'Are you sure you want to delete this record?\')">Delete this Record</a>'];
            echo UI_Table::draw($tableData);
        }
        echo '<div><a href="/model/' . $class . '">Search Records</a></div>';
        break;
        // Generation of this model
    // Generation of this model
    case "generate":