mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
* eSync/Mail: fix wrong timezone conversation if user-timezone is different from server-timezone
This commit is contained in:
parent
134cd9d249
commit
db8bd9dcc3
@ -4351,13 +4351,21 @@ class Mail
|
|||||||
*
|
*
|
||||||
* @param string $_date to be parsed/formatted
|
* @param string $_date to be parsed/formatted
|
||||||
* @param string $format ='' if none is passed, use user prefs
|
* @param string $format ='' if none is passed, use user prefs
|
||||||
|
* @param boolean|null $convert2usertime true: user-, false: server-timezone, null: as parsed
|
||||||
* @return string returns the date as it is parseable by strtotime, or current timestamp if everything fails
|
* @return string returns the date as it is parseable by strtotime, or current timestamp if everything fails
|
||||||
*/
|
*/
|
||||||
static function _strtotime($_date='', $format='', $convert2usertime=false)
|
static function _strtotime($_date='', $format='', $convert2usertime=null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$date = new DateTime($_date); // parse date & time including timezone (throws exception, if not parsable)
|
$date = new DateTime($_date); // parse date & time including timezone (throws exception, if not parsable)
|
||||||
if ($convert2usertime) $date->setUser(); // convert to user-time
|
if ($convert2usertime === true)
|
||||||
|
{
|
||||||
|
$date->setUser(); // convert to user-time
|
||||||
|
}
|
||||||
|
elseif ($convert2usertime === false)
|
||||||
|
{
|
||||||
|
$date->setServer(); // convert to server-time
|
||||||
|
}
|
||||||
$date2return = $date->format($format);
|
$date2return = $date->format($format);
|
||||||
}
|
}
|
||||||
catch(\Exception $e)
|
catch(\Exception $e)
|
||||||
@ -4378,6 +4386,7 @@ class Mail
|
|||||||
$date2return = DateTime::to('now', $format);
|
$date2return = DateTime::to('now', $format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error_log(__METHOD__."(date=".json_encode($_date).", format='$format', convert2usertime=".json_encode($convert2usertime).") returning ".json_encode($date2return));
|
||||||
return $date2return;
|
return $date2return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,7 +1087,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
|||||||
$output->subject = $headers['subject'];
|
$output->subject = $headers['subject'];
|
||||||
$output->importance = $headers['priority'] > 3 ? 0 :
|
$output->importance = $headers['priority'] > 3 ? 0 :
|
||||||
($headers['priority'] < 3 ? 2 : 1) ;
|
($headers['priority'] < 3 ? 2 : 1) ;
|
||||||
$output->datereceived = $this->mail->_strtotime($headers['date'],'ts',true);
|
$output->datereceived = $this->mail->_strtotime($headers['date'], 'ts', false); // false = servertime
|
||||||
$output->to = $headers['to_address'];
|
$output->to = $headers['to_address'];
|
||||||
if (!empty($headers['to'])) $output->displayto = $headers['to_address']; //$headers['FETCHED_HEADER']['to_name']
|
if (!empty($headers['to'])) $output->displayto = $headers['to_address']; //$headers['FETCHED_HEADER']['to_name']
|
||||||
$output->from = $headers['sender_address'];
|
$output->from = $headers['sender_address'];
|
||||||
|
Loading…
Reference in New Issue
Block a user