diff --git a/class2.php b/class2.php
index a0bec62a3..e6da00ccd 100644
--- a/class2.php
+++ b/class2.php
@@ -1140,7 +1140,7 @@ if (($_SERVER['QUERY_STRING'] == 'logout')/* || (($pref['user_tracking'] == 'ses
*
*/
-$tz = vartrue($pref['timezone'],'GMT'); //TODO Adjust on the front-end based on user timezone value.
+$tz = vartrue($pref['timezone'], 'UTC'); //TODO Adjust on the front-end based on user timezone value.
date_default_timezone_set($tz); // Must be set or PHP Warning thrown.
diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php
index 51d15fcc1..6178bd11c 100644
--- a/e107_admin/prefs.php
+++ b/e107_admin/prefs.php
@@ -750,7 +750,7 @@ foreach($toffset as $o)
- $timeZones = timezone_identifiers_list();
+ $timeZones = systemTimeZones();
@@ -763,7 +763,7 @@ $text .= "
|
- ".$frm->select('timezone', $timeZones, vartrue($pref['timezone'],'GMT'), 'useValues=1')."
+ ".$frm->select('timezone', $timeZones, vartrue($pref['timezone'], 'UTC'))."
|
@@ -772,6 +772,38 @@ $text .= "
";
+
+/**
+ * Generate an array of time zones.
+ */
+function systemTimeZones()
+{
+ $zonelist = timezone_identifiers_list();
+ $timeNow = date('m/d/Y H:i', $_SERVER['REQUEST_TIME']);
+
+ $zones = array();
+ foreach($zonelist as $zone)
+ {
+ // Because many time zones exist in PHP only for backward compatibility
+ // reasons and should not be used, the list is filtered by a regular
+ // expression.
+ if(preg_match('!^((Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Europe|Indian|Pacific)/|UTC$)!', $zone))
+ {
+ $dateTimeZone = new DateTimeZone($zone);
+ $dateTime = new DateTime($timeNow, $dateTimeZone);
+ $offset = $dateTime->format('O');
+ $offset = chunk_split($offset, 3, ':');
+
+ $zones[$zone] = str_replace('_', ' ', $zone) . ' (' . rtrim($offset, ':') . ')';
+ }
+ }
+
+ // Sort time zones alphabetically.
+ asort($zones);
+ return $zones;
+}
+
+
// =========== Registration Preferences. ==================