コード例 #1
0
ファイル: process.php プロジェクト: matthisamoto/Graphfan
        } else {
            $field["output"] = $admin->autoIPL($field["output"]);
        }
        $bigtree["entry"][$field["key"]] = $field["output"];
    }
}
// See if we added anything in pre-processing that wasn't a field in the form.
if (is_array($bigtree["preprocessed"])) {
    foreach ($bigtree["preprocessed"] as $key => $val) {
        if (!isset($bigtree["entry"][$key])) {
            $bigtree["entry"][$key] = $val;
        }
    }
}
// Sanitize the form data so it fits properly in the database (convert dates to MySQL-friendly format and such)
$bigtree["entry"] = BigTreeAutoModule::sanitizeData($bigtree["form"]["table"], $bigtree["entry"]);
// Make some easier to write out vars for below.
$tags = $_POST["_tags"];
$edit_id = $_POST["id"] ? $_POST["id"] : false;
$new_id = false;
$table = $bigtree["form"]["table"];
$item = $bigtree["entry"];
$many_to_many = $bigtree["many-to-many"];
// Check to see if this is a positioned element
// If it is and the form is setup to create new items at the top and this is a new record, update the position column.
$table_description = BigTree::describeTable($table);
if (isset($table_description["columns"]["position"]) && $bigtree["form"]["default_position"] == "Top" && !$_POST["id"]) {
    $max = sqlrows(sqlquery("SELECT id FROM `{$table}`")) + sqlrows(sqlquery("SELECT id FROM `bigtree_pending_changes` WHERE `table` = '" . sqlescape($table) . "'"));
    $item["position"] = $max;
}
// Let's stick it in the database or whatever!
コード例 #2
0
    // It's a module. Check permissions on this.
    $data = BigTreeAutoModule::getPendingItem($change["table"], $item_id);
    $permission_level = $admin->getAccessLevel($admin->getModule($change["module"]), $data["item"], $change["table"]);
} else {
    if ($change["item_id"]) {
        $permission_level = $admin->getPageAccessLevel($item_id);
    } else {
        $f = $admin->getPendingChange($change["id"]);
        $permission_level = $admin->getPageAccessLevel($f["changes"]["parent"]);
    }
}
// If they're not a publisher, they have no business here.
if ($permission_level != "p") {
    die("Permission denied.");
}
$change["changes"] = BigTreeAutoModule::sanitizeData($change["table"], $change["changes"]);
// This is an update to an existing entry.
if (!is_null($change["item_id"])) {
    if ($change["table"] == "bigtree_pages") {
        $page_data = $cms->getPendingPage($change["item_id"]);
        $admin->updatePage($change["item_id"], $page_data);
    } else {
        BigTreeAutoModule::updateItem($change["table"], $change["item_id"], $change["changes"], $change["mtm_changes"], $change["tags_changes"]);
    }
    // It's a new entry, let's publish it.
} else {
    if ($change["table"] == "bigtree_pages") {
        $page = $admin->createPage($change["changes"]);
        $admin->deletePendingChange($change["id"]);
    } else {
        BigTreeAutoModule::publishPendingItem($change["table"], $change["id"], $change["changes"], $change["mtm_changes"], $change["tags_changes"]);