Changeset 7fcb56b in github


Ignore:
Timestamp:
Nov 7, 2010 7:44:54 AM (3 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
3bb9b52
Parents:
f664284
Message:

Support skins with old template names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_template.php

    r1ac5431 r7fcb56b  
    4545    public $ajax_call = false; 
    4646 
     47    // deprecated names of templates used before 0.5 
     48    private $deprecated_templates = array( 
     49        'contact' => 'showcontact', 
     50        'contactadd' => 'addcontact', 
     51        'contactedit' => 'editcontact', 
     52        'identityedit' => 'editidentity', 
     53        'messageprint' => 'printmessage', 
     54    ); 
     55 
    4756    /** 
    4857     * Constructor 
     
    166175    { 
    167176        $filename = $this->config['skin_path'] . '/templates/' . $name . '.html'; 
    168  
    169         return (is_file($filename) && is_readable($filename)); 
     177        return (is_file($filename) && is_readable($filename)) || ($this->deprecated_templates[$name] && $this->template_exists($this->deprecated_templates[$name])); 
    170178    } 
    171179 
     
    380388 
    381389        $path = "$skin_path/templates/$name.html"; 
     390 
     391        if (!is_readable($path) && $this->deprecated_templates[$name]) { 
     392            $path = "$skin_path/templates/".$this->deprecated_templates[$name].".html"; 
     393            if (is_readable($path)) 
     394                raise_error(array('code' => 502, 'type' => 'php', 
     395                    'file' => __FILE__, 'line' => __LINE__, 
     396                    'message' => "Using deprecated template '".$this->deprecated_templates[$name]."' in ".$this->config['skin_path']."/templates. Please rename to '".$name."'"), 
     397                true, false); 
     398        } 
    382399 
    383400        // read template file 
Note: See TracChangeset for help on using the changeset viewer.