diff --git a/create_classic_poll.php b/create_classic_poll.php index bdff627..c89683c 100644 --- a/create_classic_poll.php +++ b/create_classic_poll.php @@ -17,6 +17,7 @@ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ use Framadate\Choice; +use Framadate\Form; use Framadate\Services\InputService; use Framadate\Services\LogService; use Framadate\Services\MailService; @@ -45,7 +46,14 @@ if (is_file('bandeaux_local.php')) { $min_expiry_time = $pollService->minExpiryDate(); $max_expiry_time = $pollService->maxExpiryDate(); -$form = unserialize($_SESSION['form']); +$form = isset($_SESSION['form']) ? unserialize($_SESSION['form']) : null; + +if ($form === null || !($form instanceof Form)) { + $smarty->assign('title', __('Error', 'Error!')); + $smarty->assign('error', __('Error', 'You haven\'t filled the first section of the poll creation, or your session has expired.')); + $smarty->display('error.tpl'); + exit; +} // The poll format is AUTRE (other) if we are in this file if (!isset($form->format)) { @@ -206,7 +214,7 @@ switch ($step) { case 1: // Step 1/4 : error if $_SESSION from info_sondage are not valid default: $smarty->assign('title', __('Error', 'Error!')); - $smarty->assign('error', __('Error', 'You haven\'t filled the first section of the poll creation.')); + $smarty->assign('error', __('Error', 'You haven\'t filled the first section of the poll creation, or your session has expired.')); $smarty->display('error.tpl'); exit; } diff --git a/create_date_poll.php b/create_date_poll.php index 2aee276..1aae084 100644 --- a/create_date_poll.php +++ b/create_date_poll.php @@ -17,6 +17,7 @@ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft https://framagit.org/framasoft/framadate/) */ use Framadate\Choice; +use Framadate\Form; use Framadate\Services\InputService; use Framadate\Services\LogService; use Framadate\Services\MailService; @@ -44,7 +45,14 @@ if (is_readable('bandeaux_local.php')) { $min_expiry_time = $pollService->minExpiryDate(); $max_expiry_time = $pollService->maxExpiryDate(); -$form = unserialize($_SESSION['form']); +$form = isset($_SESSION['form']) ? unserialize($_SESSION['form']) : null; + +if ($form === null || !($form instanceof Form)) { + $smarty->assign('title', __('Error', 'Error!')); + $smarty->assign('error', __('Error', 'You haven\'t filled the first section of the poll creation, or your session has expired.')); + $smarty->display('error.tpl'); + exit; +} // The poll format is DATE if we are in this file if (!isset($form->format)) {