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]
This commit is contained in:
Denis Flaven
2018-04-18 13:54:24 +00:00
parent 9c3b053727
commit c719fbf7fc
3 changed files with 11 additions and 11 deletions

View File

@@ -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);
}
}
}

View File

@@ -95,6 +95,15 @@ try
}
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.");
}

View File

@@ -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.");
}