Ejemplo n.º 1
0
// Developer Mode On?
if (isset($admin->ID) && !empty($bigtree["config"]["developer_mode"]) && $admin->Level < 2) {
    include BigTree::path("admin/pages/developer-mode.php");
    $admin->stop();
}
// Redirect to dashboard by default if we're not requesting anything.
if (!$bigtree["path"][1]) {
    BigTree::redirect(ADMIN_ROOT . "dashboard/");
}
// See if we're requesting something in /ajax/
if ($bigtree["path"][1] == "ajax") {
    $module = false;
    if ($bigtree["path"][2] != "auto-modules") {
        // If the current user isn't allowed in the module for the ajax, stop them.
        $module = $admin->getModuleByRoute($bigtree["path"][2]);
        if ($module && !$admin->checkAccess($module["id"])) {
            die("Permission denied to module: " . $module["name"]);
        } elseif (!$admin->ID) {
            die("Please login.");
        }
        if ($module) {
            $bigtree["current_module"] = $bigtree["module"] = $module;
        }
    }
    $ajax_path = array_slice($bigtree["path"], 2);
    // Check custom
    list($inc, $commands) = BigTree::route(SERVER_ROOT . "custom/admin/ajax/", $ajax_path);
    // Check core if we didn't find the page or if we found the page but it had commands (because we may be overriding a page earlier in the chain but using the core further down)
    if (!$inc || count($commands)) {
        list($core_inc, $core_commands) = BigTree::route(SERVER_ROOT . "core/admin/ajax/", $ajax_path);
        // If we either never found the custom file or if there are more routes found in the core file use the core.
Ejemplo n.º 2
0
if (isset($admin->ID) && !empty($bigtree["config"]["developer_mode"]) && $admin->Level < 2) {
    include BigTree::path("admin/pages/developer-mode.php");
    $admin->stop();
}
// Redirect to dashboard by default if we're not requesting anything.
if (!$bigtree["path"][1]) {
    BigTree::redirect(ADMIN_ROOT . "dashboard/");
}
// See if we're requesting something in /ajax/
if ($bigtree["path"][1] == "ajax") {
    $module = false;
    $core_ajax_directories = array("auto-modules", "callouts", "dashboard", "file-browser", "pages", "tags");
    if (!in_array($bigtree["path"][2], $core_ajax_directories) && $bigtree["path"]) {
        // If the current user isn't allowed in the module for the ajax, stop them.
        $module = $admin->getModuleByRoute($bigtree["path"][2]);
        if ($module && !$admin->checkAccess($module["id"])) {
            die("Permission denied to module: " . $module["name"]);
        } elseif (!$admin->ID) {
            die("Please login.");
        }
        if ($module) {
            $bigtree["current_module"] = $bigtree["module"] = $module;
        }
    }
    $ajax_path = array_slice($bigtree["path"], 2);
    // Extensions must use this directory
    if (defined("EXTENSION_ROOT")) {
        list($inc, $commands) = BigTree::route(EXTENSION_ROOT . "ajax/", $ajax_path);
        // Check custom/core
    } else {
        list($inc, $commands) = BigTree::route(SERVER_ROOT . "custom/admin/ajax/", $ajax_path);