Ticket #397 (new feature)

Opened 1 year ago

Last modified 1 year ago

Code to use date_set_default_timezone functionality in php > 5.1.0

Reported by: Jelmer Assigned to: ryan
Priority: normal Milestone:
Component: framework Version: 2.6.5
Keywords: Cc:

Description

This is a repost of a post from the forum. Just to make sure it is on the right spot.

Problem

But a question for now: The way WB handles timezones is easy to follow but posing some problems. We have a time/date value in seconds from unix epoch and we do:

gmdate(TIME_FORMAT, $postposted_when?+TIMEZONE); or even (just for example): mktime() + TIMEZONE

TIMEZONE is seconds from GMT.

I found in this forum some references to problems with Daylight Saving Time. Thats when the seconds from GMT change. I guess people in Holland (where I am) should use GMT + 1 in winter and GMT + 2 in summer or something like that, but when you change the timezone, "old" times also change.

PHP 5.1 gives new timezone support, through date_default_timezone_set, which changes the output of all date format functions that do not have the gm_..prefix.

My solution

I added (below) a patch to the original 2.6.5 file tree. Important elements:

The new file timezone.extensions.php which is called from initialize.php and selects the mode of operation: either "new framework" php timezone calculation or "old framework" GMT + seconds work. This file also defines a new function, wbdate(format, timestamp), that could and should be used instead of gmdate(format, timestamp + TIMEZONE). There is also support code for getting the right TIMEZONE from the database and filling the timezone combo's in preferences and profiles.

Install: also shows the new timezone list if available. timezone in the users table is now a varchar.

Framework and other admin-like places: code changed to get the right TIMEZONE, also a fix for not unsetting $_SESSION[USE_DEFAULT_TIMEZONE] when a user changes his or her profile. gmdate(...) calls changed to wbdate

Default modules: use of wbdate

modules still using gmdate should work like in the old situation (my code sets TIMEZONE to the current offset of the used timezone). When the new php timezones are unavailabe (php < 5.1.0), gmdate and wbdate both use the old framework, and 'old' timezones like GMT + 2 etc are used.

I welcome your thoughts.

Patch

diff -Naur websitebaker-2.6.5/wb/account/details.php websitebaker-2.6.5.timezone-extensions/wb/account/details.php
--- websitebaker-2.6.5/wb/account/details.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/account/details.php	2007-05-25 16:17:45.000000000 +0200
@@ -31,7 +31,18 @@
 // Get entered values
 $display_name = $wb->add_slashes(strip_tags($wb->get_post('display_name')));
 $language = $wb->get_post('language');
-$timezone = $wb->get_post('timezone')*60*60;
+//timezone.extensions.php change! 
+	//When using the new timezone framework, the timezone value will not be
+	//integer. In that case $value will just be saved (being a string)
+	// Spin in het web, 20070525
+	
+	//old code:
+		//$timezone = $wb->get_post('timezone')*60*60;
+	//new code:
+			$timezone = $wb->get_post('timezone');
+			if (is_numeric($timezone))
+				$timezone = $timezone*60*60;
+//end timezone.extensions.php change
 $date_format = $wb->get_post('date_format');
 $time_format = $wb->get_post('time_format');
 
diff -Naur websitebaker-2.6.5/wb/account/preferences_form.php websitebaker-2.6.5.timezone-extensions/wb/account/preferences_form.php
--- websitebaker-2.6.5/wb/account/preferences_form.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/account/preferences_form.php	2007-05-25 16:58:35.000000000 +0200
@@ -78,9 +78,28 @@
 			<option value="-20"><?php echo $TEXT['PLEASE_SELECT']; ?>...</option>
 			<?php
 			// Insert default timezone values
