Commit 2be39e13 authored by Chenu Denis's avatar Chenu Denis
Browse files

[fix] Better managing of out of session

parent d1405f41
......@@ -852,9 +852,10 @@ class reloadAnyResponse extends PluginBase
}
/* Check POST and current session : throw error if needed */
if (App()->getRequest()->getPost('reloadAnyResponseSrid')) {
$currentSrid = isset($_SESSION['survey_'.$surveyid ]['srid']) ? $_SESSION['survey_'.$surveyid ]['srid'] : null;
$currentReloadedSrid = \reloadAnyResponse\Utilities::getCurrentReloadedSrid($surveyid);
$currentSrid = \reloadAnyResponse\Utilities::getCurrentSrid($surveyid);
\reloadAnyResponse\Utilities::setSaveAutomatic($surveyid);
if ($currentSrid != App()->getRequest()->getPost('reloadAnyResponseSrid')) {
if ($currentSrid != App()->getRequest()->getPost('reloadAnyResponseSrid') || $currentReloadedSrid != $currentSrid) {
throw new CHttpException(400, $this->_translate("Your current session seems invalid with current data."));
}
$token = \reloadAnyResponse\Utilities::getCurrentReloadedToken($surveyid);
......@@ -912,7 +913,8 @@ class reloadAnyResponse extends PluginBase
$this->reloadedSrid = \reloadAnyResponse\Utilities::getCurrentSrid($this->surveyId);
\reloadAnyResponse\Utilities::setCurrentReloadedSrid($this->surveyId, $srid);
} else {
\reloadAnyResponse\Utilities::setCurrentReloadedSrid($this->surveyId, "new");
/* What happen ? Unsure on what to do . */
\reloadAnyResponse\Utilities::setCurrentReloadedSrid($this->surveyId, null);
}
}
if ($srid) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment