Fix date_format behaviour with unix timestamps
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 8 Dec 2006 18:17:10 +0000 (18:17 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 8 Dec 2006 18:17:10 +0000 (18:17 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1260 839d8a87-29fc-0310-9880-83ba4fa771e5

modules/events.php
modules/platal.php
plugins/modifier.date_format.php
templates/login.tpl
templates/motdepasse.success.tpl
templates/tmpPWD.success.tpl

index f7bb107..f90ee2b 100644 (file)
@@ -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();
index 234b925..d6a7841 100644 (file)
@@ -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');
index 4240577..78b6d24 100644 (file)
@@ -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);
     }
index 59cdd5d..927d2c7 100644 (file)
@@ -37,7 +37,7 @@ Bienvenue {$smarty.session.prenom}
 
 <div class="smaller">
   Ta connexion précédente date du
-  <strong>{$lastlogin|date_format:"%x, %X"}</strong>
+  <strong>{$smarty.session.lastlogin|date_format:"%x, %X"}</strong>
   depuis la machine <strong>{$smarty.session.host}</strong>
 </div>
   
index bbb3686..6afd43f 100644 (file)
@@ -26,7 +26,7 @@
 </h1>
 
 <p>
-<strong>Mot de passe enregistré le {$now|date_format}</strong>
+<strong>Mot de passe enregistré le {$smarty.now|date_format}</strong>
 </p>
 <p>
   <strong>Attention!</strong> Il est crypté irréversiblement,
index af349a6..5743357 100644 (file)
@@ -23,7 +23,7 @@
 <h1>Récupération de mot de passe</h1>
 
 <p>
-<strong>Mot de passe enregistré le {$now|date_format}</strong>
+<strong>Mot de passe enregistré le {$smarty.now|date_format}</strong>
 </p>
 <p>
   Cette procédure n'est pas sécurisée. Ton mot de passe est certes crypté, mais le