diff -r be6c5fdd9203 -r 4ccdfeee9a11 includes/functions.php --- a/includes/functions.php Mon Dec 31 21:43:51 2007 -0500 +++ b/includes/functions.php Thu Jan 03 00:53:33 2008 -0500 @@ -225,6 +225,21 @@ } /** + * Enano replacement for date(). Accounts for individual users' timezone preferences. + * @param string Date-formatted string + * @param int Optional - UNIX timestamp value to use. If omitted, the current time is used. + * @return string Formatted string + */ + +function enano_date($string, $timestamp = false) +{ + if ( !is_int($timestamp) && !is_double($timestamp) && strval(intval($timestamp)) !== $timestamp ) + $timestamp = time(); + // FIXME: Offset $timestamp by user's timezone + return gmdate($string, $timestamp); +} + +/** * Tells you the title for the given page ID string * @param string Page ID string (ex: Special:Administration) * @param bool Optional. If true, and if the namespace turns out to be something other than Article, the namespace prefix will be prepended to the return value. @@ -747,7 +762,7 @@ if($db->numrows() < 1) { echo '

Uploaded file

There are no files uploaded with this name yet. Upload a file...


'; return; } $r = $db->fetchrow(); $mimetype = $r['mimetype']; - $datestring = date('F d, Y h:i a', (int)$r['time_id']); + $datestring = enano_date('F d, Y h:i a', (int)$r['time_id']); echo '

Uploaded file

Type: '.$r['mimetype'].'
Size: '; $fs = $r['size']; echo $fs.' bytes'; @@ -784,7 +799,7 @@ if($session->get_permissions('history_rollback')) echo ' (revert) '; $mimetype = $r['mimetype']; - $datestring = date('F d, Y h:i a', (int)$r['time_id']); + $datestring = enano_date('F d, Y h:i a', (int)$r['time_id']); echo $datestring.': '.$r['mimetype'].', '; $fs = $r['size']; $fs = (int)$fs;