Move always included vars to init.php because it is confusing when not logged in.
authorstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 18 Aug 2006 21:27:51 +0000 (21:27 +0000)
committerstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 18 Aug 2006 21:27:51 +0000 (21:27 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11614 7612ce4b-ef26-0410-bec9-ea0150e637f0

class/template/template.class.php
include/init.php

index 238d0d1379ae8f05881985de5f44c0170f26d564..238b8ac1aead520e3b5b11d785d1f919057df3ee 100755 (executable)
@@ -203,17 +203,6 @@ class Template
    */
   function display($file)
   {
-    /**
-     * We want to make sure that certain variables are always passed to the
-     * templates b/c they are critical to certain template functions.
-     */
-    $always_include = array('icon_theme_path', 'sTplDir');
-    foreach ($always_include as $var) {
-        if (!isset($this->values[$var]) && isset($GLOBALS[$var])) {
-            $this->assign($var, $GLOBALS[$var]);
-        }
-    }
-    
     // Pull in our config file
     $t = &$this->values; // place values array directly in scope
 
index 0e00ac2477fe8d9d2d00f994692cb7e92b91f9a6..9ec05a318219ccdaefdeca7d4eefc83cb7035193 100644 (file)
@@ -509,6 +509,12 @@ if (!isset($sTplDir)) {
 }
 $oTemplate = new Template($sTplDir);
 
+// We want some variables to always be available to the template
+$always_include = array('sTplDir', 'icon_theme_path');
+foreach ($always_include as $var) {
+    $oTemplate->assign($var, (isset($$var) ? $$var : NULL));
+}
+
 /**
  * Initialize our custom error handler object
  */