diff --git a/choix_autre.php b/choix_autre.php index da3c4bc..11e693f 100644 --- a/choix_autre.php +++ b/choix_autre.php @@ -57,14 +57,32 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || ( // Step 4 : Data prepare before insert in DB if (isset($_POST['confirmecreation'])) { - $registredate = explode('/', $_POST['champdatefin']); - if (is_array($registredate) == true && count($registredate) == 3) { - $time = mktime(0, 0, 0, $registredate[1], $registredate[0], $registredate[2]); - if ($time > time() + (24 * 60 * 60)) { - $_SESSION['form']->champdatefin = $time; + // Define expiration date + $enddate = filter_input(INPUT_POST, 'enddate', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '#^[0-9]{2}/[0-9]{2}/[0-9]{4}$#']]); + $min_time = time() + (24 * 60 * 60); + $max_time = time() + (86400 * $config['default_poll_duration']); + + if (!empty($enddate)) { + $registredate = explode('/', $enddate); + + if (is_array($registredate) && count($registredate) == 3) { + $time = mktime(0, 0, 0, $registredate[1], $registredate[0], $registredate[2]); + + if ($time < $min_time) { + $_SESSION['form']->end_date = $min_time; + } elseif ($max_time < $time) { + $_SESSION['form']->end_date = $max_time; + } else { + $_SESSION['form']->end_date = $time; + } } } + if (empty($_SESSION['form']->end_date)) { + // By default, expiration date is 6 months after last day + $_SESSION['form']->end_date = $max_time; + } + // format du sondage AUTRE $_SESSION['form']->format = 'A'; @@ -156,7 +174,7 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || ( } $summary .= ''; - $end_date_str = utf8_encode(strftime('%d/%M/%Y', $_SESSION['form']->end_date)); //textual date + $end_date_str = utf8_encode(strftime('%d/%m/%Y', $_SESSION['form']->end_date)); //textual date echo '
@@ -167,23 +185,23 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || ( ' . $summary . '
-

' . _('Your poll will be automatically removed after') . ' ' . $config['default_poll_duration'] . ' ' . _('days') . '.
' . _("You can fix another removal date for it.") . '

+

' . _('Your poll will be automatically removed after') . ' ' . $config['default_poll_duration'] . ' ' . _('days') . '.
' . _('You can set a closer removal date for it.') . '

- +
- +
- ' . _("(dd/mm/yyyy)") . ' + ' . _('(dd/mm/yyyy)') . '
-

' . _("Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll.") . '

'; +

' . _('Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll.') . '

'; if ($config['use_smtp'] == true) { echo ' -

' . _("Then, you will receive quickly two emails: one contening the link of your poll for sending it to the voters, the other contening the link to the administration page of your poll.") . '

'; +

' . _('Then, you will receive quickly two emails: one contening the link of your poll for sending it to the voters, the other contening the link to the administration page of your poll.') . '

'; } echo '
diff --git a/choix_date.php b/choix_date.php index 623f5a5..6671def 100644 --- a/choix_date.php +++ b/choix_date.php @@ -58,22 +58,29 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || if (!empty($_POST['confirmation'])) { // Define expiration date - if (!empty($_POST['champdatefin'])) - { - $registredate = explode('/', $_POST['champdatefin']); - if (is_array($registredate) && count($registredate) == 3) - { - $time = mktime(0,0,0, $registredate[1], $registredate[0], $registredate[2]); - if ($time > time() + (24*60*60)) - { - $_SESSION['form']->end_date=$time; + $enddate = filter_input(INPUT_POST, 'enddate', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '#^[0-9]{2}/[0-9]{2}/[0-9]{4}$#']]); + $min_time = time() + (24 * 60 * 60); + $max_time = time() + (86400 * $config['default_poll_duration']); + + if (!empty($enddate)) { + $registredate = explode('/', $enddate); + + if (is_array($registredate) && count($registredate) == 3) { + $time = mktime(0, 0, 0, $registredate[1], $registredate[0], $registredate[2]); + + if ($time < $min_time) { + $_SESSION['form']->end_date = $min_time; + } elseif ($max_time < $time) { + $_SESSION['form']->end_date = $max_time; + } else { + $_SESSION['form']->end_date = $time; } } } - if(empty($_SESSION['form']->end_date)) { + if (empty($_SESSION['form']->end_date)) { // By default, expiration date is 6 months after last day - $_SESSION['form']->end_date=end($temp_results)+(86400 * $config['default_poll_duration']); + $_SESSION['form']->end_date = $max_time; } // Insert poll in database @@ -165,6 +172,8 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || } $summary .= ''; + $end_date_str = utf8_encode(strftime('%d/%m/%Y', $_SESSION['form']->end_date)); //textual date + echo '
@@ -175,13 +184,13 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || '. $summary .'
-

' . _('Your poll will be automatically removed '). $config['default_poll_duration'] . ' ' . _("days") . ' ' ._('after the last date of your poll') . '.
' . _('You can fix another removal date for it.') .'

+

' . _('Your poll will be automatically removed '). $config['default_poll_duration'] . ' ' . _('days') . ' ' ._('after the last date of your poll') . '.
' . _('You can set a closer removal date for it.') .'

- +
- +
'. _("(dd/mm/yyyy)") .' diff --git a/locale/de_DE/LC_MESSAGES/Studs.mo b/locale/de_DE/LC_MESSAGES/Studs.mo index 99c3591..b9acebd 100644 Binary files a/locale/de_DE/LC_MESSAGES/Studs.mo and b/locale/de_DE/LC_MESSAGES/Studs.mo differ diff --git a/locale/de_DE/LC_MESSAGES/Studs.po b/locale/de_DE/LC_MESSAGES/Studs.po index e3ce8bd..297e281 100644 --- a/locale/de_DE/LC_MESSAGES/Studs.po +++ b/locale/de_DE/LC_MESSAGES/Studs.po @@ -567,7 +567,7 @@ msgstr "Löschdatum:" msgid "Your poll will be automatically removed after 6 months." msgstr "Ihre Umfrage wird automatisch nach 6 Monaten gelöscht." -msgid "You can fix another removal date for it." +msgid "You can set a closer removal date for it." msgstr "Sie können jedoch auch ein anderes Löschdatum festlegen." msgid "Removal date (optional)" diff --git a/locale/en_GB/LC_MESSAGES/Studs.mo b/locale/en_GB/LC_MESSAGES/Studs.mo index 4a92524..6410ad6 100644 Binary files a/locale/en_GB/LC_MESSAGES/Studs.mo and b/locale/en_GB/LC_MESSAGES/Studs.mo differ diff --git a/locale/en_GB/LC_MESSAGES/Studs.po b/locale/en_GB/LC_MESSAGES/Studs.po index ad992ab..be82231 100644 --- a/locale/en_GB/LC_MESSAGES/Studs.po +++ b/locale/en_GB/LC_MESSAGES/Studs.po @@ -576,8 +576,8 @@ msgstr "Removal date:" msgid "Your poll will be automatically removed after" msgstr "Your poll will be automatically removed after" -msgid "You can fix another removal date for it." -msgstr "You can fix another removal date for it." +msgid "You can set a closer removal date for it." +msgstr "You can set a closer removal date for it." msgid "Removal date (optional)" msgstr "Removal date (optional)" diff --git a/locale/es_ES/LC_MESSAGES/Studs.mo b/locale/es_ES/LC_MESSAGES/Studs.mo index a037bd2..2339be8 100644 Binary files a/locale/es_ES/LC_MESSAGES/Studs.mo and b/locale/es_ES/LC_MESSAGES/Studs.mo differ diff --git a/locale/es_ES/LC_MESSAGES/Studs.po b/locale/es_ES/LC_MESSAGES/Studs.po index 656842d..28f5fd2 100644 --- a/locale/es_ES/LC_MESSAGES/Studs.po +++ b/locale/es_ES/LC_MESSAGES/Studs.po @@ -526,7 +526,7 @@ msgid "Characters \" < and > are not permitted" msgstr "Los caracteres \" < y > no estan autorizados!" #: choix_autre.php:191 -msgid "Your poll will be automatically removed after 6 months.
You can fix another removal date for it." +msgid "Your poll will be automatically removed after 6 months.
You can set a closer removal date for it." msgstr "Su encuesta será automaticamente borrado dentro de 6 meses.
Mientras, usted puede cambiar este fecha aquí." #: choix_autre.php:193 diff --git a/locale/fr_FR/LC_MESSAGES/Studs.mo b/locale/fr_FR/LC_MESSAGES/Studs.mo index 656e53e..8e31fb3 100644 Binary files a/locale/fr_FR/LC_MESSAGES/Studs.mo and b/locale/fr_FR/LC_MESSAGES/Studs.mo differ diff --git a/locale/fr_FR/LC_MESSAGES/Studs.po b/locale/fr_FR/LC_MESSAGES/Studs.po index db74782..30789b7 100644 --- a/locale/fr_FR/LC_MESSAGES/Studs.po +++ b/locale/fr_FR/LC_MESSAGES/Studs.po @@ -576,8 +576,8 @@ msgstr "Date de suppression :" msgid "Your poll will be automatically removed after" msgstr "Votre sondage sera automatiquement effacé dans" -msgid "You can fix another removal date for it." -msgstr "Néanmoins vous pouvez décider ci-dessous d'une date plus rapprochée pour la suppression de votre sondage." +msgid "You can set a closer removal date for it." +msgstr "Vous pouvez décider d'une date de suppression plus proche." msgid "Removal date (optional)" msgstr "Date de fin (facultative)"