? includes/date.inc Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.62 diff -u -r1.62 install.php --- install.php 25 Jun 2007 12:44:11 -0000 1.62 +++ install.php 29 Jun 2007 13:57:12 -0000 @@ -888,22 +888,39 @@ '#weight' => 0, ); - $zones = _system_zonelist(); - $form['server_settings'] = array( '#type' => 'fieldset', '#title' => st('Server settings'), '#collapsible' => FALSE, ); - $form['server_settings']['date_default_timezone'] = array( - '#type' => 'select', - '#title' => st('Default time zone'), - '#default_value' => variable_get('date_default_timezone', 0), - '#options' => $zones, - '#description' => st('By default, dates in this site will be displayed in the chosen time zone.'), - '#weight' => 5, - ); - + if (date_handle_timezones()) { + $form['server_settings']['date_default_offset'] = array( + '#type' => 'hidden', + '#value' => variable_get('date_default_offset', 0), + ); + $form['server_settings']['date_default_timezone'] = array( + '#type' => 'select', + '#title' => t('Default time zone'), + '#default_value' => variable_get('date_default_timezone', 'UTC'), + '#options' => date_zone_names(), + '#description' => st('By default, dates in this site will be displayed in the chosen time zone.'), + '#weight' => 5, + '#submit' => array('system_timezone_update_site' => array('date_default_timezone')), + ); + } + else { + $form['server_settings']['date_default_timezone'] = array( + '#type' => 'hidden', + '#value' => variable_get('date_default_timezone', 'UTC'), + ); + $form['server_settings']['date_default_offset'] = array( + '#type' => 'select', + '#title' => t('Default time zone'), + '#default_value' => variable_get('date_default_offset', 0), + '#options' => date_zone_offsets(), + '#description' => st('By default, dates in this site will be displayed in the chosen time zone.'), + ); + } drupal_add_js(drupal_get_path('module', 'system') .'/system.js', 'module'); // We add these strings as settings because JavaScript translation does not // work on install time. @@ -958,7 +975,9 @@ variable_set('site_name', $form_state['values']['site_name']); variable_set('site_mail', $form_state['values']['site_mail']); + variable_set('date_default_offset', $form_state['values']['date_default_offset']); variable_set('date_default_timezone', $form_state['values']['date_default_timezone']); + date_timezone_update_site($form, $form_state); // Turn this off temporarily so that we can pass a password through. variable_set('user_email_verification', FALSE); Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.666 diff -u -r1.666 common.inc --- includes/common.inc 28 Jun 2007 07:48:40 -0000 1.666 +++ includes/common.inc 29 Jun 2007 14:26:45 -0000 @@ -1076,26 +1076,16 @@ * before a character to avoid interpreting the character as part of a date * format. * @param $timezone - * Time zone offset in seconds; if omitted, the user's time zone is used. + * Time zone name; if omitted, the user's time zone is used. * @param $langcode * Optional language code to translate to a language other than * what is used to display the page. + * @param $offset + * Time zone offset in seconds; if omitted, the user's time zone is used. * @return * A translated date string in the requested format. */ -function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) { - if (!isset($timezone)) { - global $user; - if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) { - $timezone = $user->timezone; - } - else { - $timezone = variable_get('date_default_timezone', 0); - } - } - - $timestamp += $timezone; - +function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL, $offset = NULL) { switch ($type) { case 'small': $format = variable_get('date_format_short', 'm/d/Y - H:i'); @@ -1104,40 +1094,91 @@ $format = variable_get('date_format_long', 'l, F j, Y - H:i'); break; case 'custom': - // No change to format + $format = $format; break; case 'medium': default: $format = variable_get('date_format_medium', 'D, m/d/Y - H:i'); } - $max = strlen($format); $date = ''; - for ($i = 0; $i < $max; $i++) { - $c = $format[$i]; - if (strpos('AaDFlM', $c) !== FALSE) { - $date .= t(gmdate($c, $timestamp), array(), $langcode); + if (date_handle_timezones()) { + // Using native timezone handling mode. + if (isset($timezone)) { + $timezone = $timezone; } - else if (strpos('BdgGhHiIjLmnsStTUwWYyz', $c) !== FALSE) { - $date .= gmdate($c, $timestamp); - } - 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 { + global $user; + if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) { + $timezone = $user->timezone; + } + else { + $timezone = variable_get('date_default_timezone', 'UTC'); + } } - else if ($c == 'Z') { - $date .= $timezone; + $date_time = date_create(gmdate('c', $timestamp)); + date_timezone_set($date_time, timezone_open($timezone ? $timezone : 'UTC')); + for ($i = 0; $i < $max; $i++) { + $c = $format[$i]; + // AM/pm, days of the week, months, timezone names, and + // timezone abbreviations can be localized. + if (strpos('AaeDFlMT', $c) !== FALSE) { + $date .= t(date_format($date_time, $c), array(), $langcode); + } + else if (strpos('BcdGgHhIijLmNnOoPSstUuWwYyZz', $c) !== FALSE) { + $date .= date_format($date_time, $c); + } + else if ($c == 'r') { + $date .= format_date($timestamp, 'custom', 'D, d M Y H:i:s O', $timezone, $langcode); + } + else if ($c == '\\') { + $date .= $format[++$i]; + } + else { + $date .= $c; + } } - else if ($c == '\\') { - $date .= $format[++$i]; + } + else { + // Using legacy timezone handling mode (offsets). + if (isset($params['offset'])) { + $offset = $offset; } else { - $date .= $c; + global $user; + if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->offset)) { + $offset = $user->offset; + } + else { + $offset = variable_get('date_default_offset', 0); + } + } + $timestamp += $offset; + for ($i = 0; $i < $max; $i++) { + $c = $format[$i]; + if (strpos('AaDFlM', $c) !== FALSE) { + $date .= t(gmdate($c, $offset), array(), $langcode); + } + else if (strpos('BdgGhHiIjLmnsStTUwWYyz', $c) !== FALSE) { + $date .= gmdate($c, $offset); + } + else if ($c == 'r') { + $date .= format_date($timestamp - $offset, 'custom', 'D, d M Y H:i:s O', $timezone, $langcode, $offset); + } + else if ($c == 'O') { + $date .= sprintf('%s%02d%02d', ($offset < 0 ? '-' : '+'), abs($offset / 3600), abs($offset % 3600) / 60); + } + else if ($c == 'Z') { + $date .= $offset; + } + else if ($c == '\\') { + $date .= $format[++$i]; + } + else { + $date .= $c; + } } } - return $date; } @@ -2246,6 +2287,7 @@ return; } $called = 1; + require_once './includes/date.inc'; require_once './includes/theme.inc'; require_once './includes/pager.inc'; require_once './includes/menu.inc'; Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.124 diff -u -r1.124 system.install --- modules/system/system.install 26 Jun 2007 20:24:19 -0000 1.124 +++ modules/system/system.install 29 Jun 2007 13:53:25 -0000 @@ -277,6 +277,7 @@ db_query("INSERT INTO {variable} (name,value) VALUES ('filter_html_1','i:1;')"); db_query("INSERT INTO {variable} (name, value) VALUES ('node_options_forum', '%s')", 'a:1:{i:0;s:6:"status";}'); + } // Updates for core @@ -3421,6 +3422,19 @@ } /** + * Rename user->timezone to user->offset and add new user->timezone to hold timezone names. + * Alter variables to match new schema. + */ +function system_update_6025() { + $ret = array(); + db_change_field($ret, 'users', 'timezone', 'offset', array('type' => 'varchar', 'length' => 8, 'not null' => FALSE, 'default' => NULL)); + db_add_field($ret, 'users', 'timezone', array('type' => 'varchar', 'length' => 50, 'not null' => FALSE, 'default' => NULL)); + variable_set('date_default_offset', variable_get('date_default_timezone', 0)); + variable_set('date_default_timezone', 'UTC'); + return $ret; +} + +/** * @} End of "defgroup updates-5.x-to-6.x" * The next series of updates should start at 7000. */ Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.499 diff -u -r1.499 system.module --- modules/system/system.module 28 Jun 2007 00:48:26 -0000 1.499 +++ modules/system/system.module 29 Jun 2007 13:56:43 -0000 @@ -373,24 +373,45 @@ $form['theme_select'] = system_theme_select_form(t('Selecting a different theme will change the look and feel of the site.'), isset($edit['theme']) ? $edit['theme'] : NULL, 2); if (variable_get('configurable_timezones', 1)) { - $zones = _system_zonelist(); + $zones = date_zone_offsets(); $form['timezone'] = array( '#type' => 'fieldset', '#title' => t('Locale settings'), '#weight' => 6, '#collapsible' => TRUE, ); - $form['timezone']['timezone'] = array( - '#type' => 'select', - '#title' => t('Time zone'), - '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0), - '#options' => $zones, - '#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.'), - ); + if (date_handle_timezones()) { + $form['timezone']['offset'] = array( + '#type' => 'hidden', + '#value' => strlen($edit['offset']) ? $edit['offset'] : variable_get('date_default_offset', 0), + ); + $form['timezone']['timezone'] = array( + '#type' => 'select', + '#title' => t('Default time zone'), + '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 'UTC'), + '#options' => date_zone_names(), + '#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.'), + ); + } + else { + $form['timezone']['timezone'] = array( + '#type' => 'hidden', + '#value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 'UTC'), + ); + $form['timezone']['offset'] = array( + '#type' => 'select', + '#title' => t('Default time zone'), + '#default_value' =>strlen($edit['offset']) ? $edit['offset'] : variable_get('date_default_offset', 0), + '#options' => date_zone_offsets(), + '#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.'), + ); + } } - return $form; } + elseif ($type == 'submit') { + date_timezone_update_user($edit, $user); + } } /** @@ -542,17 +563,6 @@ return $output; } -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); - $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); - } - return $zones; -} - function system_site_information_settings() { $form['site_name'] = array( '#type' => 'textfield', @@ -827,7 +837,6 @@ $(document).ready(Drupal.dateTimeAutoAttach); }', 'inline'); // Date settings: - $zones = _system_zonelist(); // Date settings: possible date formats $date_short = array('Y-m-d H:i', 'm/d/Y - H:i', 'd/m/Y - H:i', 'Y/m/d - H:i', @@ -859,13 +868,32 @@ '#title' => t('Locale settings'), ); - $form['locale']['date_default_timezone'] = array( - '#type' => 'select', - '#title' => t('Default time zone'), - '#default_value' => variable_get('date_default_timezone', 0), - '#options' => $zones, - '#description' => t('Select the default site time zone.') - ); + if (date_handle_timezones()) { + $form['locale']['date_default_offset'] = array( + '#type' => 'hidden', + '#value' => variable_get('date_default_offset', 0), + ); + $form['locale']['date_default_timezone'] = array( + '#type' => 'select', + '#title' => t('Default time zone'), + '#default_value' => variable_get('date_default_timezone', 'UTC'), + '#options' => date_zone_names(), + '#description' => t('Select the default site time zone.'), + ); + } + else { + $form['locale']['date_default_timezone'] = array( + '#type' => 'hidden', + '#value' => variable_get('date_default_timezone', 'UTC'), + ); + $form['locale']['date_default_offset'] = array( + '#type' => 'select', + '#title' => t('Default time zone'), + '#default_value' => variable_get('date_default_offset', 0), + '#options' => date_zone_offsets(), + '#description' => t('Select the default site time zone.'), + ); + } $form['locale']['configurable_timezones'] = array( '#type' => 'radios', @@ -973,6 +1001,7 @@ if ($form_state['values']['date_format_long'] == 'custom') { $form_state['values']['date_format_long'] = $form_state['values']['date_format_long_custom']; } + date_timezone_update_site($form, $form_state); return system_settings_form_submit($form, $form_state); } Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.809 diff -u -r1.809 user.module --- modules/user/user.module 28 Jun 2007 07:48:41 -0000 1.809 +++ modules/user/user.module 29 Jun 2007 13:18:45 -0000 @@ -478,7 +478,7 @@ } else { // Make sure we return the default fields at least - $fields = array('uid', 'name', 'pass', 'mail', 'picture', 'mode', 'sort', 'threshold', 'theme', 'signature', 'created', 'access', 'login', 'status', 'timezone', 'language', 'init', 'data'); + $fields = array('uid', 'name', 'pass', 'mail', 'picture', 'mode', 'sort', 'threshold', 'theme', 'signature', 'created', 'access', 'login', 'status', 'timezone', 'offset', 'language', 'init', 'data'); } } @@ -2809,7 +2809,6 @@ } usort($categories, '_user_sort'); - return $categories; } Index: modules/user/user.schema =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.schema,v retrieving revision 1.2 diff -u -r1.2 user.schema --- modules/user/user.schema 15 Jun 2007 07:15:25 -0000 1.2 +++ modules/user/user.schema 29 Jun 2007 14:09:17 -0000 @@ -58,7 +58,8 @@ 'access' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), 'login' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), 'status' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'), - 'timezone' => array('type' => 'varchar', 'length' => 8, 'not null' => FALSE), + 'timezone' => array('type' => 'varchar', 'length' => 50, 'not null' => FALSE), + 'offset' => array('type' => 'varchar', 'length' => 8, 'not null' => FALSE), 'language' => array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''), 'picture' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'init' => array('type' => 'varchar', 'length' => 64, 'not null' => FALSE, 'default' => ''), --- includes/date.inc +++ includes/date.inc @@ -0,0 +1,522 @@ +='); +} + +/** + * Update site timezone info. + * When the timezone name is updated, update the offset as well. + */ +function date_timezone_update_site(&$form, &$form_state) { + if (!isset($form_state['values']['date_default_timezone'])) return; + $timezone = $form_state['values']['date_default_timezone']; + if (date_handle_timezones()) { + if (!empty($timezone)) { + variable_set('date_default_timezone', $timezone); + } + else { + $timezone = variable_get('date_default_timezone', 'UTC'); + } + $dateTimeZone = new DateTimeZone($timezone); + $dateTime = new DateTime("now", $dateTimeZone); + variable_set('date_default_offset', $dateTimeZone->getOffset($dateTime)); + $form['date_default_offset'] = $dateTimeZone->getOffset($dateTime); + $form_state['values']['date_default_offset'] = $dateTimeZone->getOffset($dateTime); + } +} + +/** + * Update user timezone info. + * When the timezone name is updated, update the offset as well. + */ +function date_timezone_update_user(&$edit, &$user) { + if (!isset($edit['timezone'])) return; + $timezone = $edit['timezone']; + $uid = $user->uid; + if (date_handle_timezones()) { + $dateTimeZone = new DateTimeZone($timezone); + $dateTime = new DateTime("now", $dateTimeZone); + db_query("UPDATE {users} SET timezone = '%s', offset = '%s' WHERE uid = %d", $timezone, $dateTimeZone->getOffset($dateTime), $uid); + $edit['offset'] = $dateTimeZone->getOffset($dateTime); + } +} + +function date_zone_offsets() { + $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); + $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); + } + return $zones; +} + +function date_zone_names($langcode = NULL) { + $zone_names = array( + 0 => "Africa/Abidjan", + 1 => "Africa/Accra", + 2 => "Africa/Addis_Ababa", + 3 => "Africa/Algiers", + 4 => "Africa/Asmara", + 5 => "Africa/Asmera", + 6 => "Africa/Bamako", + 7 => "Africa/Bangui", + 8 => "Africa/Banjul", + 9 => "Africa/Bissau", + 10 => "Africa/Blantyre", + 11 => "Africa/Brazzaville", + 12 => "Africa/Bujumbura", + 13 => "Africa/Cairo", + 14 => "Africa/Casablanca", + 15 => "Africa/Ceuta", + 16 => "Africa/Conakry", + 17 => "Africa/Dakar", + 18 => "Africa/Dar_es_Salaam", + 19 => "Africa/Djibouti", + 20 => "Africa/Douala", + 21 => "Africa/El_Aaiun", + 22 => "Africa/Freetown", + 23 => "Africa/Gaborone", + 24 => "Africa/Harare", + 25 => "Africa/Johannesburg", + 26 => "Africa/Kampala", + 27 => "Africa/Khartoum", + 28 => "Africa/Kigali", + 29 => "Africa/Kinshasa", + 30 => "Africa/Lagos", + 31 => "Africa/Libreville", + 32 => "Africa/Lome", + 33 => "Africa/Luanda", + 34 => "Africa/Lubumbashi", + 35 => "Africa/Lusaka", + 36 => "Africa/Malabo", + 37 => "Africa/Maputo", + 38 => "Africa/Maseru", + 39 => "Africa/Mbabane", + 40 => "Africa/Mogadishu", + 41 => "Africa/Monrovia", + 42 => "Africa/Nairobi", + 43 => "Africa/Ndjamena", + 44 => "Africa/Niamey", + 45 => "Africa/Nouakchott", + 46 => "Africa/Ouagadougou", + 47 => "Africa/Porto-Novo", + 48 => "Africa/Sao_Tome", + 49 => "Africa/Timbuktu", + 50 => "Africa/Tripoli", + 51 => "Africa/Tunis", + 52 => "Africa/Windhoek", + 53 => "America/Adak", + 54 => "America/Anchorage", + 55 => "America/Anguilla", + 56 => "America/Antigua", + 57 => "America/Araguaina", + 58 => "America/Argentina/Buenos_Aires", + 59 => "America/Argentina/Catamarca", + 60 => "America/Argentina/ComodRivadavia", + 61 => "America/Argentina/Cordoba", + 62 => "America/Argentina/Jujuy", + 63 => "America/Argentina/La_Rioja", + 64 => "America/Argentina/Mendoza", + 65 => "America/Argentina/Rio_Gallegos", + 66 => "America/Argentina/San_Juan", + 67 => "America/Argentina/Tucuman", + 68 => "America/Argentina/Ushuaia", + 69 => "America/Aruba", + 70 => "America/Asuncion", + 71 => "America/Atikokan", + 72 => "America/Atka", + 73 => "America/Bahia", + 74 => "America/Barbados", + 75 => "America/Belem", + 76 => "America/Belize", + 77 => "America/Blanc-Sablon", + 78 => "America/Boa_Vista", + 79 => "America/Bogota", + 80 => "America/Boise", + 81 => "America/Buenos_Aires", + 82 => "America/Cambridge_Bay", + 83 => "America/Campo_Grande", + 84 => "America/Cancun", + 85 => "America/Caracas", + 86 => "America/Catamarca", + 87 => "America/Cayenne", + 88 => "America/Cayman", + 89 => "America/Chicago", + 90 => "America/Chihuahua", + 91 => "America/Coral_Harbour", + 92 => "America/Cordoba", + 93 => "America/Costa_Rica", + 94 => "America/Cuiaba", + 95 => "America/Curacao", + 96 => "America/Danmarkshavn", + 97 => "America/Dawson", + 98 => "America/Dawson_Creek", + 99 => "America/Denver", + 100 => "America/Detroit", + 101 => "America/Dominica", + 102 => "America/Edmonton", + 103 => "America/Eirunepe", + 104 => "America/El_Salvador", + 105 => "America/Ensenada", + 106 => "America/Fort_Wayne", + 107 => "America/Fortaleza", + 108 => "America/Glace_Bay", + 109 => "America/Godthab", + 110 => "America/Goose_Bay", + 111 => "America/Grand_Turk", + 112 => "America/Grenada", + 113 => "America/Guadeloupe", + 114 => "America/Guatemala", + 115 => "America/Guayaquil", + 116 => "America/Guyana", + 117 => "America/Halifax", + 118 => "America/Havana", + 119 => "America/Hermosillo", + 120 => "America/Indiana/Indianapolis", + 121 => "America/Indiana/Knox", + 122 => "America/Indiana/Marengo", + 123 => "America/Indiana/Petersburg", + 124 => "America/Indiana/Vevay", + 125 => "America/Indiana/Vincennes", + 126 => "America/Indiana/Winamac", + 127 => "America/Indianapolis", + 128 => "America/Inuvik", + 129 => "America/Iqaluit", + 130 => "America/Jamaica", + 131 => "America/Jujuy", + 132 => "America/Juneau", + 133 => "America/Kentucky/Louisville", + 134 => "America/Kentucky/Monticello", + 135 => "America/Knox_IN", + 136 => "America/La_Paz", + 137 => "America/Lima", + 138 => "America/Los_Angeles", + 139 => "America/Louisville", + 140 => "America/Maceio", + 141 => "America/Managua", + 142 => "America/Manaus", + 143 => "America/Martinique", + 144 => "America/Mazatlan", + 145 => "America/Mendoza", + 146 => "America/Menominee", + 147 => "America/Merida", + 148 => "America/Mexico_City", + 149 => "America/Miquelon", + 150 => "America/Moncton", + 151 => "America/Monterrey", + 152 => "America/Montevideo", + 153 => "America/Montreal", + 154 => "America/Montserrat", + 155 => "America/Nassau", + 156 => "America/New_York", + 157 => "America/Nipigon", + 158 => "America/Nome", + 159 => "America/Noronha", + 160 => "America/North_Dakota/Center", + 161 => "America/North_Dakota/New_Salem", + 162 => "America/Panama", + 163 => "America/Pangnirtung", + 164 => "America/Paramaribo", + 165 => "America/Phoenix", + 166 => "America/Port-au-Prince", + 167 => "America/Port_of_Spain", + 168 => "America/Porto_Acre", + 169 => "America/Porto_Velho", + 170 => "America/Puerto_Rico", + 171 => "America/Rainy_River", + 172 => "America/Rankin_Inlet", + 173 => "America/Recife", + 174 => "America/Regina", + 175 => "America/Resolute", + 176 => "America/Rio_Branco", + 177 => "America/Rosario", + 178 => "America/Santiago", + 179 => "America/Santo_Domingo", + 180 => "America/Sao_Paulo", + 181 => "America/Scoresbysund", + 182 => "America/Shiprock", + 183 => "America/St_Johns", + 184 => "America/St_Kitts", + 185 => "America/St_Lucia", + 186 => "America/St_Thomas", + 187 => "America/St_Vincent", + 188 => "America/Swift_Current", + 189 => "America/Tegucigalpa", + 190 => "America/Thule", + 191 => "America/Thunder_Bay", + 192 => "America/Tijuana", + 193 => "America/Toronto", + 194 => "America/Tortola", + 195 => "America/Vancouver", + 196 => "America/Virgin", + 197 => "America/Whitehorse", + 198 => "America/Winnipeg", + 199 => "America/Yakutat", + 200 => "America/Yellowknife", + 201 => "Antarctica/Casey", + 202 => "Antarctica/Davis", + 203 => "Antarctica/DumontDUrville", + 204 => "Antarctica/Mawson", + 205 => "Antarctica/McMurdo", + 206 => "Antarctica/Palmer", + 207 => "Antarctica/Rothera", + 208 => "Antarctica/South_Pole", + 209 => "Antarctica/Syowa", + 210 => "Antarctica/Vostok", + 211 => "Arctic/Longyearbyen", + 212 => "Asia/Aden", + 213 => "Asia/Almaty", + 214 => "Asia/Amman", + 215 => "Asia/Anadyr", + 216 => "Asia/Aqtau", + 217 => "Asia/Aqtobe", + 218 => "Asia/Ashgabat", + 219 => "Asia/Ashkhabad", + 220 => "Asia/Baghdad", + 221 => "Asia/Bahrain", + 222 => "Asia/Baku", + 223 => "Asia/Bangkok", + 224 => "Asia/Beirut", + 225 => "Asia/Bishkek", + 226 => "Asia/Brunei", + 227 => "Asia/Calcutta", + 228 => "Asia/Choibalsan", + 229 => "Asia/Chongqing", + 230 => "Asia/Chungking", + 231 => "Asia/Colombo", + 232 => "Asia/Dacca", + 233 => "Asia/Damascus", + 234 => "Asia/Dhaka", + 235 => "Asia/Dili", + 236 => "Asia/Dubai", + 237 => "Asia/Dushanbe", + 238 => "Asia/Gaza", + 239 => "Asia/Harbin", + 240 => "Asia/Hong_Kong", + 241 => "Asia/Hovd", + 242 => "Asia/Irkutsk", + 243 => "Asia/Istanbul", + 244 => "Asia/Jakarta", + 245 => "Asia/Jayapura", + 246 => "Asia/Jerusalem", + 247 => "Asia/Kabul", + 248 => "Asia/Kamchatka", + 249 => "Asia/Karachi", + 250 => "Asia/Kashgar", + 251 => "Asia/Katmandu", + 252 => "Asia/Krasnoyarsk", + 253 => "Asia/Kuala_Lumpur", + 254 => "Asia/Kuching", + 255 => "Asia/Kuwait", + 256 => "Asia/Macao", + 257 => "Asia/Macau", + 258 => "Asia/Magadan", + 259 => "Asia/Makassar", + 260 => "Asia/Manila", + 261 => "Asia/Muscat", + 262 => "Asia/Nicosia", + 263 => "Asia/Novosibirsk", + 264 => "Asia/Omsk", + 265 => "Asia/Oral", + 266 => "Asia/Phnom_Penh", + 267 => "Asia/Pontianak", + 268 => "Asia/Pyongyang", + 269 => "Asia/Qatar", + 270 => "Asia/Qyzylorda", + 271 => "Asia/Rangoon", + 272 => "Asia/Riyadh", + 273 => "Asia/Saigon", + 274 => "Asia/Sakhalin", + 275 => "Asia/Samarkand", + 276 => "Asia/Seoul", + 277 => "Asia/Shanghai", + 278 => "Asia/Singapore", + 279 => "Asia/Taipei", + 280 => "Asia/Tashkent", + 281 => "Asia/Tbilisi", + 282 => "Asia/Tehran", + 283 => "Asia/Tel_Aviv", + 284 => "Asia/Thimbu", + 285 => "Asia/Thimphu", + 286 => "Asia/Tokyo", + 287 => "Asia/Ujung_Pandang", + 288 => "Asia/Ulaanbaatar", + 289 => "Asia/Ulan_Bator", + 290 => "Asia/Urumqi", + 291 => "Asia/Vientiane", + 292 => "Asia/Vladivostok", + 293 => "Asia/Yakutsk", + 294 => "Asia/Yekaterinburg", + 295 => "Asia/Yerevan", + 296 => "Atlantic/Azores", + 297 => "Atlantic/Bermuda", + 298 => "Atlantic/Canary", + 299 => "Atlantic/Cape_Verde", + 300 => "Atlantic/Faeroe", + 301 => "Atlantic/Faroe", + 302 => "Atlantic/Jan_Mayen", + 303 => "Atlantic/Madeira", + 304 => "Atlantic/Reykjavik", + 305 => "Atlantic/South_Georgia", + 306 => "Atlantic/St_Helena", + 307 => "Atlantic/Stanley", + 308 => "Australia/ACT", + 309 => "Australia/Adelaide", + 310 => "Australia/Brisbane", + 311 => "Australia/Broken_Hill", + 312 => "Australia/Canberra", + 313 => "Australia/Currie", + 314 => "Australia/Darwin", + 315 => "Australia/Eucla", + 316 => "Australia/Hobart", + 317 => "Australia/LHI", + 318 => "Australia/Lindeman", + 319 => "Australia/Lord_Howe", + 320 => "Australia/Melbourne", + 321 => "Australia/North", + 322 => "Australia/NSW", + 323 => "Australia/Perth", + 324 => "Australia/Queensland", + 325 => "Australia/South", + 326 => "Australia/Sydney", + 327 => "Australia/Tasmania", + 328 => "Australia/Victoria", + 329 => "Australia/West", + 330 => "Australia/Yancowinna", + 331 => "Brazil/Acre", + 332 => "Brazil/DeNoronha", + 333 => "Brazil/East", + 334 => "Brazil/West", + 335 => "Canada/Atlantic", + 336 => "Canada/Central", + 337 => "Canada/East-Saskatchewan", + 338 => "Canada/Eastern", + 339 => "Canada/Mountain", + 340 => "Canada/Newfoundland", + 341 => "Canada/Pacific", + 342 => "Canada/Saskatchewan", + 343 => "Canada/Yukon", + 389 => "Europe/Amsterdam", + 390 => "Europe/Andorra", + 391 => "Europe/Athens", + 392 => "Europe/Belfast", + 393 => "Europe/Belgrade", + 394 => "Europe/Berlin", + 395 => "Europe/Bratislava", + 396 => "Europe/Brussels", + 397 => "Europe/Bucharest", + 398 => "Europe/Budapest", + 399 => "Europe/Chisinau", + 400 => "Europe/Copenhagen", + 401 => "Europe/Dublin", + 402 => "Europe/Gibraltar", + 403 => "Europe/Guernsey", + 404 => "Europe/Helsinki", + 405 => "Europe/Isle_of_Man", + 406 => "Europe/Istanbul", + 407 => "Europe/Jersey", + 408 => "Europe/Kaliningrad", + 409 => "Europe/Kiev", + 410 => "Europe/Lisbon", + 411 => "Europe/Ljubljana", + 412 => "Europe/London", + 413 => "Europe/Luxembourg", + 414 => "Europe/Madrid", + 415 => "Europe/Malta", + 416 => "Europe/Mariehamn", + 417 => "Europe/Minsk", + 418 => "Europe/Monaco", + 419 => "Europe/Moscow", + 420 => "Europe/Nicosia", + 421 => "Europe/Oslo", + 422 => "Europe/Paris", + 423 => "Europe/Podgorica", + 424 => "Europe/Prague", + 425 => "Europe/Riga", + 426 => "Europe/Rome", + 427 => "Europe/Samara", + 428 => "Europe/San_Marino", + 429 => "Europe/Sarajevo", + 430 => "Europe/Simferopol", + 431 => "Europe/Skopje", + 432 => "Europe/Sofia", + 433 => "Europe/Stockholm", + 434 => "Europe/Tallinn", + 435 => "Europe/Tirane", + 436 => "Europe/Tiraspol", + 437 => "Europe/Uzhgorod", + 438 => "Europe/Vaduz", + 439 => "Europe/Vatican", + 440 => "Europe/Vienna", + 441 => "Europe/Vilnius", + 442 => "Europe/Volgograd", + 443 => "Europe/Warsaw", + 444 => "Europe/Zagreb", + 445 => "Europe/Zaporozhye", + 446 => "Europe/Zurich", + 458 => "Indian/Antananarivo", + 459 => "Indian/Chagos", + 460 => "Indian/Christmas", + 461 => "Indian/Cocos", + 462 => "Indian/Comoro", + 463 => "Indian/Kerguelen", + 464 => "Indian/Mahe", + 465 => "Indian/Maldives", + 466 => "Indian/Mauritius", + 467 => "Indian/Mayotte", + 468 => "Indian/Reunion", + 484 => "Pacific/Apia", + 485 => "Pacific/Auckland", + 486 => "Pacific/Chatham", + 487 => "Pacific/Easter", + 488 => "Pacific/Efate", + 489 => "Pacific/Enderbury", + 490 => "Pacific/Fakaofo", + 491 => "Pacific/Fiji", + 492 => "Pacific/Funafuti", + 493 => "Pacific/Galapagos", + 494 => "Pacific/Gambier", + 495 => "Pacific/Guadalcanal", + 496 => "Pacific/Guam", + 497 => "Pacific/Honolulu", + 498 => "Pacific/Johnston", + 499 => "Pacific/Kiritimati", + 500 => "Pacific/Kosrae", + 501 => "Pacific/Kwajalein", + 502 => "Pacific/Majuro", + 503 => "Pacific/Marquesas", + 504 => "Pacific/Midway", + 505 => "Pacific/Nauru", + 506 => "Pacific/Niue", + 507 => "Pacific/Norfolk", + 508 => "Pacific/Noumea", + 509 => "Pacific/Pago_Pago", + 510 => "Pacific/Palau", + 511 => "Pacific/Pitcairn", + 512 => "Pacific/Ponape", + 513 => "Pacific/Port_Moresby", + 514 => "Pacific/Rarotonga", + 515 => "Pacific/Saipan", + 516 => "Pacific/Samoa", + 517 => "Pacific/Tahiti", + 518 => "Pacific/Tarawa", + 519 => "Pacific/Tongatapu", + 520 => "Pacific/Truk", + 521 => "Pacific/Wake", + 522 => "Pacific/Wallis", + 523 => "Pacific/Yap", + 547 => "UTC", + ); + foreach ($zone_names as $zone_name) { + $split = explode('/', $zone_name); + $zone_names[$zone_name] = t($split[0], array(), $langcode) . sizeof($split) > 1 ? '/'. t($split[1], array(), $langcode) : ''; + } + return $zone_names; +}