fixed phpdoc formating. require() call loaded before first phpdoc block.
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 7 Oct 2006 15:32:40 +0000 (15:32 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 7 Oct 2006 15:32:40 +0000 (15:32 +0000)
improved template cache. Don't store SM_PATH information in cache. SM_PATH
is ../ in main scripts, but it is ../../ in plugins. Plugin option pages
break if cache stores SM_PATH.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11859 7612ce4b-ef26-0410-bec9-ea0150e637f0

class/template/Template.class.php

index b9b992f402d6b870459faf77f5a5f528ab38aade..20e82bffece6579452518f05cee4f01cfa7f3187 100644 (file)
@@ -1,7 +1,4 @@
 <?php
-
-require(SM_PATH . 'functions/template.php');
-
 /**
   * Template.class.php
   *
@@ -20,6 +17,9 @@ require(SM_PATH . 'functions/template.php');
   *
   */
 
+/** load template functions */
+require(SM_PATH . 'functions/template.php');
+
 /**
   * The SquirrelMail Template class.
   *
@@ -549,7 +549,6 @@ class Template
 
         if ($regenerate_cache) unset($template_file_hierarchy);
 
-
         if (!empty($template_file_hierarchy)) {
 
             // have to add additional files if given before returning
@@ -658,11 +657,13 @@ class Template
             //
             $relative_file = substr($file, strlen($template_base_dir));
 
-            // only put file in cache if not already found in earlier template
-            //
+            /**
+             * only put file in cache if not already found in earlier template
+             * PATH should be relative to SquirrelMail top directory
+             */
             if (!isset($file_list[$relative_file])) {
                 $file_list[$relative_file] = array(
-                                                     'PATH'   => $file,
+                                                     'PATH'   => substr($file,strlen(SM_PATH)),
                                                      'SET_ID' => $template_set_id,
                                                      'ENGINE' => $engine,
                                                   );
@@ -831,7 +832,7 @@ class Template
                 //
                 if (strpos($file, $filename) === 0 
                  && strpos($file, '/', strlen($filename)) === FALSE)
-                    $return_array[] = $file_info['PATH'];
+                    $return_array[] = SM_PATH . $file_info['PATH'];
 
             }
             return $return_array;
@@ -856,7 +857,7 @@ class Template
 
         }
 
-        return $this->template_file_cache[$filename]['PATH'];
+        return SM_PATH . $this->template_file_cache[$filename]['PATH'];
 
     }