Example #1
0
// Run Permissions & Header
require SYS_PATH . "/controller/includes/admin_perm.php";
// Only the webmaster can access this page
if (Me::$clearance < 9) {
    header("Location: /admin");
    exit;
}
// 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);
    Config::$dataList = array();
    $siteHandle = array();
    // Begin tracking sites on this server (by capturing their config file)
    foreach (glob(dirname(SYS_PATH) . "/*/config.php") as $filename) {
        Config::$dataList[] = $filename;
    }
    // Begin tracking sub-sites on the server (by capturing their config file)
    foreach (glob(dirname(SYS_PATH) . "/*/*/config.php") as $filename) {
        Config::$dataList[] = $filename;
    }
    // Capture each of the site handles in the config files
    foreach (Config::$dataList as $file) {
        $fileContents = File::read($file);
        $siteHandle[] = Data_Parse::between($fileContents, 'Config::$data[\'database\'][\'name\'] = "', '";');
    }
    // Make sure the system was able to collect the appropriate site handles