Skip to content
Snippets Groups Projects
Commit 64b79965 authored by Antonin's avatar Antonin
Browse files

Fixing the description newlines problem

	- As it is now, description can't be in error state : we are waiting the markdown implementation to eventually change that.
	- Comments are now normaly formated (newlines are taken into account)
	- The title, description and comment regexes are now useless. Deleted.
parent 4a9179ff
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
/**
......
......@@ -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]$/';
......
......@@ -90,7 +90,7 @@ if ($goToStep2) {
$error_on_name = true;
}
if ($description !== $_POST['description']) {
if ($description === false) {
$error_on_description = true;
}
......
......@@ -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>&nbsp;
<span class="comment">{nl2br($comment->comment|html)}</span>
<span class="comment">{$comment->comment|escape|nl2br}</span>
</div>
{/foreach}
{/if}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment