Dotclear


Ignore:
Timestamp:
10/04/13 00:53:07 (12 years ago)
Author:
Denis Jean-Chirstian <contact@…>
Branch:
default
Children:
2240:2553775ae2fe, 2242:f31162da2395
Message:

Prevent install theme as plugin and vice versa by adding property "type" to modules definition, fixes #1713

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.themes.php

    r1179 r2239  
    2323class dcThemes extends dcModules 
    2424{     
     25     protected static $type = 'theme'; 
     26 
    2527     /** 
    2628     This method registers a theme in modules list. You should use this to 
     
    5860                    'parent' => null, 
    5961                    'priority' => 1000, 
    60                     'standalone_config' => false 
     62                    'standalone_config' => false, 
     63                    'type' => null 
    6164               ), $properties 
    6265          ); 
     66 
     67          if ($properties['type'] !== null && $properties['type'] != self::$type) { 
     68               $this->errors[] = sprintf( 
     69                    __('Module "%s" has type "%s" that mismatch required module type "%s".'), 
     70                    '<strong>'.html::escapeHTML($name).'</strong>', 
     71                    '<em>'.html::escapeHTML($properties['type']).'</em>', 
     72                    '<em>'.html::escapeHTML(self::$type).'</em>' 
     73               ); 
     74               return; 
     75          } 
     76 
    6377          if ($this->id) { 
    6478               $this->modules[$this->id] = array_merge( 
Note: See TracChangeset for help on using the changeset viewer.

Sites map