[CPHP] Add global variables for Templater class

feature/node-rewrite
Sven Slootweg 13 years ago
parent 8d7edd593e
commit 9e3e8c31df

@ -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);

@ -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.

@ -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 = "";

Loading…
Cancel
Save