fixes #2557 use pwg_get_cookie_var

-Update cookie to use pwg_lang to avoid conflicts with other potential apps.
-Add cookie path to the pwg_lang cookie to help with conflicts also.
-Be less restrictive in load_cookie_language function
-We can't use pwg_set_cookie because it is set in js not PHP so we force it to be called pwg_lang
This commit is contained in:
HWFord
2026-05-06 08:53:44 +02:00
parent 29c7957054
commit f12323d1c9
9 changed files with 20 additions and 19 deletions
+4 -4
View File
@@ -88,8 +88,8 @@ function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
let expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
if (cname == "lang")
document.cookie = cname + "=" + cvalue + ";" + expires + ";path="+cookie_path;
if (cname == "pwg_lang")
{
location.reload();
}
@@ -125,9 +125,9 @@ jQuery(".togglePassword").click(function(e){
jQuery("#other-languages a").click(function(e){
let clickedUrl = new URL(jQuery(e.target).attr('href'));
let selectedLang = clickedUrl.searchParams.get("lang");
let selectedLang = clickedUrl.searchParams.get("pwg_lang");
if (selectedLang) {
setCookie('lang',selectedLang,1);
setCookie('pwg_lang',selectedLang,1);
}
});