changed wfMsgExt()'s warnings to use the new wfWarn() so that the caller function...
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index aa44d5e..3da1399 100644 (file)
@@ -646,8 +646,6 @@ function wfMsgGetKey( $key, $useDB, $langCode = false, $transform = true ) {
                $message = $wgMessageCache->get( $key, $useDB, $langCode );
                if ( $transform ) {
                        $message = $wgMessageCache->transform( $message );
-                       // Decode two entities used in messages, to allow them "pass" htmlspecialchars
-                       $message = str_replace( array( ' ', ' ' ), array( ' ', "\xc2\xa0" ), $message );
                }
        } else {
                $lang = wfGetLangObj( $langCode );
@@ -758,12 +756,12 @@ function wfMsgExt( $key, $options ) {
        foreach( $options as $arrayKey => $option ) {
                if( !preg_match( '/^[0-9]+|language$/', $arrayKey ) ) {
                        # An unknown index, neither numeric nor "language"
-                       trigger_error( "wfMsgExt called with incorrect parameter key $arrayKey", E_USER_WARNING );
+                       wfWarn( "wfMsgExt called with incorrect parameter key $arrayKey", 1, E_USER_WARNING );
                } elseif( preg_match( '/^[0-9]+$/', $arrayKey ) && !in_array( $option,
                array( 'parse', 'parseinline', 'escape', 'escapenoentities',
                'replaceafter', 'parsemag', 'content' ) ) ) {
                        # A numeric index with unknown value
-                       trigger_error( "wfMsgExt called with incorrect parameter $option", E_USER_WARNING );
+                       wfWarn( "wfMsgExt called with incorrect parameter $option", 1, E_USER_WARNING );
                }
        }
 
@@ -798,8 +796,6 @@ function wfMsgExt( $key, $options ) {
                        $string = $wgMessageCache->transform( $string,
                                !$forContent,
                                is_object( $langCode ) ? $langCode : null );
-                       // Decode two entities used in messages, to allow them "pass" htmlspecialchars
-                       $string = str_replace( array( ' ', ' ' ), array( ' ', "\xc2\xa0" ), $string );
                }
        }
 
@@ -1835,8 +1831,8 @@ function wfTimestamp($outputtype=TS_UNIX,$ts=0) {
        } elseif (preg_match('/^\d{1,13}$/D',$ts)) {
                # TS_UNIX
                $uts = $ts;
-       } elseif (preg_match('/^\d{1,2}-...-\d\d(?:\d\d)? \d\d\.\d\d\.\d\d/', $ts)) {
-               # TS_ORACLE
+       } elseif (preg_match('/^\d{2}-\d{2}-\d{4} \d{2}:\d{2}:\d{2}.\d{6}$/', $ts)) {
+               # TS_ORACLE // session altered to DD-MM-YYYY HH24:MI:SS.FF6
                $uts = strtotime(preg_replace('/(\d\d)\.(\d\d)\.(\d\d)(\.(\d+))?/', "$1:$2:$3",
                                str_replace("+00:00", "UTC", $ts)));
        } elseif (preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.*\d*)?Z$/', $ts, $da)) {
@@ -1873,7 +1869,8 @@ function wfTimestamp($outputtype=TS_UNIX,$ts=0) {
                case TS_RFC2822:
                        return gmdate( 'D, d M Y H:i:s', $uts ) . ' GMT';
                case TS_ORACLE:
-                       return gmdate( 'd-M-y h.i.s A', $uts) . ' +00:00';
+                       return gmdate( 'd-m-Y H:i:s.000000', $uts);
+                       //return gmdate( 'd-M-y h.i.s A', $uts) . ' +00:00';
                case TS_POSTGRES:
                        return gmdate( 'Y-m-d H:i:s', $uts) . ' GMT';
                case TS_DB2:
@@ -1968,9 +1965,7 @@ function wfGetCachedNotice( $name ) {
        }
 
        wfProfileOut( $fname );
-       // Use $wgContLang to get a converted string by language.
-       global $wgContLang;
-       return $wgContLang->convert( $notice );
+       return $notice;
 }
 
 function wfGetNamespaceNotice() {
@@ -3129,3 +3124,17 @@ function wfArrayInsertAfter( $array, $insert, $after ) {
        
        return $output;
 }
+
+/* Recursively converts the parameter (an object) to an array with the same data */
+function wfObjectToArray( $object, $recursive = true ) {
+       $array = array();
+       foreach ( get_object_vars($object) as $key => $value ) {
+               if ( is_object($value) && $recursive ) {
+                       $value = wfObjectToArray( $value );
+               }
+               
+               $array[$key] = $value;
+       }
+       
+       return $array;
+}