Ignore:
Timestamp:
Mar 22, 2010, 4:03:43 PM (14 years ago)
Author:
plg
Message:

ture 1514: improvement, impossible to activate a theme is a parent is missing
(a parent includes grand father and his own father, and his own father, and so
on... until the root theme is "default" or has no parent declared)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/themes.class.php

    r5258 r5259  
    8181          break;
    8282        }
     83
     84        $missing_parent = $this->missing_parent_theme($theme_id);
     85        if (isset($missing_parent))
     86        {
     87          array_push(
     88            $errors,
     89            sprintf(
     90              l10n('Impossible to activate this theme, the parent theme is missing: %s'),
     91              $missing_parent
     92              )
     93            );
     94         
     95          break;
     96        }
    8397       
    8498        $query = "
     
    167181    }
    168182    return $errors;
     183  }
     184
     185  function missing_parent_theme($theme_id)
     186  {
     187    if (!isset($this->fs_themes[$theme_id]['parent']))
     188    {
     189      return null;
     190    }
     191   
     192    $parent = $this->fs_themes[$theme_id]['parent'];
     193     
     194    if ('default' == $parent)
     195    {
     196      return null;
     197    }
     198     
     199    if (!isset($this->fs_themes[$parent]))
     200    {
     201      return $parent;
     202    }
     203
     204    return $this->missing_parent_theme($parent);
    169205  }
    170206
Note: See TracChangeset for help on using the changeset viewer.