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, ...
This commit is contained in:
Ralf Becker 2005-02-09 10:35:28 +00:00
parent 3eb201a071
commit 09279b48cb
2 changed files with 14 additions and 14 deletions

View File

@ -508,14 +508,14 @@
{ {
foreach($infos as $info) foreach($infos as $info)
{ {
$time = intval(date('Hi',$info['info_startdate'])); $time = (int) adodb_date('Hi',$info['info_startdate']);
$date = date('Y/m/d',$info['info_startdate']); $date = adodb_date('Y/m/d',$info['info_startdate']);
if ($do_events && !$time || if ($do_events && !$time ||
!$do_events && $time && $date == $date_wanted) !$do_events && $time && $date == $date_wanted)
{ {
continue; 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']; $info['info_subject'];
$view = $this->link->view('infolog',$info['info_id']); $view = $this->link->view('infolog',$info['info_id']);
$content=array(); $content=array();

View File

@ -59,21 +59,21 @@
if ($date && (is_int($date) || is_numeric($date))) if ($date && (is_int($date) || is_numeric($date)))
{ {
$year = (int)$GLOBALS['phpgw']->common->show_date($date,'Y'); $year = (int)adodb_date('Y',$date);
$month = (int)$GLOBALS['phpgw']->common->show_date($date,'n'); $month = (int)adodb_date('n',$date);
$day = (int)$GLOBALS['phpgw']->common->show_date($date,'d'); $day = (int)adodb_date('d',$date);
} }
if ($year && $month && $day) 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) 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 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 !== '') if ($helpmsg !== '')
@ -99,7 +99,7 @@
{ {
if ($date) // string if format YYYYmmdd or timestamp 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); substr($date,4,2).'/'.substr($date,6,2).'/'.substr($date,0,4);
} }
return ' return '
@ -164,8 +164,8 @@
$partcial_match = 0; $partcial_match = 0;
for($i = 1; $i <= 12; $i++) for($i = 1; $i <= 12; $i++)
{ {
$long_name = lang(date('F',mktime(12,0,0,$i,1,2000))); $long_name = lang(adodb_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 $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 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')); $short_name = substr($long_name,0,(int) lang('3 number of chars for month-shortcut'));
@ -198,7 +198,7 @@
); );
if ($raw) 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 "<p>jscalendar::input2date('$datestr','$raw',$day','$month','$year') = "; print_r($ret); echo "</p>\n"; //echo "<p>jscalendar::input2date('$datestr','$raw',$day','$month','$year') = "; print_r($ret); echo "</p>\n";