- $fd = fopen('../locale/timezones.cfg','r');
- while (!feof ($fd)) {
- $zone = fgets($fd, 1024);
- if( $zone ) {
- $zone = trim($zone);
- $TZ_ARRAY["$zone"] = "$zone";
+
+ $aTimeZones = sq_get_tz_array();
+ unset($message);
+ if (! empty($aTimeZones)) {
+ // check if current timezone is linked to other TZ and update it
+ if ($timeZone != SMPREF_NONE && $timeZone != "" &&
+ isset($aTimeZones[$timeZone]['LINK'])) {
+ $timeZone = $aTimeZones[$timeZone]['LINK'];
+ // TODO: recheck setting of $timeZone
+ // setPref($data_dir,$username,'timezone',$timeZone);
+ }
+
+ // sort time zones by name. sq_get_tz_array() returns sorted by key.
+ // asort($aTimeZones);
+
+ // add all 'TZ' entries to TZ_ARRAY
+ foreach ($aTimeZones as $TzKey => $TzData) {
+ if (! isset($TzData['LINK'])) {
+ // Old display format
+ $TZ_ARRAY[$TzKey] = $TzKey;
+
+ // US Eastern standard time (America/New_York) - needs asort($aTimeZones)
+ //$TZ_ARRAY[$TzKey] = (isset($TzData['NAME']) ? $TzData['NAME']." ($TzKey)" : "($TzKey)");
+
+ // US Eastern standard time if NAME is present or America/New_York if NAME not present
+ // needs sorting after all data is added or uasort()
+ //$TZ_ARRAY[$TzKey] = (isset($TzData['NAME']) ? $TzData['NAME'] : $TzKey);
+
+ // (America/New_Your) US Eastern standard time
+ //$TZ_ARRAY[$TzKey] = "($TzKey)" . (isset($TzData['NAME']) ? ' '.$TzData['NAME'] : '');
+ }