mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 17:23:04 +02:00
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) git-svn-id: http://piwigo.org/svn/trunk@5259 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -80,6 +80,20 @@ class themes
|
||||
// the theme is already active
|
||||
break;
|
||||
}
|
||||
|
||||
$missing_parent = $this->missing_parent_theme($theme_id);
|
||||
if (isset($missing_parent))
|
||||
{
|
||||
array_push(
|
||||
$errors,
|
||||
sprintf(
|
||||
l10n('Impossible to activate this theme, the parent theme is missing: %s'),
|
||||
$missing_parent
|
||||
)
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$query = "
|
||||
INSERT INTO ".THEMES_TABLE."
|
||||
@@ -168,6 +182,28 @@ DELETE
|
||||
return $errors;
|
||||
}
|
||||
|
||||
function missing_parent_theme($theme_id)
|
||||
{
|
||||
if (!isset($this->fs_themes[$theme_id]['parent']))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$parent = $this->fs_themes[$theme_id]['parent'];
|
||||
|
||||
if ('default' == $parent)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isset($this->fs_themes[$parent]))
|
||||
{
|
||||
return $parent;
|
||||
}
|
||||
|
||||
return $this->missing_parent_theme($parent);
|
||||
}
|
||||
|
||||
function get_children_themes($theme_id)
|
||||
{
|
||||
$children = array();
|
||||
|
||||
Reference in New Issue
Block a user