Пример #1
0
}
// If there's a preprocess function for this module, let's get'r'done.
$bigtree["preprocessed"] = array();
if ($bigtree["form"]["preprocess"]) {
    $bigtree["preprocessed"] = call_user_func($bigtree["form"]["preprocess"], $_POST);
    // Update the $_POST
    if (is_array($bigtree["preprocessed"])) {
        foreach ($bigtree["preprocessed"] as $key => $val) {
            $_POST[$key] = $val;
        }
    }
}
// Find out what kind of permissions we're allowed on this item.  We need to check the EXISTING copy of the data AND what it's turning into and find the lowest of the two permissions.
$bigtree["access_level"] = $admin->getAccessLevel($bigtree["module"], $_POST, $bigtree["form"]["table"]);
if ($_POST["id"] && $bigtree["access_level"] && $bigtree["access_level"] != "n") {
    $original_item = BigTreeAutoModule::getItem($bigtree["form"]["table"], $_POST["id"]);
    $existing_item = BigTreeAutoModule::getPendingItem($bigtree["form"]["table"], $_POST["id"]);
    $previous_permission = $admin->getAccessLevel($bigtree["module"], $existing_item["item"], $bigtree["form"]["table"]);
    $original_permission = $admin->getAccessLevel($bigtree["module"], $original_item["item"], $bigtree["form"]["table"]);
    // If the current permission is e or p, drop it down to e if the old one was e.
    if ($previous_permission != "p") {
        $bigtree["access_level"] = $previous_permission;
    }
    // Check the original. If we're not already at "you're not allowed" then apply the original permission.
    if ($bigtree["access_level"] != "n" && $original_permission != "p") {
        $bigtree["access_level"] = $original_permission;
    }
}
// If permission check fails, stop and throw the denied page.
if (!$bigtree["access_level"] || $bigtree["access_level"] == "n") {
    $admin->stop(file_get_contents(BigTree::path("admin/auto-modules/forms/_denied.php")));
Пример #2
0
}
// If there's a callback function for this module, let's get'r'done.
if ($bigtree["form"]["hooks"]["post"]) {
    call_user_func($bigtree["form"]["hooks"]["post"], $edit_id, $item, $did_publish);
}
// Publish Hook
if ($did_publish && $bigtree["form"]["hooks"]["publish"]) {
    call_user_func($bigtree["form"]["hooks"]["publish"], $table, $edit_id, $item, $many_to_many, $tags);
}
// Track resource allocation
$admin->allocateResources($bigtree["module"]["id"], $edit_id);
// Put together saved form information for the error or crop page in case we need it.
$_SESSION["bigtree_admin"]["form_data"] = array("errors" => $bigtree["errors"]);
// If we have errors, we want to save the data and drop the entry from the database but give them the info again
if (count($bigtree["errors"])) {
    $item = BigTreeAutoModule::getItem($table, $edit_id);
    $_SESSION["bigtree_admin"]["form_data"]["saved"] = $item["item"];
    if ($bigtree["form"]["default_pending"]) {
        BigTreeAutoModule::deletePendingItem($table, substr($edit_id, 1));
    } else {
        BigTreeAutoModule::deleteItem($table, $edit_id);
    }
}
if (count($bigtree["crops"])) {
    $_SESSION["bigtree_admin"]["form_data"]["crop_key"] = $cms->cacheUnique("org.bigtreecms.crops", $bigtree["crops"]);
    BigTree::redirect($bigtree["form_root"] . "crop/?id=" . $bigtree["form"]["id"] . "&hash=" . $bigtree["form"]["hash"]);
} elseif (count($bigtree["errors"])) {
    BigTree::redirect($bigtree["form_root"] . "error/?id=" . $bigtree["form"]["id"] . "&hash=" . $bigtree["form"]["hash"]);
} else {
    BigTree::redirect($bigtree["form_root"] . "complete/?id=" . $bigtree["form"]["id"] . "&hash=" . $bigtree["form"]["hash"]);
}
Пример #3
0
<?php

header("Content-type: text/javascript");
$id = sqlescape($_GET["id"]);
// Grab View Data
$view = BigTreeAutoModule::getView(sqlescape($_GET["view"]));
$table = $view["table"];
// Get module
$module = $admin->getModule(BigTreeAutoModule::getModuleForView($view["id"]));
// Get the item
$current_item = BigTreeAutoModule::getPendingItem($table, $id);
$item = $current_item["item"];
// Check permission
$access_level = $admin->getAccessLevel($module, $item, $table);
if ($access_level != "n") {
    $original_item = BigTreeAutoModule::getItem($table, $id);
    $original_access_level = $admin->getAccessLevel($module, $original_item["item"], $table);
    if ($original_access_level != "p") {
        $access_level = $original_access_level;
    }
}
Пример #4
0
<?php

$bigtree["edit_id"] = $bigtree["commands"][0];
$item = BigTreeAutoModule::getItem("btx_social_feed_queries", $bigtree["edit_id"]);
BigTree::globalizeArray($item["item"]);
$action = "update-query/" . $bigtree["edit_id"] . "/";
$button_value = "Update";
include "_form.php";