From 655f34aa27dbacefe19816c4c1c5c5c3c3bc1042 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 16 Mar 2012 16:44:59 +1300 Subject: [PATCH] Correct HTTP date formatting function. --- htdocs/always.php | 24 ++++++++++++------------ inc/always.php.in | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/always.php b/htdocs/always.php index b067839b..e3d8f6c9 100644 --- a/htdocs/always.php +++ b/htdocs/always.php @@ -337,23 +337,23 @@ function ISODateToHTTPDate( $isodate ) { // It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info. $month = gmstrftime('%m', strtotime($isodate)); switch( intval($month) ) { - case 1: $month = 'January'; break; - case 2: $month = 'February'; break; - case 3: $month = 'March'; break; - case 4: $month = 'April'; break; + case 1: $month = 'Jan'; break; + case 2: $month = 'Feb'; break; + case 3: $month = 'Mar'; break; + case 4: $month = 'Apr'; break; case 5: $month = 'May'; break; - case 6: $month = 'June'; break; - case 7: $month = 'July'; break; - case 8: $month = 'August'; break; - case 9: $month = 'September'; break; - case 10: $month = 'October'; break; - case 11: $month = 'November'; break; - case 12: $month = 'December'; break; + case 6: $month = 'Jun'; break; + case 7: $month = 'Jul'; break; + case 8: $month = 'Aug'; break; + case 9: $month = 'Sep'; break; + case 10: $month = 'Oct'; break; + case 11: $month = 'Nov'; break; + case 12: $month = 'Dec'; break; default: throw new Exception('Invalid month '.$month); } // Use strtotime since strptime is not available on Windows platform. - return( gmstrftime('%a, '.$month.' %b %Y %H:%M:%S GMT', strtotime($isodate)) ); + return( gmstrftime('%a, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) ); } /** diff --git a/inc/always.php.in b/inc/always.php.in index f41104a6..37916a68 100644 --- a/inc/always.php.in +++ b/inc/always.php.in @@ -337,23 +337,23 @@ function ISODateToHTTPDate( $isodate ) { // It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info. $month = gmstrftime('%m', strtotime($isodate)); switch( intval($month) ) { - case 1: $month = 'January'; break; - case 2: $month = 'February'; break; - case 3: $month = 'March'; break; - case 4: $month = 'April'; break; + case 1: $month = 'Jan'; break; + case 2: $month = 'Feb'; break; + case 3: $month = 'Mar'; break; + case 4: $month = 'Apr'; break; case 5: $month = 'May'; break; - case 6: $month = 'June'; break; - case 7: $month = 'July'; break; - case 8: $month = 'August'; break; - case 9: $month = 'September'; break; - case 10: $month = 'October'; break; - case 11: $month = 'November'; break; - case 12: $month = 'December'; break; + case 6: $month = 'Jun'; break; + case 7: $month = 'Jul'; break; + case 8: $month = 'Aug'; break; + case 9: $month = 'Sep'; break; + case 10: $month = 'Oct'; break; + case 11: $month = 'Nov'; break; + case 12: $month = 'Dec'; break; default: throw new Exception('Invalid month '.$month); } // Use strtotime since strptime is not available on Windows platform. - return( gmstrftime('%a, '.$month.' %b %Y %H:%M:%S GMT', strtotime($isodate)) ); + return( gmstrftime('%a, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) ); } /**