From 8fa2388ea48b346e4158717415678b329cf08a9c Mon Sep 17 00:00:00 2001 From: Denis Chenu Date: Wed, 2 Feb 2022 01:47:35 +0100 Subject: [PATCH] Fixed issue #17790: KCFinder Image Browse Server not working due to incorrect cookieDomain (#2212) Dev: this need to set it in config. Dev: but take config to fix KCFINDER cookieDomain --- application/helpers/admin/htmleditor_helper.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/helpers/admin/htmleditor_helper.php b/application/helpers/admin/htmleditor_helper.php index a37d23a78a4..10f5bdbcda7 100644 --- a/application/helpers/admin/htmleditor_helper.php +++ b/application/helpers/admin/htmleditor_helper.php @@ -25,8 +25,11 @@ function initKcfinder() 'flash' => $sAllowedExtensions, 'images' => $sAllowedExtensions ); - if (Yii::app()->getRequest()->enableCsrfValidation && !empty(Yii::app()->getRequest()->csrfCookie->domain)) { - $_SESSION['KCFINDER']['cookieDomain'] = Yii::app()->getRequest()->csrfCookie->domain; + if (!empty(App()->getSession()->cookieParams['domain'])) { + $_SESSION['KCFINDER']['cookieDomain'] = App()->getSession()->cookieParams['domain']; + } + if (App()->getRequest()->enableCsrfValidation && !empty(App()->getRequest()->csrfCookie['domain'])) { + $_SESSION['KCFINDER']['cookieDomain'] = Yii::app()->getRequest()->csrfCookie['domain']; } if (Yii::app()->getConfig('demoMode') === false &&