mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-01 20:04:51 +02:00
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:
@@ -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);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user