A better transition with deprecation
This commit is contained in:
parent
7db443e8ab
commit
8a6e28860b
@ -1771,25 +1771,28 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Analyze date
|
// Analyze date
|
||||||
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)
|
$reg=array();
|
||||||
|| preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
||||||
{
|
{
|
||||||
// This part of code should not be used.
|
|
||||||
/*dol_syslog("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
|
||||||
//if (function_exists('debug_print_backtrace')) debug_print_backtrace();
|
|
||||||
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
|
|
||||||
$syear = (! empty($reg[1]) ? $reg[1] : '');
|
|
||||||
$smonth = (! empty($reg[2]) ? $reg[2] : '');
|
|
||||||
$sday = (! empty($reg[3]) ? $reg[3] : '');
|
|
||||||
$shour = (! empty($reg[4]) ? $reg[4] : '');
|
|
||||||
$smin = (! empty($reg[5]) ? $reg[5] : '');
|
|
||||||
$ssec = (! empty($reg[6]) ? $reg[6] : '');
|
|
||||||
|
|
||||||
$time=dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true);
|
|
||||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt);*/
|
|
||||||
dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
|
dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) // Still available to solve problems in extrafields of type date
|
||||||
|
{
|
||||||
|
// This part of code should not be used.
|
||||||
|
dol_syslog("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
||||||
|
//if (function_exists('debug_print_backtrace')) debug_print_backtrace();
|
||||||
|
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
|
||||||
|
$syear = (! empty($reg[1]) ? $reg[1] : '');
|
||||||
|
$smonth = (! empty($reg[2]) ? $reg[2] : '');
|
||||||
|
$sday = (! empty($reg[3]) ? $reg[3] : '');
|
||||||
|
$shour = (! empty($reg[4]) ? $reg[4] : '');
|
||||||
|
$smin = (! empty($reg[5]) ? $reg[5] : '');
|
||||||
|
$ssec = (! empty($reg[6]) ? $reg[6] : '');
|
||||||
|
|
||||||
|
$time=dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true);
|
||||||
|
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Date is a timestamps
|
// Date is a timestamps
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user