Hidden results option is taken into account.

- Also added possibility for the poll's maker to edit this hidden results option.
This commit is contained in:
Antonin 2015-04-06 12:39:58 +02:00
parent 0c2ba20bfa
commit a135f74383
12 changed files with 166 additions and 100 deletions

View file

@ -70,7 +70,7 @@ if (!$poll) {
if (isset($_POST['update_poll_info'])) {
$updated = false;
$field = $inputService->filterAllowedValues($_POST['update_poll_info'], ['title', 'admin_mail', 'description', 'rules', 'expiration_date', 'name']);
$field = $inputService->filterAllowedValues($_POST['update_poll_info'], ['title', 'admin_mail', 'description', 'rules', 'expiration_date', 'name', 'hidden']);
// Update the right poll field
if ($field == 'title') {
@ -128,6 +128,13 @@ if (isset($_POST['update_poll_info'])) {
$poll->admin_name = $admin_name;
$updated = true;
}
} elseif ($field == 'hidden') {
$hidden = filter_input(INPUT_POST, 'hidden', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => BOOLEAN_REGEX]]);
$hidden = $hidden==null?false:true;
if ($hidden != $poll->hidden) {
$poll->hidden = $hidden;
$updated = true;
}
}
// Update poll in database