function _localDrawCalloutLevel($keys, $level) { global $field; foreach ($level as $key => $value) { if (is_array($value)) { _localDrawCalloutLevel(array_merge($keys, array($key)), $value); } else { ?> <input type="hidden" name="<?php echo $field["key"]; ?> [<?php echo implode("][", $keys); ?> ][<?php echo $key; ?> ]" value="<?php echo BigTree::safeEncode($value); ?> " /> <?php } } }
function _localCleanup() { // Remove the package directory, we do it backwards because the "deepest" files are last $contents = @array_reverse(BigTree::directoryContents(SERVER_ROOT . "cache/package/")); foreach ((array) $contents as $file) { @unlink($file); @rmdir($file); } @rmdir(SERVER_ROOT . "cache/package/"); }
function oAuthRedirect() { $this->Settings["token_secret"] = ""; $response = $this->callAPI("https://api.login.yahoo.com/oauth/v2/get_request_token", "GET", array("oauth_callback" => $this->ReturnURL)); parse_str($response); if ($oauth_callback_confirmed != "true") { global $admin; $admin->growl("Yahoo BOSS API", "Consumer Key or Secret invalid.", "error"); BigTree::redirect(ADMIN_ROOT . "developer/geocoding/yahoo-boss/"); } $this->Settings["token_secret"] = $oauth_token_secret; BigTree::redirect("https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token={$oauth_token}"); }
function __construct($cache = true) { parent::__construct("bigtree-internal-salesforce-api", "Salesforce API", "org.bigtreecms.api.salesforce", $cache); // Set OAuth Return URL $this->ReturnURL = ADMIN_ROOT . "developer/services/salesforce/return/"; // Change things if we're in the test environment. if ($this->Settings["test_environment"]) { $this->AuthorizeURL = str_ireplace("login.", "test.", $this->AuthorizeURL); $this->TokenURL = str_replace("login.", "test.", $this->TokenURL); } // Get a new access token for this session. $this->Connected = false; if ($this->Settings["refresh_token"]) { $response = json_decode(BigTree::cURL($this->TokenURL, array("grant_type" => "refresh_token", "client_id" => $this->Settings["key"], "client_secret" => $this->Settings["secret"], "refresh_token" => $this->Settings["refresh_token"])), true); if ($response["access_token"]) { $this->InstanceURL = $response["instance_url"]; $this->EndpointURL = $this->InstanceURL . "/services/data/v28.0/"; $this->Settings["token"] = $response["access_token"]; $this->Connected = true; } } }
} else { ?> <input type="text" disabled="disabled" value="Please select "Other Table"" /> <?php } ?> </div> </fieldset> <fieldset> <label>Sort By</label> <div data-name="mtm-sort" class="sort_by pop-dependant mtm-other-table"> <?php if ($data["mtm-other-table"]) { ?> <select name="mtm-sort"><?php BigTree::getFieldSelectOptions($data["mtm-other-table"], $data["mtm-sort"], true); ?> </select> <?php } else { ?> <input type="text" disabled="disabled" value="Please select "Other Table"" /> <?php } ?> </div> </fieldset> <fieldset> <label>List Parser Function</label> <input type="text" name="mtm-list-parser" value="<?php echo htmlspecialchars($data["mtm-list-parser"]);
foreach ((array) $p["field_types"] as $type) { if ($type) { if (file_exists(SERVER_ROOT . "custom/admin/form-field-types/draw/{$type}.php")) { $p["files"][] = SERVER_ROOT . "custom/admin/form-field-types/draw/{$type}.php"; } if (file_exists(SERVER_ROOT . "custom/admin/form-field-types/process/{$type}.php")) { $p["files"][] = SERVER_ROOT . "custom/admin/form-field-types/process/{$type}.php"; } if (file_exists(SERVER_ROOT . "custom/admin/ajax/developer/field-options/{$type}.php")) { $p["files"][] = SERVER_ROOT . "custom/admin/ajax/developer/field-options/{$type}.php"; } } } // Make sure we have no dupes $p["module_groups"] = array_unique($p["module_groups"]); $p["modules"] = array_unique($p["modules"]); $p["templates"] = array_unique($p["templates"]); $p["callouts"] = array_unique($p["callouts"]); $p["settings"] = array_unique($p["settings"]); $p["feeds"] = array_unique($p["feeds"]); $p["field_types"] = array_unique($p["field_types"]); $p["files"] = array_unique($p["files"]); $p["tables"] = array_unique($p["tables"]); // Sort them to make them easier to read foreach ($p as &$part) { if (is_array($part)) { asort($part); } } BigTree::redirect(DEVELOPER_ROOT . "packages/build/files/");
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); } }
<?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"); }
<?php if ($_SERVER["HTTP_REFERER"] != ADMIN_ROOT . "users/profile/") { ?> <div class="container"> <section> <p>To update your profile, please access your <a href="<?php echo ADMIN_ROOT; ?> users/profile/">Profile</a> page directly.</p> </section> </div> <?php } else { if ($_POST["password"] && !$admin->validatePassword($_POST["password"])) { $_SESSION["bigtree_admin"]["update_profile"] = $_POST; $admin->growl("Users", "Invalid Password", "error"); BigTree::redirect(ADMIN_ROOT . "users/profile/"); } $admin->updateProfile($_POST); $admin->growl("Users", "Updated Profile"); BigTree::redirect(ADMIN_ROOT . "dashboard/"); }
$table = $_POST["table"]; $type = $_POST["type"]; $options = json_decode(str_replace(array("\r", "\n"), array('\\r', '\\n'), $_POST["data"]), true); $filter = isset($options["filter"]) ? $options["filter"] : ""; ?> <div style="width: 450px;"> <fieldset> <label>Filter Function <small>(function name only, <a href="http://www.bigtreecms.org/docs/dev-guide/modules/advanced-techniques/view-filters/" target="_blank">learn more</a>)</small></label> <input type="text" name="filter" value="<?php echo htmlspecialchars($filter); ?> " /> </fieldset> <?php $path = BigTree::path("admin/ajax/developer/view-options/" . $type . ".php"); if (file_exists($path)) { include $path; } ?> </div> <script> BigTree.localTable = false; $(".table_select").change(function() { x = 0; BigTree.localTable = $(this).val(); $(this).parents("fieldset").nextAll("fieldset").each(function() { div = $(this).find("div");
function oAuthRefreshToken() { $r = json_decode(BigTree::cURL($this->TokenURL, array("client_id" => $this->Settings["key"], "client_secret" => $this->Settings["secret"], "refresh_token" => $this->Settings["refresh_token"], "grant_type" => "refresh_token"))); if ($r->access_token) { $this->Settings["token"] = $r->access_token; $this->Settings["expires"] = strtotime("+" . $r->expires_in . " seconds"); } }
<?php //!BigTree Warnings $warnings = array(); $writable_directories = array("cache/", "custom/inc/modules/", "custom/admin/ajax/developer/field-options/", "custom/admin/form-field-types/draw/", "custom/admin/form-field-types/process/", "templates/routed/", "templates/basic/", "templates/callouts/", "site/files/"); foreach ($writable_directories as $directory) { if (!BigTree::isDirectoryWritable(SERVER_ROOT . $directory)) { $warnings[] = array("parameter" => "Directory Permissions Error", "rec" => "Make " . SERVER_ROOT . $directory . " writable.", "status" => "bad"); } } // Go through every module form and look for uploads, make sure the directories exist and are writable. $forms = array_merge($admin->getModuleForms(), $admin->getModuleEmbedForms()); foreach ($forms as $form) { foreach (array_filter((array) $form["fields"]) as $key => $data) { if ($data["directory"]) { if (!BigTree::isDirectoryWritable(SITE_ROOT . $data["directory"])) { $warnings[] = array("parameter" => "Directory Permissions Error", "rec" => "Make " . SITE_ROOT . $data["directory"] . " writable.", "status" => "bad"); } } } } // Search all content for links to the admin. $bad = $admin->getPageAdminLinks(); foreach ($bad as $f) { $warnings[] = array("parameter" => "Bad Admin Links", "rec" => 'Remove links to Admin on <a href="' . ADMIN_ROOT . 'pages/edit/' . $f["id"] . '/">' . $f["nav_title"] . '</a>', "status" => "ok"); } if (!file_exists(SITE_ROOT . "favicon.ico")) { $warnings[] = array("parameter" => "Missing Favicon", "rec" => "Create a favicon and place it in the /site/ root.", "status" => "ok"); } //!Server Parameters $mysql = extension_loaded('mysql') || extension_loaded("mysqli") ? "good" : "bad";
} ?> <?php foreach ($list as $option) { ?> <option value="<?php echo BigTree::safeEncode($option["value"]); ?> "<?php if ($field["value"] == $option["value"]) { ?> selected="selected"<?php } if ($option["access_level"]) { ?> data-access-level="<?php echo $option["access_level"]; ?> "<?php } ?> ><?php echo BigTree::safeEncode(BigTree::trimLength(strip_tags($option["description"]), 100)); ?> </option> <?php } ?> </select> <?php }
<?php // Check whether our database is running the latest revision of BigTree or not. $current_revision = $cms->getSetting("bigtree-internal-revision"); if ($current_revision < BIGTREE_REVISION && $admin->Level > 1) { BigTree::redirect(DEVELOPER_ROOT . "upgrade/database/"); } // Check for newer versions of BigTree $ignored_all = true; if (!$_COOKIE["bigtree_admin"]["deferred_update"]) { $updates = array_filter((array) @json_decode(BigTree::cURL("http://www.bigtreecms.org/ajax/version-check/?current_version=" . BIGTREE_VERSION, false, array(CURLOPT_CONNECTTIMEOUT => 1, CURLOPT_TIMEOUT => 5)), true)); // See if we've ignored these updates $ignorable = array(); foreach ($updates as $update) { if (!$_COOKIE["bigtree_admin"]["ignored_update"][$update["version"]]) { $ignored_all = false; } $ignorable[] = $update["version"]; } } // If we're ignoring updates through config, still ignore them if (!empty($bigtree["config"]["ignore_admin_updates"])) { $ignored_all = true; } // Updates are available and we didn't ignore them if (!$ignored_all && count($updates)) { ?> <div class="container"> <summary><h2>Update Available</h2></summary> <section> <p>You are currently running BigTree <?php
BigTree::globalizeArray($view); ?> <div class="table" id="" class="image_list"> <summary><h2>Search Results</h2></summary> <header> <span class="view_column">Click an image to edit it.</span> </header> <section> <ul id="image_list_<?php echo $view["id"]; ?> " class="image_list"> <?php foreach ($items as $item) { if ($options["preview_prefix"]) { $preview_image = BigTree::prefixFile($item[$options["image"]], $options["preview_prefix"]); } else { $preview_image = $item[$options["image"]]; } ?> <li id="row_<?php echo $item["id"]; ?> "> <a class="image" href="<?php echo $view["edit_url"] . $item["id"]; ?> /"><img src="<?php echo $preview_image; ?> " alt="" /></a>
<?php // Prevent including files outside feed-options $type = BigTree::cleanFile($_POST["type"]); $table = $_POST["table"]; $data = json_decode(str_replace(array("\r", "\n"), array('\\r', '\\n'), $_POST["data"]), true); $path = BigTree::path("admin/ajax/developer/feed-options/{$type}.php"); if (file_exists($path)) { include $path; }
// Modified Photo Gallery to add Attribution and Link attributes $photos = is_array($field["value"]) ? $field["value"] : array(); $max = count($photos); $current = 0; $button_options = htmlspecialchars(json_encode(array("minWidth" => $field["options"]["min_width"], "minHeight" => $field["options"]["min_height"]))); ?> <div class="photo_gallery_widget" id="<?php echo $field["id"]; ?> "> <ul> <?php foreach ($photos as $photo) { if ($field["options"]["preview_prefix"]) { $preview_image = BigTree::prefixFile($photo["image"], $field["options"]["preview_prefix"]); } else { $preview_image = $photo["image"]; } ?> <li> <figure> <img src="<?php echo $preview_image; ?> " alt="" /> </figure> <input type="hidden" name="<?php echo $field["key"]; ?> [<?php
<?php BigTree::globalizeArray($_SESSION["bigtree_admin"]["form_data"]); ?> <div class="container"> <section> <div class="alert"> <span></span> <p>Your submission had <?php echo count($errors); ?> error<?php if (count($errors) != 1) { ?> s<?php } ?> .</p> </div> <div class="table error_table"> <header> <span class="view_column field">Field</span> <span class="view_column error">Error</span> </header> <ul> <?php foreach ($errors as $error) { ?> <li> <section class="view_column field"><?php echo $error["field"];
<?php $setting = $admin->getSetting($_POST["id"]); if ($setting["locked"]) { $admin->requireLevel(2); } else { $admin->requireLevel(1); } $title = $setting["title"]; $value = $setting["value"]; $key = $setting["id"]; ?> <div style="width: 460px;"> <input type="hidden" name="setting-id" value="<?php echo $_POST["id"]; ?> " /> <?php if ($setting["description"]) { ?> <p><?php echo $setting["description"]; ?> </p> <?php } ?> <?php include BigTree::path("admin/form-field-types/draw/" . $setting["type"] . ".php"); ?> </div>
$sizes = BigTree::getThumbnailSizes($first_copy, $thumb["width"], $thumb["height"]); if (!BigTree::imageManipulationMemoryAvailable($first_copy, $sizes[3], $sizes[4], $iwidth, $iheight)) { $error = "Image uploaded is too large for the server to manipulate. Please upload a smaller version of this image."; unlink($first_copy); } } } if (!$error) { // Now let's make the thumbnails we need for the image manager $thumbs = array(); $pinfo = BigTree::pathInfo($file_name); // Create a bunch of thumbnails foreach ($thumbnails_to_create as $key => $thumb) { if ($iwidth > $thumb["width"] || $iheight > $thumb["height"]) { $temp_thumb = SITE_ROOT . "files/" . uniqid("temp-") . $itype_exts[$itype]; BigTree::createThumbnail($first_copy, $temp_thumb, $thumb["width"], $thumb["height"]); if ($key == "bigtree_internal_list") { list($twidth, $theight) = getimagesize($temp_thumb); $margin = floor((100 - $theight) / 2); } if ($replacing) { $file = $storage->replace($temp_thumb, $thumb["prefix"] . $pinfo["basename"], "files/resources/"); } else { $file = $storage->store($temp_thumb, $thumb["prefix"] . $pinfo["basename"], "files/resources/"); } $thumbs[$key] = $file; } } // Upload the original to the proper place. if ($replacing) { $file = $storage->replace($first_copy, $file_name, "files/resources/");
$.ajax("<?php echo ADMIN_ROOT; ?> ajax/pages/order/", { type: "POST", data: { id: "<?php echo $page["id"]; ?> ", sort: $("#pages_<?php echo $class; ?> ").sortable("serialize") } }); }}); </script> <?php } } include BigTree::path("admin/modules/pages/_properties.php"); ?> <h3>Subpages</h3> <?php $nav_visible = array_merge($admin->getNaturalNavigationByParent($page["id"], 1), $admin->getPendingNavigationByParent($page["id"])); $nav_hidden = array_merge($admin->getHiddenNavigationByParent($page["id"]), $admin->getPendingNavigationByParent($page["id"], "")); $nav_archived = $admin->getArchivedNavigationByParent($page["id"]); if (count($nav_visible) || count($nav_hidden) || count($nav_archived)) { // Drag Visible Pages if (count($nav_visible)) { local_drawPageTree($nav_visible, "Visible", "", "pages", true); } // Draw Hidden Pages if (count($nav_hidden)) { local_drawPageTree($nav_hidden, "Hidden", "Not Appearing In Navigation", "hidden", false); }
$x = 0; } $x++; ?> <li class="page_<?php echo $page; ?> "<?php if ($page > 0) { ?> style="display: none;"<?php } ?> > <section class="messages_from_to"><span class="gravatar"><img src="<?php echo BigTree::gravatar($item["sender_email"], 36); ?> " alt="" /></span><?php echo $item["sender_name"]; ?> </section> <section class="messages_subject"><?php echo $item["subject"]; ?> </section> <section class="messages_date_time"><?php echo date("n/j/y", strtotime($item["date"])); ?> </section> <section class="messages_date_time"><?php echo date("g:ia", strtotime($item["date"]));
<?php BTXSocialFeed::sync(); $admin->growl("Social Feed", "Synced Stream"); BigTree::redirect(MODULE_ROOT);
<div class="form_fields"> <?php $bigtree["html_fields"] = array(); $bigtree["simple_html_fields"] = array(); $bigtree["tabindex"] = 1; $bigtree["field_namespace"] = uniqid("template_field_"); $bigtree["field_counter"] = 0; // We alias $bigtree["entry"] to $bigtree["resources"] so that information is in the same place for field types. $bigtree["entry"] =& $bigtree["resources"]; if (is_array($bigtree["template"]["resources"]) && count($bigtree["template"]["resources"])) { foreach ($bigtree["template"]["resources"] as $resource) { $field = array("type" => $resource["type"], "title" => $resource["title"], "subtitle" => $resource["subtitle"], "key" => "resources[" . $resource["id"] . "]", "value" => isset($bigtree["resources"][$resource["id"]]) ? $bigtree["resources"][$resource["id"]] : "", "tabindex" => $bigtree["tabindex"], "options" => $resource["options"]); BigTreeAdmin::drawField($field); } } else { echo '<p>There are no resources for the selected template.</p>'; } ?> </div> <?php $bigtree["html_editor_width"] = 898; $bigtree["html_editor_height"] = 365; include BigTree::path("admin/layouts/_html-field-loader.php"); $bigtree["tinymce_fields"] = array_merge($bigtree["html_fields"], $bigtree["simple_html_fields"]); ?> <script> BigTree.TinyMCEFields = <?php echo json_encode($bigtree["tinymce_fields"]); ?> ; </script>
<?php echo BigTree::curl("http://www.bigtreecms.org/ajax/extensions/exists/?id=" . urlencode($_GET["id"]));
<?php $admin->processCrops(json_decode($_POST["crop_info"], true)); // For embedded forms we let them process crops first since we're not saving the data to the database and we'll lose their uploads otherwise if (count($_SESSION["bigtree_admin"]["form_data"]["errors"])) { BigTree::redirect($bigtree["form_root"] . "error/?id=" . $bigtree["form"]["id"] . "&hash=" . $bigtree["form"]["hash"]); } else { unset($_SESSION["bigtree_admin"]["form_data"]); BigTree::redirect($bigtree["form_root"] . "complete/?id=" . $bigtree["form"]["id"] . "&hash=" . $bigtree["form"]["hash"]); }
if (file_exists($header)) { $headers[] = $header; } if (file_exists($footer)) { $footers[] = $footer; } } } // Draw the headers. foreach ($headers as $header) { include $header; } // Draw the main page. include $inc; // Draw the footers. $footers = array_reverse($footers); foreach ($footers as $footer) { include $footer; } } else { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); define("BIGTREE_404", true); include BigTree::path("admin/pages/_404.php"); } // If we have a page, just include it. } else { include $inc; } $bigtree["content"] = ob_get_clean(); include BigTree::path("admin/layouts/" . $bigtree["layout"] . ".php");
<?php $item = $admin->getSetting(end($bigtree["path"])); if ($item["system"]) { $admin->growl("Developer", "Access Denied", "error"); BigTree::redirect(DEVELOPER_ROOT . "settings/"); } else { $success = $admin->updateSetting(end($bigtree["path"]), $_POST); if ($success) { $admin->growl("Developer", "Updated Setting"); BigTree::redirect(DEVELOPER_ROOT . "settings/"); } else { $_SESSION["bigtree_admin"]["developer"]["setting_data"] = $_POST; $_SESSION["bigtree_admin"]["developer"]["error"] = "The ID you specified is already in use by another Setting."; BigTree::redirect(DEVELOPER_ROOT . "settings/edit/" . end($bigtree["path"]) . "/"); } }
<?php // Route to common if we hit something in a sub directory that doesn't exist. if (count($bigtree["commands"])) { include BigTree::path("admin/modules/developer/services/_" . $bigtree["commands"][0] . ".php"); if ($bigtree["commands"][1]) { include BigTree::path("admin/modules/developer/services/common/" . $bigtree["commands"][1] . ".php"); } else { include BigTree::path("admin/modules/developer/services/common/default.php"); } } else { // Figure out which are connected $twitter = new BigTreeTwitterAPI(); $instagram = new BigTreeInstagramAPI(); $google = new BigTreeGooglePlusAPI(); $youtube = new BigTreeYouTubeAPI(); $flickr = new BigTreeFlickrAPI(); $disqus = new BigTreeDisqusAPI(); $salesforce = new BigTreeSalesforceAPI(); ?> <div class="table"> <summary><h2>Configure</h2></summary> <section> <a class="box_select<?php if ($twitter->Connected) { ?> connected<?php } ?> " href="twitter/"> <span class="twitter"></span>
<?php $user = $admin->getUser($admin->ID); $bigtree["gravatar"] = $user["email"]; BigTree::globalizeArray($user, array("htmlspecialchars")); $error = false; if (isset($_SESSION["bigtree_admin"]["update_profile"])) { BigTree::globalizeArray($_SESSION["bigtree_admin"]["update_profile"], array("htmlspecialchars")); $daily_digest = isset($daily_digest) ? $daily_digest : false; unset($_SESSION["bigtree_admin"]["update_profile"]); $error = true; } ?> <div class="container"> <form class="module" action="<?php echo ADMIN_ROOT; ?> users/profile/update/" method="post"> <section> <p class="error_message"<?php if (!$error) { ?> style="display: none;"<?php } ?> >Errors found! Please fix the highlighted fields before submitting.</p> <div class="left"> <fieldset> <label>Name</label> <input type="text" name="name" value="<?php echo $name;