Merge branch 'master' of github.com:ZoneMinder/zoneminder

This commit is contained in:
Isaac Connor 2019-10-18 14:14:07 -04:00
commit 98d0c4b104
4 changed files with 56 additions and 6 deletions

View File

@ -162,6 +162,12 @@ our %types = (
pattern => qr|^([a-zA-Z0-9_.-]+)\@([a-zA-Z0-9_.-]+)$|,
format => q( $1\@$2 )
},
timezone => {
db_type => 'string',
hint => 'America/Toronto',
pattern => qr|^(.+)$|,
format => q($1)
}
);
our @options = (
@ -777,6 +783,15 @@ our @options = (
type => $types{string},
category => 'config',
},
{
name => 'ZM_TIMEZONE',
default => 'UTC',
description => 'The timezone that php should use.',
help => q`
This should be set equal to the system timezone of the mysql server`,
type => $types{timezone},
category => 'system',
},
{
name => 'ZM_CPU_EXTENSIONS',
default => 'yes',

View File

@ -2367,7 +2367,7 @@ function check_timezone() {
#");
if ( $sys_tzoffset != $php_tzoffset )
ZM\Error("ZoneMinder is not installed properly: php's date.timezone does not match the system timezone!");
ZM\Error("ZoneMinder is not installed properly: php's date.timezone $php_tzoffset does not match the system timezone $sys_tzoffset!");
if ( $sys_tzoffset != $mysql_tzoffset )
ZM\Error("ZoneMinder is not installed properly: mysql's timezone does not match the system timezone! Event lists will display incorrect times.");

View File

@ -202,6 +202,7 @@ 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);
check_timezone();
}

View File

@ -389,6 +389,40 @@ 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;
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);
}
array_multisort($offsets, $timezones);
}
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();
}
?>
<form name="optionsForm" class="form-horizontal" method="post" action="?">
@ -396,10 +430,10 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*',GLOB_ONLYDIR)) as $
<input type="hidden" name="tab" value="<?php echo $tab ?>"/>
<input type="hidden" name="action" value="options"/>
<?php
$configCat = $configCats[$tab];
foreach ( $configCat as $name=>$value ) {
$shortName = preg_replace( '/^ZM_/', '', $name );
$optionPromptText = !empty($OLANG[$shortName])?$OLANG[$shortName]['Prompt']:$value['Prompt'];
$configCat = $configCats[$tab];
foreach ( $configCat as $name=>$value ) {
$shortName = preg_replace( '/^ZM_/', '', $name );
$optionPromptText = !empty($OLANG[$shortName])?$OLANG[$shortName]['Prompt']:$value['Prompt'];
?>
<div class="form-group">
<label for="<?php echo $name ?>" class="col-sm-3 control-label"><?php echo $shortName ?></label>
@ -409,7 +443,7 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*',GLOB_ONLYDIR)) as $
?>
<input type="checkbox" id="<?php echo $name ?>" name="newConfig[<?php echo $name ?>]" value="1"<?php if ( $value['Value'] ) { ?> checked="checked"<?php } ?><?php echo $canEdit?'':' disabled="disabled"' ?>/>
<?php
} elseif ( is_array( $value['Hint'] ) ) {
} elseif ( is_array($value['Hint']) ) {
echo htmlSelect("newConfig[$name]", $value['Hint'], $value['Value']);
} elseif ( preg_match('/\|/', $value['Hint']) ) {
?>