From 4a280a73d1e2df10a1589bcb76a72a8762ada02e Mon Sep 17 00:00:00 2001 From: baffo32 Date: Mon, 12 Oct 2015 15:43:24 -0400 Subject: [PATCH] Use Fatal function to report bad timezone --- web/index.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/web/index.php b/web/index.php index 9ba3df8b0..79dd70ce5 100644 --- a/web/index.php +++ b/web/index.php @@ -46,13 +46,6 @@ if ( false ) ob_end_clean(); } -// Check time zone is set -if (!ini_get('date.timezone')) { - trigger_error( "ZoneMinder is not installed properly: date.timezone in php.ini is unset", E_USER_ERROR ); -} else if(!date_default_timezone_set(ini_get('date.timezone'))) { - trigger_error( "ZoneMinder is not installed properly: date.timezone in php.ini is invalid", E_USER_ERROR ); -} - require_once( 'includes/config.php' ); require_once( 'includes/logger.php' ); @@ -67,6 +60,12 @@ else define( "ZM_BASE_PROTOCOL", $protocol ); define( "ZM_BASE_URL", $protocol.'://'.$_SERVER['HTTP_HOST'] ); +// Check time zone is set +if (!ini_get('date.timezone') || !date_default_timezone_set(ini_get('date.timezone'))) { + date_default_timezone_set('UTC'); + Fatal( "ZoneMinder is not installed properly: date.timezone in php.ini is not set to a valid timezone" ); +} + if ( isset($_GET['skin']) ) $skin = $_GET['skin']; elseif ( isset($_COOKIE['zmSkin']) )