? sites/all/modules
? sites/default/files
? sites/default/settings.pgsql.php
? sites/default/settings.php
Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.116
diff -u -p -r1.116 install.php
--- install.php	10 Feb 2008 19:03:47 -0000	1.116
+++ install.php	12 Mar 2008 00:01:48 -0000
@@ -1047,7 +1047,7 @@ function install_configure_form(&$form_s
   $form['server_settings']['date_default_timezone'] = array(
     '#type' => 'select',
     '#title' => st('Default time zone'),
-    '#default_value' => 0,
+    '#default_value' => 'UTC',
     '#options' => _system_zonelist(),
     '#description' => st('By default, dates in this site will be displayed in the chosen time zone.'),
     '#weight' => 5,
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.759
diff -u -p -r1.759 common.inc
--- includes/common.inc	20 Feb 2008 13:38:32 -0000	1.759
+++ includes/common.inc	12 Mar 2008 00:01:49 -0000
@@ -1149,17 +1149,19 @@ function format_interval($timestamp, $gr
  *   A translated date string in the requested format.
  */
 function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) {
-  if (!isset($timezone)) {
+  static $timezones;
+  if (!$timezone) {
     global $user;
-    if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
+    if (variable_get('configurable_timezones', 1) && $user->uid && $user->timezone) {
       $timezone = $user->timezone;
     }
     else {
-      $timezone = variable_get('date_default_timezone', 0);
+      $timezone = variable_get('date_default_timezone', 'UTC');
     }
   }
-
-  $timestamp += $timezone;
+  if (!isset($timezones[$timezone])) {
+    $timezones[$timezone] = timezone_open($timezone);
+  }
 
   switch ($type) {
     case 'small':
@@ -1178,28 +1180,25 @@ function format_date($timestamp, $type =
 
   $max = strlen($format);
   $date = '';
+  $date_time = date_create('@'. $timestamp);
+  date_timezone_set($date_time, $timezones[$timezone]);
+
   for ($i = 0; $i < $max; $i++) {
     $c = $format[$i];
-    if (strpos('AaDlM', $c) !== FALSE) {
-      $date .= t(gmdate($c, $timestamp), array(), $langcode);
+    if (strpos('AaeDlMT', $c) !== FALSE) {
+      $date .= t(date_format($date_time, $c), array(), $langcode);
     }
     else if ($c == 'F') {
       // Special treatment for long month names: May is both an abbreviation
       // and a full month name in English, but other languages have
       // different abbreviations.
-      $date .= trim(t('!long-month-name '. gmdate($c, $timestamp), array('!long-month-name' => ''), $langcode));
+      $date .= trim(t('!long-month-name '. date_format($date_time, $c), array('!long-month-name' => ''), $langcode));
     }
-    else if (strpos('BdgGhHiIjLmnsStTUwWYyz', $c) !== FALSE) {
-      $date .= gmdate($c, $timestamp);
+    else if (strpos('BcdGgHhIijLmNnOoPSstUuWwYyZz', $c) !== FALSE) {
+      $date .= date_format($date_time, $c);
     }
     else if ($c == 'r') {
-      $date .= format_date($timestamp - $timezone, 'custom', 'D, d M Y H:i:s O', $timezone, $langcode);
-    }
-    else if ($c == 'O') {
-      $date .= sprintf('%s%02d%02d', ($timezone < 0 ? '-' : '+'), abs($timezone / 3600), abs($timezone % 3600) / 60);
-    }
-    else if ($c == 'Z') {
-      $date .= $timezone;
+      $date .= format_date($timestamp, 'custom', 'D, d M Y H:i:s O', $timezone, $langcode);
     }
     else if ($c == '\\') {
       $date .= $format[++$i];
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.64
diff -u -p -r1.64 system.admin.inc
--- modules/system/system.admin.inc	20 Feb 2008 13:46:41 -0000	1.64
+++ modules/system/system.admin.inc	12 Mar 2008 00:01:49 -0000
@@ -1485,7 +1485,7 @@ function system_date_time_settings() {
   $form['locale']['date_default_timezone'] = array(
     '#type' => 'select',
     '#title' => t('Default time zone'),
-    '#default_value' => variable_get('date_default_timezone', 0),
+    '#default_value' => variable_get('date_default_timezone', 'UTC'),
     '#options' => $zones,
     '#description' => t('Select the default site time zone.')
   );
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.240
diff -u -p -r1.240 system.install
--- modules/system/system.install	23 Feb 2008 08:13:09 -0000	1.240
+++ modules/system/system.install	12 Mar 2008 00:01:50 -0000
@@ -2549,6 +2549,24 @@ function system_update_7000() {
 }
 
 /**
+ * Store timezone names rather than timezone offsets in the users table.
+ */
+function system_update_7001() {
+  $ret = array();
+  db_change_field($ret, 'users', 'timezone', 'timezone', array('type' => 'varchar', 'length' => 32, 'not null' => FALSE, 'description' => t("User's timezone.")));
+  $users = db_query("SELECT uid, timezone FROM {users} WHERE LENGTH(timezone) > 0");
+  while ($user = db_fetch_object($users)) {
+    // It is impossible to determine the timezone correctly from the offset alone.
+    // We can throw a little extra data at the problem by also providing the server's 
+    // daylight saving time status; this, however, may not match the user's daylight
+    // saving time status.
+    $timezone = timezone_name_from_abbr('', intval($user->timezone), intval(date('I')));
+    $ret[] = update_sql("UPDATE {users} SET timezone = '$timezone' WHERE uid = $user->uid");
+  }
+  return $ret;
+}
+
+/**
  * @} End of "defgroup updates-6.x-to-7.x"
  * The next series of updates should start at 8000.
  */
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.593
diff -u -p -r1.593 system.module
--- modules/system/system.module	11 Mar 2008 08:13:14 -0000	1.593
+++ modules/system/system.module	12 Mar 2008 00:01:50 -0000
@@ -562,7 +562,7 @@ function system_user($type, $edit, &$use
       $form['timezone']['timezone'] = array(
         '#type' => 'select',
         '#title' => t('Time zone'),
-        '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0),
+        '#default_value' => $edit['timezone'] ? $edit['timezone'] : variable_get('date_default_timezone', 'UTC'),
         '#options' => $zones,
         '#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.'),
       );
@@ -1851,11 +1851,12 @@ function system_goto_action($object, $co
  */
 function _system_zonelist() {
   $timestamp = time();
-  $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
+  $zonelist = timezone_identifiers_list();
   $zones = array();
-  foreach ($zonelist as $offset) {
-    $zone = $offset * 3600;
-    $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', 'l, F j, Y - H:i') .' O', $zone);
+  foreach ($zonelist as $zone) {
+    if (preg_match('!^((Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Europe|Indian|Pacific)/|UTC$)!', $zone)) {
+      $zones[$zone] = t('@zone: @date', array('@zone' => t($zone), '@date' => format_date($timestamp, 'custom', variable_get('date_format_long', 'l, F j, Y - H:i') .' O', $zone)));
+    }
   }
   return $zones;
 }
Index: modules/user/user.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.install,v
retrieving revision 1.6
diff -u -p -r1.6 user.install
--- modules/user/user.install	18 Feb 2008 16:53:36 -0000	1.6
+++ modules/user/user.install	12 Mar 2008 00:01:50 -0000
@@ -218,7 +218,7 @@ function user_schema() {
       ),
       'timezone' => array(
         'type' => 'varchar',
-        'length' => 8,
+        'length' => 32,
         'not null' => FALSE,
         'description' => t("User's timezone."),
       ),
Index: modules/user/user.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.js,v
retrieving revision 1.6
diff -u -p -r1.6 user.js
--- modules/user/user.js	12 Sep 2007 18:29:32 -0000	1.6
+++ modules/user/user.js	12 Mar 2008 00:01:50 -0000
@@ -171,8 +171,30 @@ Drupal.evaluatePasswordStrength = functi
  * Set the client's system timezone as default values of form fields.
  */
 Drupal.setDefaultTimezone = function() {
-  var offset = new Date().getTimezoneOffset() * -60;
-  $("#edit-date-default-timezone, #edit-user-register-timezone").val(offset);
+  var matches = Date().match(/\(([A-Z]{3,4})\)/);
+  var abbr = matches ? matches[1] : 0;
+  var dateNow = new Date();
+  var dateJan = new Date(dateNow.getFullYear(), 0, 1, 0, 0, 0, 0);
+  var dateJul = new Date(dateNow.getFullYear(), 6, 1, 0, 0, 0, 0);
+  var offsetNow = dateNow.getTimezoneOffset() * -60;
+  var offsetJan = dateJan.getTimezoneOffset() * -60;
+  var offsetJul = dateJul.getTimezoneOffset() * -60;
+  offsetMax = Math.max(offsetJan, offsetJul);
+  if (offsetJan == offsetJul) {
+    var dst = '';
+  }
+  else if (offsetMax == offsetNow) {
+    var dst = 1;
+  }
+  else {
+    var dst = 0;
+  }
+  var path = 'user/timezone/'+ Drupal.encodeURIComponent(abbr) +'/'+ Drupal.encodeURIComponent(offsetNow) +'/'+ Drupal.encodeURIComponent(dst);
+  $.getJSON(Drupal.settings.basePath, { q: path }, function (data) {
+    if (data) {
+      $("#edit-date-default-timezone, #edit-user-register-timezone").val(data);
+    }
+  });
 };
 
 /**
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.896
diff -u -p -r1.896 user.module
--- modules/user/user.module	20 Feb 2008 13:46:43 -0000	1.896
+++ modules/user/user.module	12 Mar 2008 00:01:50 -0000
@@ -844,6 +844,14 @@ function user_menu() {
     'file' => 'user.pages.inc',
   );
 
+  $items['user/timezone'] = array(
+    'title' => 'User timezone',
+    'page callback' => 'user_timezone',
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK,
+    'file' => 'user.pages.inc',
+  );
+
   // Registration and login pages.
   $items['user'] = array(
     'title' => 'User account',
@@ -2363,7 +2371,7 @@ function user_register() {
     // and never touch it on user edit pages.
     $form['timezone'] = array(
       '#type' => 'hidden',
-      '#default_value' => variable_get('date_default_timezone', NULL),
+      '#default_value' => variable_get('date_default_timezone', 'UTC'),
       '#id' => 'edit-user-register-timezone',
     );
 
Index: modules/user/user.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v
retrieving revision 1.12
diff -u -p -r1.12 user.pages.inc
--- modules/user/user.pages.inc	18 Feb 2008 16:53:37 -0000	1.12
+++ modules/user/user.pages.inc	12 Mar 2008 00:01:50 -0000
@@ -22,6 +22,14 @@ function user_autocomplete($string = '')
 }
 
 /**
+ * Menu callback; Retrieve a JSON object containing a suggested timezone name.
+ */
+function user_timezone($abbr = '', $offset = -1, $dst = NULL) {
+  $abbr = $abbr ? $abbr : '';
+  drupal_json(timezone_name_from_abbr($abbr, intval($offset), $dst));
+}
+
+/**
  * Form builder; Request a password reset.
  *
  * @ingroup forms
