From c719fbf7fcff87609ff68c0f8983d725fd59ee6a Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Wed, 18 Apr 2018 13:54:24 +0000 Subject: [PATCH] Bug fix (regression): use a different endpoint (ajax.document.render.php) for the output of the JS dictionary since we use the JS dictionary also when there is no user logged in (like in the login page). SVN:trunk[5691] --- application/webpage.class.inc.php | 2 +- pages/ajax.document.php | 11 ++++++++++- pages/ajax.render.php | 9 --------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/application/webpage.class.inc.php b/application/webpage.class.inc.php index ea1708cee..184ff9556 100644 --- a/application/webpage.class.inc.php +++ b/application/webpage.class.inc.php @@ -824,7 +824,7 @@ class WebPage implements Page file_put_contents($sJSFileName, $this->get_dict_file_content()); } // Load the dictionary as the first javascript file, so that other JS file benefit from the translations - array_unshift($this->a_linked_scripts, utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php/?operation=dict&s='.$sSignature); + array_unshift($this->a_linked_scripts, utils::GetAbsoluteUrlAppRoot().'pages/ajax.document.php?operation=dict&s='.$sSignature); } } } diff --git a/pages/ajax.document.php b/pages/ajax.document.php index 35f9bcd05..cca38559a 100644 --- a/pages/ajax.document.php +++ b/pages/ajax.document.php @@ -94,7 +94,16 @@ try $oPage->add_header("Last-Modified: Wed, 15 Jun 2016 13:21:15 GMT"); // An arbitrary date in the past is ok } break; - + + case 'dict': + $sSignature = Utils::ReadParam('s', ''); // Sanitization prevents / and .. + $oPage = new ajax_page(""); // New page to cleanup the no_cache done above + $oPage->SetContentType('text/javascript'); + $oPage->add_header('Cache-control: public, max-age=86400'); // Cache for 24 hours + $oPage->add_header("Pragma: cache"); // Reset the value set .... where ? + $oPage->add(file_get_contents(Utils::GetCachePath().$sSignature.'.js')); + break; + default: $oPage->p("Invalid query."); } diff --git a/pages/ajax.render.php b/pages/ajax.render.php index cda35039e..f8eb8f038 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -2581,15 +2581,6 @@ EOF $oPage->add(json_encode($aResult)); break; - case 'dict': - $sSignature = Utils::ReadParam('s', ''); // Sanitization prevents / and .. - $oPage = new ajax_page(""); // New page to cleanup the no_cache done above - $oPage->SetContentType('text/javascript'); - $oPage->add_header('Cache-control: public, max-age=86400'); // Cache for 24 hours - $oPage->add_header("Pragma: cache"); // Reset the value set .... where ? - $oPage->add(file_get_contents(Utils::GetCachePath().$sSignature.'.js')); - break; - default: $oPage->p("Invalid query."); }