From 09279b48cbb1a6a02724523ac4c7ee5ad2f4ea6c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 9 Feb 2005 10:35:28 +0000 Subject: [PATCH] fix for bug [ 1049574 ] Windows does not support dates prior 1970-01-01 using adodb's datelibary instead of the regular php-functions: date, mktime, ... --- infolog/inc/class.boinfolog.inc.php | 6 +++--- phpgwapi/inc/class.jscalendar.inc.php | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/infolog/inc/class.boinfolog.inc.php b/infolog/inc/class.boinfolog.inc.php index 601f606b4c..d9eb542427 100644 --- a/infolog/inc/class.boinfolog.inc.php +++ b/infolog/inc/class.boinfolog.inc.php @@ -508,14 +508,14 @@ { foreach($infos as $info) { - $time = intval(date('Hi',$info['info_startdate'])); - $date = date('Y/m/d',$info['info_startdate']); + $time = (int) adodb_date('Hi',$info['info_startdate']); + $date = adodb_date('Y/m/d',$info['info_startdate']); if ($do_events && !$time || !$do_events && $time && $date == $date_wanted) { continue; } - $title = ($do_events?$GLOBALS['phpgw']->common->formattime(date('H',$info['info_startdate']),date('i',$info['info_startdate'])).' ':''). + $title = ($do_events?$GLOBALS['phpgw']->common->formattime(adodb_date('H',$info['info_startdate']),adodb_date('i',$info['info_startdate'])).' ':''). $info['info_subject']; $view = $this->link->view('infolog',$info['info_id']); $content=array(); diff --git a/phpgwapi/inc/class.jscalendar.inc.php b/phpgwapi/inc/class.jscalendar.inc.php index d62c539cfc..6f107108be 100644 --- a/phpgwapi/inc/class.jscalendar.inc.php +++ b/phpgwapi/inc/class.jscalendar.inc.php @@ -59,21 +59,21 @@ if ($date && (is_int($date) || is_numeric($date))) { - $year = (int)$GLOBALS['phpgw']->common->show_date($date,'Y'); - $month = (int)$GLOBALS['phpgw']->common->show_date($date,'n'); - $day = (int)$GLOBALS['phpgw']->common->show_date($date,'d'); + $year = (int)adodb_date('Y',$date); + $month = (int)adodb_date('n',$date); + $day = (int)adodb_date('d',$date); } if ($year && $month && $day) { - $date = date($this->dateformat,$ts = mktime(12,0,0,$month,$day,$year)); + $date = adodb_date($this->dateformat,$ts = adodb_mktime(12,0,0,$month,$day,$year)); if (strpos($this->dateformat,'M') !== False) { - $short = lang(date('M',$ts)); // check if we have a translation of the short-cut + $short = lang(adodb_date('M',$ts)); // check if we have a translation of the short-cut if (substr($short,-1) == '*') // if not generate one by truncating the translation of the long name { - $short = substr(lang(date('F',$ts)),0,(int) lang('3 number of chars for month-shortcut')); + $short = substr(lang(adodb_date('F',$ts)),0,(int) lang('3 number of chars for month-shortcut')); } - $date = str_replace(date('M',$ts),$short,$date); + $date = str_replace(adodb_date('M',$ts),$short,$date); } } if ($helpmsg !== '') @@ -99,7 +99,7 @@ { if ($date) // string if format YYYYmmdd or timestamp { - $date = is_int($date) ? date('m/d/Y',$date) : + $date = is_int($date) ? adodb_date('m/d/Y',$date) : substr($date,4,2).'/'.substr($date,6,2).'/'.substr($date,0,4); } return ' @@ -164,8 +164,8 @@ $partcial_match = 0; for($i = 1; $i <= 12; $i++) { - $long_name = lang(date('F',mktime(12,0,0,$i,1,2000))); - $short_name = lang(date('M',mktime(12,0,0,$i,1,2000))); // do we have a translation of the short-cut + $long_name = lang(adodb_date('F',mktime(12,0,0,$i,1,2000))); + $short_name = lang(adodb_date('M',mktime(12,0,0,$i,1,2000))); // do we have a translation of the short-cut if (substr($short_name,-1) == '*') // if not generate one by truncating the translation of the long name { $short_name = substr($long_name,0,(int) lang('3 number of chars for month-shortcut')); @@ -198,7 +198,7 @@ ); if ($raw) { - $ret[$raw] = mktime(12,0,0,$date['m'],$date['d'],$date['Y']); + $ret[$raw] = adodb_mktime(12,0,0,$date['m'],$date['d'],$date['Y']); } //echo "

jscalendar::input2date('$datestr','$raw',$day','$month','$year') = "; print_r($ret); echo "

\n";