From adf0f102cc7a04cf8fcac8743801d48214118cad Mon Sep 17 00:00:00 2001 From: Russell Michell Date: Fri, 9 Jan 2015 11:16:00 +1300 Subject: [PATCH 1/5] FIX: Fixes CMS errors when viewing history on "Deleted" pages. Fixes undocumented error when viewing history tab of deleted pages with no history. Related to silverstripe/silverstripe/cms#1054 (See silverstripe/silverstripe-cms/pull/1149). --- model/Versioned.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/model/Versioned.php b/model/Versioned.php index 6dbfe57e1..6e0f09412 100644 --- a/model/Versioned.php +++ b/model/Versioned.php @@ -1249,8 +1249,11 @@ class Versioned extends DataExtension implements TemplateGlobalProvider { */ public function isLatestVersion() { $version = self::get_latest_version($this->owner->class, $this->owner->ID); + if($version) { + return ($version->Version == $this->owner->Version); + } - return ($version->Version == $this->owner->Version); + return false; } /** From fde6376996dbaba31601065869c60676845eeb85 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Sun, 24 Apr 2016 08:57:45 +0100 Subject: [PATCH 2/5] FIX Admin bloacklisted messages using correct $.inArray check --- admin/javascript/LeftAndMain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index 577cd9c33..1dd8ceb25 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -150,7 +150,7 @@ jQuery.noConflict(); } // Show message (but ignore aborted requests) - if(xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages)) { + if(xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages) != -1) { // Decode into UTF-8, HTTP headers don't allow multibyte statusMessage(decodeURIComponent(msg), msgType); } From 8673ac15bcafc66708e59c725ed86b650f19a705 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Thu, 8 Jan 2015 18:26:04 +0000 Subject: [PATCH 3/5] MINOR Empty YAML config causes invalid argument error --- core/manifest/ConfigManifest.php | 6 ++++-- .../fixtures/configmanifest/mysite/_config/empty.yml | 0 .../fixtures/configmanifest/mysite/_config/namedempty.yml | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 tests/core/manifest/fixtures/configmanifest/mysite/_config/empty.yml create mode 100644 tests/core/manifest/fixtures/configmanifest/mysite/_config/namedempty.yml diff --git a/core/manifest/ConfigManifest.php b/core/manifest/ConfigManifest.php index 22e6dd51e..985747069 100644 --- a/core/manifest/ConfigManifest.php +++ b/core/manifest/ConfigManifest.php @@ -652,8 +652,10 @@ class SS_ConfigManifest { * @return void */ public function mergeInYamlFragment(&$into, $fragment) { - foreach ($fragment as $k => $v) { - Config::merge_high_into_low($into[$k], $v); + if ($fragment) { + foreach ($fragment as $k => $v) { + Config::merge_high_into_low($into[$k], $v); + } } } diff --git a/tests/core/manifest/fixtures/configmanifest/mysite/_config/empty.yml b/tests/core/manifest/fixtures/configmanifest/mysite/_config/empty.yml new file mode 100644 index 000000000..e69de29bb diff --git a/tests/core/manifest/fixtures/configmanifest/mysite/_config/namedempty.yml b/tests/core/manifest/fixtures/configmanifest/mysite/_config/namedempty.yml new file mode 100644 index 000000000..7ce2d4818 --- /dev/null +++ b/tests/core/manifest/fixtures/configmanifest/mysite/_config/namedempty.yml @@ -0,0 +1,3 @@ +--- +Name: emptyconfig +--- From 2a5ba397e61b0c23fcc866bcd088876586ca8a3c Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Mon, 2 May 2016 08:54:19 +1200 Subject: [PATCH 4/5] BUG Fix SS_HTTPResponse being cast as string (#5413) Fixes #5335 --- security/Security.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/security/Security.php b/security/Security.php index 54e1ffe45..e48ed5db2 100644 --- a/security/Security.php +++ b/security/Security.php @@ -275,9 +275,12 @@ class Security extends Controller implements TemplateGlobalProvider { $form = $me->LoginForm(); $form->sessionMessage($message, 'warning'); Session::set('MemberLoginForm.force_message',1); - $formText = $me->login(); + $loginResponse = $me->login(); + if($loginResponse instanceof SS_HTTPResponse) { + return $loginResponse; + } - $response->setBody($formText); + $response->setBody((string)$loginResponse); $controller->extend('permissionDenied', $member); @@ -502,7 +505,7 @@ class Security extends Controller implements TemplateGlobalProvider { * For multiple authenticators, Security_MultiAuthenticatorLogin is used. * See getTemplatesFor and getIncludeTemplate for how to override template logic * - * @return string Returns the "login" page as HTML code. + * @return string|SS_HTTPResponse Returns the "login" page as HTML code. */ public function login() { // Check pre-login process From a38eb8b784406f8558f79bd4d99118467513b1a6 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Mon, 2 May 2016 18:15:39 +1200 Subject: [PATCH 5/5] Fix incorrect logic check --- admin/javascript/LeftAndMain.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index 1dd8ceb25..6295e69ae 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -150,7 +150,7 @@ jQuery.noConflict(); } // Show message (but ignore aborted requests) - if(xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages) != -1) { + if(xhr.status !== 0 && msg && $.inArray(msg, ignoredMessages) === -1) { // Decode into UTF-8, HTTP headers don't allow multibyte statusMessage(decodeURIComponent(msg), msgType); } @@ -816,9 +816,9 @@ jQuery.noConflict(); sessionStates = sessionData ? JSON.parse(sessionData) : false; this.find('.cms-tabset, .ss-tabset').each(function() { - var index, - tabset = $(this), - tabsetId = tabset.attr('id'), + var index, + tabset = $(this), + tabsetId = tabset.attr('id'), tab, forcedTab = tabset.children('ul').children('li.ss-tabs-force-active');