From 7f4dbb3e2eeb4a5f9845427821caaf4fee9dc8d4 Mon Sep 17 00:00:00 2001 From: onli Date: Sun, 9 Mar 2014 16:00:38 +0100 Subject: [PATCH] Include JS in installer and upgrader This should fix issue #80 by giving serendipity_editor.js of default to the installer and the normal template JS to the upgrader --- include/functions_config.inc.php | 3 ++- serendipity_config.inc.php | 6 ++---- templates/2k11/admin/installer.inc.tpl | 7 ++----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php index dab82177..b59933df 100644 --- a/include/functions_config.inc.php +++ b/include/functions_config.inc.php @@ -279,8 +279,9 @@ function serendipity_getTemplateFile($file, $key = 'serendipityHTTPPath') { return $serendipity[$key] . $templateFile; } - if (file_exists($serendipity['serendipityPath'] . $templateFile . ".tpl")) { + if (file_exists($serendipity['serendipityPath'] . $templateFile . ".tpl") && IS_installed) { # catch .js.tpl files served via the template-plugin-api + # this won't work in the installer return $serendipity['baseURL'] . 'index.php?/plugin/' . $file; } } diff --git a/serendipity_config.inc.php b/serendipity_config.inc.php index e9500c48..e2d24a42 100644 --- a/serendipity_config.inc.php +++ b/serendipity_config.inc.php @@ -395,16 +395,14 @@ $serendipity['permissionLevels'] = array(USERLEVEL_EDITOR => USERLEVEL_EDITOR_DE USERLEVEL_CHIEF => USERLEVEL_CHIEF_DESC, USERLEVEL_ADMIN => USERLEVEL_ADMIN_DESC); -/* - * Check if the installed version is higher than the version of the config - */ +// Redirect to the upgrader if (IS_up2date === false && !defined('IN_upgrader')) { if (preg_match(PAT_CSS, $_SERVER['REQUEST_URI'], $matches)) { $css_mode = 'serendipity_admin.css'; return 1; } - if ( preg_match('@/(serendipity_editor\.js|serendipity\.js)@', $_SERVER['REQUEST_URI'], $matches)) { + if (preg_match('@/(serendipity_editor\.js$)@', $_SERVER['REQUEST_URI'], $matches)) { return 1; } serendipity_die(sprintf(SERENDIPITY_NEEDS_UPGRADE, $serendipity['versionInstalled'], $serendipity['version'], $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php')); diff --git a/templates/2k11/admin/installer.inc.tpl b/templates/2k11/admin/installer.inc.tpl index cd82a9ce..1cfcce12 100644 --- a/templates/2k11/admin/installer.inc.tpl +++ b/templates/2k11/admin/installer.inc.tpl @@ -6,7 +6,8 @@ {$CONST.SERENDIPITY_ADMIN_SUITE} - + +
@@ -286,12 +287,8 @@ {/if} -

{$ADMIN_FOOTER_POWERED_BY|sprintf:$versionInstalled:$phpversion}

- - {* *} -