diff --git a/docs/NEWS b/docs/NEWS index db2deb3c..e2fdd04a 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -4,6 +4,9 @@ Version 2.0-beta3 () ------------------------------------------------------------------------ + * Themes using Engines are now able to use the parent's + configuration + * Prevent "new" plugin api to install double instances of plugins that are not stackable (issue #45) @@ -49,7 +52,7 @@ Version 2.0-beta3 () a backend theme would reference to. * Changed 2k11's config.inc.php file to provide a more stable - call of event hooks so that other templates can also hook + call of event hooks so that other themes can also hook their own events. * Changed JS for category filtering and its reset button to be a diff --git a/include/admin/templates.inc.php b/include/admin/templates.inc.php index f4be9b48..35ed10b7 100644 --- a/include/admin/templates.inc.php +++ b/include/admin/templates.inc.php @@ -96,11 +96,13 @@ if ( @file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] $data["cur_template"] = $serendipity['template']; $data["cur_template_backend"] = $serendipity['template_backend']; +$data['cur_template_info'] = serendipity_fetchTemplateInfo($serendipity['template']); -if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] . '/config.inc.php')) { +// NOTE: config.inc.php currently only applies to frontend configuration. Backend configuration is not planned yet, and would preferrably use a "config_backend.inc.php" file! +if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $data['cur_template_info']['custom_config_engine'] . '/config.inc.php')) { serendipity_smarty_init(); $old_template_config_groups = $template_config_groups; - include_once $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] . '/config.inc.php'; + include_once $serendipity['serendipityPath'] . $serendipity['templatePath'] . $data['cur_template_info']['custom_config_engine'] . '/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) diff --git a/include/functions.inc.php b/include/functions.inc.php index 322281a1..2dc4d148 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -260,6 +260,22 @@ function serendipity_fetchTemplateInfo($theme, $abspath = null) { if (@is_file($serendipity['templatePath'] . $theme . '/config.inc.php')) { $data['custom_config'] = YES; + $data['custom_config_engine'] = $theme; + } + + // Templates can depend on a possible "Engine" (i.e. "Engine: 2k11"). + // We support the fallback chain also of a template's configuration, so let's check each engine for a config file. + if (!empty($data['engine'])) { + $engines = explode(',', $data['engine']); + foreach($engines AS $engine) { + $engine = trim($engine); + if (empty($engine)) continue; + + if (@is_file($serendipity['templatePath'] . $engine . '/config.inc.php')) { + $data['custom_config'] = YES; + $data['custom_config_engine'] = $engine; + } + } } if ( $theme != 'default' && $theme != 'default-rtl'