From 7341c172b0754194233c787f14f2cde95c75205d Mon Sep 17 00:00:00 2001 From: anuko Date: Sun, 14 Jan 2018 13:52:26 +0000 Subject: [PATCH] A bit more refactoring. --- WEB-INF/lib/Auth.class.php | 3 ++- WEB-INF/lib/auth/Auth_ldap.class.php | 5 ++--- WEB-INF/templates/footer.tpl | 2 +- access_denied.php | 2 +- initialize.php | 1 - mobile/access_denied.php | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/WEB-INF/lib/Auth.class.php b/WEB-INF/lib/Auth.class.php index 2c3c657d..354d34ba 100644 --- a/WEB-INF/lib/Auth.class.php +++ b/WEB-INF/lib/Auth.class.php @@ -36,7 +36,8 @@ class Auth { // die ("Your browser's cookie functionality is turned off. Please turn it on."); // } - $GLOBALS['SMARTY']->assign('authenticated', true); // Used in header.tpl for menu display. + global $smarty; + $smarty->assign('authenticated', true); // Used in header.tpl for menu display. return true; } session_write_close(); diff --git a/WEB-INF/lib/auth/Auth_ldap.class.php b/WEB-INF/lib/auth/Auth_ldap.class.php index f99d752a..e17b6e7c 100644 --- a/WEB-INF/lib/auth/Auth_ldap.class.php +++ b/WEB-INF/lib/auth/Auth_ldap.class.php @@ -53,10 +53,9 @@ class Auth_ldap extends Auth { function __construct($params) { + global $smarty; $this->params = $params; - if (isset($GLOBALS['smarty'])) { - $GLOBALS['smarty']->assign('Auth_ldap_params', $this->params); - } + $smarty->assign('Auth_ldap_params', $this->params); } function ldap_escape($str){ diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 1279cfa3..7c5a8ab2 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.13.15.3746 | Copyright © Anuko | +  Anuko Time Tracker 1.13.15.3747 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/access_denied.php b/access_denied.php index d5c58fe2..65a5ed72 100644 --- a/access_denied.php +++ b/access_denied.php @@ -29,7 +29,7 @@ require_once('initialize.php'); $err->add($i18n->getKey('error.access_denied')); -if ($auth->isAuthenticated()) $GLOBALS['SMARTY']->assign('authenticated', true); // Used in header.tpl for menu display. +if ($auth->isAuthenticated()) $smarty->assign('authenticated', true); // Used in header.tpl for menu display. $smarty->assign('title', $i18n->getKey('label.error')); $smarty->assign('content_page_name', 'access_denied.tpl'); diff --git a/initialize.php b/initialize.php index 689925d3..c1a8437a 100644 --- a/initialize.php +++ b/initialize.php @@ -74,7 +74,6 @@ $smarty = new Smarty; $smarty->use_sub_dirs = false; $smarty->template_dir = TEMPLATE_DIR; $smarty->compile_dir = TEMPLATE_DIR.'_c'; -$GLOBALS['SMARTY'] = &$smarty; // Note: these 3 settings below used to be in .htaccess file. Moved them here to eliminate "error 500" problems // with some shared hostings that do not have AllowOverride Options or AllowOverride All in their apache configurations. diff --git a/mobile/access_denied.php b/mobile/access_denied.php index 836579a5..b0bc0028 100644 --- a/mobile/access_denied.php +++ b/mobile/access_denied.php @@ -29,7 +29,7 @@ require_once('../initialize.php'); $err->add($i18n->getKey('error.access_denied')); -if ($auth->isAuthenticated()) $GLOBALS['SMARTY']->assign('authenticated', true); // Used in header.tpl for menu display. +if ($auth->isAuthenticated()) $smarty->assign('authenticated', true); // Used in header.tpl for menu display. $smarty->assign('title', $i18n->getKey('label.error')); $smarty->assign('content_page_name', 'mobile/access_denied.tpl'); -- 2.20.1