-			require_once(ADMIN_PATH.'/interface/timezones.php');
+			//timezone.extensions.php change! 
+				//We use a call that selects between php < 5.1 and above
+				// Spin in het web, 20070525
+				
+				//old code:
+					//require_once(ADMIN_PATH.'/interface/timezones.php');
+				//new code:
+					set_TIMEZONES();
+					global $TIMEZONES;
+			//end timezone.extensions.php change
+			
 			foreach($TIMEZONES AS $hour_offset => $title) {
-				if($wb->get_timezone() == $hour_offset*60*60) {
+			//timezone.extensions.php change! 
+				//$hour_offset is a name when using new timezone code (EXCEPT for the standard value -20), otherwise a numeric string
+				//when it is a string, we should not do the hour->second conversion like with numeric
+				// Spin in het web, 20070525
+					
+				//old code
+					//if($wb->get_timezone() == $hour_offset*60*60) {
+				//new code
+				if ((is_numeric($hour_offset) && $wb->get_timezone() == $hour_offset*60*60) || ((! is_numeric($hour_offset)) && $wb->get_timezone() == $hour_offset)) {
+				//end timezone.extensions.php change
 					?>
 					<option value="<?php echo $hour_offset; ?>" selected><?php echo $title; ?></option>
 					<?php
diff -Naur websitebaker-2.6.5/wb/admin/interface/date_formats.php websitebaker-2.6.5.timezone-extensions/wb/admin/interface/date_formats.php
--- websitebaker-2.6.5/wb/admin/interface/date_formats.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/admin/interface/date_formats.php	2007-05-29 15:19:17.000000000 +0200
@@ -31,6 +31,12 @@
 
 */
 
+//timezone.extensions.php change! 
+//we made a lot of changes to this file. We no longer use mktime to make time and add TIMEZONE.
+//instead, we use the new wbdate call to create a date using the current TIMEZONE
+//problem with this is that date will allways be displayed in the current user's timezone, but well
+
+
 if(!defined('WB_URL')) {
 	header('Location: ../index.php');
 	exit(0);
@@ -44,34 +50,66 @@
 // Create array
 $DATE_FORMATS = array();
 
+//timezone.extensions.php change
+//this code removed:
+/*
 // Get the current time (in the users timezone if required)
 if(isset($user_time) AND $user_time == true) {
 	$mktime = mktime()+TIMEZONE;
 } else {
 	$mktime = mktime()+DEFAULT_TIMEZONE;
 }
+*/
+//end timezone.extensions.php change
 
 // Add values to list
-$DATE_FORMATS['l,|jS|F,|Y'] = gmdate('l, jS F, Y', $mktime);
-$DATE_FORMATS['jS|F,|Y'] = gmdate('jS F, Y', $mktime);
-$DATE_FORMATS['d|M|Y'] = gmdate('d M Y', $mktime);
-$DATE_FORMATS['M|d|Y'] = gmdate('M d Y', $mktime);
-$DATE_FORMATS['D|M|d,|Y'] = gmdate('D M d, Y', $mktime);
-$DATE_FORMATS['d-m-Y'] = gmdate('d-m-Y', $mktime).' (D-M-Y)';
-$DATE_FORMATS['m-d-Y'] = gmdate('m-d-Y', $mktime).' (M-D-Y)';
-$DATE_FORMATS['d.m.Y'] = gmdate('d.m.Y', $mktime).' (D.M.Y)';
-$DATE_FORMATS['m.d.Y'] = gmdate('m.d.Y', $mktime).' (M.D.Y)';
-$DATE_FORMATS['d/m/Y'] = gmdate('d/m/Y', $mktime).' (D/M/Y)';
-$DATE_FORMATS['m/d/Y'] = gmdate('m/d/Y', $mktime).' (M/D/Y)';
 
-// Add "System Default" to list (if we need to)
-if(isset($user_time) AND $user_time == true) {
-	if(isset($TEXT['SYSTEM_DEFAULT'])) {
-		$DATE_FORMATS['system_default'] = gmdate(DEFAULT_DATE_FORMAT, $mktime).' ('.$TEXT['SYSTEM_DEFAULT'].')';
-	} else {
-		$DATE_FORMATS['system_default'] = gmdate(DEFAULT_DATE_FORMAT, $mktime).' (System Default)';
-	}
-}
+//timezone.extensions.php change
+	//old code:
+	/*
+		$DATE_FORMATS['l,|jS|F,|Y'] = gmdate('l, jS F, Y', $mktime);
+		$DATE_FORMATS['jS|F,|Y'] = gmdate('jS F, Y', $mktime);
+		$DATE_FORMATS['d|M|Y'] = gmdate('d M Y', $mktime);
+		$DATE_FORMATS['M|d|Y'] = gmdate('M d Y', $mktime);
+		$DATE_FORMATS['D|M|d,|Y'] = gmdate('D M d, Y', $mktime);
+		$DATE_FORMATS['d-m-Y'] = gmdate('d-m-Y', $mktime).' (D-M-Y)';
+		$DATE_FORMATS['m-d-Y'] = gmdate('m-d-Y', $mktime).' (M-D-Y)';
+		$DATE_FORMATS['d.m.Y'] = gmdate('d.m.Y', $mktime).' (D.M.Y)';
+		$DATE_FORMATS['m.d.Y'] = gmdate('m.d.Y', $mktime).' (M.D.Y)';
+		$DATE_FORMATS['d/m/Y'] = gmdate('d/m/Y', $mktime).' (D/M/Y)';
+		$DATE_FORMATS['m/d/Y'] = gmdate('m/d/Y', $mktime).' (M/D/Y)';
+		
+		// Add "System Default" to list (if we need to)
+		if(isset($user_time) AND $user_time == true) {
+			if(isset($TEXT['SYSTEM_DEFAULT'])) {
+				$DATE_FORMATS['system_default'] = gmdate(DEFAULT_DATE_FORMAT, $mktime).' ('.$TEXT['SYSTEM_DEFAULT'].')';
+			} else {
+				$DATE_FORMATS['system_default'] = gmdate(DEFAULT_DATE_FORMAT, $mktime).' (System Default)';
+			}
+		}
+	*/
+	//new code:
+		$DATE_FORMATS['l,|jS|F,|Y'] = wbdate('l, jS F, Y');
+		$DATE_FORMATS['jS|F,|Y'] = wbdate('jS F, Y');
+		$DATE_FORMATS['d|M|Y'] = wbdate('d M Y');
+		$DATE_FORMATS['M|d|Y'] = wbdate('M d Y');
+		$DATE_FORMATS['D|M|d,|Y'] = wbdate('D M d, Y');
+		$DATE_FORMATS['d-m-Y'] = wbdate('d-m-Y').' (D-M-Y)';
+		$DATE_FORMATS['m-d-Y'] = wbdate('m-d-Y').' (M-D-Y)';
+		$DATE_FORMATS['d.m.Y'] = wbdate('d.m.Y').' (D.M.Y)';
+		$DATE_FORMATS['m.d.Y'] = wbdate('m.d.Y').' (M.D.Y)';
+		$DATE_FORMATS['d/m/Y'] = wbdate('d/m/Y').' (D/M/Y)';
+		$DATE_FORMATS['m/d/Y'] = wbdate('m/d/Y').' (M/D/Y)';
+		
+		// Add "System Default" to list (if we need to)
+		if(isset($user_time) AND $user_time == true) {
+			if(isset($TEXT['SYSTEM_DEFAULT'])) {
+				$DATE_FORMATS['system_default'] = wbdate(DEFAULT_DATE_FORMAT).' ('.$TEXT['SYSTEM_DEFAULT'].')';
+			} else {
+				$DATE_FORMATS['system_default'] = wbdate(DEFAULT_DATE_FORMAT).' (System Default)';
+			}
+		}
+//end timezone.extensions.php change
 
 // Reverse array so "System Default" is at the top
 $DATE_FORMATS = array_reverse($DATE_FORMATS, true);
diff -Naur websitebaker-2.6.5/wb/admin/interface/time_formats.php websitebaker-2.6.5.timezone-extensions/wb/admin/interface/time_formats.php
--- websitebaker-2.6.5/wb/admin/interface/time_formats.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/admin/interface/time_formats.php	2007-05-29 15:21:39.000000000 +0200
@@ -30,6 +30,11 @@
 This file is used to generate a list of time formats for the user to select
 
 */
+//timezone.extensions.php change! 
+//we made a lot of changes to this file. We no longer use mktime to make time and add TIMEZONE.
+//instead, we use the new wbdate call to create a date using the current TIMEZONE
+//problem with this is that date will allways be displayed in the current user's timezone, but well
+
 
 if(!defined('WB_URL')) {
 	header('Location: ../index.php');
@@ -44,14 +49,23 @@
 // Create array
 $TIME_FORMATS = array();
 
+//timezone.extensions.php change
+//this code removed:
+/*
 // Get the current time (in the users timezone if required)
 if(isset($user_time) AND $user_time == true) {
 	$mktime = mktime()+TIMEZONE;
 } else {
 	$mktime = mktime()+DEFAULT_TIMEZONE;
 }
+//end timezone.extensions.php change
+
 
 // Add values to list
+
+//timezone.extensions.php change
+	//old code:
+	/*
 $TIME_FORMATS['g:i|A'] = gmdate('g:i A', $mktime);
 $TIME_FORMATS['g:i|a'] = gmdate('g:i a', $mktime);
 $TIME_FORMATS['H:i:s'] = gmdate('H:i:s', $mktime);
@@ -65,6 +79,22 @@
 		$TIME_FORMATS['system_default'] = gmdate(DEFAULT_TIME_FORMAT, $mktime).' (System Default)';
 	}
 }
+*/
+	//new code:
+		$TIME_FORMATS['g:i|A'] = wbdate('g:i A');
+		$TIME_FORMATS['g:i|a'] = wbdate('g:i a');
+		$TIME_FORMATS['H:i:s'] = wbdate('H:i:s');
+		$TIME_FORMATS['H:i'] = wbdate('H:i');
+		
+		// Add "System Default" to list (if we need to)
+		if(isset($user_time) AND $user_time == true) {
+			if(isset($TEXT['SYSTEM_DEFAULT'])) {
+				$TIME_FORMATS['system_default'] = wbdate(DEFAULT_TIME_FORMAT).' ('.$TEXT['SYSTEM_DEFAULT'].')';
+			} else {
+				$TIME_FORMATS['system_default'] = wbdate(DEFAULT_TIME_FORMAT).' (System Default)';
+			}
+		}
+//end timezone.extensions.php change
 
 // Reverse array so "System Default" is at the top
 $TIME_FORMATS = array_reverse($TIME_FORMATS, true);
diff -Naur websitebaker-2.6.5/wb/admin/pages/modify.php websitebaker-2.6.5.timezone-extensions/wb/admin/pages/modify.php
--- websitebaker-2.6.5/wb/admin/pages/modify.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/admin/pages/modify.php	2007-05-29 12:51:59.000000000 +0200
@@ -49,7 +49,12 @@
 
 // Convert the unix ts for modified_when to human a readable form
 if($results_array['modified_when'] != 0) {
-	$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
+	//timezone.extensions.php change! 
+		//old code
+			// $modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
+		//new code
+			$modified_ts = wbdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']);
+	//end timezone.extensions.php change
 } else {
 	$modified_ts = 'Unknown';
 }
diff -Naur websitebaker-2.6.5/wb/admin/pages/settings.php websitebaker-2.6.5.timezone-extensions/wb/admin/pages/settings.php
--- websitebaker-2.6.5/wb/admin/pages/settings.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/admin/pages/settings.php	2007-05-29 12:52:28.000000000 +0200
@@ -65,7 +65,12 @@
 
 // Convert the unix ts for modified_when to human a readable form
 if($results_array['modified_when'] != 0) {
-	$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
+	//timezone.extensions.php change! 
+		//old code
+			// $modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
+		//new code
+			$modified_ts = wbdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']);
+	//end timezone.extensions.php change
 } else {
 	$modified_ts = 'Unknown';
 }
diff -Naur websitebaker-2.6.5/wb/admin/preferences/details.php websitebaker-2.6.5.timezone-extensions/wb/admin/preferences/details.php
--- websitebaker-2.6.5/wb/admin/preferences/details.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/admin/preferences/details.php	2007-05-29 15:38:45.000000000 +0200
@@ -31,7 +31,30 @@
 // Get entered values
 $display_name = $admin->add_slashes(strip_tags($admin->get_post('display_name')));
 $language = $admin->get_post('language');
-$timezone = $admin->get_post('timezone')*60*60;
+
+//timezone.extensions.php change! 
+	//When using the new timezone framework, the timezone value will not be
+	//integer. In that case $value will just be saved (being a string)
+	// Spin in het web, 20070525
+	
+	//old code:
+		//$timezone = $admin->get_post('timezone')*60*60;
+	//new code:
+			$timezone = $admin->get_post('timezone');
+			if (is_numeric($timezone))
+				$timezone = $timezone*60*60;
+			//this seemed to be missing in the original code
+			if($timezone == '-72000')
+			{
+				// Set a session var so apps can tell user is using default tz
+				$_SESSION['USE_DEFAULT_TIMEZONE'] = true;
+			}
+			else
+			{
+				unset($_SESSION['USE_DEFAULT_TIMEZONE']);
+			}
+//end timezone.extensions.php change
+
 $date_format = $admin->get_post('date_format');
 $time_format = $admin->get_post('time_format');
 
diff -Naur websitebaker-2.6.5/wb/admin/preferences/index.php websitebaker-2.6.5.timezone-extensions/wb/admin/preferences/index.php
--- websitebaker-2.6.5/wb/admin/preferences/index.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/admin/preferences/index.php	2007-05-29 15:47:42.000000000 +0200
@@ -25,6 +25,8 @@
 
 require('../../config.php');
 require_once(WB_PATH.'/framework/class.admin.php');
+
+
 $admin = new admin('Preferences');
 
 // Create new template object for the preferences form
@@ -66,12 +68,40 @@
 }
 
 // Insert default timezone values
-require(ADMIN_PATH.'/interface/timezones.php');
+
+//timezone.extensions.php change! 
+	//We use a call that selects between php < 5.1 and above
+	// Spin in het web, 20070525
+	
+	//old code:
+		//require(ADMIN_PATH.'/interface/timezones.php');
+	//new code:
+		set_TIMEZONES();
+//end timezone.extensions.php change
+
 $template->set_block('main_block', 'timezone_list_block', 'timezone_list');
+
+//timezone.extensions.php change! 
+	//we save admin->get_timezone() once, saves calling it for once or twice for every timezone
+	//code added:
+	
+	$admintz = $admin->get_timezone();
+//end timezone.extensions.php change
+
 foreach($TIMEZONES AS $hour_offset => $title) {
 	$template->set_var('VALUE', $hour_offset);
 	$template->set_var('NAME', $title);
-	if($admin->get_timezone() == $hour_offset*60*60) {
+	//timezone.extensions.php change! 
+		//$hour_offset is a name when using new timezone code (EXCEPT for the standard value -20), otherwise a numeric string
+		//when it is a string, we should not do the hour->second conversion like with numeric
+		// Spin in het web, 20070525
+			
+		//old code
+			//if($admin->get_timezone() == $hour_offset*60*60) {
+		//new code
+
+			if ((is_numeric($hour_offset) && $admintz == $hour_offset*60*60) || ((! is_numeric($hour_offset)) && $admintz == $hour_offset)) {
+	//end timezone.extensions.php change
 		$template->set_var('SELECTED', 'selected');
 	} else {
 		$template->set_var('SELECTED', '');
diff -Naur websitebaker-2.6.5/wb/admin/settings/index.php websitebaker-2.6.5.timezone-extensions/wb/admin/settings/index.php
--- websitebaker-2.6.5/wb/admin/settings/index.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/admin/settings/index.php	2007-05-25 15:52:50.000000000 +0200
@@ -158,14 +158,34 @@
 }
 
 // Insert default timezone values
-require(ADMIN_PATH.'/interface/timezones.php');
+
+//timezone.extensions.php change! 
+	//We use a call that selects between php < 5.1 and above
+	// Spin in het web, 20070525
+	
+	//old code:
+		//require(ADMIN_PATH.'/interface/timezones.php');
+	//new code:
+		set_TIMEZONES();
+//end timezone.extensions.php change
+
 $template->set_block('main_block', 'timezone_list_block', 'timezone_list');
 foreach($TIMEZONES AS $hour_offset => $title) {
 	// Make sure we dont list "System Default" as we are setting this value!
 	if($hour_offset != '-20') {
 		$template->set_var('VALUE', $hour_offset);
 		$template->set_var('NAME', $title);
-		if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
+		
+		//timezone.extensions.php change! 
+			//$hour_offset is a name when using new timezone code  (EXCEPT for the standard value -20), otherwise a numeric string
+			//when it is a string, we should not do the hour->second conversion like with numeric
+			// Spin in het web, 20070525
+			
+			//old code
+				//if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
+			//new code
+				if ((is_numeric($hour_offset) && DEFAULT_TIMEZONE == $hour_offset*60*60) || ((! is_numeric($hour_offset)) && DEFAULT_TIMEZONE == $hour_offset)) {
+		//end timezone.extensions.php change
 			$template->set_var('SELECTED', 'selected');
 		} else {
 			$template->set_var('SELECTED', '');
diff -Naur websitebaker-2.6.5/wb/admin/settings/save.php websitebaker-2.6.5.timezone-extensions/wb/admin/settings/save.php
--- websitebaker-2.6.5/wb/admin/settings/save.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/admin/settings/save.php	2007-05-25 15:32:07.000000000 +0200
@@ -126,6 +126,14 @@
 		$value = $admin->add_slashes($value);
 		switch ($setting_name) {
 			case 'default_timezone':
+				//timezone.extensions.php change! 
+					//When using the new timezone framework, this value will not be
+					//integer. In that case $value will just be saved (being a string)
+					// Spin in het web, 20070525
+					
+					//added code:
+						if (is_numeric($value))
+				//end timezone.extensions.php change
 				$value=$value*60*60;
 				break;
 			case 'string_dir_mode':
diff -Naur websitebaker-2.6.5/wb/framework/initialize.php websitebaker-2.6.5.timezone-extensions/wb/framework/initialize.php
--- websitebaker-2.6.5/wb/framework/initialize.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/framework/initialize.php	2007-05-29 12:21:18.000000000 +0200
@@ -23,6 +23,11 @@
 
 */
  
+//timezone.extensions.php added
+//Spin in het Web 20070525
+require_once(WB_PATH.'/framework/timezone.extensions.php');
+//
+
 if (file_exists(WB_PATH.'/framework/class.database.php')) {
 	
 	require_once(WB_PATH.'/framework/class.database.php');
@@ -79,12 +84,22 @@
 		}
 	}
 	
-	// Get users timezone
-	if(isset($_SESSION['TIMEZONE'])) {
-		define('TIMEZONE', $_SESSION['TIMEZONE']);
-	} else {
-		define('TIMEZONE', DEFAULT_TIMEZONE);
-	}
+		//timezone.extensions.php change! 
+	//we now fix the timezone for the new timezone framework (see timezone.extensions.php)
+	//old code
+	/*
+		// Get users timezone
+		if(isset($_SESSION['TIMEZONE'])) {
+			define('TIMEZONE', $_SESSION['TIMEZONE']);
+		} else {
+			define('TIMEZONE', DEFAULT_TIMEZONE);
+		}	
+	*/
+	//new code
+		init_timezone();
+	//end timezone.extensions.php change
+
+	
 	// Get users date format
 	if(isset($_SESSION['DATE_FORMAT'])) {
 		define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
diff -Naur websitebaker-2.6.5/wb/framework/timezone.extensions.php websitebaker-2.6.5.timezone-extensions/wb/framework/timezone.extensions.php
--- websitebaker-2.6.5/wb/framework/timezone.extensions.php	1970-01-01 01:00:00.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/framework/timezone.extensions.php	2007-05-29 16:11:38.000000000 +0200
@@ -0,0 +1,209 @@
+<?php
+
+// Timezone Extensions
+// This code will take advantages of the new timezone framework offered by php >= 5.1
+// while making sure everything keeps working when using an older php version
+
+// New timezones are like Europe/Amsterdam and automatically support daylight saving time etc
+
+// This file is (c) 2007 Spin in het Web (http://www.spininhetweb.nl), Jelmer Jellema
+// This code is placed into the public domain. Use it at your own risk.
+
+
+// This code is used in the framework of:
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2007, Ryan Djurovich
+
+ Website Baker 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.
+
+ Website Baker 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 Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+
+/*
+General functions that could be used elsewhere in the Website Baker code or templates. The usualy differ in functionality with the new features enbabled (TZ+) or disabled (TZ-)
+
+- init_timezone. To be called when initializing sessions. Will define TIMEZONE the way initialize.php used to do it and:
+TZ-: do nothing, except for some stuff when php was *downgraded*
+TZ+: Will set the constant TIMEZONENAME with the chosen (new) timezone. Will set the old constant TIMEZONE to the *current* offset of that timestamp, so old code using gmtdate(.., timestamp + TIMEZONE) still works. When the preferences or user settings contain an old style timezone, this call tries to find a matching TIMEZONENAME and use it.
+
+- set_TIMEZONES: sets the TIMEZONES array like admin/interface/timezones.php does.
+TZ-: Will call the timezones.php file
+TZ+: Will fill the TIMEZONES array with the new timezones. Values and indices are both timezone names.
+
+- wbdate(timeformat,[timestamp = mktime()]). Our implementation of date() and gmdate(). Use it instead of gmdate("..",time + TIMEZONE)
+TZ-: will return the built-in gmdate(timeformat,timestamp + TIMEZONE)
+TZ+: will return date(timeformat,timestamp), using the right timezone
+
+
+*/
+
+// Stop this file from being accessed directly
+if(!defined('WB_URL')) {
+	header('Location: ../index.php');
+	exit(0);
+}
+
+// Define that this file has been loaded
+define('TIMEZONE_EXTENSIONS_FILE_LOADED', true);
+
+//Can we use the new framework?
+
+if (function_exists('date_default_timezone_set'))
+{
+///////////////////////// USING THE NEW TIMEZONE FRAMEWORK //////////////////
+
+	function init_timezone()
+	{
+		// Get users timezone
+		if(isset($_SESSION['TIMEZONE']) && $_SESSION['TIMEZONE'] != '-72000') 
+			$timezone = $_SESSION['TIMEZONE'];
+		else
+			$timezone = DEFAULT_TIMEZONE;
+
+		//do we have a numeric or normal timezone?
+		if (is_numeric($timezone))
+		{
+			//probably upgraded php lately?
+			//Lets see if we can find a good one
+			//this is not perfect, because we do not know is dst is running or not
+			
+			//informed guess: does the server use DST
+			
+			
+			$tz = false;
+			if ($month < 5 or $month > 10)
+				$dst = 0;
+			else
+				$dst = 1;
+			if (function_exists('timezone_name_from_abbr')) //5.1.3
+				$tz = timezone_name_from_abbr("", $timezone,date('I'));
+				
+			if (! $tz)
+				$tz = 'UTC'; //what else can we do?
+			define('TIMEZONENAME',$tz);
+		}
+		else
+		{
+			define('TIMEZONENAME', $timezone);			
+		}
+		
+		//we set TIMEZONE to the offset that is now current
+		//there is a problem with this. All offset calculating functionality is bèta in php 5.1 and not
+		//included by default. So we do some tricks here
+		
+		$now_universal = mktime(); //tz-independend unix timestamp
+		$oldtz = date_default_timezone_get();
+		date_default_timezone_set('GMT');
+		
+		$gmdate = getdate($now_universal);
+		date_default_timezone_set(TIMEZONENAME);
+		$now_in_tz = mktime($gmdate['hours'],$gmdate['minutes'],$gmdate['seconds'],$gmdate['mon'],$gmdate['mday'],$gmdate['year'],-1);
+		
+		//if now_in_tz is less then now_universal, this means it is usualy *later* in the time zone than in GMT
+		//
+		define('TIMEZONE',$now_universal - $now_in_tz); 
+	
+		date_default_timezone_set($oldtz);
+		
+		//print "TZ $timezone<br>Timezone: " . TIMEZONE . "<br>Session timezone: " . $_SESSION['TIMEZONE'] . "<br>Timezone name: " . TIMEZONENAME . "<br>Use default: " . ($_SESSION['USE_DEFAULT_TIMEZONE'] ? 'true' : 'false') . "<br>";
+		
+		//we do NOT use date_default_timezone_set, because this will set the TZ environment, which gives problem
+		//when used in apache php module: even apache will start logging in the new timezone
+	}
+	
+	function set_TIMEZONES()
+	{
+		//set the TIMEZONE array using the new style values
+		global $TIMEZONES;
+		global $TEXT;
+		
+		$TIMEZONES = array();
+		// Add "System Default" to top of list, just like timezones.php
+		if(isset($TEXT['SYSTEM_DEFAULT'])) {
+			$TIMEZONES['-20'] = $TEXT['SYSTEM_DEFAULT'];
+		} else {
+			$TIMEZONES['-20'] = 'System Default';
+		}
+
+		//add the current server timezone on the top of the list
+		$tz = date_default_timezone_get();
+		if ($tz)
+			$TIMEZONES[$tz] = $tz;
+		foreach (DateTimeZone::listIdentifiers() as $tz)
+		{
+			$TIMEZONES[$tz] = $tz;
+		}
+	}
+	
+	function wbdate($timeformat, $timestamp = -1)
+	{
+		//create a time string like date() and gmdate(), using the timezone in TIMEZONENAME
+		//this is the new framework version. Old framework will call gmdate
+		
+		//set the tz only when really needed (see init_timezone above)
+		$oldtz = '';
+		$oldtz = date_default_timezone_get();
+		date_default_timezone_set(TIMEZONENAME);
+		
+		if ($timestamp == -1)
+			$r = date($timeformat);
+		else
+			$r = date($timeformat, $timestamp);
+			
+		date_default_timezone_set($oldtz);
+		return $r;
+	}
+}
+///////////////////////// NOT USING THE NEW TIMEZONE FRAMEWORK //////////////////
+else
+{
+	//NOT USING THE NEW TIMEZONE FRAMEWORK
+	
+	function init_timezone()
+	{
+	
+		// Get users timezone
+		if(isset($_SESSION['TIMEZONE']) && $_SESSION['TIMEZONE'] != '-72000') 
+			$timezone = $_SESSION['TIMEZONE'];
+		else
+			$timezone = DEFAULT_TIMEZONE;
+		
+		//very special case: downgrading php
+		if (! is_numeric($timezone))
+			define(TIMEZONE,0); #numeric again
+		else
+			define(TIMEZONE,$timezone);			
+	}
+	
+	function set_TIMEZONES()
+	{
+		//usual WB code to read the timezones
+		global $TIMEZONES;
+		require_once(ADMIN_PATH.'/interface/timezones.php');
+		
+	}
+
+	function wbdate($timeformat, $timestamp = -1)
+	{
+		//in the old framework, wbdate does the same as gmdate(format, timestamp + TIMEZONE)
+		
+		if ($timestamp == -1)
+			return gmdate($timeformat, mktime() + TIMEZONE);
+		else
+			return gmdate($timeformat, $timestamp + TIMEZONE);
+	}
+}
\ No newline at end of file
diff -Naur websitebaker-2.6.5/wb/install/index.php websitebaker-2.6.5.timezone-extensions/wb/install/index.php
--- websitebaker-2.6.5/wb/install/index.php	2006-12-25 02:38:05.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/install/index.php	2007-05-29 15:58:56.000000000 +0200
@@ -201,39 +201,64 @@
 			</td>
 			<td>
 				<select tabindex="3" name="default_timezone" style="width: 100%;">
-					<?php
-					$TIMEZONES['-12'] = 'GMT - 12 Hours';
-					$TIMEZONES['-11'] = 'GMT -11 Hours';
-					$TIMEZONES['-10'] = 'GMT -10 Hours';
-					$TIMEZONES['-9'] = 'GMT -9 Hours';
-					$TIMEZONES['-8'] = 'GMT -8 Hours';
-					$TIMEZONES['-7'] = 'GMT -7 Hours';
-					$TIMEZONES['-6'] = 'GMT -6 Hours';
-					$TIMEZONES['-5'] = 'GMT -5 Hours';
-					$TIMEZONES['-4'] = 'GMT -4 Hours';
-					$TIMEZONES['-3.5'] = 'GMT -3.5 Hours';
-					$TIMEZONES['-3'] = 'GMT -3 Hours';
-					$TIMEZONES['-2'] = 'GMT -2 Hours';
-					$TIMEZONES['-1'] = 'GMT -1 Hour';
-					$TIMEZONES['0'] = 'GMT';
-					$TIMEZONES['1'] = 'GMT +1 Hour';
-					$TIMEZONES['2'] = 'GMT +2 Hours';
-					$TIMEZONES['3'] = 'GMT +3 Hours';
-					$TIMEZONES['3.5'] = 'GMT +3.5 Hours';
-					$TIMEZONES['4'] = 'GMT +4 Hours';
-					$TIMEZONES['4.5'] = 'GMT +4.5 Hours';
-					$TIMEZONES['5'] = 'GMT +5 Hours';
-					$TIMEZONES['5.5'] = 'GMT +5.5 Hours';
-					$TIMEZONES['6'] = 'GMT +6 Hours';
-					$TIMEZONES['6.5'] = 'GMT +6.5 Hours';
-					$TIMEZONES['7'] = 'GMT +7 Hours';
-					$TIMEZONES['8'] = 'GMT +8 Hours';
-					$TIMEZONES['9'] = 'GMT +9 Hours';
-					$TIMEZONES['9.5'] = 'GMT +9.5 Hours';
-					$TIMEZONES['10'] = 'GMT +10 Hours';
-					$TIMEZONES['11'] = 'GMT +11 Hours';
-					$TIMEZONES['12'] = 'GMT +12 Hours';
-					$TIMEZONES['13'] = 'GMT +13 Hours';
+				<?php
+					//timezone.extensions.php change!
+					//when available, we use the new timezone framework
+					
+					//added code:
+						if (function_exists('date_default_timezone_set'))
+						{
+							//New timezone framework
+							$TIMEZONES = array();
+							//add the current server timezone on the top of the list
+							$tz = date_default_timezone_get();
+							if ($tz)
+								$TIMEZONES[$tz] = $tz;
+							foreach (DateTimeZone::listIdentifiers() as $tz)
+							{
+								$TIMEZONES[$tz] = $tz;
+							}
+						}
+						else
+						{
+							//old timezone framework
+					//old code still active:
+						$TIMEZONES['-12'] = 'GMT - 12 Hours';
+						$TIMEZONES['-11'] = 'GMT -11 Hours';
+						$TIMEZONES['-10'] = 'GMT -10 Hours';
+						$TIMEZONES['-9'] = 'GMT -9 Hours';
+						$TIMEZONES['-8'] = 'GMT -8 Hours';
+						$TIMEZONES['-7'] = 'GMT -7 Hours';
+						$TIMEZONES['-6'] = 'GMT -6 Hours';
+						$TIMEZONES['-5'] = 'GMT -5 Hours';
+						$TIMEZONES['-4'] = 'GMT -4 Hours';
+						$TIMEZONES['-3.5'] = 'GMT -3.5 Hours';
+						$TIMEZONES['-3'] = 'GMT -3 Hours';
+						$TIMEZONES['-2'] = 'GMT -2 Hours';
+						$TIMEZONES['-1'] = 'GMT -1 Hour';
+						$TIMEZONES['0'] = 'GMT';
+						$TIMEZONES['1'] = 'GMT +1 Hour';
+						$TIMEZONES['2'] = 'GMT +2 Hours';
+						$TIMEZONES['3'] = 'GMT +3 Hours';
+						$TIMEZONES['3.5'] = 'GMT +3.5 Hours';
+						$TIMEZONES['4'] = 'GMT +4 Hours';
+						$TIMEZONES['4.5'] = 'GMT +4.5 Hours';
+						$TIMEZONES['5'] = 'GMT +5 Hours';
+						$TIMEZONES['5.5'] = 'GMT +5.5 Hours';
+						$TIMEZONES['6'] = 'GMT +6 Hours';
+						$TIMEZONES['6.5'] = 'GMT +6.5 Hours';
+						$TIMEZONES['7'] = 'GMT +7 Hours';
+						$TIMEZONES['8'] = 'GMT +8 Hours';
+						$TIMEZONES['9'] = 'GMT +9 Hours';
+						$TIMEZONES['9.5'] = 'GMT +9.5 Hours';
+						$TIMEZONES['10'] = 'GMT +10 Hours';
+						$TIMEZONES['11'] = 'GMT +11 Hours';
+						$TIMEZONES['12'] = 'GMT +12 Hours';
+						$TIMEZONES['13'] = 'GMT +13 Hours';
+					//added code:
+						}
+					//end timezone.extensions.php change
+					
 					foreach($TIMEZONES AS $hour_offset => $title) {
 						?>
 							<option value="<?php echo $hour_offset; ?>"<?php if(isset($_SESSION['default_timezone']) AND $_SESSION['default_timezone'] == $hour_offset) { echo ' selected'; } elseif(!isset($_SESSION['default_timezone']) AND $hour_offset == 0) { echo 'selected'; } ?>><?php echo $title; ?></option>
diff -Naur websitebaker-2.6.5/wb/install/save.php websitebaker-2.6.5.timezone-extensions/wb/install/save.php
--- websitebaker-2.6.5/wb/install/save.php	2006-12-25 02:13:59.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/install/save.php	2007-05-29 16:54:16.000000000 +0200
@@ -160,12 +160,35 @@
 if(substr($wb_url, strlen($wb_url)-1, 1) == "\\") {
 	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
 }
+
 // Get the default time zone
-if(!isset($_POST['default_timezone']) OR !is_numeric($_POST['default_timezone'])) {
-	set_error('Please select a valid default timezone');
-} else {
-	$default_timezone = $_POST['default_timezone']*60*60;
-}
+//timezone.extensions.php change!
+//when available, we use the new timezone framework
+
+	//added code:
+		if (function_exists('date_default_timezone_set'))
+		{
+			//New timezone framework
+			if(!isset($_POST['default_timezone']) OR is_numeric($_POST['default_timezone'])) {
+				set_error('Please select a valid default timezone');
+			} else {
+				$default_timezone = $_POST['default_timezone'];
+			}
+		}
+		else
+		{
+			//old timezone framework
+	//old code still active:
+
+		if(!isset($_POST['default_timezone']) OR !is_numeric($_POST['default_timezone'])) {
+			set_error('Please select a valid default timezone');
+		} else {
+			$default_timezone = $_POST['default_timezone']*60*60;
+		}
+	//added code:
+		}
+//end timezone.extensions.php change
+
 // End path and timezone details code
 
 // Begin operating system specific code
@@ -490,7 +513,10 @@
 	       . ' `last_reset` INT NOT NULL DEFAULT \'0\','
 	       . ' `display_name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
 	       . ' `email` TEXT NOT NULL ,'
-	       . ' `timezone` INT NOT NULL DEFAULT \'0\','
+//SIHW
+//. ' `timezone` INT NOT NULL DEFAULT \'0\','
+	       . ' `timezone` VARCHAR(40) NOT NULL DEFAULT \'-72000\','
+//_SIHW
 	       . ' `date_format` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
 	       . ' `time_format` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
 	       . ' `language` VARCHAR( 5 ) NOT NULL DEFAULT \'\' ,'
@@ -685,4 +711,4 @@
 									'GROUPS_TABLE' => TABLE_PREFIX."groups",
 							)
 					);
-?>
\ No newline at end of file
+?>
diff -Naur websitebaker-2.6.5/wb/modules/admin.php websitebaker-2.6.5.timezone-extensions/wb/modules/admin.php
--- websitebaker-2.6.5/wb/modules/admin.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/modules/admin.php	2007-05-29 16:06:51.000000000 +0200
@@ -112,7 +112,14 @@
 
 // Convert the unix ts for modified_when to human a readable form
 if($results_array['modified_when'] != 0) {
-	$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
+//timezone.extensions.php change! 
+//old code
+	/*
+		$modified_ts = gmdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']+TIMEZONE);
+	*/
+//new code
+	$modified_ts = wbdate(TIME_FORMAT.', '.DATE_FORMAT, $results_array['modified_when']);
+//end timezone.extensions.php change
 } else {
 	$modified_ts = 'Unknown';
 }
diff -Naur websitebaker-2.6.5/wb/modules/backup/backup-sql.php websitebaker-2.6.5.timezone-extensions/wb/modules/backup/backup-sql.php
--- websitebaker-2.6.5/wb/modules/backup/backup-sql.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/modules/backup/backup-sql.php	2007-05-29 16:14:57.000000000 +0200
@@ -23,9 +23,6 @@
 
 */
 
-// Filename to use
-$filename = $_SERVER['HTTP_HOST'].'-backup-'.gmdate('Y-m-d', mktime()+TIMEZONE).'.sql';
-
 // Check if user clicked on the backup button
 if(!isset($_POST['backup'])){ 
 	header('Location: ../');
@@ -39,12 +36,32 @@
 require(WB_PATH.'/framework/class.admin.php');
 $admin = new admin('Settings', 'settings_advanced', false);
 
+// Filename to use
+
+//timezone.extensions.php change! 
+//we moved it a bit
+//old code
+	/*
+		$filename = $_SERVER['HTTP_HOST'].'-backup-'.gmdate('Y-m-d', mktime()+TIMEZONE).'.sql';
+	*/
+//new code
+	$filename = $_SERVER['HTTP_HOST'].'-backup-'.wbdate('Y-m-d', mktime()).'.sql';
+//end timezone.extensions.php change
+
+
 // Begin output var
 $output = "".
 "#\n".
 "# Website Baker ".WB_VERSION." Database Backup\n".
 "# ".WB_URL."\n".
-"# ".gmdate(DATE_FORMAT, mktime()+TIMEZONE).", ".gmdate(TIME_FORMAT, mktime()+TIMEZONE)."\n".
+//timezone.extensions.php change! 
+//old code
+	/*
+	"# ".gmdate(DATE_FORMAT, mktime()+TIMEZONE).", ".gmdate(TIME_FORMAT, mktime()+TIMEZONE)."\n".
+	*/
+//new code
+		"# ".wbdate(DATE_FORMAT).", ".wbdate(TIME_FORMAT)."\n".
+//end timezone.extensions.php change
 "#".
 "\n";
 
diff -Naur websitebaker-2.6.5/wb/modules/form/modify.php websitebaker-2.6.5.timezone-extensions/wb/modules/form/modify.php
--- websitebaker-2.6.5/wb/modules/form/modify.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/modules/form/modify.php	2007-05-29 16:10:25.000000000 +0200
@@ -164,7 +164,16 @@
 				</a>
 			</td>
 			<td width="237"><?php echo $TEXT['SUBMISSION_ID'].': '.$submission['submission_id']; ?></td>
-			<td><?php echo $TEXT['SUBMITTED'].': '.gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
+			<td><?php echo $TEXT['SUBMITTED'].': '.
+					//timezone.extensions.php change! 
+					//old code
+						/*
+						gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE);
+						*/
+					//new code
+						wbdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']);
+					//end timezone.extensions.php change
+					?></td>
 			<td width="20">
 				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_submission.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&submission_id=<?php echo $submission['submission_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
 					<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
diff -Naur websitebaker-2.6.5/wb/modules/form/view_submission.php websitebaker-2.6.5.timezone-extensions/wb/modules/form/view_submission.php
--- websitebaker-2.6.5/wb/modules/form/view_submission.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/modules/form/view_submission.php	2007-05-29 16:09:11.000000000 +0200
@@ -63,7 +63,16 @@
 </tr>
 <tr>
 	<td><?php echo $TEXT['SUBMITTED']; ?>:</td>
-	<td><?php echo gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
+	<td><?php
+			//timezone.extensions.php change! 
+	//old code
+		/*
+			echo gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE);
+		*/
+	//new code
+			echo wbdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']);
+	//end timezone.extensions.php change
+	?></td>
 </td>
 <tr>
 	<td><?php echo $TEXT['USER']; ?>:</td>
diff -Naur websitebaker-2.6.5/wb/modules/news/view.php websitebaker-2.6.5.timezone-extensions/wb/modules/news/view.php
--- websitebaker-2.6.5/wb/modules/news/view.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/modules/news/view.php	2007-05-29 16:18:00.000000000 +0200
@@ -167,8 +167,16 @@
 			if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
 				$uid = $post['posted_by']; // User who last modified the post
 				// Workout date and time of last modified post
-				$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
-				$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
+				//timezone.extensions.php change! 
+				//old code
+					/*
+						$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
+						$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
+					*/
+				//new code
+					$post_date = wbdate(DATE_FORMAT, $post['posted_when']);
+					$post_time = wbdate(TIME_FORMAT, $post['posted_when']);
+				//end timezone.extensions.php change
 				// Work-out the post link
 				$post_link = page_link($post['link']);
 				if(isset($_GET['p']) AND $position > 0) {
@@ -257,8 +265,16 @@
 		if(isset($groups[$post['group_id']]['active']) AND $groups[$post['group_id']]['active'] != false) { // Make sure parent group is active
 			$uid = $post['posted_by']; // User who last modified the post
 			// Workout date and time of last modified post
-			$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
-			$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
+			//timezone.extensions.php change! 
+			//old code
+				/*
+					$post_date = gmdate(DATE_FORMAT, $post['posted_when']+TIMEZONE);
+					$post_time = gmdate(TIME_FORMAT, $post['posted_when']+TIMEZONE);
+				*/
+			//new code
+				$post_date = wbdate(DATE_FORMAT, $post['posted_when']);
+				$post_time = wbdate(TIME_FORMAT, $post['posted_when']);
+			//end timezone.extensions.php change
 			// Get group id, title, and image
 			$group_id = $post['group_id'];
 			$group_title = $groups[$group_id]['title'];
@@ -305,8 +321,16 @@
 				$comment['comment'] = nl2br(($comment['comment']));
 				$comment['title'] = ($comment['title']);
 				// Print comments loop
-				$commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
-				$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
+				//timezone.extensions.php change! 
+				//old code
+					/*
+						$commented_date = gmdate(DATE_FORMAT, $comment['commented_when']+TIMEZONE);
+						$commented_time = gmdate(TIME_FORMAT, $comment['commented_when']+TIMEZONE);
+					*/
+				//new code
+					$commented_date = wbdate(DATE_FORMAT, $comment['commented_when']);
+					$commented_time = wbdate(TIME_FORMAT, $comment['commented_when']);
+				//end timezone.extensions.php change
 				$uid = $comment['commented_by'];
 				$vars = array('[TITLE]','[COMMENT]','[DATE]','[TIME]','[USER_ID]','[USERNAME]','[DISPLAY_NAME]', '[EMAIL]');
 				if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
diff -Naur websitebaker-2.6.5/wb/search/search.php websitebaker-2.6.5.timezone-extensions/wb/search/search.php
--- websitebaker-2.6.5/wb/search/search.php	2006-12-24 08:50:44.000000000 +0100
+++ websitebaker-2.6.5.timezone-extensions/wb/search/search.php	2007-05-29 16:06:07.000000000 +0200
@@ -150,8 +150,16 @@
 				// Set vars to be replaced by values
 				$vars = array('[LINK]', '[TITLE]', '[DESCRIPTION]', '[USERNAME]','[DISPLAY_NAME]','[DATE]','[TIME]','[TEXT_LAST_UPDATED_BY]','[TEXT_ON]');
 				if($page['modified_when'] > 0) {
-					$date = gmdate(DATE_FORMAT, $page['modified_when']+TIMEZONE);
-					$time = gmdate(TIME_FORMAT, $page['modified_when']+TIMEZONE);
+					//timezone.extensions.php change! 
+					//old code
+						/*
+						$date = gmdate(DATE_FORMAT, $page['modified_when']+TIMEZONE);
+						$time = gmdate(TIME_FORMAT, $page['modified_when']+TIMEZONE);
+						*/
+					//new code
+						$date = wbdate(DATE_FORMAT, $page['modified_when']);
+						$time = wbdate(TIME_FORMAT, $page['modified_when']);
+					//end timezone.extensions.php change
 				} else {
 					$date = $TEXT['UNKNOWN'].' '.$TEXT['DATE'];
 					$time = $TEXT['UNKNOWN'].' '.$TEXT['TIME'];
@@ -218,8 +226,16 @@
 										// Set vars to be replaced by values
 										$vars = array('[LINK]', '[TITLE]', '[DESCRIPTION]', '[USERNAME]','[DISPLAY_NAME]','[DATE]','[TIME]','[TEXT_LAST_UPDATED_BY]','[TEXT_ON]');
 										if($page[$fields['modified_when']] > 0) {
-											$date = gmdate(DATE_FORMAT, $page[$fields['modified_when']]+TIMEZONE);
-											$time = gmdate(TIME_FORMAT, $page[$fields['modified_when']]+TIMEZONE);
+												//timezone.extensions.php change! 
+												//old code
+													/*
+													$date = gmdate(DATE_FORMAT, $page[$fields['modified_when']]+TIMEZONE);
+													$time = gmdate(TIME_FORMAT, $page[$fields['modified_when']]+TIMEZONE);
+													*/
+												//new code
+												$date = wbdate(DATE_FORMAT, $page[$fields['modified_when']]);
+												$time = wbdate(TIME_FORMAT, $page[$fields['modified_when']]);
+												//end timezone.extensions.php change
 										} else {
 											$date = $TEXT['UNKNOWN'].' '.$TEXT['DATE'];
 											$time = $TEXT['UNKNOWN'].' '.$TEXT['TIME'];

Attachments

timezone-extensions.patch.txt (41.3 kB) - added by Jelmer on 05/29/07 19:55:01.

Change History

05/29/07 19:55:01 changed by Jelmer

  • attachment timezone-extensions.patch.txt added.

05/29/07 19:56:25 changed by Jelmer

Sorry for the double attachment, I use this system for the 1st time.

06/13/07 22:13:50 changed by ah520

http://www.52ec.org 企业电子商务指南 http://www.sxian.net 数字寿州寿县门户 http://www.myjinxin.cn/ 金信输送设备 输送机金信 http://www.jinxin8.com、 工业流水线自动化流水线电动车流水线 http://www.jinxinec.com 金信输送线输送流水线 http://www.wltuoye.com 拓野流水线 http://www.liushuixian.com 中国流水线行业网 http://www.wltuoye.cn 拓野生产线 http://www.myjinxin.com 金信装配线、装配流水线 http://www.myjinxin.cn 输送设备、输送机 http://www.51jinxin.com 金信生产线生产流水线 http://www.wlyalong.com 雅龙流水线 http://www.elyalong.com 雅龙生产线 http://www.wljinxin.com 金信流水线 http://www.wllianchuang.cn/ 自动化装配线输送线流水线生产线 http://www.zslsx.com 增盛流水线 http://www.hekaitong.com 和凯通电动门道闸岗亭 http://www.tzyalong.com/ 雅龙装配线,装配流水线 http://www.36oo.com 台州水泵网 http://www.toplsx.com 装配线,装配流水线,流水线配件 http://www.zjcmlsx.cn/ 生产线、组装流水线、自动化流水线 http://www.tzcmlsx.cn/ 输送线、输送流水线、皮带输送线 http://www.ecmlsx.cn/ 板链线、流水线设备、皮带流水线 http://www.cncmlsx.cn/ 流水线、工业流水线、自动化流水线 http://www.wlcmlsx.cn/ 流水线、装配线、装配流水线、涂装流水线

06/19/07 08:56:01 changed by lala

月季、蔷薇这两种鲜花可吸收硫化氢、氟化氢、苯酚、乙醚等有害气体。深圳鲜花市场非常常见.在花店中放盆石榴花,既能观 花又观果,能降低空气中的含铅量。武汉鲜花养护,减少细菌繁殖就会增加鲜花的花期。菊花在北京鲜花市场非常熟悉,例如白母菊鲜花在较高浓度的二氧化碳气体包围下,仍傲然挺立,含苞怒放。牡丹,上海鲜花市场很少出现。牡丹这种鲜花不仅是著名的观赏植物,而且对光、化学烟雾中的臭氧非常的敏感,当大气中的臭氧 浓度小于0.5PPM时,只要三小时,鲜花的叶片上出现特征性的斑点和伤痕,进而扩展成伤害区。根据程度不同,叶的颜色可变为赤褐、淡黄、灰白等色。 在不少[http://www.komiyo.cn 上海鲜花]花店入住前,摆上吊兰、龙骨等,既可装饰家居又能除装修材料和家具释放的有毒气体。

06/21/07 08:00:58 changed by allen wang

shanghai florist is a local professional florist who have more than 20 year experience in flower industry. We have more than 500 chains and cooperate local chinese florists in P.R.China, send products within 3-6 hours in big city,such as shenzhen flower beijing flower delivery Professional services, local prices for your lover , for your parents, for your best friends

06/27/07 11:15:56 changed by shanda

Google左侧排名 Google优化 Google排名 网站建设 平面设计 电子杂志 Google左侧优化 Google排名优化 Google左侧排名 北京网站建设 google排名 google优化 农民工 维权 在行动 注册公司 北京注册公司 北京公司注册 注册北京公司 公司注册 注册公司 公司注册 上海注册公司 上海公司注册 注册上海公司 注册公司 北京公司注册 北京注册公司 注册北京公司 公司注册 上海搬家公司 上海搬家公司 搬家公司 北京公司注册 北京注册公司 注册北京公司 办照 塑料托盘 输送机 升降平台 仓储系统 仓库管理系统 叉车 升降机械 条码设备 托盘 物流软件 自动仓储 清洗设备 交通运输 平托盘 网箱托盘 集装箱 手推台车 手动托盘搬运车 手推液压堆高车 电动托盘搬运车 电动托盘堆垛车 前移式叉车 烟罩清洗 地板清洗 石材养护 取样机 金刚石钻头 公路养护 工程机械 拉力试验机 喷码机 喷码机 北京搬家公司 同声翻译 翻译公司 搬家公司 机票 网络机柜 快递 显微镜 英语培训 机械连接 钢筋连接套筒 连接件 翻译公司 北京翻译公司 招聘兼职翻译 手机美容 脚手架 膨润土 龙兴六号 淡水龙虾 龙虾养殖 水产养殖 特种养殖 水产类 龙虾 东西湖龙虾 武汉龙虾 龙虾 牛仔牛仔裤 牛仔服 网络视频服务器 视频服务器 视频监控 网络视频监控 网络摄像机 远程视频监控 网络视频服务器 视频服务器 网络摄像机 视频监控 网络视频监控 远程视频监控 网络摄像机 冰淇淋 冰淇淋 冰淇淋加盟 冰淇淋专卖店 冰淇淋设备 烧包 烧包小铺 烧包加盟 烧包连锁 烧包招商 饰品连锁 时尚休闲 鞋业连锁 名品鞋业 鞋业折扣 恋步鞋业 服装加盟 品牌加盟 [http://www.olysec.com/ 时尚休闲服装 ]运动休闲装 运动装代理 品牌服装加盟 韩国服装品牌 运动情侣装 名牌服装 休闲装 运动装 运动装招商 连锁加盟 加盟店 山特UPS 山特UPS电源 山特UPS报价 艾默生UPS 梅兰日兰UPS APC UPS 搬场公司 一元店一元店加盟二元店 二元店加盟 物流软件 地毯清洗 烟道清洗 石材翻新 胶带机 胶带机械 胶带机器 封箱胶带机 塑料胶带 胶带设备 胶带生产设备 北京公司注册 北京注册公司 注册北京公司 北京google左侧优化 北京google优化 北京google排名 北京google左侧排名 北京google左侧排名 品牌加盟 女装加盟 西班牙女装 西班牙女装 胖人服装 时尚女装 精油 芳香疗法 agricultural equipment 韩国女装 品牌加盟 服饰搭配 加盟服饰 色彩搭配 连锁加盟 服装连锁加盟 加盟店 服装专卖 服装代理 服饰招商 时尚包搭配 包搭配专卖 服装加盟 创意服饰 品牌服饰加盟 加盟店 服饰招商 服装加盟 短信猫 代发短信 短信群发器 北京google左侧优化 北京google优化 北京google排名 北京google左侧排名 快餐加盟 西餐连锁 餐饮连锁 比萨加盟 蛋糕加盟 冰淇淋加盟 果冻加盟 果冻原料 巧克力喷泉机 饮料加盟 西饼加盟 煲仔饭加盟 冷水机 冷水机 五金配件 起名 取名 风水 商标注册 专利代理 商标代理 数码影像 数码影像加盟 数码影像连锁 加盟店 手机饰品加盟 个性饰品加盟 手工饰品加盟 个性礼品 礼品加盟 个性店 水晶像 童装 童装 童装加盟 亲子教育 婴幼儿教育 水晶像 电流传感器 电压传感器 电流变送器 电压变送器 霍尔传感器 功率变送器 隔离端子 海洋饰品 贝壳饰品加盟 贝壳饰品 贝壳饰品批发 贝壳工艺 海底饰界 冷水机 冷水机 五金配件 货架 藏獒 runescape money runescape gold 模温机 机械手 服装服饰 餐饮美食 建材化工 家居家装 运动休闲 文化教育 美容康体 IT互联网 礼品饰品 婴幼服务 医疗保健 汽车服务 其他行业 连锁加盟

07/11/07 03:00:29 changed by hjracks

货架 仓储货架 货架厂 南京货架 上海货架 广州货架 北京货架 仓库货架 货架公司

货架 仓储货架 仓库货架

货架 仓储货架 仓库货架

货架 仓储货架 仓库货架

南京货架 货架公司 货架厂 仓库货架 仓储货架 货架

货架 货架 仓储货架 仓库货架 货架厂 货架公司 南京货架 上海货架 杭州货架 无锡货架 苏州货架 轻型货架 角钢货架 中型货架 中量A型货架 中量B型货架 重型货架 货位式货架 横梁式货架 托盘式货架 阁楼式货架 悬臂式货架 贯通式货架 驶入式货架 通廊式货架 抽屉式货架 模具货架

货架 仓储货架 仓库货架 货架厂 货架公司 南京货架 上海货架

★★★★★A

仓储货架 仓库货架 货架 货架厂 货架公司 南京货架 上海货架

货架 仓储货架 仓库货架 货架厂 货架公司 南京货架 上海货架 杭州货架 北京货架

货架 货架 货架 货架 货架 货架 货架 货架 货架 货架 货架 货架 货架 货架 货架 货架 轻量型货架 角钢货架 中量A型货架 中量B型货架 货位式货架 横梁式货架 阁楼式货架 钢平台 悬臂式货架 贯通式货架 通廊式货架 驶入式货架 辊轮式货架 流利条货架 压入式货架 移动式货架 密集架 模具货架 抽屉式货架 汽车4S店货架 汽配库货架 自动化立体仓库货架

托盘 托盘 钢托盘 钢制托盘 塑料托盘 木托盘 木制托盘 纸托盘 木塑托盘

★★★★★B

托盘 钢托盘 钢制托盘

托盘 钢托盘 钢制托盘 塑料托盘 托盘

托盘 钢托盘 钢制托盘

钢托盘 木托盘 钢制托盘 托盘 塑料托盘

托盘 钢托盘 钢制托盘

托盘 钢托盘 钢制托盘 塑料托盘 木托盘 南京托盘 南京钢托盘 上海托盘

托盘 钢托盘 钢制托盘 塑料托盘 木托盘 南京托盘 南京钢托盘 上海托盘

托盘 钢托盘 钢制托盘 塑料托盘 木托盘 纸托盘 南京托盘 上海托盘 北京托盘 广州托盘 杭州托盘 成都托盘 武汉托盘 长沙托盘 合肥托盘 苏州托盘 无锡托盘 昆山托盘

托盘 钢托盘 钢制托盘 塑料托盘 木托盘 纸托盘 南京托盘 南京钢制托盘 南京钢托盘 上海托盘 北京托盘

★★★★★C

托盘 托盘 托盘 托盘 钢托盘 钢制托盘 塑料托盘 塑料托盘 塑料托盘

仓储笼 仓储笼 折叠式仓储笼 仓库笼 南京仓储笼 上海仓储笼 北京仓储笼 广州仓储笼 杭州仓储笼

仓储设备 置物架 金属置物架

仓储笼 仓库笼 折叠式仓储笼 蝴蝶笼

折叠式仓储笼 仓库笼 仓储笼

仓储笼 仓库笼 折叠式仓储笼 南京仓储笼 上海仓储笼

仓储笼 仓库笼 折叠式仓储笼 南京仓储笼 上海仓储笼

仓储笼 仓库笼 折叠式仓储笼 南京仓储笼 上海仓储笼

仓储笼 仓库笼 折叠式仓储笼

挂板架 堆垛车 堆高车 叉车 手动液压托盘搬运车 物料整理架 巧固架 堆垛架

★★★★★D

置物架 载物台车 物流台车 登高车 平板手推车 静音手推车 手推车 钢制料箱

仓储设备 置物架 金属置物架

钢制料箱 手推车 静音手推车 平板手推车 登高车 物流台车 置物架 堆垛架 巧固架 物料整理架 手动液压托盘搬运车 叉车 堆垛车 堆高车 载物台车

钢制料箱 手推车 静音手推车 平板手推车 登高车 物流台车 载物台车 置物架 堆垛架 巧固架 挂板架 物料整理架 手动液压托盘搬运车 叉车 堆高车 堆垛车

钢制料箱 手推车