1) { $bigtree["path"] = array_slice($bigtree["path"],$x - 1); } if (file_exists("../custom/admin/router.php")) { include "../custom/admin/router.php"; } else { include "../core/admin/router.php"; } die(); } // See if we're in a multi-domain setup if (!empty($bigtree["config"]["sites"]) && count($bigtree["config"]["sites"])) { // Figure out which domain we're in foreach ($bigtree["config"]["sites"] as $site_key => $site_data) { $domain_match = str_replace(array("http://", "https://"), "", $site_data["domain"]); if ($domain_match == $_SERVER["HTTP_HOST"]) { define("BIGTREE_SITE_KEY", $site_key); define("BIGTREE_SITE_TRUNK", intval($site_data["trunk"])); define("BIGTREE_CACHE_DIRECTORY", $server_root."cache/".BIGTREE_SITE_KEY."/"); if (!file_exists(BIGTREE_CACHE_DIRECTORY)) { mkdir(BIGTREE_CACHE_DIRECTORY, 0777); } $domain = rtrim($site_data["domain"], "/"); $www_root = $site_data["www_root"]; $static_root = !empty($site_data["static_root"]) ? $site_data["static_root"] : $www_root; } } } if (!defined("BIGTREE_SITE_KEY")) { define("BIGTREE_CACHE_DIRECTORY", $server_root."cache/"); } // We're not in the admin, see if caching is enabled and serve up a cached page if it exists if ($bigtree["config"]["cache"] && $bigtree["path"][0] != "_preview" && $bigtree["path"][0] != "_preview-pending") { $cache_location = md5(json_encode($_GET)); $file = BIGTREE_CACHE_DIRECTORY.$cache_location.".page"; // If the file is at least 5 minutes fresh, serve it up. clearstatcache(); $ttl = !empty($bigtree["config"]["cache_ttl"]) ? $bigtree["config"]["cache_ttl"] : 300; if (file_exists($file) && filemtime($file) > (time() - $ttl)) { readfile($file); die(); } } // Clean up the variables we set. unset($config,$debug,$in_admin,$parts_of_admin,$x); // Bootstrap BigTree if (file_exists("../custom/bootstrap.php")) { include "../custom/bootstrap.php"; } else { include "../core/bootstrap.php"; } // Route BigTree if (file_exists("../custom/router.php")) { include "../custom/router.php"; } else { include "../core/router.php"; } ?>