partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 264bc16c333579516fc099ae6baa52e190386d3d
parent 7ae29f8a6c21010544dcc19cfccbf3a027a3ea89
Author: Felicitus <felicitus@felicitus.org>
Date:   Thu,  9 Feb 2012 01:01:46 +0100

Added check for PHP's timezone settings

Diffstat:
Msrc/setup/tests/check-php-settings.php | 23+++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/setup/tests/check-php-settings.php b/src/setup/tests/check-php-settings.php @@ -23,5 +23,24 @@ if (!class_exists("\\Imagick")) { echo json_encode(array("error" => true, "errormessage" => "You are missing the Imagick library for PHP. Please install and activate it.")); exit; } + +if (!isTimezoneSetAndValid()) { + $errorMessage = "The PHP timezone (%s) is not set or invalid. Please set the correct timezone in your"; + $errorMessage .= " php.ini file (don't forget to restart the web server afterwards)"; + + echo json_encode(array("error" => true, "errormessage" => sprintf($errorMessage, @date_default_timezone_get()))); + exit; +} + echo json_encode(array("error" => false)); -exit;- \ No newline at end of file +exit; + +/** + * Checks if the timezone is set and valid. + * + * @param none + * @return bool True if the timezone is set and valid, false otherwise. + */ +public function isTimezoneSetAndValid () { + return @date_default_timezone_set(@date_default_timezone_get()); +}+ \ No newline at end of file