diff --git a/adminstuds.php b/adminstuds.php
index 0ea9a4c..1af9393 100644
--- a/adminstuds.php
+++ b/adminstuds.php
@@ -79,11 +79,13 @@ $dsondage=$sondage->FetchObject(false);
// Send email (only once during the session) to alert admin of the change he made. ==> two modifications (comment, title, description, ...) on differents polls in the same session will generate only one mail.
$email_admin = $dsondage->mail_admin;
$poll_title = $dsondage->titre;
+$smtp_allowed = $config['use_smtp'];
function send_mail_admin() {
global $email_admin;
global $poll_title;
global $numsondageadmin;
- if($config['use_smtp']==true){
+ global $smtp_allowed;
+ if($smtp_allowed==true){
if(!isset($_SESSION["mail_admin_sent"])) {
Utils::sendEmail( $email_admin,
_("[ADMINISTRATOR] New settings for your poll") . ' ' . stripslashes( $poll_title ),
@@ -836,45 +838,43 @@ if (substr($dsondage->format, 0, 1)=="D") {
for ($i = 0; $i < count($toutsujet); $i++) {
// Current date
- $current = $toutsujet[$i];
-
+ $current = $toutsujet[$i];//format date@hour. ex : 2020292820@10:00
+ $horoCur = explode("@",$current); //horoCur[0] = date, horoCur[1] = hour
+ if (isset($toutsujet[$i+1])){
+ $next = $toutsujet[$i+1];
+ $horoNext = explode("@",$next);
+ }
$border[$i] = false;
- $radio_title[$i] = strftime($date_format['txt_short'],$current);
+ $radio_title[$i] = strftime($date_format['txt_short'],$horoCur[0]);
// Months
$td_headers[$i] = 'M'.($i+1-$colspan_month);
- if (isset($toutsujet[$i+1]) && strftime("%B", $current) == strftime("%B", $toutsujet[$i+1]) && strftime("%Y", $current) == strftime("%Y", $toutsujet[$i+1])){
+ if (isset($toutsujet[$i+1]) && strftime("%B", $horoCur[0]) == strftime("%B", $horoNext[0]) && strftime("%Y", $horoCur[0]) == strftime("%Y", $horoNext[0])){
$colspan_month++;
} else {
$border[$i] = true;
- $tr_months .= '
'.strftime("%B",$current).' '.strftime("%Y", $current).' | ';
+ $tr_months .= ''.strftime("%B",$horoCur[0]).' '.strftime("%Y", $horoCur[0]).' | ';
$colspan_month=1;
}
// Days
$td_headers[$i] .= ' D'.($i+1-$colspan_day);
- if (isset($toutsujet[$i+1]) && strftime($date_format['txt_day'],$current)==strftime($date_format['txt_day'],$toutsujet[$i+1]) && strftime("%B",$current)==strftime("%B",$toutsujet[$i+1])){
+ if (isset($toutsujet[$i+1]) && strftime($date_format['txt_day'],$horoCur[0])==strftime($date_format['txt_day'],$horoNext[0]) && strftime("%B",$horoCur[0])==strftime("%B",$horoNext[0])){
$colspan_day++;
} else {
$rbd = ($border[$i]) ? ' rbd' : '';
- $tr_days .= ''.strftime($date_format['txt_day'],$current).' | ';
+ $tr_days .= ''.strftime($date_format['txt_day'],$horoCur[0]).' | ';
$colspan_day=1;
}
// Hours
$rbd = ($border[$i]) ? ' rbd' : '';
- if (strpos($current,'@') !== false) {
- $hour = substr($current, strpos($current, '@')-count($current)+2);
-
- if ($hour != "") {
- $tr_hours .= ''.$hour.' | ';
- $radio_title[$i] .= ' - '.$hour;
+ if ($horoCur[1] !== "") {
+ $tr_hours .= ''.$horoCur[1].' | ';
+ $radio_title[$i] .= ' - '.$horoCur[1];
$td_headers[$i] .= ' H'.$i;
- } else {
- $tr_hours .= ' | ';
- }
} else {
$tr_hours .= ' | ';
}
diff --git a/app/inc/i18n.php b/app/inc/i18n.php
index 0986b29..31c6f2d 100644
--- a/app/inc/i18n.php
+++ b/app/inc/i18n.php
@@ -36,8 +36,18 @@ if (isset($_POST['lang']) && is_string($_POST['lang']) && in_array($_POST['lang'
}
-$locale = $mlocale . '.utf8';
-putenv('LANGUAGE=');
+$locale = $mlocale . '.utf8';//unix format
+if (strtoupper(substr(PHP_OS,0,3))=='WIN'){
+ putenv("LC_ALL=$mlocale"); //Windows env. needed to switch between languages
+ switch ($mlocale){
+ case 'fr_FR' : $locale = "fra";break; //$locale in windows locale format, needed to use php function that handle text : strftime()
+ case 'en_GB' : $locale = "english";break; //see http://msdn.microsoft.com/en-us/library/39cwe7zf%28v=vs.90%29.aspx
+ case 'de_DE' : $locale = "deu";break;
+ case 'es_ES' : $locale = "esp";break;
+ }
+}
+
+putenv('LANGUAGE=');//sert à quoi?
setlocale(LC_ALL, $locale);
setlocale(LC_TIME, $locale);
setlocale(LC_MESSAGES, $locale);
@@ -48,7 +58,7 @@ bind_textdomain_codeset($domain, 'UTF-8');
textdomain($domain);
/* temp, for compatibility :*/
-$a = explode('_', $locale);
+$a = explode('_', $mlocale);
$_SESSION['langue'] = strtoupper($a[0]);
/* */
diff --git a/choix_autre.php b/choix_autre.php
index 978ba66..fd69bd5 100644
--- a/choix_autre.php
+++ b/choix_autre.php
@@ -94,7 +94,7 @@ if (Utils::issetAndNoEmpty('titre', $_SESSION) === false || Utils::issetAndNoEmp
// 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['default_poll_duration']); //60 sec * 60 min * 24 hours * config
- $removal_date= strftime($date_format['txt_full'], ($_SESSION["champdatefin"]));//textual date
+ $removal_date= utf8_encode(strftime($date_format['txt_full'], ($_SESSION["champdatefin"])));//textual date
// Summary
$summary = '';
diff --git a/choix_date.php b/choix_date.php
index 0531b4e..b9f6314 100644
--- a/choix_date.php
+++ b/choix_date.php
@@ -29,7 +29,7 @@ if (is_readable('bandeaux_local.php')) {
}
// Step 1/3 : error if $_SESSION from info_sondage are not valid
-if (!Utils::issetAndNoEmpty('nom', $_SESSION) && !Utils::issetAndNoEmpty('adresse', $_SESSION) && !Utils::issetAndNoEmpty('commentaires', $_SESSION) && !Utils::issetAndNoEmpty('mail', $_SESSION)) {
+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!"));
@@ -124,7 +124,7 @@ if (!Utils::issetAndNoEmpty('nom', $_SESSION) && !Utils::issetAndNoEmpty('adress
$temp_array = array_unique($_SESSION["totalchoixjour"]);
sort($temp_array);
- $removal_date=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 = '';
@@ -213,8 +213,8 @@ if (!Utils::issetAndNoEmpty('nom', $_SESSION) && !Utils::issetAndNoEmpty('adress
'."\n";
// Fields hours : 3 by default
- for ($j=0;$j
diff --git a/studs.php b/studs.php
index 0d3ee93..9918083 100644
--- a/studs.php
+++ b/studs.php
@@ -333,44 +333,43 @@ if ($dsondage->format=="D"||$dsondage->format=="D+"||$dsondage->format=="D-") {
// Current date
$current = $toutsujet[$i];
+ $horoCur = explode("@",$current); //horoCur[0] = date, horoCur[1] = hour
+ if (isset($toutsujet[$i+1])){
+ $next = $toutsujet[$i+1];
+ $horoNext = explode("@",$next);
+ }
$border[$i] = false;
- $radio_title[$i] = strftime($date_format['txt_short'],$current);
+ $radio_title[$i] = strftime($date_format['txt_short'],$horoCur[0]);
// Months
$td_headers[$i] = 'M'.($i+1-$colspan_month);
- if (isset($toutsujet[$i+1]) && strftime("%B", $current) == strftime("%B", $toutsujet[$i+1]) && strftime("%Y", $current) == strftime("%Y", $toutsujet[$i+1])){
+ if (isset($toutsujet[$i+1]) && strftime("%B", $horoCur[0]) == strftime("%B", $horoNext[0]) && strftime("%Y", $horoCur[0]) == strftime("%Y", $horoNext[0])){
$colspan_month++;
} else {
$border[$i] = true;
- $tr_months .= ''.strftime("%B",$current).' '.strftime("%Y", $current).' | ';
+ $tr_months .= ''.strftime("%B",$horoCur[0]).' '.strftime("%Y", $horoCur[0]).' | ';
$colspan_month=1;
}
// Days
$td_headers[$i] .= ' D'.($i+1-$colspan_day);
- if (isset($toutsujet[$i+1]) && strftime($date_format['txt_day'],$current)==strftime($date_format['txt_day'],$toutsujet[$i+1])&&strftime("%B",$current)==strftime("%B",$toutsujet[$i+1])){
+ if (isset($toutsujet[$i+1]) && strftime($date_format['txt_day'],$horoCur[0])==strftime($date_format['txt_day'],$horoNext[0])&&strftime("%B",$horoCur[0])==strftime("%B",$horoNext[0])){
$colspan_day++;
} else {
$rbd = ($border[$i]) ? ' rbd' : '';
- $tr_days .= ''.strftime($date_format['txt_day'],$current).' | ';
+ $tr_days .= ''.strftime($date_format['txt_day'],$horoCur[0]).' | ';
$colspan_day=1;
}
// Hours
$rbd = ($border[$i]) ? ' rbd' : '';
- if (strpos($current,'@') !== false) {
- $hour = substr($current, strpos($current, '@')-count($current)+2);
-
- if ($hour != "") {
- $tr_hours .= ''.$hour.' | ';
- $radio_title[$i] .= ' - '.$hour;
+ if ($horoCur[1] !== "") {
+ $tr_hours .= ''.$horoCur[1].' | ';
+ $radio_title[$i] .= ' - '.$horoCur[1];
$td_headers[$i] .= ' H'.$i;
- } else {
- $tr_hours .= ' | ';
- }
} else {
$tr_hours .= ' | ';
}
@@ -473,7 +472,7 @@ echo'
$user_mod = false;
//affichage des resultats actuels
-$somme = array();
+$somme[] = 0;
$compteur = 0;
while ($data = $user_studs->FetchNextObject(false)) {