closes #137
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Wed, 29 Dec 2004 23:07:06 +0000 (23:07 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:02 +0000 (23:27 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-183

ChangeLog
include/xorg.inc.php
include/xorg/page.inc.php
plugins/modifier.date_format.php [new file with mode: 0644]

index ff56d69..6e9f43b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,15 +13,17 @@ New :
                - Brand new PDF of the contact list (using FPDF).                                       -MC
                - Even include Photos in the PDF (kludgy !).                                            -MC
 
-       * Validation :
-               - quite a lot of rewrite, simplifications.                                                      -MC
-               - now possible to add comments without any action.                                      -MC
-
        * Skins :
                - Openweb : update.                                                                                                     -MC
 
+       * Validation :
+               - quite a lot of rewrite, simplifications.                                                      -MC
+
 Bug/Wish :
 
+       * Validations :
+               - #137: now possible to add comments without any action.                        -MC
+
 ================================================================================
 VERSION 0.9.3                                                                                                           27 Dec 2004
 
index 4a4d82a..b13acf0 100644 (file)
@@ -25,7 +25,7 @@ function microtime_float()
     return ((float)$usec + (float)$sec); 
 } 
 $TIME_BEGIN = microtime_float();
+
 // {{{ defines
 
 $i=0;
@@ -40,6 +40,9 @@ define("PERMS_ADMIN", "admin");
 define('SKINNED', 0);
 define('NO_SKIN', 1);
 
+setlocale(LC_MESSAGES, 'fr_FR');
+setlocale(LC_TIME, 'fr_FR');
+
 // }}}
 // {{{ globals + session init
 
index 9b52d17..4696b0e 100644 (file)
@@ -54,12 +54,9 @@ class XorgPage extends DiogenesCorePage
     {
         global $globals;
 
-       setlocale(LC_MESSAGES, 'fr_FR');
-       setlocale(LC_TIME, 'fr_FR');
-
         $this->template_dir  = $globals->spoolroot."/templates/";
         $this->compile_dir   = $globals->spoolroot."/templates_c/";
-        $this->plugins_dir[] = $globals->spoolroot."/plugins/";
+        array_unshift($this->plugins_dir, $globals->spoolroot."/plugins/");
         $this->config_dir    = $globals->spoolroot."/configs/";
 
         $this->compile_check = !empty($globals->debug);
diff --git a/plugins/modifier.date_format.php b/plugins/modifier.date_format.php
new file mode 100644 (file)
index 0000000..1f9f06a
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************/
+
+function smarty_modifier_date_format($string, $format="%d %b %Y", $default_date=null)
+{
+    require_once('Date.php');
+    if($string != '') {
+        $date = new Date($string);
+        return $date->format($format);
+    } elseif (!empty($default_date)) {
+        $date = new Date($default_date);
+        return $date->format($format);
+    } else {
+        return;
+    }
+}
+
+?>