diff --git a/app/classes/Framadate/Services/InputService.php b/app/classes/Framadate/Services/InputService.php index c7de2981c9984fe3cca753b82db42135de75c1f6..31b3103d142bb47496f694fbd88bf50f10bef635 100644 --- a/app/classes/Framadate/Services/InputService.php +++ b/app/classes/Framadate/Services/InputService.php @@ -51,8 +51,7 @@ class InputService { } public function filterTitle($title) { - $filtered = filter_var($title, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => TITLE_REGEX]]); - return $this->returnIfNotBlank($filtered); + return $this->returnIfNotBlank($title); } public function filterName($name) { @@ -66,7 +65,7 @@ class InputService { public function filterDescription($description) { $description = str_replace("\r\n", "\n", $description); - return filter_var($description, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => DESCRIPTION_REGEX]]); + return $description; } public function filterBoolean($boolean) { @@ -79,8 +78,7 @@ class InputService { public function filterComment($comment) { $comment = str_replace("\r\n", "\n", $comment); - $filtered = filter_var($comment, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => COMMENT_REGEX]]); - return $this->returnIfNotBlank($filtered); + return $this->returnIfNotBlank($comment); } /** diff --git a/app/inc/constants.php b/app/inc/constants.php index f0430995ea8382717923db55ce7ffdfb3561eead..d1db10a037627566b5b977911af0340d8132dee6 100644 --- a/app/inc/constants.php +++ b/app/inc/constants.php @@ -24,9 +24,6 @@ const VERSION = '0.9'; const POLL_REGEX = '/^[a-z0-9]+$/i'; const CHOICE_REGEX = '/^[012]$/'; const NAME_REGEX = '/^[áà âäãåçéèêëÃìîïñóòôöõúùûüýÿæœa-z0-9_ -]+$/i'; -const TITLE_REGEX = '/^[áà âäãåçéèêëÃìîïñóòôöõúùûüýÿæœa-z0-9\\/ &"\'(_)=~#{|`^@}$[\\]\\\\,;:!?.*-]+$/i'; -const DESCRIPTION_REGEX = "/^[áà âäãåçéèêëÃìîïñóòôöõúùûüýÿæœa-z0-9\\/ &\"'(_)=~#{|`^@}$[\\]\\\\,;:!?.*\n-]*$/i"; -const COMMENT_REGEX = "/^[áà âäãåçéèêëÃìîïñóòôöõúùûüýÿæœa-z0-9\\/ &\"'(_)=~#{|`^@}$[\\]\\\\,;:!?.*\n-]+$/i"; const BOOLEAN_REGEX = '/^(on|off|true|false|1|0)$/i'; const BOOLEAN_TRUE_REGEX = '/^(on|true|1)$/i'; const EDITABLE_CHOICE_REGEX = '/^[0-2]$/'; diff --git a/create_poll.php b/create_poll.php index 8682c74ba7f016681aabc2c33f944aa53caffc78..43c5b4a4361463fef0a6adbd94523f5e3fbd140c 100644 --- a/create_poll.php +++ b/create_poll.php @@ -90,7 +90,7 @@ if ($goToStep2) { $error_on_name = true; } - if ($description !== $_POST['description']) { + if ($description === false) { $error_on_description = true; } diff --git a/tpl/part/comments.tpl b/tpl/part/comments.tpl index 660041ea687f52e680196ddfeb3b67888d232024..c25adf2852109a6fd9d7971da83247f5e98e9862 100644 --- a/tpl/part/comments.tpl +++ b/tpl/part/comments.tpl @@ -11,7 +11,7 @@ <button type="submit" name="delete_comment" value="{$comment->id|html}" class="btn btn-link" title="{__('Comments', 'Remove the comment')}"><span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">{__('Generic', 'Remove')}</span></button> {/if} <b>{$comment->name|html}</b> - <span class="comment">{nl2br($comment->comment|html)}</span> + <span class="comment">{$comment->comment|escape|nl2br}</span> </div> {/foreach} {/if}