oops
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 7ea1028..3c3b199 100644 (file)
@@ -213,7 +213,7 @@ function wfUtf8Sequence( $codepoint ) {
 function wfMungeToUtf8( $string ) {
        global $wgInputEncoding; # This is debatable
        #$string = iconv($wgInputEncoding, "UTF-8", $string);
-       $string = preg_replace ( '/&#([0-9]+);/e', 'wfUtf8Sequence($1)', $string );
+       $string = preg_replace ( '/&#0*([0-9]+);/e', 'wfUtf8Sequence($1)', $string );
        $string = preg_replace ( '/&#x([0-9a-f]+);/ie', 'wfUtf8Sequence(0x$1)', $string );
        # Should also do named entities here
        return $string;
@@ -830,11 +830,8 @@ function wfHttpError( $code, $label, $desc ) {
        header( "Status: $code $label" );
        $wgOut->sendCacheControl();
 
-       # Don't send content if it's a HEAD request.
-       if( $_SERVER['REQUEST_METHOD'] == 'HEAD' ) {
-               header( 'Content-type: text/plain' );
-               print $desc."\n";
-       }
+       header( 'Content-type: text/plain' );
+       print $desc."\n";
 }
 
 /**
@@ -1004,7 +1001,9 @@ define('TS_RFC2822', 3 );
  * @todo document
  */
 function wfTimestamp($outputtype=TS_UNIX,$ts=0) {
-       if (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/",$ts,$da)) {
+       if ($ts==0) { 
+               $uts=time(); 
+       } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/",$ts,$da)) {
                # TS_DB
                $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6],
                            (int)$da[2],(int)$da[3],(int)$da[1]);
@@ -1017,11 +1016,10 @@ function wfTimestamp($outputtype=TS_UNIX,$ts=0) {
                $uts=$ts;
        } else {
                # Bogus value; fall back to the epoch...
-               wfDebug("wfTimestamp() given bogus time value.\n");
+               wfDebug("wfTimestamp() fed bogus time value: $outputtype; $ts\n");
                $uts = 0;
        }
 
-       if ($ts==0) { $uts=time(); }
                
        switch($outputtype) {
                case TS_UNIX: