From d0abd1618f23280208134919684b9468081d3266 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 31 Jul 2011 18:12:47 +0200 Subject: [PATCH] added configuration for timezone and suppress warnings (fixes # 80) --- etc/volkszaehler.conf.template.php | 18 ++++++++++++++---- htdocs/middleware.php | 4 ++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/etc/volkszaehler.conf.template.php b/etc/volkszaehler.conf.template.php index b0d48fc..dd7affe 100644 --- a/etc/volkszaehler.conf.template.php +++ b/etc/volkszaehler.conf.template.php @@ -77,18 +77,28 @@ $config['db']['dbname'] = 'volkszaehler'; * @link http://www.php.net/manual/en/ini.core.php#ini.include-path */ $config['lib']['doctrine'] = VZ_DIR . '/lib/vendor/Doctrine'; -$config['lib']['jpgraph'] = VZ_DIR . '/lib/vendor/JpGraph'; +//$config['lib']['jpgraph'] = VZ_DIR . '/lib/vendor/JpGraph'; + +/** + * @var string timezone for the middleware + * @link http://www.php.net/manual/de/timezones.php + * @link http://www.php.net/manual/de/datetime.configuration.php#ini.date.timezone + */ +//$config['timezone'] = 'Europe/Berlin'; /** - * Plot colors * @var array of colors for plot series */ $config['colors'] = array('#83CAFF', '#7E0021', '#579D1C', '#FFD320', '#FF420E', '#004586', '#0084D1', '#C5000B', '#FF950E', '#4B1F6F', '#AECF00', '#314004'); -/** @var boolean disables some optimizations. Only use it when you exactly know what you are doing. */ +/** + * @var boolean disables some optimizations. Only use it when you exactly know what you are doing. + */ $config['devmode'] = FALSE; -/** @var integer set to > 0 to show debugging messages */ +/** + * @var integer set to > 0 to show debugging messages + */ $config['debug'] = 0; ?> diff --git a/htdocs/middleware.php b/htdocs/middleware.php index 51c6b7b..89cd558 100644 --- a/htdocs/middleware.php +++ b/htdocs/middleware.php @@ -42,6 +42,10 @@ require_once VZ_DIR . '/lib/Util/Configuration.php'; // load configuration Util\Configuration::load(VZ_DIR . '/etc/volkszaehler.conf'); +// set timezone +$tz = (Util\Configuration::read('timezone')) ? Util\Configuration::read('timezone') : @date_default_timezone_get() +date_default_timezone_set($tz); + // define include dirs for vendor libs define('DOCTRINE_DIR', Util\Configuration::read('lib.doctrine') ? Util\Configuration::read('lib.doctrine') : 'Doctrine'); define('JPGRAPH_DIR', Util\Configuration::read('lib.jpgraph') ? Util\Configuration::read('lib.jpgraph') : 'JpGraph');