From 9e3e8c31dfe667b4c5b45a18adf3065fda92a0f4 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Fri, 11 May 2012 03:33:05 +0200 Subject: [PATCH] [CPHP] Add global variables for Templater class --- frontend/cphp/class.templater.php | 5 +++++ frontend/locales/english.lng | 3 +++ frontend/rewrite.php | 2 ++ 3 files changed, 10 insertions(+) diff --git a/frontend/cphp/class.templater.php b/frontend/cphp/class.templater.php index fd69fe6..d1c83e6 100644 --- a/frontend/cphp/class.templater.php +++ b/frontend/cphp/class.templater.php @@ -14,6 +14,7 @@ if($_CPHP !== true) { die(); } $template_cache = array(); +$template_global_vars = array(); class Templater { @@ -80,8 +81,12 @@ class Templater public function Compile($strings) { + global $template_global_vars; + if(!is_null($this->tpl)) { + $strings = array_merge($strings, $template_global_vars); + $this->tpl_rendered = $this->ParseForEach($this->tpl_rendered, $strings); $this->tpl_rendered = $this->ParseIf($this->tpl_rendered, $strings); diff --git a/frontend/locales/english.lng b/frontend/locales/english.lng index 69c5c88..cfc62c9 100644 --- a/frontend/locales/english.lng +++ b/frontend/locales/english.lng @@ -31,6 +31,7 @@ title-console; Out-of-band console title-admin-userlist; User overview title-admin-containerlist; Container overview title-admin-userinfo; User lookup +title-admin-overview; Administrative overview header-admin-user-containers; Containers owned by this user @@ -119,3 +120,5 @@ admin-level-enduser; End user admin-level-reseller; Reseller admin-level-nodeadmin; Node administrator admin-level-masteradmin; Master administrator + +admin-overview-message; In the future, this page will hold a log of all most recent events. For now, it's just an empty page. diff --git a/frontend/rewrite.php b/frontend/rewrite.php index c18d04f..d7768f1 100644 --- a/frontend/rewrite.php +++ b/frontend/rewrite.php @@ -20,6 +20,7 @@ if(!empty($_SESSION['userid'])) { $sUser = new User($_SESSION['userid']); $sLoggedIn = true; + $template_global_vars['accesslevel'] = $sUser->sAccessLevel; $sTemplateParameters = array_merge($sTemplateParameters, array( 'username' => $sUser->sUsername )); @@ -28,6 +29,7 @@ else { $sUser = new User(0); $sLoggedIn = false; + $template_global_vars['accesslevel'] = 0; } $sMainContents = "";