Issue #26 Admin can change the name of initiator of the poll

This commit is contained in:
Olivier PEREZ 2015-01-08 22:03:44 +01:00
parent 924bd1ed1a
commit 6f7c911bae
5 changed files with 54 additions and 15 deletions

View file

@ -63,7 +63,7 @@ if (!$poll) {
if (isset($_POST['update_poll_info'])) {
$updated = false;
$field = $inputService->filterAllowedValues($_POST['update_poll_info'], ['title', 'admin_mail', 'comment', 'rules', 'expiration_date']);
$field = $inputService->filterAllowedValues($_POST['update_poll_info'], ['title', 'admin_mail', 'comment', 'rules', 'expiration_date', 'name']);
// Update the right poll field
if ($field == 'title') {
@ -110,6 +110,12 @@ if (isset($_POST['update_poll_info'])) {
$poll->end_date = $expiration_date;
$updated = true;
}
} elseif ($field == 'name') {
$admin_name = filter_input(INPUT_POST, 'name', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => NAME_REGEX]]);
if ($admin_name) {
$poll->admin_name = $admin_name;
$updated = true;
}
}
// Update poll in database