From 9017676f70a59a0676be92d33794a48147a34e80 Mon Sep 17 00:00:00 2001 From: "Spanti Nicola (RyDroid)" Date: Wed, 26 Nov 2014 23:47:40 +0100 Subject: [PATCH] Small cleaning of choix_date.php --- choix_date.php | 93 +++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/choix_date.php b/choix_date.php index b9f6314..5e4624c 100644 --- a/choix_date.php +++ b/choix_date.php @@ -5,7 +5,7 @@ * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt * * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ - * Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft) + * Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft https://git.framasoft.org/framasoft/framadate/) * * ============================= * @@ -14,7 +14,7 @@ * http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt * * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ - * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) + * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft https://git.framasoft.org/framasoft/framadate/) */ namespace Framadate; @@ -31,13 +31,13 @@ if (is_readable('bandeaux_local.php')) { // Step 1/3 : error if $_SESSION from info_sondage are not valid if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmpty('nom', $_SESSION) === false || (($config['use_smtp']) ? Utils::issetAndNoEmpty('adresse', $_SESSION) === false : false)) { - Utils::print_header ( _("Error!") ); - bandeau_titre(_("Error!")); + Utils::print_header ( _('Error!') ); + bandeau_titre(_('Error!')); echo '
-

' . _("You haven't filled the first section of the poll creation.") . ' !

-

' . _("Back to the homepage of ") . ' ' . '' . NOMAPPLICATION . '.

+

' . _('You haven\'t filled the first section of the poll creation.') . ' !

+

' . _('Back to the homepage of ') . ' ' . '' . NOMAPPLICATION . '.

'; bandeau_pied(); @@ -46,19 +46,19 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp // Step 4 : Data prepare before insert in DB if (Utils::issetAndNoEmpty('confirmation')) { $temp_results = array(); - $choixdate=''; + $choixdate = ''; if (Utils::issetAndNoEmpty('totalchoixjour', $_SESSION) === true) { - for ($i = 0; $i < count($_SESSION["totalchoixjour"]); $i++) { + for ($i = 0; $i < count($_SESSION["totalchoixjour"]); ++$i) { if(count($_SESSION['horaires'.$i])!=0) { - for ($j=0;$j< min(count($_SESSION['horaires'.$i]),12);$j++) { - if ($_SESSION['horaires'.$i][$j]!="") { + for ($j=0; $j< min(count($_SESSION['horaires'.$i]),12); ++$j) { + if ($_SESSION['horaires'.$i][$j] != '') { array_push($temp_results, $_SESSION["totalchoixjour"][$i].'@'.$_SESSION['horaires'.$i][$j]); } else { array_push($temp_results, $_SESSION["totalchoixjour"][$i]); } } } else { - array_push($temp_results, $_SESSION["totalchoixjour"][$i]); + array_push($temp_results, $_SESSION['totalchoixjour'][$i]); } } @@ -67,23 +67,24 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp // Sort and remove doublons $temp_results = array_unique($temp_results); sort($temp_results); - for ($i=0;$i time() + (24*60*60)) { - $_SESSION["champdatefin"]=$time; + if ($time > time() + 86400) { + $_SESSION['champdatefin'] = $time; } } } @@ -92,16 +93,20 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp } else { if (Utils::issetAndNoEmpty('days')) { - if (!isset($_SESSION["totalchoixjour"])) { - $_SESSION["totalchoixjour"]=array(); + if (!isset($_SESSION['totalchoixjour'])) { + $_SESSION['totalchoixjour'] = array(); } $k = 0; - for ($i = 0; $i < count($_POST["days"]); $i++) { - if (isset($_POST["days"][$i]) && $_POST["days"][$i] !='') { - $_SESSION['totalchoixjour'][$k] = mktime(0, 0, 0, substr($_POST["days"][$i],3,2),substr($_POST["days"][$i],0,2),substr($_POST["days"][$i],6,4)); + for ($i = 0; $i < count($_POST['days']); ++$i) { + if (isset($_POST['days'][$i]) && $_POST['days'][$i] !='') { + $_SESSION['totalchoixjour'][$k] = mktime( + 0, 0, 0, + substr($_POST["days"][$i], 3, 2), + substr($_POST['days'][$i], 0, 2), + substr($_POST['days'][$i], 6, 4)); $l = 0; - for($j = 0; $j < count($_POST['horaires'.$i]); $j++) { + for($j = 0; $j < count($_POST['horaires'.$i]); ++$j) { if (isset($_POST['horaires'.$i][$j]) && $_POST['horaires'.$i][$j] != '') { $_SESSION['horaires'.$k][$l] = $_POST['horaires'.$i][$j]; $l++; @@ -114,23 +119,26 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp } //le format du sondage est DATE - $_SESSION["formatsondage"] = "D".$_SESSION["studsplus"]; + $_SESSION['formatsondage'] = 'D'. $_SESSION['studsplus']; // Step 3/3 : Confirm poll creation if (Utils::issetAndNoEmpty('choixheures') && Utils::issetAndNoEmpty('totalchoixjour', $_SESSION)) { - Utils::print_header ( _("Removal date and confirmation (3 on 3)") ); - bandeau_titre(_("Removal date and confirmation (3 on 3)")); + Utils::print_header ( _('Removal date and confirmation (3 on 3)') ); + bandeau_titre(_('Removal date and confirmation (3 on 3)')); - $temp_array = array_unique($_SESSION["totalchoixjour"]); + $temp_array = array_unique($_SESSION['totalchoixjour']); sort($temp_array); - $removal_date=utf8_encode(strftime($date_format['txt_full'], end($temp_array)+ (86400 * $config['default_poll_duration']))); + $removal_date = utf8_encode( + strftime($date_format['txt_full'], + end($temp_array) + (86400 * $config['default_poll_duration'])) + ); // Sumary $summary = '