Fix E_STRICT notices
[squirrelmail.git] / class / template / Smarty_Template.class.php
index 1e4dde88a7b50e97e9be6d15c5ac2fd57650f57a..fb83905f26befb736e22f9d07adf168944bbe66b 100644 (file)
@@ -7,7 +7,7 @@
   * SquirrelMail and Smarty.  All abstract methods from the Template class
   * are implemented here.
   *
-  * @copyright © 2003-2006 The SquirrelMail Project Team
+  * @copyright 2003-2012 The SquirrelMail Project Team
   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
   * @version $Id$
   * @package squirrelmail
@@ -20,7 +20,7 @@
   * The SquirrelMail Smarty Template class.  Extends the base
   * Template class for use with Smarty template pages.
   *
-  * @author Paul Lesniewski
+  * @author Paul Lesniewski <paul at squirrelmail.org>
   * @package squirrelmail
   *
   */
@@ -54,37 +54,26 @@ class Smarty_Template extends Template
         parent::Template($template_id);
 
 
-        // pull in the tempalte config file and load smarty settings
+        // load smarty settings
         //
-        $template_config_file = SM_PATH . $this->get_template_file_directory()
-                              . 'config.php';
-        if (!file_exists($template_config_file)) {
-
-            trigger_error('No template configuration file was found where expected: ("'
-                        . $template_config_file . '")', E_USER_ERROR);
-
-        } else {
-
-            require($template_config_file);
-
-
-            // instantiate and set up Smarty object
-            //
-//LEFT OFF HERE - check for this as empty or not
-            require($smarty_path);
-            $this->smarty_template = new Smarty();
-//LEFT OFF HERE - check for these as empty or not.... I think we at least need compile dir?
-            $this->smarty_template->compile_dir = $smarty_compile_dir;
-            $this->smarty_template->cache_dir = $smarty_cache_dir;
-            $this->smarty_template->config_dir = $smarty_config_dir;
-
-            // note that we do not use Smarty's template_dir 
-            // because SquirrelMail has its own method of 
-            // determining template file paths
-            //
-            //$this->smarty_template->template_dir = 
-
-        }
+        // instantiate and set up Smarty object
+        //
+        $smarty_path 
+            = Template::get_template_config($this->template_set_id, 'smarty_path');
+        require($smarty_path);
+        $this->smarty_template = new Smarty();
+        $this->smarty_template->compile_dir 
+            = Template::get_template_config($this->template_set_id, 'smarty_compile_dir');
+        $this->smarty_template->cache_dir 
+            = Template::get_template_config($this->template_set_id, 'smarty_cache_dir');
+        $this->smarty_template->config_dir 
+            = Template::get_template_config($this->template_set_id, 'smarty_config_dir');
+
+        // note that we do not use Smarty's template_dir 
+        // because SquirrelMail has its own method of 
+        // determining template file paths
+        //
+        //$this->smarty_template->template_dir = 
 
     }
 
@@ -120,6 +109,35 @@ FIXME: Proposed idea to add a parameter here that turns variable
 
     }
 
+    /**
+      * Clears the values of all assigned varaiables.
+      *
+      */
+    function clear_all_assign() {
+
+        $this->smarty_template->clear_all_assign();
+
+    }
+
+    /**
+      * Returns assigned variable value(s).
+      *
+      * @param string $varname If given, the value of that variable
+      *                        is returned, assuming it has been
+      *                        previously assigned.  If not specified
+      *                        an array of all assigned variables is
+      *                        returned. (optional)
+      *
+      * @return mixed Desired single variable value or list of all 
+      *               assigned variable values.
+      *
+      */
+    function get_template_vars($varname=NULL) {
+
+        return $this->smarty_template->get_template_vars($varname);
+
+    }
+
     /**
       * Appends values to template variables
       *