Ejemplo n.º 1
0
<?php

BigTree::globalizePOSTVars();
$admin->updateModuleEmbedForm(end($bigtree["path"]), $title, $table, $fields, $hooks, $default_position, $default_pending, $css, $redirect_url, $thank_you_message);
$admin->growl("Developer", "Updated Embeddable Form");
$form = BigTreeAutoModule::getEmbedForm(end($bigtree["path"]));
BigTree::redirect(DEVELOPER_ROOT . "modules/edit/" . $form["module"] . "/");
Ejemplo n.º 2
0
<?php

$bigtree["report"] = BigTreeAutoModule::getReport($bigtree["module_action"]["report"]);
$bigtree["form"] = BigTreeAutoModule::getRelatedFormForReport($bigtree["report"]);
$bigtree["view"] = $bigtree["report"]["view"] ? BigTreeAutoModule::getView($bigtree["report"]["view"]) : BigTreeAutoModule::getRelatedViewForReport($bigtree["report"]);
if ($admin->Level > 1) {
    $bigtree["subnav_extras"][] = array("link" => ADMIN_ROOT . "developer/modules/reports/edit/" . $bigtree["report"]["id"] . "/?return=front", "icon" => "setup", "title" => "Edit in Developer");
}
$action = $bigtree["commands"][0];
if ($action == "csv") {
    include BigTree::path("admin/auto-modules/reports/csv.php");
} elseif ($action == "view") {
    include BigTree::path("admin/auto-modules/reports/view.php");
} else {
    include BigTree::path("admin/auto-modules/reports/filter.php");
}
Ejemplo n.º 3
0
        }
    } elseif ($r["table"] == "bigtree_users") {
        if (!isset($user_cache[$r["entry"]])) {
            $user_cache[$r["entry"]] = $admin->getUser($r["entry"]);
        }
        $user = $user_cache[$r["entry"]];
        if ($user) {
            $link = '<a target="_blank" href="' . ADMIN_ROOT . 'users/edit/' . $user["id"] . '/">' . $user["name"] . '</a>';
        } else {
            $link = 'Deleted User: '******'<a target="_blank" href="' . $form_link . $r["entry"] . '/">View Entry (id: ' . $r["entry"] . ')</a>';
        } else {
            $link = $r["entry"] . " (Unknown Form)";
        }
    }
    ?>
		<li>
Ejemplo n.º 4
0
<?php

if (is_numeric($id)) {
    BigTreeAutoModule::recacheItem($id, $table);
} else {
    BigTreeAutoModule::recacheItem(substr($id, 1), $table, true);
}
Ejemplo n.º 5
0
function _local_bigtree_update_22()
{
    global $admin;
    // Go through all views and figure out what kind of data is in each column.
    $q = sqlquery("SELECT id FROM bigtree_module_views");
    while ($f = sqlfetch($q)) {
        $admin->updateModuleViewColumnNumericStatus(BigTreeAutoModule::getView($f["id"]));
    }
}
Ejemplo n.º 6
0
}
$base_price = floatval(str_replace(array('$', ',', ' '), '', $_POST["base_price"]));
$max_entries = intval($max_entries);
// Create the form.
$form = BigTreeAutoModule::createItem("btx_form_builder_forms", 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 = "";
foreach ($_POST["type"] as $key => $type) {
    if ($type == "column_start") {
        // If we're starting a set of columns and don't have an alignment it's a new set.
        if (!$alignment) {
            $column = BigTreeAutoModule::createItem("btx_form_builder_fields", array("form" => $form, "type" => "column", "position" => $position));
            $alignment = "left";
            // Otherwise we're starting the second column of the set, just change the alignment.
        } elseif ($alignment == "left") {
            $alignment = "right";
        }
    } elseif ($type == "column_end") {
        if ($alignment == "right") {
            $column = 0;
            $alignment = "";
        }
    } elseif ($type) {
        BigTreeAutoModule::createItem("btx_form_builder_fields", array("form" => $form, "column" => $column, "alignment" => $alignment, "type" => $type, "data" => $_POST["data"][$key], "position" => $position));
    }
    $position--;
}
$admin->growl("Form Builder", "Created Form");
BigTree::redirect(MODULE_ROOT);
Ejemplo n.º 7
0
 static function updateModuleViewColumnNumericStatus($view)
 {
     if (is_array($view["fields"])) {
         $form = BigTreeAutoModule::getRelatedFormForView($view);
         $table = BigTree::describeTable($view["table"]);
         foreach ($view["fields"] as $key => $field) {
             $numeric = false;
             $t = $table["columns"][$key]["type"];
             if ($t == "int" || $t == "float" || $t == "double" || $t == "double precision" || $t == "tinyint" || $t == "smallint" || $t == "mediumint" || $t == "bigint" || $t == "real" || $t == "decimal" || $t == "dec" || $t == "fixed" || $t == "numeric") {
                 $numeric = true;
             }
             if ($field["parser"] || $form["fields"][$key]["type"] == "list" && $form["fields"][$key]["list_type"] == "db") {
                 $numeric = false;
             }
             $view["fields"][$key]["numeric"] = $numeric;
         }
         $fields = BigTree::json($view["fields"], true);
         sqlquery("UPDATE bigtree_module_views SET fields = '{$fields}' WHERE id = '" . $view["id"] . "'");
     }
 }
Ejemplo n.º 8
0
			<section class="changes_action"><a href="#<?php 
        echo $change["id"];
        ?>
" data-module="Pages" class="icon_deny"></a></section>
		</li>
		<?php 
    }
    ?>
	</ul>
