mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-01 04:13:28 +01:00
handling totally absent dates in _strtotime, return current timestamp is all failes
This commit is contained in:
parent
ead7f146a9
commit
2228cb11cc
@ -2931,6 +2931,7 @@
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Helper function to handle wrong or unrecognized timezones
|
* Helper function to handle wrong or unrecognized timezones
|
||||||
|
* returns the date as it is parseable by strtotime, or current timestamp if everything failes
|
||||||
*/
|
*/
|
||||||
static function _strtotime($date='')
|
static function _strtotime($date='')
|
||||||
{
|
{
|
||||||
@ -2938,12 +2939,13 @@
|
|||||||
{
|
{
|
||||||
$dtarr = explode(' ',$date);
|
$dtarr = explode(' ',$date);
|
||||||
$test = false;
|
$test = false;
|
||||||
while ($test===false)
|
while ($test===false && count($dtarr)>=1)
|
||||||
{
|
{
|
||||||
array_pop($dtarr);
|
array_pop($dtarr);
|
||||||
$test=strtotime(implode(' ',$dtarr));
|
$test=strtotime(implode(' ',$dtarr));
|
||||||
if ($test) $date = implode(' ',$dtarr);
|
if ($test) $date = implode(' ',$dtarr);
|
||||||
}
|
}
|
||||||
|
if ($test===false) $date = strtotime('now');
|
||||||
}
|
}
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user