diff --git a/setup/lib/main.lib.php b/setup/lib/main.lib.php index 3d5ddf7..97bfa34 100644 --- a/setup/lib/main.lib.php +++ b/setup/lib/main.lib.php @@ -127,6 +127,19 @@ function validate() { $fp_config ['general'] ['www'] = $user ['www'] = $www; $fp_config ['general'] ['email'] = $user ['email'] = $email; + // Set UTC offset according to time zone set in php.ini + $timezoneFromIni = new DateTimeZone('UTC'); // UTC as fallback value + try { + $timezoneFromIni = new DateTimeZone(ini_get('date.timezone')); + } catch (Exception $e) { + // ignore "Unknown or bad timezone" exceptions - just move on with UTC + } + // calculate the offset from local time zon to UTC... + $now = new DateTime('now', $timezoneFromIni); + $timeOffset = $timezoneFromIni->getOffset($now) / 3600; + // ... and set it to the FlatPress config + $fp_config ['locale'] ['timeoffset'] = $timeOffset; + if (isset($err)) { $GLOBALS ['err'] = $err; return false; diff --git a/setup/lib/step2.lib.php b/setup/lib/step2.lib.php index 92c8310..013a126 100644 --- a/setup/lib/step2.lib.php +++ b/setup/lib/step2.lib.php @@ -11,7 +11,7 @@ function check_step() { entry_save(array( 'subject' => $vl ['entry'] ['subject'], 'content' => $vl ['entry'] ['content'], - 'date' => time(), + 'date' => date_time(), 'version' => system_ver(), 'author' => 'FlatPress' ));