fix(admin/add_column): stop modifying user input in stored data

An [earlier
change](892fa11373)
modifed the user's input when creating new columns in an existing
Poll.

Indeed all `,` comma were replaced by `-` dashes and the user inputs
was saved as such.

It seems the rational behind it was to keep the existing "formatting"
of log messages where different elements were separated by commas.

This commit makes sure to not strip the users' data but only the
logged message.

Fixes #384
This commit is contained in:
Paul B 2019-04-15 15:00:00 +02:00
parent e13f66eb4d
commit dc164c4d79
No known key found for this signature in database
GPG Key ID: DE331B23748D3A27
2 changed files with 4 additions and 4 deletions

View File

@ -467,10 +467,10 @@ if (isset($_POST['confirm_add_column'])) {
if ($poll->format === 'D') {
$date = DateTime::createFromFormat(__('Date', 'Y-m-d'), $_POST['newdate'])->setTime(0, 0, 0);
$time = $date->getTimestamp();
$newmoment = str_replace(',', '-', strip_tags($_POST['newmoment']));
$newmoment = strip_tags($_POST['newmoment']);
$adminPollService->addDateSlot($poll_id, $time, $newmoment);
} else {
$newslot = str_replace(',', '-', strip_tags($_POST['choice']));
$newslot = strip_tags($_POST['choice']);
$adminPollService->addClassicSlot($poll_id, $newslot);
}

View File

@ -200,7 +200,7 @@ class AdminPollService {
* @throws \Doctrine\DBAL\ConnectionException
*/
public function addDateSlot($poll_id, $datetime, $new_moment) {
$this->logService->log('ADD_COLUMN', 'id:' . $poll_id . ', datetime:' . $datetime . ', moment:' . $new_moment);
$this->logService->log('ADD_COLUMN', 'id:' . $poll_id . ', datetime:' . $datetime . ', moment:' . str_replace(',', '-', $new_moment));
try {
$slots = $this->slotRepository->listByPollId($poll_id);
@ -252,7 +252,7 @@ class AdminPollService {
* @throws \Doctrine\DBAL\DBALException
*/
public function addClassicSlot($poll_id, $title) {
$this->logService->log('ADD_COLUMN', 'id:' . $poll_id . ', title:' . $title);
$this->logService->log('ADD_COLUMN', 'id:' . $poll_id . ', title:' . str_replace(',', '-', $title));
$slots = $this->slotRepository->listByPollId($poll_id);