Merge branch 'release/0.9' into 'release/0.9'
Bugfixes - Prévention de la suppression du dernier slot - Correction des problèmes de \n dans la description et les commentaires - Correction de la date de suppression du sondage - Blindage du format de la date d'expiration du sondage See merge request !55
This commit is contained in:
commit
cdf4f0caec
@ -153,7 +153,8 @@ if (isset($_POST['update_poll_info'])) {
|
||||
break;
|
||||
}
|
||||
} elseif ($field == 'expiration_date') {
|
||||
$expiration_date = filter_input(INPUT_POST, 'expiration_date', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '#^[0-9]+[-/][0-9]+[-/][0-9]+#']]);
|
||||
$expiration_date = filter_input(INPUT_POST, 'expiration_date', FILTER_VALIDATE_REGEXP,
|
||||
['options' => ['regexp' => '#^[0-9]{4}-[0-9]{2}-[0-9]{2}$#']]);
|
||||
if ($expiration_date) {
|
||||
$poll->end_date = $expiration_date;
|
||||
$updated = true;
|
||||
@ -374,7 +375,7 @@ if (!empty($_GET['delete_column'])) {
|
||||
if ($result) {
|
||||
$message = new Message('success', __('adminstuds', 'Column removed'));
|
||||
} else {
|
||||
$message = new Message('danger', __('Error', 'Failed to delete the column'));
|
||||
$message = new Message('danger', __('Error', 'Failed to delete column'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,6 +117,10 @@ class AdminPollService {
|
||||
|
||||
$slots = $this->pollService->allSlotsByPollId($poll_id);
|
||||
|
||||
if (count($slots) === 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$index = 0;
|
||||
$indexToDelete = -1;
|
||||
$newMoments = [];
|
||||
@ -155,6 +159,10 @@ class AdminPollService {
|
||||
|
||||
$slots = $this->pollService->allSlotsByPollId($poll_id);
|
||||
|
||||
if (count($slots) === 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$index = 0;
|
||||
$indexToDelete = -1;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -328,6 +328,7 @@
|
||||
"Update vote failed": "Update vote failed",
|
||||
"Adding vote failed": "Adding vote failed",
|
||||
"Comment failed": "Kommentar gescheitert",
|
||||
"You can't create a poll with hidden results with the following edition option:": "Sie können nicht eine Umfrage erstellen mit versteckten Ergebnisse mit der folgenden Ausgabe-Option:"
|
||||
"You can't create a poll with hidden results with the following edition option:": "Sie können nicht eine Umfrage erstellen mit versteckten Ergebnisse mit der folgenden Ausgabe-Option:",
|
||||
"Failed to delete column": "Fehler beim Spalte löschen"
|
||||
}
|
||||
}
|
||||
|
@ -328,6 +328,7 @@
|
||||
"Update vote failed": "Update vote failed",
|
||||
"Adding vote failed": "Adding vote failed",
|
||||
"Comment failed": "Comment failed",
|
||||
"You can't create a poll with hidden results with the following edition option:": "You can't create a poll with hidden results with the following edition option: "
|
||||
"You can't create a poll with hidden results with the following edition option:": "You can't create a poll with hidden results with the following edition option: ",
|
||||
"Failed to delete column": "Failed to delete column"
|
||||
}
|
||||
}
|
||||
|
@ -328,6 +328,7 @@
|
||||
"Update vote failed": "ES_Mise à jour du vote échoué",
|
||||
"Adding vote failed": "ES_Ajout d'un vote échoué",
|
||||
"Comment failed": "ES_Commentaire échoué",
|
||||
"You can't create a poll with hidden results with the following edition option:": "ES_Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : "
|
||||
"You can't create a poll with hidden results with the following edition option:": "ES_Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : ",
|
||||
"Failed to delete column": "Error al eliminar la columna"
|
||||
}
|
||||
}
|
||||
|
@ -328,6 +328,7 @@
|
||||
"Update vote failed": "Mise à jour du vote échoué",
|
||||
"Adding vote failed": "Ajout d'un vote échoué",
|
||||
"Comment failed": "Commentaire échoué",
|
||||
"You can't create a poll with hidden results with the following edition option:": "Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : "
|
||||
"You can't create a poll with hidden results with the following edition option:": "Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : ",
|
||||
"Failed to delete column": "Échec de la suppression de colonne"
|
||||
}
|
||||
}
|
||||
|
@ -328,6 +328,7 @@
|
||||
"Update vote failed": "IT_Mise à jour du vote échoué",
|
||||
"Adding vote failed": "IT_Ajout d'un vote échoué",
|
||||
"Comment failed": "IT_Commentaire échoué",
|
||||
"You can't create a poll with hidden results with the following edition option:": "IT_Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : "
|
||||
"You can't create a poll with hidden results with the following edition option:": "IT_Vous ne pouvez pas créer de sondage avec résulats cachés avec les options d'éditions suivantes : ",
|
||||
"Failed to delete column": "Impossibile eliminare colonna"
|
||||
}
|
||||
}
|
@ -206,7 +206,7 @@ $smarty->assign('poll_id', $poll_id);
|
||||
$smarty->assign('poll', $poll);
|
||||
$smarty->assign('title', __('Generic', 'Poll') . ' - ' . $poll->title);
|
||||
$smarty->assign('expired', strtotime($poll->end_date) < time());
|
||||
$smarty->assign('deletion_date', $poll->end_date + PURGE_DELAY * 86400);
|
||||
$smarty->assign('deletion_date', strtotime($poll->end_date) + PURGE_DELAY * 86400);
|
||||
$smarty->assign('slots', $poll->format === 'D' ? $pollService->splitSlots($slots) : $slots);
|
||||
$smarty->assign('votes', $pollService->splitVotes($votes));
|
||||
$smarty->assign('best_choices', $pollService->computeBestChoices($votes));
|
||||
|
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user