$_SESSION["champdatefin"] modification (created in step 3 and only modified in needed in step 4)

handle date format for windows platform
This commit is contained in:
Bob Le Bricodeur 2014-11-12 16:35:13 +01:00
parent 52a783fba2
commit e53043b232
2 changed files with 13 additions and 7 deletions

View File

@ -57,8 +57,6 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
$temp_results=substr($temp_results,1);
$_SESSION["toutchoix"]=$temp_results;
// Expiration date → the configuration value is used if not filled or in bad format
$_SESSION["champdatefin"]= time()+ (86400 * config_get('default_poll_duration')); //60 secondes * 60 minutes * 24 heures * config
if (Utils::issetAndNoEmpty('champdatefin')) {
$registredate = explode("/",$_POST["champdatefin"]);
@ -69,7 +67,7 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
}
}
}
//format du sondage AUTRE
$_SESSION["formatsondage"]="A".$_SESSION["studsplus"];
@ -93,9 +91,16 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
Utils::print_header ( _("Removal date and confirmation (3 on 3)") );
bandeau_titre(_("Removal date and confirmation (3 on 3)"));
$removal_date=strftime(_("%A, den %e. %B %Y"), time()+15552000);
// Expiration date is initialised with config parameter. Value will be modified in step 4 if user has defined an other date
$_SESSION["champdatefin"]= time()+ (86400 * config_get('default_poll_duration')); //60 secondes * 60 minutes * 24 heures * config
// Sumary
$date_format = _("%A, den %e. %B %Y"); //locale replacement
if (strtoupper(substr(PHP_OS,0,3))=='WIN'){ //%e can't be used on Windows platform, use %#d instead
$date_format = preg_replace('#(?<!%)((?:%%)*)%e#','\1%#d', $date_format); //replace %e by %#d for windows
}
$removal_date="(".strftime($date_format, ($_SESSION["champdatefin"])).")";//textual date
// Summary
$summary = '<ol>';
for ($i=0;$i<count($_SESSION['choices']);$i++) {

View File

@ -45,8 +45,9 @@ function ajouter_sondage()
$sondage=random(16);
$sondage_admin=$sondage.random(8);
$date_fin = ($_SESSION["champdatefin"]) ? $_SESSION["champdatefin"] : $date_fin=time()+15552000;
//$date_fin = ($_SESSION["champdatefin"]) ? $_SESSION["champdatefin"] : $date_fin=time()+ (86400 * config_get('default_poll_duration'));
$date_fin = $_SESSION["champdatefin"]; //always provided by choix_autre.php
$_SESSION["champdatefin"]=""; //clean param cause 2 polls created by the same user in the same session can be affected by this param during the 2nd creation.
$sql = 'INSERT INTO sondage
(id_sondage, commentaires, mail_admin, nom_admin, titre, id_sondage_admin, date_fin, format, mailsonde)
VALUES (