From 111bcc0829a3a5ce164de012f583874a3280edfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Nana?= <sebastien.nana@maarch.org>
Date: Tue, 22 Dec 2009 17:36:15 +0000
Subject: [PATCH] Evol : ajout du timezone dans la config

---
 core/trunk/core/class/class_portal.php |  9 ++++++++-
 core/trunk/core/init.php               | 12 ++++++++++--
 core/trunk/core/xml/config.xml.default |  1 +
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/core/trunk/core/class/class_portal.php b/core/trunk/core/class/class_portal.php
index de684266ea1..60fe28c333f 100644
--- a/core/trunk/core/class/class_portal.php
+++ b/core/trunk/core/class/class_portal.php
@@ -51,7 +51,14 @@ class portal extends functions
 			$_SESSION['config']['unixserver'] = (string) $CONFIG->unixserver;
 			$_SESSION['config']['defaultpage'] = (string) $CONFIG->defaultpage;
 			$_SESSION['config']['defaultlang'] = (string) $CONFIG->defaultlanguage;
-			
+			if(isset($CONFIG->default_timezone) && !empty($CONFIG->default_timezone))
+			{
+				$_SESSION['config']['default_timezone'] = (string) $CONFIG->default_timezone;
+			}
+			else
+			{
+				$_SESSION['config']['default_timezone'] = 'Europe/Paris';
+			}
 			if ($_SERVER['HTTPS'] == "on")
 				$protocol = "https";
 			else
diff --git a/core/trunk/core/init.php b/core/trunk/core/init.php
index 57ff966481d..7cdee9fe670 100644
--- a/core/trunk/core/init.php
+++ b/core/trunk/core/init.php
@@ -1,7 +1,16 @@
 <?php
 session_name('maarch_entreprise');
 session_start();
-
+if(isset($_SESSION['config']['default_timezone']) && !empty($_SESSION['config']['default_timezone']))
+{
+	ini_set('date.timezone', $_SESSION['config']['default_timezone']);
+	date_default_timezone_set($_SESSION['config']['default_timezone']);
+}
+else
+{
+	ini_set('date.timezone', 'Europe/Paris');
+	date_default_timezone_set('Europe/Paris');
+}
 if(isset($_SESSION['config']['corepath']) && !empty($_SESSION['config']['corepath']))
 {
 	chdir($_SESSION['config']['corepath']);
@@ -15,7 +24,6 @@ if (isset($_SESSION['custom_override_id']) && !empty($_SESSION['custom_override_
 }
 elseif(isset($_SESSION['config']['corepath']) && !empty($_SESSION['config']['corepath']))
 {
-	
 	set_include_path($_SESSION['config']['corepath']);	
 }
 
diff --git a/core/trunk/core/xml/config.xml.default b/core/trunk/core/xml/config.xml.default
index d450905e676..2968eb83895 100644
--- a/core/trunk/core/xml/config.xml.default
+++ b/core/trunk/core/xml/config.xml.default
@@ -5,6 +5,7 @@
 		<tmppath>C:\xampp\htdocs\maarch_entreprise\tmp\</tmppath>
 		<defaultpage>C:\xampp\htdocs\maarch_entreprise\index.php</defaultpage>
 		<defaultlanguage>fr</defaultlanguage>
+		<default_timezone>Europe/Paris</default_timezone>
 	</CONFIG>
 	<BUSINESSAPPS>
 		<appid>maarch_entreprise</appid> <!-- same name as the app directory -->
-- 
GitLab