Don't split admin_poll_id as poll_id

This commit is contained in:
Olivier PEREZ 2015-10-28 22:53:56 +01:00
parent 15640a6788
commit 8f2c9f07d4

View File

@ -90,12 +90,13 @@ function sendUpdateNotification($poll, $mailService, $type) {
if (!empty($_GET['poll'])) { if (!empty($_GET['poll'])) {
$admin_poll_id = filter_input(INPUT_GET, 'poll', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]); $admin_poll_id = filter_input(INPUT_GET, 'poll', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]);
if (strlen($admin_poll_id) === 24) { if (strlen($admin_poll_id) === 24) {
$poll_id = substr($admin_poll_id, 0, 16);
$poll = $pollService->findByAdminId($admin_poll_id); $poll = $pollService->findByAdminId($admin_poll_id);
} }
} }
if (!$poll) { if ($poll) {
$poll_id = $poll->id;
} else {
$smarty->assign('error', __('Error', 'This poll doesn\'t exist !')); $smarty->assign('error', __('Error', 'This poll doesn\'t exist !'));
$smarty->display('error.tpl'); $smarty->display('error.tpl');
exit; exit;