Exemplo n.º 1
0
<?php

// See if we've hit post_max_size
if (!$_POST["_bigtree_post_check"]) {
    $_SESSION["bigtree_admin"]["post_max_hit"] = true;
    BigTree::redirect($_SERVER["HTTP_REFERER"]);
}
$admin->requireLevel(1);
$item = $admin->getSetting($_POST["id"]);
if ($item["system"] || $item["locked"] && $admin->Level < 2) {
    $admin->growl("Settings", "Access Denied", "error");
} else {
    $bigtree["crops"] = array();
    $bigtree["errors"] = array();
    $bigtree["post_data"] = $_POST;
    $bigtree["file_data"] = BigTree::parsedFilesArray();
    // Pretend like we're a normal field
    $field = array("type" => $item["type"], "title" => $item["title"], "key" => "value", "options" => json_decode($item["options"], true), "ignore" => false, "input" => $bigtree["post_data"]["value"], "file_input" => $bigtree["file_data"]["value"]);
    // Process the input
    $output = BigTreeAdmin::processField($field);
    if (!is_null($output)) {
        $admin->updateSettingValue($_POST["id"], $output);
    }
    $admin->growl("Settings", "Updated Setting");
}
$_SESSION["bigtree_admin"]["form_data"] = array("page" => true, "return_link" => ADMIN_ROOT . "settings/", "edit_link" => ADMIN_ROOT . "settings/edit/" . $_POST["id"] . "/", "errors" => $bigtree["errors"]);
// Track resource allocation
$admin->allocateResources("settings", $_POST["id"]);
if (count($bigtree["crops"])) {
    $_SESSION["bigtree_admin"]["form_data"]["crop_key"] = $cms->cacheUnique("org.bigtreecms.crops", $bigtree["crops"]);
    BigTree::redirect(ADMIN_ROOT . "settings/crop/");
Exemplo n.º 2
0
<?php

// Parse the resources
$bigtree["entry"] = array();
$bigtree["template"] = $cms->getTemplate($_POST["template"]);
$bigtree["file_data"] = BigTree::parsedFilesArray("resources");
$bigtree["post_data"] = $_POST["resources"];
// Duplicate vars and $upload_service in for backwards compat.
$data = $_POST["resources"];
$file_data = $_FILES["resources"];
$upload_service = new BigTreeUploadService();
foreach ((array) $bigtree["template"]["resources"] as $resource) {
    unset($value);
    // Backwards compat.
    $field = array();
    $field["key"] = $key = $resource["id"];
    $field["options"] = $options = $resource;
    if (empty($field["options"]["directory"])) {
        $field["options"]["directory"] = $options["directory"] = "files/pages/";
    }
    $field["ignore"] = false;
    $field["input"] = $bigtree["post_data"][$resource["id"]];
    $field["file_input"] = $bigtree["file_data"][$resource["id"]];
    // If we have a customized handler for this data type, run it, otherwise, it's simply the post value.
    $field_type_path = BigTree::path("admin/form-field-types/process/" . $resource["type"] . ".php");
    if (file_exists($field_type_path)) {
        include $field_type_path;
    } else {
        if (is_array($bigtree["post_data"][$field["key"]])) {
            $field["output"] = $bigtree["post_data"][$field["key"]];
        } else {