if(isset($wgLocaltimezone)) {
$oldtz = getenv("TZ"); putenv("TZ=$wgLocaltimezone");
}
- $d = $wgLang->timeanddate( wfTimestampNow(), false ) .
+ /* Note: this is an ugly timezone hack for the European wikis */
+ $d = $wgLang->timeanddate( date( "YmdHis" ), false ) .
" (" . date( "T" ) . ")";
if(isset($wgLocaltimezone)) putenv("TZ=$oldtz");
# Ideally we'd be using actual time fields in the db
function wfTimestamp2Unix( $ts ) {
- return mktime( ( (int)substr( $ts, 8, 2) ),
+ return gmmktime( ( (int)substr( $ts, 8, 2) ),
(int)substr( $ts, 10, 2 ), (int)substr( $ts, 12, 2 ),
(int)substr( $ts, 4, 2 ), (int)substr( $ts, 6, 2 ),
(int)substr( $ts, 0, 4 ) );
}
function wfUnix2Timestamp( $unixtime ) {
- return date( "YmdHis", $unixtime );
+ return gmdate( "YmdHis", $unixtime );
}
function wfTimestampNow() {
# return NOW
- return date( "YmdHis" );
+ return gmdate( "YmdHis" );
}
# Sorting hack for MySQL 3, which doesn't use index sorts for DESC
if ( 0 == wfNumRows( $res ) ) {
$sql = "INSERT INTO image (img_name,img_size,img_timestamp," .
"img_description,img_user,img_user_text) VALUES ('" .
- wfStrencode( $name ) . "',{$size},'" . date( "YmdHis" ) . "','" .
+ wfStrencode( $name ) . "',{$size},'" . wfTimestampNow() . "','" .
wfStrencode( $desc ) . "', '" . $wgUser->getID() .
"', '" . wfStrencode( $wgUser->getName() ) . "')";
wfQuery( $sql, $fname );
wfQuery( $sql, $fname );
$sql = "UPDATE image SET img_size={$size}," .
- "img_timestamp='" . date( "YmdHis" ) . "',img_user='" .
+ "img_timestamp='" . wfTimestampNow() . "',img_user='" .
$wgUser->getID() . "',img_user_text='" .
wfStrencode( $wgUser->getName() ) . "', img_description='" .
wfStrencode( $desc ) . "' WHERE img_name='" .
} else {
$ul = $ut;
}
- $d = $wgLang->timeanddate( date( "YmdHis" ), false );
+ $d = $wgLang->timeanddate( wfTimestampNow(), false );
preg_match( "/^(.*?)<ul>(.*)$/sD", $this->mContent, $m );
if( !$wgCachePages ) return;
if( preg_match( '/MSIE ([1-4]|5\.0)/', $_SERVER["HTTP_USER_AGENT"] ) ) {
# IE 5.0 has probs with our caching
+ #wfDebug( "-- bad client, not caching\n", false );
return;
}
if( $wgUser->getOption( "nocache" ) ) return;
if( $_SERVER["HTTP_IF_MODIFIED_SINCE"] != "" ) {
$ismodsince = wfUnix2Timestamp( strtotime( $_SERVER["HTTP_IF_MODIFIED_SINCE"] ) );
+ #wfDebug( "-- client send If-Modified-Since: " . $_SERVER["HTTP_IF_MODIFIED_SINCE"] . "\n", false );
$lastmod = gmdate( "D, j M Y H:i:s", wfTimestamp2Unix(
max( $timestamp, $wgUser->mTouched ) ) ) . " GMT";
+ #wfDebug( "-- we might send Last-Modified : $lastmod\n", false );
if( ($ismodsince >= $timestamp ) and $wgUser->validateCache( $ismodsince ) ) {
# Make sure you're in a place you can leave when you call us!
if($wgUser->getId() == 0)
$forward .= " anon";
$log = sprintf( "%s\t%04.3f\t%s\n",
- date( "YmdHis" ), $elapsed,
+ gmdate( "YmdHis" ), $elapsed,
urldecode( $HTTP_SERVER_VARS['REQUEST_URI'] . $forward ) );
error_log( $log . $prof, 3, $wgDebugLogFile );
}
global $wgLang;
wfProfileIn( "OutputPage:replaceVariables" );
+ /* As with sigs, use server's local time --
+ ensure this is appropriate for your audience! */
$v = date( "m" );
$text = str_replace( "{{CURRENTMONTH}}", $v, $text );
$v = $wgLang->getMonthName( date( "n" ) );
$text = str_replace( "{{CURRENTDAYNAME}}", $v, $text );
$v = date( "Y" );
$text = str_replace( "{{CURRENTYEAR}}", $v, $text );
- $v = $wgLang->time( date( "YmdHis" ), false );
+ $v = $wgLang->time( wfTimestampNow(), false );
$text = str_replace( "{{CURRENTTIME}}", $v, $text );
if ( false !== strstr( $text, "{{NUMBEROFARTICLES}}" ) ) {
function dateLink()
{
global $wgLinkCache;
- $t1 = Title::newFromText( date( "F j" ) );
- $t2 = Title::newFromText( date( "Y" ) );
+ $t1 = Title::newFromText( gmdate( "F j" ) );
+ $t2 = Title::newFromText( gmdate( "Y" ) );
$wgLinkCache->suspend();
$id = $t1->getArticleID();
$sql = "INSERT INTO ipblocks (ipb_address, ipb_user, ipb_by, " .
"ipb_reason, ipb_timestamp ) VALUES ('{$wpBlockAddress}', 0, " .
$wgUser->getID() . ", '" . wfStrencode( $wpBlockReason ) . "','" .
- date( "YmdHis" ) . "')";
+ wfTimestampNow() . "')";
wfQuery( $sql, $fname );
$success = wfLocalUrl( $wgLang->specialPage( "Blockip" ),
}
fwrite( $fp, $wpLockReason );
fwrite( $fp, "\n<p>(by " . $wgUser->getName() . " at " .
- $wgLang->timeanddate( date( "YmdHis" ) ) . ")\n" );
+ $wgLang->timeanddate( wfTimestampNow() ) . ")\n" );
fclose( $fp );
$success = wfLocalUrl( $wgLang->specialPage( "Lockdb" ),
}
$days = (int)$days;
list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
- $cutoff = date( "YmdHis", time() - ( $days * 86400 ) );
+ $now = wfTimestampNow();
+ $cutoff = wfUnix2Timestamp( time() - ( $days * 86400 ) );
if(preg_match('/^[0-9]{14}$/', $from) and $from > $cutoff) {
$cutoff = $from;
} else {
$note = rcDayLimitLinks( $days, $limit );
- $now = date( "YmdHis" );
$note .= "<br>\n" . wfMsg( "rclistfrom",
$sk->makeKnownLink( $wgLang->specialPage( "Recentchanges" ),
$wgLang->timeanddate( $now, true ), "from=$now" ) );
}
$days = (int)$days;
list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
- $cutoff = date( "YmdHis", time() - ( $days * 86400 ) );
+ $cutoff = wfUnix2Timestamp( time() - ( $days * 86400 ) );
if ( ! isset( $hideminor ) ) {
$hideminor = $wgUser->getOption( "hideminor" );
$wgSavedFile = "{$dest}/{$wpUploadSaveName}";
if ( is_file( $wgSavedFile ) ) {
- $wgUploadOldVersion = date( "YmdHis" ) . "!{$wpUploadSaveName}";
+ $wgUploadOldVersion = gmdate( "YmdHis" ) . "!{$wpUploadSaveName}";
if ( ! rename( $wgSavedFile, "${archive}/{$wgUploadOldVersion}" ) ) {
$wgOut->fileRenameError( $wgSavedFile,
$docutoff = '';
} else {
$docutoff = "cur_timestamp > '" .
- date( "YmdHis", time() - ( $days * 86400 ) )
+ wfUnix2Timestamp( time() - ( $days * 86400 ) )
. "' AND";
}
if ( $limit == 0 ) {
return $this->date( $ts, $adj ) . " " . $this->time( $ts, $adj );
}
- function rfc1123( $ts )
- {
- return date( "D, d M Y H:i:s T", $ts );
- }
+ # inherit function rfc1123( $ts )
function getValidSpecialPages()
{
return $wgWeekdayNamesPl[$key-1];
}
- function userAdjust( $ts )
- {
- global $wgUser;
-
- $diff = $wgUser->getOption( "timecorrection" );
- if ( ! $diff ) { $diff = 0; }
- if ( 0 == $diff ) { return $ts; }
-
- $t = mktime( ( (int)substr( $ts, 8, 2) ) + $diff,
- (int)substr( $ts, 10, 2 ), (int)substr( $ts, 12, 2 ),
- (int)substr( $ts, 4, 2 ), (int)substr( $ts, 6, 2 ),
- (int)substr( $ts, 0, 4 ) );
- return date( "YmdHis", $t );
- }
+ # inherit function userAdjust( $ts )
function date( $ts, $adj = false )
{