<?php if (file_exists("../include/elation.php")) { require_once "../include/elation.php"; } else { require_once "elation.php"; } $root = preg_replace("|/htdocs\$|", "", getcwd()); chdir($root); elation_readpaths($root); include_once "include/webapp_class.php"; include_once "lib/profiler.php"; Profiler::StartTimer("Total"); $req = array(); if (!empty($_GET)) { if (isset($_GET["path"])) { unset($_GET["path"]); } $req = array_merge($req, $_GET); } if (!empty($_POST)) { $req = array_merge($req, $_POST); } $webapp = new WebApp($root, $req); $webapp->Display(); Profiler::StopTimer("Total"); if (!empty($_REQUEST["_timing"])) { print Profiler::Display(); }
function Display($path = NULL, $args = NULL) { $path = any($path, $this->request["path"], "/"); $args = any($args, $this->request["args"], array()); if (!empty($this->components)) { try { $output = $this->components->Dispatch($path, $args, $this->request["type"]); } catch (Exception $e) { //print_pre($e); $output["content"] = $this->HandleException($e); } $this->session->quit(); $contegargs = any($this->cfg->servers["conteg"], array()); $sitecfg = ConfigManager::get("conteg"); if (is_array($sitecfg)) { $contegargs = array_merge($contegargs, $sitecfg); } if (is_array($this->sitecfg["conteg"])) { $contegargs = array_merge($contegargs, $this->sitecfg["conteg"]); } if (empty($contegargs["type"])) { $contegargs["type"] = any($this->request["contenttype"], $output["responsetype"]); } if (is_array($contegargs["policy"][$contegargs["type"]])) { $contegargs = array_merge($contegargs, $contegargs["policy"][$contegargs["type"]]); } if (empty($contegargs["modified"])) { // Set modified time to mtime of base directory if not set $contegargs["modified"] = filemtime($this->rootdir); } if (!empty($contegargs["alloworigin"])) { header('Access-Control-Allow-Origin: ' . $contegargs["alloworigin"]); } //header('Content-type: ' . any($output["type"], "text/html")); if ($output["type"] == "ajax" || $output["type"] == "jsonp") { print $this->tplmgr->PostProcess($output["content"], true); } else { print $this->tplmgr->PostProcess($output["content"]); $showprofiler = !empty($this->request["args"]["timing"]) || $output["type"] == "text/html" && array_get($this->cfg->servers, "profiler.display"); if ($showprofiler) { print Profiler::Display(); } } Profiler::StopTimer("WebApp::TimeToDisplay"); Profiler::StartTimer("WebApp::Display() - Conteg", 1); new Conteg($contegargs); Profiler::StopTimer("WebApp::Display() - Conteg"); if (Profiler::$log) { Profiler::Log(DependencyManager::$locations["tmp"], $this->components->pagecfg["pagename"]); } } }
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <?if($layout->description!=""):?><meta name="description" content="{{$layout->description}}" /><?endif; ?> <title>{{$layout->title}}</title> <layout:includes /> <layout:styles /> <layout:blocks /> </head> <body> <div id="container"> <div id="header"> <img src="/i/logo.png" /> <a href="https://manage.slicehost.com" target="_blank">Slicehost.com</a> </div> <div id="nav"> <ul> <li {{ ($loc=='') ? 'class="selected"' : '' }}><a href="/">Dashboard</a></li> <li {{ ($loc=='slices') ? 'class="selected"' : '' }}><a href="/slices">Clouds</a></li> <li {{ ($loc=='configs') ? 'class="selected"' : '' }}><a href="/configs">Configurations</a></li> <li {{ ($loc=='inventories') ? 'class="selected"' : '' }}><a href="/inventory">Inventory</a></li> <li {{ ($loc=='accounts') ? 'class="selected"' : '' }}><a href="/accounts">Accounts</a></li> </ul> </div> <layout:content id="main" wrap="div" use_id="true" /> </div> <? if (!isset($_GET['noprofiler'])) Profiler::Display(); ?> </body> </html>
function controller_profiler($args) { return Profiler::Display(E_ALL); }
function Display($path = NULL, $args = NULL) { $path = any($path, $this->request["path"], "/"); $args = any($args, $this->request["args"], array()); if (!empty($this->components)) { try { $output = $this->components->Dispatch($path, $args, $this->request["type"]); } catch (Exception $e) { //print_pre($e); $output["content"] = $this->HandleException($e); } $this->session->quit(); $headers = headers_list(); $isRedirect = false; $ctype = null; foreach ($headers as $header) { list($k, $v) = explode(": ", $header, 2); if ($k == "Location") { $isRedirect = true; } if ($k == "Content-Type") { $ctype = $v; } } if (!$isRedirect) { // Load settings from servers.ini $contegargs = isset($this->cfg->servers["conteg"]) ? $this->cfg->servers["conteg"] : array(); $contegargs["charset"] = "UTF-8"; // FIXME - shouldn't be hardcoded, but we should also replace Conteg... $contegargs["cache_control"]["macro"] = "public"; $contegargs["use_etags"] = true; // And also from site config $contegcfg = ConfigManager::get("conteg"); if (is_array($contegcfg)) { $contegargs = array_merge($contegargs, $contegcfg); } if (empty($contegargs["type"])) { $contegargs["type"] = any($ctype, $this->request["contenttype"], $output["responsetype"]); } // Merge type-specific policy settings from config if applicable if (isset($contegargs["policy"]) && is_array($contegargs["policy"][$contegargs["type"]])) { $contegargs = array_merge($contegargs, $contegargs["policy"][$contegargs["type"]]); } if (empty($contegargs["modified"])) { // Set modified time to mtime of base directory if not set $contegargs["modified"] = filemtime($this->rootdir); } if ($output["type"] == "ajax" || $output["type"] == "jsonp") { print $this->tplmgr->PostProcess($output["content"], true); } else { print $this->tplmgr->PostProcess($output["content"]); if (!empty($this->request["args"]["timing"])) { print Profiler::Display(); } } if ($output["http_status"]) { $contegargs["http_status"] = $output["http_status"]; } Profiler::StopTimer("WebApp::TimeToDisplay"); Profiler::StartTimer("WebApp::Display() - Conteg", 1); new Conteg($contegargs); Profiler::StopTimer("WebApp::Display() - Conteg"); } if (Profiler::$log) { Profiler::Log(DependencyManager::$locations["tmp"], $this->components->pagecfg["pagename"]); } } }