Fixes #99.
Setup sets UTC offset from local time zone automatically. With this information, the Welcome entry now has the correct local time.
This commit is contained in:
parent
e77a2c458d
commit
9f71fcca6d
@ -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;
|
||||
|
@ -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'
|
||||
));
|
||||
|
Loading…
x
Reference in New Issue
Block a user