From e11f5dde0d79d82386f60aad5cdee6e77c52f79c Mon Sep 17 00:00:00 2001
From: redray <redray@ispconfig3>
Date: Wed, 11 Feb 2009 10:41:31 +0000
Subject: [PATCH] improved displaying of dates.

---
 interface/lib/classes/listform.inc.php      | 30 ++++++++++++++++++---
 interface/lib/lang/bg.lng                   |  6 +++++
 interface/lib/lang/de.lng                   |  6 +++++
 interface/lib/lang/en.lng                   |  6 +++++
 interface/lib/lang/es.lng                   |  6 +++++
 interface/lib/lang/fi.lng                   |  6 +++++
 interface/lib/lang/fr.lng                   |  6 +++++
 interface/lib/lang/it.lng                   |  6 +++++
 interface/lib/lang/nl.lng                   |  6 +++++
 interface/lib/lang/ru.lng                   |  6 +++++
 interface/lib/lang/se.lng                   |  6 +++++
 interface/web/monitor/list/datalog.list.php |  2 +-
 interface/web/monitor/list/log.list.php     |  2 +-
 13 files changed, 88 insertions(+), 6 deletions(-)

diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php
index a3946eb469..41b93d4ce6 100644
--- a/interface/lib/classes/listform.inc.php
+++ b/interface/lib/classes/listform.inc.php
@@ -38,7 +38,6 @@ class listform {
     private $pagingValues;
     private $searchChanged = 0;
     private $module;
-	private $dateformat = 'Y-m-d H:i';
 	public $wordbook;
 
     public function loadListDef($file, $module = '')
@@ -280,7 +279,25 @@ class listform {
                          break;
 
                     case 'DATE':
-                        $record[$key] = ($record[$key] > 0) ? date($this->dateformat,$record[$key]) : '';
+                        if ($record[$key] > 0) {
+							// is value int?
+							if (ereg("^[0-9]+[.]?[0-9]*$", $record[$key], $p)) {
+	                        	$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
+							} else {
+	                        	$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
+							}
+						}
+                        break;
+                        
+                    case 'DATETIME':
+                        if ($record[$key] > 0) {
+							// is value int?
+							if (ereg("^[0-9]+[.]?[0-9]*$", $record[$key], $p)) {
+	                        	$record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
+							} else {
+	                        	$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
+							}
+						}
                         break;
 
                     case 'INTEGER':
@@ -322,8 +339,13 @@ class listform {
                     
                     case 'DATE':
                         if($record[$key] > 0) {
-                            list($tag,$monat,$jahr) = explode('.',$record[$key]);
-                            $record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
+						    $record[$key] = date('Y-m-d',strtotime($record[$key]));
+                        }
+                        break;
+
+                    case 'DATETIME':
+                        if($record[$key] > 0) {
+						    $record[$key] = date('Y-m-d H:i:s',strtotime($record[$key]));
                         }
                         break;
 
diff --git a/interface/lib/lang/bg.lng b/interface/lib/lang/bg.lng
index 1c373046bd..1d3f890950 100644
--- a/interface/lib/lang/bg.lng
+++ b/interface/lib/lang/bg.lng
@@ -1,4 +1,10 @@
 <?php
+$wb['conf_format_dateshort'] = 'Y-m-d';
+$wb['conf_format_datelong'] = 'l dS of F Y';
+$wb['conf_format_timeshort'] = 'H:i';
+$wb['conf_format_timelong'] = 'H:i:s';
+$wb['conf_format_datetime'] = 'Y-m-d H:i';
+
 $wb['301'] = 'Този модул не е разрешен за текущия потреител.';
 $wb['302'] = 'Невалиден модул.';
 $wb['1001'] = 'Потребителското име и паролата не могат да бъдат празни!';
diff --git a/interface/lib/lang/de.lng b/interface/lib/lang/de.lng
index c5326e8d7d..eb87bd7218 100644
--- a/interface/lib/lang/de.lng
+++ b/interface/lib/lang/de.lng
@@ -1,4 +1,10 @@
 <?php
+$wb['conf_format_dateshort'] = 'd.m.Y';
+$wb['conf_format_datelong'] = 'l, d. F Y';
+$wb['conf_format_timeshort'] = 'H:i';
+$wb['conf_format_timelong'] = 'H:i:s';
+$wb['conf_format_datetime'] = 'd.m.Y H:i';
+
 $wb['301'] = 'Modul für Benutzer nicht erlaubt.';
 $wb['302'] = 'Modul ungültig.';
 $wb['1001'] = 'Der Benutzername und das Passwort dürfen nicht leer sein!';
diff --git a/interface/lib/lang/en.lng b/interface/lib/lang/en.lng
index e5b01c81e8..c94811ef41 100644
--- a/interface/lib/lang/en.lng
+++ b/interface/lib/lang/en.lng
@@ -1,4 +1,10 @@
 <?php
+$wb['conf_format_dateshort'] = 'Y-m-d';
+$wb['conf_format_datelong'] = 'l dS of F Y';
+$wb['conf_format_timeshort'] = 'H:i';
+$wb['conf_format_timelong'] = 'H:i:s';
+$wb['conf_format_datetime'] = 'Y-m-d H:i';
+
 $wb['301'] = 'Module not permitted for the current user.';
 $wb['302'] = 'Module invalid.';
 $wb['1001'] = 'The username and password cannot be empty !';
diff --git a/interface/lib/lang/es.lng b/interface/lib/lang/es.lng
index 24737fdd7d..0467f68fd9 100644
--- a/interface/lib/lang/es.lng
+++ b/interface/lib/lang/es.lng
@@ -1,4 +1,10 @@
 <?php
+$wb['conf_format_dateshort'] = 'Y-m-d';
+$wb['conf_format_datelong'] = 'l dS of F Y';
+$wb['conf_format_timeshort'] = 'H:i';
+$wb['conf_format_timelong'] = 'H:i:s';
+$wb['conf_format_datetime'] = 'Y-m-d H:i';
+
 $wb['301'] = 'Modulo no permitido para el usuario actual.';
 $wb['302'] = 'Modulo inválido.';
 $wb['1001'] = '¡ El usuario y contraseña no pueden estar vacíos !';
diff --git a/interface/lib/lang/fi.lng b/interface/lib/lang/fi.lng
index 969c373dc8..ecab1d0134 100755
--- a/interface/lib/lang/fi.lng
+++ b/interface/lib/lang/fi.lng
@@ -1,4 +1,10 @@
 <?php
+$wb['conf_format_dateshort'] = 'Y-m-d';
+$wb['conf_format_datelong'] = 'l dS of F Y';
+$wb['conf_format_timeshort'] = 'H:i';
+$wb['conf_format_timelong'] = 'H:i:s';
+$wb['conf_format_datetime'] = 'Y-m-d H:i';
+
 $wb['301'] = 'Tämä moduuli ei ole sallittu nykyiselle käyttäjälle.';
 $wb['302'] = 'Viallinen moduuli.';
 $wb['1001'] = 'Käyttäjätunnus ja/tai salasana eivät voi olla tyhjiä!';
diff --git a/interface/lib/lang/fr.lng b/interface/lib/lang/fr.lng
index 43dc5dee69..dfac0016b4 100644
--- a/interface/lib/lang/fr.lng
+++ b/interface/lib/lang/fr.lng
@@ -1,4 +1,10 @@
 <?php
+$wb['conf_format_dateshort'] = 'Y-m-d';
+$wb['conf_format_datelong'] = 'l dS of F Y';
+$wb['conf_format_timeshort'] = 'H:i';
+$wb['conf_format_timelong'] = 'H:i:s';
+$wb['conf_format_datetime'] = 'Y-m-d H:i';
+
 $wb['301'] = 'Module interdit pour lutilisateur courant.';
 $wb['302'] = 'Module invalide.';
 $wb['1001'] = 'The username and password must not be empty!';
diff --git a/interface/lib/lang/it.lng b/interface/lib/lang/it.lng
index 4bf4ad64aa..b03a176ff9 100644
--- a/interface/lib/lang/it.lng
+++ b/interface/lib/lang/it.lng
@@ -1,4 +1,10 @@
 <?php
+$wb['conf_format_dateshort'] = 'Y-m-d';
+$wb['conf_format_datelong'] = 'l dS of F Y';
+$wb['conf_format_timeshort'] = 'H:i';
+$wb['conf_format_timelong'] = 'H:i:s';
+$wb['conf_format_datetime'] = 'Y-m-d H:i';
+
 $wb['301'] = 'Modulo non permesso per l`utente corrente.';
 $wb['302'] = 'Modulo non valido.';
 $wb['1001'] = 'Nome utente e password non possono essere vuoti!';
diff --git a/interface/lib/lang/nl.lng b/interface/lib/lang/nl.lng
index 72acdfaf7e..e5e253f271 100644
--- a/interface/lib/lang/nl.lng
+++ b/interface/lib/lang/nl.lng
@@ -1,4 +1,10 @@
 <?php
+$wb['conf_format_dateshort'] = 'Y-m-d';
+$wb['conf_format_datelong'] = 'l dS of F Y';
+$wb['conf_format_timeshort'] = 'H:i';
+$wb['conf_format_timelong'] = 'H:i:s';
+$wb['conf_format_datetime'] = 'Y-m-d H:i';
+
 $wb['301'] = 'Module niet toegestaan voor de huidige gebruiker.';
 $wb['302'] = 'Ongeldige module.';
 $wb['1001'] = 'De gebruikersnaam en wachtwoord kunnen niet leeg zijn!';
diff --git a/interface/lib/lang/ru.lng b/interface/lib/lang/ru.lng
index 41ceb5cd2b..737b8e3cd8 100644
--- a/interface/lib/lang/ru.lng
+++ b/interface/lib/lang/ru.lng
@@ -1,4 +1,10 @@
 <?php
+$wb['conf_format_dateshort'] = 'Y-m-d';
+$wb['conf_format_datelong'] = 'l dS of F Y';
+$wb['conf_format_timeshort'] = 'H:i';
+$wb['conf_format_timelong'] = 'H:i:s';
+$wb['conf_format_datetime'] = 'Y-m-d H:i';
+
 $wb['301'] = 'Модуль недоступен для данной учетной записи.';
 $wb['302'] = 'Модуль неправилен.';
 $wb['1001'] = 'Имя или пароль не должны быть пустыми!';
diff --git a/interface/lib/lang/se.lng b/interface/lib/lang/se.lng
index fde40e8669..f37a689807 100644
--- a/interface/lib/lang/se.lng
+++ b/interface/lib/lang/se.lng
@@ -1,4 +1,10 @@
 <?php
+$wb['conf_format_dateshort'] = 'Y-m-d';
+$wb['conf_format_datelong'] = 'l dS of F Y';
+$wb['conf_format_timeshort'] = 'H:i';
+$wb['conf_format_timelong'] = 'H:i:s';
+$wb['conf_format_datetime'] = 'Y-m-d H:i';
+
 $wb['301'] = 'Modulen är ej tillåten för nuvarande användare.';
 $wb['302'] = 'Modulen är ogiltig.';
 $wb['1001'] = 'Användarnamn och lösenord får ej vara tomma!';
diff --git a/interface/web/monitor/list/datalog.list.php b/interface/web/monitor/list/datalog.list.php
index 5fee4dddf7..04dbba09bd 100644
--- a/interface/web/monitor/list/datalog.list.php
+++ b/interface/web/monitor/list/datalog.list.php
@@ -45,7 +45,7 @@ $liste['auth']				= 'no';
 *****************************************************/
 
 $liste["item"][] = array(	'field'		=> "tstamp",
-							'datatype'	=> "DATE",
+							'datatype'	=> "DATETIME",
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "",
diff --git a/interface/web/monitor/list/log.list.php b/interface/web/monitor/list/log.list.php
index aa3ad5d3ef..1b2a3490f1 100644
--- a/interface/web/monitor/list/log.list.php
+++ b/interface/web/monitor/list/log.list.php
@@ -44,7 +44,7 @@ $liste['auth']				= 'no';
 *****************************************************/
 
 $liste["item"][] = array(	'field'		=> "tstamp",
-							'datatype'	=> "DATE",
+							'datatype'	=> "DATETIME",
 							'formtype'	=> "TEXT",
 							'op'		=> "like",
 							'prefix'	=> "",
-- 
GitLab