Beispiel #1
0
    } else {
        $edit_id = "p" . BigTreeAutoModule::createPendingItem($bigtree["module"]["id"], $table, $item, $many_to_many, $tags);
        $admin->growl($bigtree["module"]["name"], "Created " . $bigtree["form"]["title"] . " Draft");
    }
    // We're a publisher and we want to publish
} elseif ($bigtree["access_level"] == "p" && $data_action == "publish") {
    // If we have an edit_id we're modifying something that exists.
    if ($edit_id) {
        // If the edit id starts with a "p" it's a pending entry we're publishing.
        if (substr($edit_id, 0, 1) == "p") {
            $edit_id = BigTreeAutoModule::publishPendingItem($table, substr($edit_id, 1), $item, $many_to_many, $tags);
            $admin->growl($bigtree["module"]["name"], "Updated & Published " . $bigtree["form"]["title"]);
            $did_publish = true;
            // Otherwise we're updating something that is already published
        } else {
            BigTreeAutoModule::updateItem($table, $edit_id, $item, $many_to_many, $tags);
            $admin->growl($bigtree["module"]["name"], "Updated " . $bigtree["form"]["title"]);
            $did_publish = true;
        }
        // We're creating a new published entry.
    } else {
        $edit_id = BigTreeAutoModule::createItem($table, $item, $many_to_many, $tags);
        $admin->growl($bigtree["module"]["name"], "Created " . $bigtree["form"]["title"]);
        $did_publish = true;
    }
}
// Kill off any applicable locks to the entry
if ($edit_id) {
    $admin->unlock($table, $edit_id);
}
// Figure out if we should return to a view with search results / page / sorting preset.
    $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"]);
    }
}
<?php

$fieldMod = new BigTreeModule("btx_form_builder_fields");
BigTree::globalizePOSTVars("htmlspecialchars");
$form = sqlescape($bigtree["commands"][0]);
// Get cleaned up prices, dates, and entries
if ($early_bird) {
    $early_bird_date = "'" . date("Y-m-d H:i:s", strtotime(str_replace("@", "", $_POST["early_bird_date"]))) . "'";
    $early_bird_base_price = floatval(str_replace(array('$', ',', ' '), '', $_POST["early_bird_base_price"]));
} else {
    $early_bird_date = "NULL";
}
$base_price = floatval(str_replace(array('$', ',', ' '), '', $_POST["base_price"]));
$max_entries = intval($max_entries);
BigTreeAutoModule::updateItem("btx_form_builder_forms", $form, array("title" => $title, "paid" => $paid, "base_price" => $base_price, "early_bird_base_price" => $early_bird_base_price, "early_bird_date" => $early_bird_date, "limit_entries" => $limit_entries, "max_entries" => $max_entries));
// Setup the default column, sort position, alignment inside columns.
$position = count($_POST["type"]);
$column = 0;
$alignment = "";
// Get all the previous fields so we know which to delete.
$fields_to_delete = array();
$existing_fields = $fieldMod->getMatching("form", $form);
foreach ($existing_fields as $field) {
    $fields_to_delete[$field["id"]] = $field["id"];
}
foreach ($_POST["type"] as $key => $type) {
    $id = $_POST["id"][$key];
    // The field still exists, remove it from the list to delete
    if ($id) {
        unset($fields_to_delete[$id]);
    }
<?php

BigTree::globalizePOSTVars();
if ($type == "Location") {
    list($lat, $lon) = explode(" ", $query);
    $query = json_encode(array("latitude" => $lat, "longitude" => $lon, "radius" => $radius));
}
BigTreeAutoModule::updateItem("btx_social_feed_queries", $bigtree["commands"][0], array("service" => $service, "type" => $type, "query" => $query, "cached_info" => $_POST["cached_info"]), $category_parser);
BTXSocialFeed::sync($bigtree["commands"][0]);
$admin->growl("Social Feed", "Updated Query");
BigTree::redirect(MODULE_ROOT . "view-queries/");