From 0efc3d4bcc72365e8c12e1db6dacfeaa8ce36857 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ <olivier@olivierperez.fr> Date: Wed, 18 Mar 2015 00:46:19 +0100 Subject: [PATCH] Fix the update of poll infos --- adminstuds.php | 10 +++++----- app/classes/Framadate/FramaDB.php | 2 +- tpl/part/poll_info.tpl | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/adminstuds.php b/adminstuds.php index f8501dda..25c5bf8c 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -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', 'name']); + $field = $inputService->filterAllowedValues($_POST['update_poll_info'], ['title', 'admin_mail', 'description', 'rules', 'expiration_date', 'name']); // Update the right poll field if ($field == 'title') { @@ -78,10 +78,10 @@ if (isset($_POST['update_poll_info'])) { $poll->admin_mail = $admin_mail; $updated = true; } - } elseif ($field == 'comment') { - $comment = strip_tags($_POST['comment']); - if ($comment) { - $poll->comment = $comment; + } elseif ($field == 'description') { + $description = strip_tags($_POST['description']); + if ($description) { + $poll->description = $description; $updated = true; } } elseif ($field == 'rules') { diff --git a/app/classes/Framadate/FramaDB.php b/app/classes/Framadate/FramaDB.php index 6b7c4c37..d4a198f9 100644 --- a/app/classes/Framadate/FramaDB.php +++ b/app/classes/Framadate/FramaDB.php @@ -90,7 +90,7 @@ class FramaDB { } function updatePoll($poll) { - $prepared = $this->prepare('UPDATE `' . Utils::table('poll') . '` SET title=?, admin_name=?, admin_mail=?, description=?, end_date=FROM_UNIXTIME(?), active=?, editable=? WHERE id = ?'); + $prepared = $this->prepare('UPDATE `' . Utils::table('poll') . '` SET title=?, admin_name=?, admin_mail=?, description=?, end_date=?, active=?, editable=? WHERE id = ?'); return $prepared->execute([$poll->title, $poll->admin_name, $poll->admin_mail, $poll->description, $poll->end_date, $poll->active, $poll->editable, $poll->id]); } diff --git a/tpl/part/poll_info.tpl b/tpl/part/poll_info.tpl index 360e09aa..75060875 100644 --- a/tpl/part/poll_info.tpl +++ b/tpl/part/poll_info.tpl @@ -80,8 +80,8 @@ {if $admin && !$expired} <div class="hidden js-desc text-right"> <label class="sr-only" for="newdescription">{_('Description')}</label> - <textarea class="form-control" id="newdescription" name="comment" rows="2" cols="40">{$poll->description|html}</textarea> - <button type="submit" id="btn-new-desc" name="update_poll_info" value="comment" class="btn btn-sm btn-success" title="{_('Save the description')}"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">{_('Save')}</span></button> + <textarea class="form-control" id="newdescription" name="description" rows="2" cols="40">{$poll->description|html}</textarea> + <button type="submit" id="btn-new-desc" name="update_poll_info" value="description" class="btn btn-sm btn-success" title="{_('Save the description')}"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">{_('Save')}</span></button> <button class="btn btn-default btn-sm btn-cancel" title="{_('Cancel the description edit')}"><span class="glyphicon glyphicon-remove"></span><span class="sr-only">{_('Cancel')}</span></button> </div> {/if} -- GitLab