From d90afdc5c7fc6f2b071b6dc8654224aa6634bb25 Mon Sep 17 00:00:00 2001 From: Pepijn Over Date: Tue, 1 Apr 2014 12:39:58 +0200 Subject: [PATCH] issue #43: add warning to install page and set default timezone when no timezone has been set in the php.ini file --- src/bootstrap.php | 4 ++++ src/psm/Module/Install/Controller/InstallController.class.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/bootstrap.php b/src/bootstrap.php index ffa41336..952b695b 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -38,6 +38,10 @@ define('PSM_USER_ADMIN', 10); define('PSM_USER_USER', 20); define('PSM_USER_ANONYMOUS', 30); +if(function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) { + date_default_timezone_set(@date_default_timezone_get()); +} + // find config file $path_conf = PSM_PATH_SRC . '../config.php'; if(file_exists($path_conf)) { diff --git a/src/psm/Module/Install/Controller/InstallController.class.php b/src/psm/Module/Install/Controller/InstallController.class.php index 6444641d..f332960f 100644 --- a/src/psm/Module/Install/Controller/InstallController.class.php +++ b/src/psm/Module/Install/Controller/InstallController.class.php @@ -103,6 +103,9 @@ class InstallController extends AbstractController { $errors++; $this->addMessage('The PDO MySQL driver needs to be installed.', 'error'); } + if(!ini_get('date.timezone')) { + $this->addMessage('You should set a timezone in your php.ini file (e.g. \'date.timezone = UTC\'). See this page for more info.', 'warning'); + } if($errors > 0) { $this->addMessage($errors . ' error(s) have been encountered. Please fix them and refresh this page.', 'error');