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:
@@ -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. ==================
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user