Fix the update of poll infos

This commit is contained in:
Olivier PEREZ 2015-03-18 00:46:19 +01:00
parent 779af07c60
commit 0efc3d4bcc
3 changed files with 8 additions and 8 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', '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') {

View File

@ -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]);
}

View File

@ -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}