[Svn] r4192 - trunk/roundcubemail/program/include

trac at roundcube.net trac at roundcube.net
Sun Nov 7 13:44:54 CET 2010


Author: thomasb
Date: 2010-11-07 06:44:54 -0600 (Sun, 07 Nov 2010)
New Revision: 4192

Modified:
   trunk/roundcubemail/program/include/rcube_template.php
Log:
Support skins with old template names

Modified: trunk/roundcubemail/program/include/rcube_template.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_template.php	2010-11-07 10:58:50 UTC (rev 4191)
+++ trunk/roundcubemail/program/include/rcube_template.php	2010-11-07 12:44:54 UTC (rev 4192)
@@ -44,6 +44,15 @@
     public $type = 'html';
     public $ajax_call = false;
 
+    // deprecated names of templates used before 0.5
+    private $deprecated_templates = array(
+        'contact' => 'showcontact',
+        'contactadd' => 'addcontact',
+        'contactedit' => 'editcontact',
+        'identityedit' => 'editidentity',
+        'messageprint' => 'printmessage',
+    );
+
     /**
      * Constructor
      *
@@ -165,8 +174,7 @@
     public function template_exists($name)
     {
         $filename = $this->config['skin_path'] . '/templates/' . $name . '.html';
-
-        return (is_file($filename) && is_readable($filename));
+        return (is_file($filename) && is_readable($filename)) || ($this->deprecated_templates[$name] && $this->template_exists($this->deprecated_templates[$name]));
     }
 
     /**
@@ -380,6 +388,15 @@
 
         $path = "$skin_path/templates/$name.html";
 
+        if (!is_readable($path) && $this->deprecated_templates[$name]) {
+            $path = "$skin_path/templates/".$this->deprecated_templates[$name].".html";
+            if (is_readable($path))
+                raise_error(array('code' => 502, 'type' => 'php',
+                    'file' => __FILE__, 'line' => __LINE__,
+                    'message' => "Using deprecated template '".$this->deprecated_templates[$name]."' in ".$this->config['skin_path']."/templates. Please rename to '".$name."'"),
+                true, false);
+        }
+
         // read template file
         if (($templ = @file_get_contents($path)) === false) {
             raise_error(array(

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list