From 1559472ca3150a0b2b0166d38cb0954bdc46264b Mon Sep 17 00:00:00 2001 From: Ian Date: Tue, 5 Feb 2013 17:24:39 +0100 Subject: [PATCH] Update include/admin/templates.inc.php to avoid displaying older template vars in case of a template change like from BP to some other Template, in case of: - previouses config_groups in templates with a config file and - all other other core used vars in case of no config file This may need further finetuning... --- include/admin/templates.inc.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/admin/templates.inc.php b/include/admin/templates.inc.php index 74f567fb..70ac64c0 100644 --- a/include/admin/templates.inc.php +++ b/include/admin/templates.inc.php @@ -80,9 +80,26 @@ $data["cur_template"] = $serendipity['template']; if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] . '/config.inc.php')) { serendipity_smarty_init(); + $old_template_config_groups = $template_config_groups; include_once $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] . '/config.inc.php'; + // in case of theme switch, check to unset config_group array + if ($serendipity['GET']['adminAction'] == 'install' && $serendipity['GET']['adminModule'] == 'templates') { + // array diff - but do not do this for bulletproof, as this is the only one which needs them in case of reloads (temporary) + if($old_template_config_groups === $template_config_groups && $serendipity['GET']['theme'] != 'bulletproof') { + $template_config_groups = NULL; // force destroy previouses config_group array! + } + } + unset($old_template_config_groups); +} else { + if ($serendipity['GET']['adminAction'] == 'install' && $serendipity['GET']['adminModule'] == 'templates') { + #include_once $serendipity['serendipityPath'] . $serendipity['templatePath'] . '/default/config_fallback.inc.php'; + $template_config_groups = NULL; + $template_config = NULL; + $template_loaded_config = NULL; + } } + if (is_array($template_config)) { serendipity_plugin_api::hook_event('backend_templates_configuration_top', $template_config); $data["has_config"] = true;