[prev in list] [next in list] [prev in thread] [next in thread]
List: tep-commits
Subject: [TEP-COMMIT] CVS: catalog/catalog/includes/functions general.php,1.181,1.182
From: David Garcia Watkins <dgw_ () users ! sourceforge ! net>
Date: 2002-07-19 17:34:33
[Download RAW message or body]
Update of /cvsroot/tep/catalog/catalog/includes/functions
In directory usw-pr-cvs1:/tmp/cvs-serv14404
Modified Files:
general.php
Log Message:
Dates before 01/01/1970 fail with the date() function on windows servers.
This workaround changes the year to a valid date for date(), and after formatting it \
replaces again.
Index: general.php
===================================================================
RCS file: /cvsroot/tep/catalog/catalog/includes/functions/general.php,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- general.php 9 Jul 2002 18:15:09 -0000 1.181
+++ general.php 19 Jul 2002 17:34:31 -0000 1.182
@@ -518,6 +518,7 @@
////
// Output a raw date string in the selected locale date format
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
+// NOTE: Includes a workaround for dates before 01/01/1970 that fail on windows \
servers function tep_date_short($raw_date) {
if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false;
@@ -528,7 +529,12 @@
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);
- return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));
+ if (ereg('WIN', PHP_OS) && $year <= 1970) {
+ $delta = $year + (2038-$year);
+ return ereg_replace($delta . '$', $year, date(DATE_FORMAT, mktime($hour, \
$minute, $second, $month, $day, $delta))); + } else {
+ return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, \
$year)); + }
}
////
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tep-commits mailing list
Tep-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tep-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic