From 9e1743cdee33a5033670ecd78ce7c6a616520945 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Fri, 8 Dec 2006 18:17:10 +0000 Subject: [PATCH] Fix date_format behaviour with unix timestamps git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1260 839d8a87-29fc-0310-9880-83ba4fa771e5 --- modules/events.php | 3 --- modules/platal.php | 2 -- plugins/modifier.date_format.php | 2 ++ templates/login.tpl | 2 +- templates/motdepasse.success.tpl | 2 +- templates/tmpPWD.success.tpl | 2 +- 6 files changed, 5 insertions(+), 8 deletions(-) diff --git a/modules/events.php b/modules/events.php index f7bb107..f90ee2b 100644 --- a/modules/events.php +++ b/modules/events.php @@ -92,9 +92,6 @@ class EventsModule extends PLModule $page->addJsLink('ajax.js'); $page->assign('tips', $this->get_tips()); - // donne la derniere date de session - $page->assign('lastlogin', strftime("%Y%m%d%H%M%S",S::i('lastlogin'))); - $res = XDB::query('SELECT date, naissance FROM auth_user_md5 WHERE user_id={?}', S::v('uid')); list($date, $naissance) = $res->fetchOneRow(); diff --git a/modules/platal.php b/modules/platal.php index 234b925..d6a7841 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -191,7 +191,6 @@ class PlatalModule extends PLModule } $page->changeTpl('motdepasse.success.tpl'); - $page->assign('now', strftime("%Y%m%d%H%M%S")); $page->run(); } @@ -319,7 +318,6 @@ Mail envoy XDB::query('DELETE FROM perte_pass WHERE certificat={?}', $certif); $logger->log("passwd",""); $page->changeTpl('tmpPWD.success.tpl'); - $page->assign('now', strftime("%Y%m%d%H%M%S")); } else { $page->changeTpl('motdepasse.tpl'); $page->addJsLink('motdepasse.js'); diff --git a/plugins/modifier.date_format.php b/plugins/modifier.date_format.php index 4240577..78b6d24 100644 --- a/plugins/modifier.date_format.php +++ b/plugins/modifier.date_format.php @@ -27,6 +27,8 @@ function smarty_modifier_date_format($string, $format = '%x', $default_date=null if (preg_match('/^\d{14}$/', $d)) { $t = mktime(substr($d,8,2), substr($d,10,2), substr($d,12,2), substr($d,4,2), substr($d,6,2), substr($d,0,4)); + } elseif (is_numeric($d)) { + $t = intval($d); } else { $t = strtotime($d); } diff --git a/templates/login.tpl b/templates/login.tpl index 59cdd5d..927d2c7 100644 --- a/templates/login.tpl +++ b/templates/login.tpl @@ -37,7 +37,7 @@ Bienvenue {$smarty.session.prenom}
Ta connexion précédente date du - {$lastlogin|date_format:"%x, %X"} + {$smarty.session.lastlogin|date_format:"%x, %X"} depuis la machine {$smarty.session.host}
diff --git a/templates/motdepasse.success.tpl b/templates/motdepasse.success.tpl index bbb3686..6afd43f 100644 --- a/templates/motdepasse.success.tpl +++ b/templates/motdepasse.success.tpl @@ -26,7 +26,7 @@

-Mot de passe enregistré le {$now|date_format} +Mot de passe enregistré le {$smarty.now|date_format}

Attention! Il est crypté irréversiblement, diff --git a/templates/tmpPWD.success.tpl b/templates/tmpPWD.success.tpl index af349a6..5743357 100644 --- a/templates/tmpPWD.success.tpl +++ b/templates/tmpPWD.success.tpl @@ -23,7 +23,7 @@

Récupération de mot de passe

-Mot de passe enregistré le {$now|date_format} +Mot de passe enregistré le {$smarty.now|date_format}

Cette procédure n'est pas sécurisée. Ton mot de passe est certes crypté, mais le -- 2.1.4