</div>
<?php 
}
foreach ($modules as $mod) {
    $view = BigTreeAutoModule::getViewForTable($mod["table"]);
    if ($view) {
        $view_data = BigTreeAutoModule::getViewData($view);
    } else {
        $view_data = false;
    }
    ?>
<a name="<?php 
    echo $mod["id"];
    ?>
"></a>
<div class="table">
	<summary>
		<h2 class="full">
			<span class="modules"></span>
			<?php 
    echo $mod["name"];
    ?>
Ejemplo n.º 9
0
        }
    }
    foreach ($fields as $key => $field) {
        if (!$old_view["fields"][$key]) {
            $keys_match = false;
        }
    }
    // Check actions
    if (count($old_view["actions"]) != count($actions)) {
        $keys_match = false;
    }
    // Check preview field
    if (!$old_view["preview_url"] && $preview_url || $old_view["preview_url"] && !$preview_url) {
        $keys_match = false;
    }
    if (!$keys_match || $old_view["type"] == "searchable" && $type != "searchable" || $type == "searchable" && $old_view["type"] != "searchable") {
        foreach ($fields as $key => $field) {
            unset($fields[$key]["width"]);
        }
    }
    // Let's update the view and clear its cache
    $admin->updateModuleView(end($bigtree["path"]), $title, $description, $table, $type, $options, $fields, $actions, $related_form, $preview_url);
    BigTreeAutoModule::clearCache(end($bigtree["path"]));
    $action = $admin->getModuleActionForView(end($bigtree["path"]));
    $admin->growl("Developer", "Updated View");
    if ($_POST["return_page"]) {
        BigTree::redirect($_POST["return_page"]);
    } else {
        BigTree::redirect(DEVELOPER_ROOT . "modules/edit/" . $action["module"] . "/");
    }
}
Ejemplo n.º 10
0
    $bigtree["module"] = $admin->getModule(BigTreeAutoModule::getModuleForView($bigtree["view"]));
}
$permission = $admin->getAccessLevel($bigtree["module"]["id"]);
// Setup the preview action if we have a preview URL and field.
if ($bigtree["view"]["preview_url"]) {
    $bigtree["view"]["actions"]["preview"] = "on";
}
$module_page = ADMIN_ROOT . $bigtree["module"]["route"] . "/";
// Retrieve our results.
if (isset($_POST["search"]) && $_POST["search"] || isset($_GET["search"]) && $_GET["search"]) {
    $search = isset($_GET["search"]) ? $_GET["search"] : $_POST["search"];
    $bigtree["view"]["options"]["per_page"] = 10000000;
    $r = BigTreeAutoModule::getSearchResults($bigtree["view"], 1, $search, "column1 ASC", false);
    $items = $r["results"];
} else {
    $items = BigTreeAutoModule::getViewData($bigtree["view"], "position DESC, CAST(id AS UNSIGNED) ASC", "both");
    $search = "";
}
// We're going to append information to the end of an edit string so that we can return to the same page / set of search results after submitting a form.
$edit_append = "?view_data=" . base64_encode(serialize(array("view" => $bigtree["view"]["id"], "search" => $search)));
foreach ($items as $item) {
    // Stop the item status notice
    if (!isset($item["status"])) {
        $item["status"] = false;
    }
    if ($item["status"] == "p") {
        $status = "Pending";
        $status_class = "pending";
    } elseif ($item["status"] == "c") {
        $status = "Changed";
        $status_class = "pending";
Ejemplo n.º 11
0
<?php

include "_setup.php";
if ($item["featured"]) {
    if ($access_level != "p") {
        echo 'BigTree.growl("' . $module["name"] . '","You don\'t have permission to perform this action.");';
    } else {
        echo 'BigTree.growl("' . $module["name"] . '","Item is now unfeatured.");';
        if (is_numeric($id)) {
            sqlquery("UPDATE `{$table}` SET featured = '' WHERE id = '{$id}'");
        } else {
            BigTreeAutoModule::updatePendingItemField(substr($id, 1), "featured", "");
        }
    }
} else {
    if ($access_level != "p") {
        echo 'BigTree.growl("' . $module["name"] . '","You don\'t have permission to perform this action.");';
    } else {
        echo 'BigTree.growl("' . $module["name"] . '","Item is now featured.");';
        if (is_numeric($id)) {
            sqlquery("UPDATE `{$table}` SET featured = 'on' WHERE id = '{$id}'");
        } else {
            BigTreeAutoModule::updatePendingItemField(substr($id, 1), "featured", "on");
        }
    }
}
include "_recache.php";
Ejemplo n.º 12
0
    } elseif (isset($options["sort"])) {
        $sort = $options["sort"];
    } else {
        $sort = "id DESC";
    }
    // Same thing we were going to do above but omit the sort stuff.
    $edit_append = "?view_data=" . base64_encode(serialize(array("view" => $bigtree["view"]["id"], "search" => $search, "page" => $page)));
}
$module_page = ADMIN_ROOT . $bigtree["module"]["route"] . "/";
// Setup the preview action if we have a preview URL and field.
if ($bigtree["view"]["preview_url"]) {
    $actions["preview"] = "on";
}
$perm = $admin->getAccessLevel($bigtree["module"]);
// Handle how many pages we have and get our results.
$data = BigTreeAutoModule::getSearchResults($bigtree["view"], $page, $search, $sort, false);
$pages = $data["pages"];
$items = $data["results"];
foreach ($items as $item) {
    // If it's straight from the db, it's published.
    if (!isset($item["status"])) {
        $item["status"] = "";
    }
    if ($item["status"] == "p") {
        $status = "Pending";
        $status_class = "pending";
    } elseif ($item["status"] == "c") {
        $status = "Changed";
        $status_class = "pending";
    } else {
        $status = "Published";
Ejemplo n.º 13
0
		<span class="view_action" style="width: <?php 
echo count($bigtree["view"]["actions"]) * 40;
?>
px;"><?php 
if (count($bigtree["view"]["actions"]) > 1) {
    ?>
Actions<?php 
}
?>
</span>
	</header>
	<ul id="sort_table">
		<?php 
foreach ($items as $item) {
    // Get the status
    if (BigTreeAutoModule::changeExists($bigtree["view"]["table"], $item["id"])) {
        $status_class = "pending";
        $status = "Changed";
    } else {
        $status_class = "published";
        $status = "Published";
    }
    $item_permission = $admin->getAccessLevel($bigtree["module"], $item, $bigtree["form"]["table"]);
    if ($item_permission && $item_permission != "n") {
        ?>
		<li id="row_<?php 
        echo $item["id"];
        ?>
" class="<?php 
        echo $status_class;
        ?>
Ejemplo n.º 14
0
<?php

// If the last command is numeric then we're editing something.
if (is_numeric(end($bigtree["commands"])) || is_numeric(substr(end($bigtree["commands"]), 1))) {
    $bigtree["edit_id"] = $edit_id = end($bigtree["commands"]);
    // Otherwise we're adding something or we're processing something we were editing.
} else {
    $bigtree["edit_id"] = $edit_id = $_POST["id"] ? $_POST["id"] : false;
}
$bigtree["form"] = $form = BigTreeAutoModule::getForm($bigtree["module_action"]["form"]);
$bigtree["form_root"] = ADMIN_ROOT . $bigtree["module"]["route"] . "/" . $bigtree["module_action"]["route"] . "/";
// Provide developers a nice handy link for edit/return of this form
if ($admin->Level > 1) {
    $bigtree["subnav_extras"][] = array("link" => ADMIN_ROOT . "developer/modules/forms/edit/" . $bigtree["form"]["id"] . "/?return=front", "icon" => "setup", "title" => "Edit in Developer");
}
// Audit Trail link
if ($bigtree["edit_id"]) {
    $bigtree["subnav_extras"][] = array("link" => ADMIN_ROOT . "developer/audit/search/?table=" . $bigtree["form"]["table"] . "&entry=" . $bigtree["edit_id"], "icon" => "trail", "title" => "View Audit Trail");
}
$action = $bigtree["commands"][0];
if (!$action || is_numeric($action) || is_numeric(substr($action, 1))) {
    if ($bigtree["edit_id"]) {
        if (isset($_GET["force"])) {
            $admin->unlock($bigtree["form"]["table"], $bigtree["edit_id"]);
        }
        include BigTree::path("admin/auto-modules/forms/edit.php");
    } else {
        include BigTree::path("admin/auto-modules/forms/add.php");
    }
} else {
    include BigTree::path("admin/auto-modules/forms/{$action}.php");
Ejemplo n.º 15
0
    } else {
        $redirect_url = ADMIN_ROOT . $bigtree["module"]["route"] . "/" . $redirect_append;
    }
    // If we specify a specific return URL...
} elseif ($bigtree["form"]["return_url"]) {
    $redirect_url = $bigtree["form"]["return_url"] . $redirect_append;
    // Otherwise just go back to the main module landing.
} else {
    $redirect_url = ADMIN_ROOT . $bigtree["module"]["route"] . "/" . $redirect_append;
}
// If we've specified a preview URL in our module and the user clicked Save & Preview, return to preview page.
if ($_POST["_bigtree_preview"]) {
    $admin->ungrowl();
    $redirect_url = $view["preview_url"] . $edit_id . "/?bigtree_preview_return=" . urlencode($bigtree["form_root"] . $edit_id . "/");
}
// If there's a callback function for this module, let's get'r'done.
if ($bigtree["form"]["callback"]) {
    call_user_func($bigtree["form"]["callback"], $edit_id, $item, $did_publish);
}
// 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.
$edit_action = BigTreeAutoModule::getEditAction($bigtree["module"]["id"], $bigtree["form"]["id"]);
$_SESSION["bigtree_admin"]["form_data"] = array("view" => $view, "id" => $edit_id, "return_link" => $redirect_url, "edit_link" => ADMIN_ROOT . $bigtree["module"]["route"] . "/" . $edit_action["route"] . "/{$edit_id}/", "errors" => $bigtree["errors"], "crops" => $bigtree["crops"]);
if (count($bigtree["crops"])) {
    BigTree::redirect($bigtree["form_root"] . "crop/");
} elseif (count($bigtree["errors"])) {
    BigTree::redirect($bigtree["form_root"] . "error/");
} else {
    BigTree::redirect($redirect_url);
}
Ejemplo n.º 16
0
    $email .= $address["city"] . ", " . $address["state"] . " " . $address["zip"] . "\n";
    $email .= $address["country"];
    $email .= "\n\n";
    $email .= "Credit Card Info:\n";
    $email .= $card["type"] . "\n";
    $email .= "**** **** **** " . $pg->Last4CC . "\n";
    $email .= "Expires " . $card["month"] . "/" . $card["year"];
    $email .= "\n\n";
    $email .= "Total Charged: \$" . number_format($total, 2);
}
// Get rid of saved data or errors.
unset($_SESSION["form_builder"]);
// Add the entry to the entries table.
BigTreeAutoModule::createItem("btx_form_builder_entries", array("form" => $form["id"], "data" => $entry, "created_at" => "NOW()"));
// Update the totals for the form and recache it.
sqlquery("UPDATE btx_form_builder_forms SET entries = (entries + 1), last_entry = NOW(), total_collected = (total_collected + " . round($total, 2) . ") WHERE id = '" . $form["id"] . "'");
BigTreeAutoModule::recacheItem($form["id"], "btx_form_builder_forms");
// Get the no-reply domain
$no_reply_domain = str_replace(array("http://www.", "https://www.", "http://", "https://"), "", DOMAIN);
$email_title = $page_header ? $page_header : $bigtree["page"]["nav_title"];
$email = $email_title . ' - Form Submission
' . str_repeat("=", strlen($email_title)) . '==================

' . $email;
// Send out email alerts
$emails = explode(",", $emails);
foreach ($emails as $e) {
    $e = trim($e);
    mail($e, $email_title . " - Form Submission", $email, "From: no-reply@{$no_reply_domain}");
}
BigTree::redirect($page_link . "thanks/");
Ejemplo n.º 17
0
    function _localDrawLevel($items, $depth)
    {
        global $bigtree, $module_page, $permission, $admin;
        foreach ($items as $item) {
            $expanded = !empty($_COOKIE["bigtree_admin"]["nested_views"][$bigtree["view"]["id"]][$item["id"]]) ? true : false;
            $children = BigTreeAutoModule::getViewDataForGroup($bigtree["view"], $item["id"], "position DESC, id ASC", "both");
            // Stop the item status notice
            if (!isset($item["status"])) {
                $item["status"] = false;
            }
            if ($item["status"] == "p") {
                $status = "Pending";
                $status_class = "pending";
            } elseif ($item["status"] == "c") {
                $status = "Changed";
                $status_class = "pending";
            } else {
                $status = "Published";
                $status_class = "published";
            }
            if ($expanded) {
                $status_class .= " expanded";
            }
            ?>
<li id="row_<?php 
            echo $item["id"];
            ?>
" class="<?php 
            echo $status_class;
            ?>
">
	<span class="depth" style="width: <?php 
            echo $depth * 24;
            ?>
px;">
		<?php 
            if ($permission == "p") {
                ?>
		<span class="icon_sort"></span>
		<?php 
            }
            ?>
	</span>
	<?php 
            $x = 0;
            $depth_minus = ceil((24 * $depth + 1) / count($bigtree["view"]["fields"]));
            foreach ($bigtree["view"]["fields"] as $key => $field) {
                $x++;
                $value = $item["column{$x}"];
                if ($x == 1) {
                    $field["width"] -= 20;
                }
                ?>
	<section class="view_column<?php 
                if ($x == 1 && !count($children)) {
                    ?>
 disabled<?php 
                }
                ?>
" style="width: <?php 
                echo $field["width"] - $depth_minus;
                ?>
px;"><?php 
                echo $value;
                ?>
</section>
	<?php 
            }
            ?>
	<section class="view_status status_<?php 
            echo $status_class;
            ?>
"><?php 
            echo $status;
            ?>
</section>
	<?php 
            $iperm = $permission == "p" ? "p" : $admin->getCachedAccessLevel($bigtree["module"], $item, $bigtree["view"]["table"]);
            foreach ($bigtree["view"]["actions"] as $action => $data) {
                if ($data == "on") {
                    if (($action == "delete" || $action == "approve" || $action == "feature" || $action == "archive") && $iperm != "p") {
                        if ($action == "delete" && $item["pending_owner"] == $admin->ID) {
                            $class = "icon_delete";
                        } else {
                            $class = "icon_disabled";
                        }
                    } else {
                        $class = $admin->getActionClass($action, $item);
                    }
                    if ($action == "preview") {
                        $link = rtrim($bigtree["view"]["preview_url"], "/") . "/" . $item["id"] . '/" target="_preview';
                    } elseif ($action == "edit") {
                        $link = $bigtree["view"]["edit_url"] . $item["id"] . "/" . $edit_append;
                    } else {
                        $link = "#" . $item["id"];
                    }
                    ?>
	<section class="view_action action_<?php 
                    echo $action;
                    ?>
"><a href="<?php 
                    echo $link;
                    ?>
" class="<?php 
                    echo $class;
                    ?>
"></a></section>
	<?php 
                } else {
                    $data = json_decode($data, true);
                    $link = $module_page . $data["route"] . "/" . $item["id"] . "/";
                    if ($data["function"]) {
                        $link = call_user_func($data["function"], $item);
                    }
                    ?>
	<section class="view_action"><a href="<?php 
                    echo $link;
                    ?>
" class="<?php 
                    echo $data["class"];
                    ?>
"></a></section>
	<?php 
                }
            }
            if (count($children)) {
                if ($expanded) {
                    echo "<ul>";
                } else {
                    echo '<ul style="display: none;">';
                }
                _localDrawLevel($children, $depth + 1);
                echo "</ul>";
            }
            ?>
</li>
<?php 
        }
    }
Ejemplo n.º 18
0
<?php

// Update the count
sqlquery("UPDATE btx_form_builder_forms SET entries = (entries - 1) WHERE id = '" . sqlescape($_POST["form"]) . "'");
BigTreeAutoModule::recacheItem($_POST["form"], "btx_form_builder_forms");
// Delete the entry
BigTreeAutoModule::deleteItem("btx_form_builder_entries", $_POST["id"]);
// Show the growl and update the table
header("Content-type: text/javascript");
?>
BigTree.growl("Form Builder","Deleted Entry");
$("#row_<?php 
echo $_POST["id"];
?>
").remove();
Ejemplo n.º 19
0
$permission = $admin->getAccessLevel($bigtree["module"]["id"]);
// Setup defaults
$draggable = isset($bigtree["view"]["options"]["draggable"]) && $bigtree["view"]["options"]["draggable"] ? true : false;
$prefix = isset($bigtree["view"]["options"]["prefix"]) && $bigtree["view"]["options"]["prefix"] ? $bigtree["view"]["options"]["prefix"] : "";
$items = array();
if ($draggable) {
    $order = "position DESC, CAST(id AS UNSIGNED) ASC";
} else {
    if ($bigtree["view"]["options"]["sort"] && ($bigtree["view"]["options"]["sort"] == "ASC" || $bigtree["view"]["options"]["sort"] == "DESC")) {
        $order = "CAST(id AS UNSIGNED) " . $bigtree["view"]["options"]["sort"];
    } else {
        $order = "CAST(id AS UNSIGNED) DESC";
    }
}
$items = BigTreeAutoModule::getViewData($bigtree["view"], $order, "active");
$pending_items = BigTreeAutoModule::getViewData($bigtree["view"], $order, "pending");
?>
<div class="table auto_modules image_list">
	<summary>
		<p><?php 
if ($permission == "p" && $draggable) {
    ?>
Click and drag the light gray area of an item to sort the images. <?php 
}
?>
Click an image to edit it.</p>
	</summary>
	<?php 
if (count($pending_items)) {
    ?>
	<header><span>Active</span></header>
Ejemplo n.º 20
0
<?php

$bigtree["form"] = $form = BigTreeAutoModule::getEmbedFormByHash($_GET["hash"]);
$bigtree["form_root"] = ADMIN_ROOT . "ajax/auto-modules/embeddable-form/";
?>
<!doctype html> 
<!--[if lt IE 7 ]> <html lang="en" class="ie ie6"> <![endif]-->
<!--[if IE 7 ]>	<html lang="en" class="ie ie7"> <![endif]-->
<!--[if IE 8 ]>	<html lang="en" class="ie ie8"> <![endif]-->
<!--[if IE 9 ]>	<html lang="en" class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
	<head>
		<meta charset="utf-8" />
		<link rel="stylesheet" href="<?php 
echo ADMIN_ROOT;
?>
css/main.css" type="text/css" media="screen" />
		<?php 
if (isset($bigtree["css"]) && is_array($bigtree["css"])) {
    foreach ($bigtree["css"] as $style) {
        ?>
		<link rel="stylesheet" href="<?php 
        echo ADMIN_ROOT;
        ?>
css/<?php 
        echo $style;
        ?>
" type="text/css" media="screen" />
		<?php 
    }
}
Ejemplo n.º 21
0
<?php

include "_setup.php";
// If you made this pending item, you should be allowed to delete it, or if you're a publisher of the module.
if ($access_level != "p" && $current_item["owner"] != $admin->ID) {
    echo 'BigTree.growl("' . $module["name"] . '","You don\'t have permission to delete this item.");';
} else {
    echo 'BigTree.growl("' . $module["name"] . '","Deleted Item");';
    if (substr($id, 0, 1) == "p") {
        BigTreeAutoModule::deletePendingItem($table, substr($id, 1));
    } else {
        BigTreeAutoModule::deleteItem($table, $id);
    }
}
Ejemplo n.º 22
0
<?php

// Get the form so we can walk through its fields
$form = BigTreeAutoModule::getForm($_GET["form"]);
// Create a generic module class to get the decoded item data
$m = new BigTreeModule();
$m->Table = $form["table"];
$item = $m->get($_GET["id"]);
// Loop through form resources and see if we have related page data, only check html and text fields
if (is_array($form["fields"])) {
    $check_data("", $external, $form["fields"], $item);
}
// Only retrieve these if we have errors as we only need them for URL generation
if (array_filter($integrity_errors)) {
    $action = $admin->getModuleActionForForm($form);
    $module = $admin->getModule($action["module"]);
}
foreach ($integrity_errors as $field => $error_types) {
    foreach ($error_types as $type => $errors) {
        foreach ($errors as $error) {
            ?>
<li>
	<section class="integrity_errors">
		<a href="<?php 
            echo ADMIN_ROOT . $module["route"] . "/" . $action["route"] . "/" . htmlspecialchars($_GET["id"]);
            ?>
/" target="_blank">Edit</a>
		<span class="icon_small icon_small_warning"></span>
		<p>Broken <?php 
            echo $type == "img" ? "Image" : "Link";
            ?>
Ejemplo n.º 23
0
<?php

if (!count($_POST)) {
    BigTree::redirect(MODULE_ROOT);
}
$items = BigTreeAutoModule::getReportResults($bigtree["report"], $bigtree["view"], $bigtree["form"], $_POST, $_POST["*sort"]["field"], $_POST["*sort"]["order"]);
if ($bigtree["view"]["type"] == "searchable" || $bigtree["view"]["type"] == "grouped" || $bigtree["view"]["type"] == "draggable" || $bigtree["view"]["type"] == "nested") {
    include BigTree::path("admin/auto-modules/reports/views/text.php");
} else {
    include BigTree::path("admin/auto-modules/reports/views/images.php");
}
Ejemplo n.º 24
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;
    }
}
Ejemplo n.º 25
0
<?php

$mpage = ADMIN_ROOT . $module["route"] . "/";
BigTree::globalizeArray($view);
// Figure out the column width
$awidth = count($actions) * 40;
$available = 896 - $awidth;
$percol = floor($available / count($fields));
foreach ($fields as $key => $field) {
    $fields[$key]["width"] = $percol - 20;
}
$items = BigTreeAutoModule::parseViewData($view, $items);
?>
<div class="table" style="margin: 0;">
	<summary><h2>Search Results</h2></summary>
	<header>
		<?php 
$x = 0;
foreach ($fields as $key => $field) {
    $x++;
    ?>
		<span class="view_column" style="width: <?php 
    echo $field["width"];
    ?>
px;"><?php 
    echo $field["title"];
    ?>
</span>
		<?php 
}
?>
Ejemplo n.º 26
0
<?php

$view = BigTreeAutoModule::getView(end($bigtree["path"]));
$fields = $view["fields"];
$x = 0;
foreach ($fields as $key => $field) {
    $fields[$key]["width"] = $_POST[$key];
}
// Update the view
$admin->updateModuleViewFields(end($bigtree["path"]), $fields);
$action = $admin->getModuleActionForView(end($bigtree["path"]));
$admin->growl("Developer", "Updated View Styles");
BigTree::redirect(DEVELOPER_ROOT . "modules/edit/" . $action["module"] . "/");
Ejemplo n.º 27
0
 function update($id, $fields, $values = false, $ignore_cache = false)
 {
     $id = sqlescape($id);
     // Turn a key => value array into pairs
     if ($values === false && is_array($fields)) {
         $values = $fields;
         $fields = array_keys($fields);
     }
     // Multiple columns to update
     if (is_array($fields)) {
         $query_parts = array();
         foreach ($fields as $key) {
             $val = current($values);
             if (is_array($val)) {
                 $val = BigTree::json(BigTree::translateArray($val));
             } else {
                 $val = BigTreeAdmin::autoIPL($val);
             }
             $query_parts[] = "`{$key}` = '" . sqlescape($val) . "'";
             next($values);
         }
         sqlquery("UPDATE `" . $this->Table . "` SET " . implode(", ", $query_parts) . " WHERE id = '{$id}'");
         // Single column to update
     } else {
         if (is_array($values)) {
             $val = json_encode(BigTree::translateArray($values));
         } else {
             $val = BigTreeAdmin::autoIPL($values);
         }
         sqlquery("UPDATE `" . $this->Table . "` SET `{$fields}` = '" . sqlescape($val) . "' WHERE id = '{$id}'");
     }
     if (!$ignore_cache) {
         BigTreeAutoModule::recacheItem($id, $this->Table);
     }
 }
Ejemplo n.º 28
0
    $package["components"]["module_groups"][] = $admin->getModuleGroup($group);
}
foreach ((array) $modules as $module) {
    $module = $admin->getModule($module);
    if ($module) {
        $module["actions"] = $admin->getModuleActions($module["id"]);
        foreach ($module["actions"] as $a) {
            // If there's an auto module, include it as well.
            if ($a["form"] && !in_array($a["form"], $used_forms)) {
                $module["forms"][] = BigTreeAutoModule::getForm($a["form"], false);
                $used_forms[] = $a["form"];
            } elseif ($a["view"] && !in_array($a["view"], $used_views)) {
                $module["views"][] = BigTreeAutoModule::getView($a["view"], false);
                $used_views[] = $a["view"];
            } elseif ($a["report"] && !in_array($a["report"], $used_reports)) {
                $module["reports"][] = BigTreeAutoModule::getReport($a["report"]);
                $used_reports[] = $a["report"];
            }
        }
        $module["embed_forms"] = $admin->getModuleEmbedForms("title", $module["id"]);
        $package["components"]["modules"][] = $module;
    }
}
foreach ((array) $templates as $template) {
    $package["components"]["templates"][] = $cms->getTemplate($template);
}
foreach ((array) $callouts as $callout) {
    $package["components"]["callouts"][] = $admin->getCallout($callout);
}
foreach ((array) $feeds as $feed) {
    $package["components"]["feeds"][] = $cms->getFeed($feed);
Ejemplo n.º 29
0
                     if (!in_array($field["options"]["mtm-other-table"] . "#structure", $p["tables"]) && substr($field["options"]["mtm-other-table"], 0, 8) != "bigtree_") {
                         $p["tables"][] = $field["options"]["mtm-other-table"] . "#structure";
                     }
                 }
                 // Include the custom field type if it was forgotten.
                 if (isset($custom_field_types[$field["type"]])) {
                     if (!in_array($field["type"], $p["field_types"])) {
                         $p["field_types"][] = $field["type"];
                     }
                 }
             }
             // For views/reports we just care about what table it's from
         } elseif ($action["view"]) {
             $auto = BigTreeAutoModule::getView($action["view"]);
         } elseif ($action["report"]) {
             $auto = BigTreeAutoModule::getReport($action["report"]);
         }
         if (!in_array($auto["table"] . "#structure", $p["tables"])) {
             $p["tables"][] = $auto["table"] . "#structure";
         }
     }
     if ($module["group"]) {
         $p["module_groups"][] = $module["group"];
     }
 }
 // Search the class files directory to see if one exists in there with our route.
 if (file_exists(SERVER_ROOT . "custom/inc/modules/" . $module["route"] . ".php")) {
     $p["files"][] = SERVER_ROOT . "custom/inc/modules/" . $module["route"] . ".php";
 }
 // Search the class files directory to see if one exists in there with our route.
 if (file_exists(SERVER_ROOT . "custom/inc/required/" . $module["route"] . ".php")) {
Ejemplo n.º 30
0
<?php

BigTree::globalizeArray($bigtree["view"]);
$m = BigTreeAutoModule::getModuleForView($bigtree["view"]);
$perm = $admin->checkAccess($m);
if (isset($_GET["sort"])) {
    $sort = $_GET["sort"] . " " . $_GET["sort_direction"];
} elseif (isset($options["sort_column"])) {
    $sort = $options["sort_column"] . " " . $options["sort_direction"];
} elseif (isset($options["sort"])) {
    $sort = $options["sort"];
} else {
    $sort = "id DESC";
}
// Retrieve the column and the sort direction from the consolidated ORDER BY statement.
$sort = ltrim($sort, "`");
$sort_column = BigTree::nextSQLColumnDefinition($sort);
$sort_pieces = explode(" ", $sort);
$sort_direction = end($sort_pieces);
// See if we're searching for anything.
$search = isset($_GET["search"]) ? $_GET["search"] : "";
?>
<div class="table auto_modules">
	<summary>
		<input type="search" class="form_search" id="search" placeholder="Search" value="<?php 
echo htmlspecialchars($search);
?>
" />
		<span class="form_search_icon"></span>
		<nav id="view_paging" class="view_paging"></nav>
	</summary>