diff options
author | patdenice <patdenice@piwigo.org> | 2010-03-29 13:30:02 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2010-03-29 13:30:02 +0000 |
commit | 29d36ffdc36bf20ab43840df9272fac160cbc476 (patch) | |
tree | 6df10661fe632fa6a8b78ab32fafba5a76b9851e /admin/include/themes.class.php | |
parent | 034e75f8ea2fc21f38a623df2f9a362048b4c2a5 (diff) |
feature 1502: Allow to have configuration page for each theme.css.
About string for theme has to be saved in language theme directory (about.html)
git-svn-id: http://piwigo.org/svn/trunk@5446 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include/themes.class.php')
-rw-r--r-- | admin/include/themes.class.php | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/admin/include/themes.class.php b/admin/include/themes.class.php index 524462306..41ee5f336 100644 --- a/admin/include/themes.class.php +++ b/admin/include/themes.class.php @@ -70,6 +70,8 @@ class themes $crt_db_theme = $this->db_themes_by_id[$theme_id]; } + $file_to_include = PHPWG_THEMES_PATH.'/'.$theme_id.'/admin/maintain.inc.php'; + $errors = array(); switch ($action) @@ -100,14 +102,26 @@ class themes break; } - - $query = " + + if (file_exists($file_to_include)) + { + include($file_to_include); + if (function_exists('theme_activate')) + { + theme_activate($theme_id, $this->fs_themes[$theme_id]['version'], $errors); + } + } + + if (empty($errors)) + { + $query = " INSERT INTO ".THEMES_TABLE." SET id = '".$theme_id."' , version = '".$this->fs_themes[$theme_id]['version']."' , name = '".$this->fs_themes[$theme_id]['name']."' ;"; - pwg_query($query); + pwg_query($query); + } break; case 'deactivate': @@ -150,7 +164,16 @@ SELECT $this->set_default_theme($new_theme); } - + + if (file_exists($file_to_include)) + { + include($file_to_include); + if (function_exists('theme_deactivate')) + { + theme_deactivate($theme_id); + } + } + $query = " DELETE FROM ".THEMES_TABLE." @@ -374,7 +397,13 @@ SELECT .'/images/missing_screenshot.png' ; } - + + $admin_file = $path.'/admin/admin.inc.php'; + if (file_exists($admin_file)) + { + $theme['admin_uri'] = get_root_url().'admin.php?page=theme&theme='.$file; + } + // IMPORTANT SECURITY ! $theme = array_map('htmlspecialchars', $theme); $this->fs_themes[$file] = $theme; |