1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-20 21:32:09 +02:00

Updated Timezone EUF. Use user-defined timezone as default date timezone, if it's possible.

This commit is contained in:
Lóna Lore
2016-12-13 20:48:45 +01:00
parent 794a9f3ea6
commit 04cf3a6dc2
3 changed files with 180 additions and 128 deletions

View File

@@ -773,37 +773,6 @@ $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. ==================