public function view($filePath = false, $data = array(), $pass_vars = false) { if ($filePath === false) { if ($obj = $this->getController()) { $this->logController($obj); $res = $obj->result($this); $res = is_array($res) ? $res : array(); $this->data = array_merge($this->data, $res); } extract($this->data); $this->logBuild(); if ($this->filePath) { $this->logExecute(); require $this->filePath; } } else { $view = new solumView($filePath, $data ? $pass_vars ? array_merge($data, $this->data) : $data : $this->data); $view->view(); } }
} require 'php/http/sessioncookie.class.php'; require 'php/http/controller.class.php'; require 'php/http/adminController.class.php'; require 'php/http/request.class.php'; require 'php/http/solumView.class.php'; require 'php/http/cms.class.php'; require 'php/http/lib_compat.php'; $coreTime = sprintf('%0.5f', (microtime(true) - $coreTime) * 1000); $appTime = microtime(true); sessionCookie::init(); /**init the page**/ request::addConfig($config); $user = sessionCookie::getUser(); $default_vars = array('authenticated' => sessionCookie::$session['logged_in'], 'user' => $user); $view = new solumView('master', $default_vars); $view->view(); /** done **/ if (request::readConfig('tracking_enabled')) { /* $users_id = $user?$user['users_id']:0; DB::write("INSERT INTO `metrics`.`requests`(time,day_time,users_id,session_key,ip,user_agent,uri,referer) values(".time().",".day_time().",".$users_id.",'".sessionCookie::$session['key']."','".$_SERVER['REMOTE_ADDR']."','".DB::sqlEsc($_SERVER['HTTP_USER_AGENT'])."','".DB::sqlEsc($_SERVER['REQUEST_URI'])."','".(isset($_SERVER['HTTP_REFERER'])?DB::sqlEsc($_SERVER['HTTP_REFERER']):'')."') "); */ } if (!request::readConfig('debug')) { exit; } if (request::get(0) == 'ajax') { exit; } $appTime = sprintf('%0.5f', (microtime(true) - $appTime) * 1000);
protected function loadViewHTML($view, $vars = array()) { $vars = array_merge($this->view->export(), $vars); ob_start(); $view = new solumView($view, $vars); $view->view(); $html = ob_get_contents(); ob_end_clean(); //passvar from page tpl to the base view $this->view->import($view->export()); return $html; }
function getDebugInfo() { $out = "<div style='clear:both;border:1px solid blue;margin:5px;background:#d4d4d4;padding:3px;margin-left:10px;mergin-right:10px;color:#000;'>\n\t\t\t<div style='background:white;padding:3px;'>\n\t\t\t\t<div>\n\t\t\t\t\t<b>benchmarks:</b>\n\t\t\t\t\t<div style='margin:5px;background:#D9FFCE;'>"; foreach (bench::get_marks() as $m) { $out .= "<div>{$m}: " . bench::elapsed_ms($m) . " ms</div>"; } $out .= "<hr/>\n\t\t\t\t\t\t<div>peak memory: " . (int) (memory_get_peak_usage() / 1024) . " kb</div>\n\t\t\t\t\t\t<div>database reads: " . db::$query_count . " </div>\n\t\t\t\t\t\t<div>database writes: " . db::$query_count_w . " </div>\n\t\t\t\t\t\t<div>database read time: " . sprintf('%0.5f', db::$query_time * 1000) . " ms</div>\n\t\t\t\t\t\t<div>database write time: " . sprintf('%0.5f', db::$query_time_w * 1000) . " ms</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<b>database queries:</b>" . (QUERY_LIST ? '[query list enabled]' : '[query list DISABLED]') . "\n\t\t\t\t\t<div style='margin:5px;background:#D9FFCE;'>\n\t\t\t\t\t\t<pre>" . db::$query_list . "</pre>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<b>session data:</b>\n\t\t\t\t\t<div style='margin:5px;background:#D9FFCE;'>"; foreach (sessionCookie::$session as $k => $v) { $out .= "<div>{$k}: {$v}</div>"; } $out .= "</div>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<b>data log:</b>\n\t\t\t\t\t<div style='margin:5px;background:#D9FFCE;'>\n\t\t\t\t\t\t<pre>" . Data::getDataLog() . "</pre>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<b>view log:</b>\n\t\t\t\t\t<div style='margin:5px;background:#D9FFCE;'>\n\t\t\t\t\t\t<pre>" . solumView::getViewLog() . "</pre>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>"; return $out; }