From 63020cf2887ebe3e17059e24c7035d3d9c21d5dc Mon Sep 17 00:00:00 2001 From: James Date: Thu, 28 Jun 2012 12:25:15 -0400 Subject: [PATCH] CC-3955: System -> Preferences: Timezone setting is the first one in the list, not the current (local) timezone - adding some code to validate the timezone that is parsed --- install_minimal/include/AirtimeInstall.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install_minimal/include/AirtimeInstall.php b/install_minimal/include/AirtimeInstall.php index e656bf983..d0c2ed3f7 100644 --- a/install_minimal/include/AirtimeInstall.php +++ b/install_minimal/include/AirtimeInstall.php @@ -321,6 +321,10 @@ class AirtimeInstall $con = Propel::getConnection(); // we need to run php as commandline because we want to get the timezone in cli php.ini file $defaultTimezone = exec("php -r 'echo date_default_timezone_get().PHP_EOL;'"); + $defaultTimezone = trim($defaultTimezone); + if((!in_array($defaultTimezone, DateTimeZone::listIdentifiers()))){ + $defaultTimezone = "UTC"; + } $sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', '$defaultTimezone')"; $result = $con->exec($sql); if ($result < 1) {