diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in index cd93dfe15..de4eb6984 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in @@ -785,7 +785,7 @@ our @options = ( }, { name => 'ZM_TIMEZONE', - default => 'UTC', + default => '', description => 'The timezone that php should use.', help => q` This should be set equal to the system timezone of the mysql server`, diff --git a/web/includes/config.php.in b/web/includes/config.php.in index 909a10e15..57064f22d 100644 --- a/web/includes/config.php.in +++ b/web/includes/config.php.in @@ -193,7 +193,8 @@ if ( ! defined('ZM_SERVER_ID') ) { } } -ini_set('date.timezone', ZM_TIMEZONE); +if ( ZM_TIMEZONE ) + ini_set('date.timezone', ZM_TIMEZONE); function process_configfile($configFile) { if ( is_readable( $configFile ) ) { diff --git a/web/index.php b/web/index.php index 7f6e17432..2f1a6cf62 100644 --- a/web/index.php +++ b/web/index.php @@ -202,7 +202,8 @@ isset($action) || $action = NULL; if ( (!$view and !$request) or ($view == 'console') ) { // Verify the system, php, and mysql timezones all match - date_default_timezone_set(ZM_TIMEZONE); + #if ( ZM_TIMEZONE ) + #date_default_timezone_set(ZM_TIMEZONE); check_timezone(); } diff --git a/web/lang/en_gb.php b/web/lang/en_gb.php index ad4911a4d..a8569639c 100644 --- a/web/lang/en_gb.php +++ b/web/lang/en_gb.php @@ -771,6 +771,7 @@ $SLANG = array( 'TurboPanSpeed' => 'Turbo Pan Speed', 'TurboTiltSpeed' => 'Turbo Tilt Speed', 'Type' => 'Type', + 'TZUnset' => 'Unset - use value in php.ini', 'Unarchive' => 'Unarchive', 'Undefined' => 'Undefined', 'Units' => 'Units', diff --git a/web/skins/classic/views/options.php b/web/skins/classic/views/options.php index 82692fbaf..e1a77b874 100644 --- a/web/skins/classic/views/options.php +++ b/web/skins/classic/views/options.php @@ -393,41 +393,41 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*',GLOB_ONLYDIR)) as $ $configCats[$tab]['ZM_SKIN_DEFAULT']['Hint'] = join('|', array_map('basename', glob('skins/*',GLOB_ONLYDIR))); $configCats[$tab]['ZM_CSS_DEFAULT']['Hint'] = join('|', array_map ( 'basename', glob('skins/'.ZM_SKIN_DEFAULT.'/css/*',GLOB_ONLYDIR) )); $configCats[$tab]['ZM_BANDWIDTH_DEFAULT']['Hint'] = $bandwidth_options; + function timezone_list() { - static $timezones = null; + static $timezones = null; - if ($timezones === null) { - $timezones = []; - $offsets = []; - $now = new DateTime('now', new DateTimeZone('UTC')); + if ( $timezones === null ) { + $timezones = []; + $offsets = []; + $now = new DateTime('now', new DateTimeZone('UTC')); - foreach (DateTimeZone::listIdentifiers() as $timezone) { - $now->setTimezone(new DateTimeZone($timezone)); - $offsets[] = $offset = $now->getOffset(); - $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone); + foreach ( DateTimeZone::listIdentifiers() as $timezone ) { + $now->setTimezone(new DateTimeZone($timezone)); + $offsets[] = $offset = $now->getOffset(); + $timezones[$timezone] = '(' . format_GMT_offset($offset) . ') ' . format_timezone_name($timezone); + } + + array_multisort($offsets, $timezones); + } + + return $timezones; } - array_multisort($offsets, $timezones); - } + function format_GMT_offset($offset) { + $hours = intval($offset / 3600); + $minutes = abs(intval($offset % 3600 / 60)); + return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); + } - return $timezones; -} - -function format_GMT_offset($offset) { - $hours = intval($offset / 3600); - $minutes = abs(intval($offset % 3600 / 60)); - return 'GMT' . ($offset ? sprintf('%+03d:%02d', $hours, $minutes) : ''); -} - -function format_timezone_name($name) { - $name = str_replace('/', ', ', $name); - $name = str_replace('_', ' ', $name); - $name = str_replace('St ', 'St. ', $name); - return $name; -} - $configCats[$tab]['ZM_TIMEZONE']['Hint'] = timezone_list(); - - } + function format_timezone_name($name) { + $name = str_replace('/', ', ', $name); + $name = str_replace('_', ' ', $name); + $name = str_replace('St ', 'St. ', $name); + return $name; + } + $configCats[$tab]['ZM_TIMEZONE']['Hint'] = array(''=> translate('TZUnset')) + timezone_list(); + } # end if tab == system ?>