Added a function that returns the list of supported formats to ApiMain
[lhc/web/wiklou.git] / includes / UserMailer.php
index 6b28c64..31ff18b 100644 (file)
@@ -114,6 +114,7 @@ class UserMailer {
                global $wgEnotifMaxRecips, $wgAdditionalMailParams;
 
                if ( is_array( $to ) ) {
+                       $emails = '';
                        // This wouldn't be necessary if implode() worked on arrays of
                        // objects using __toString(). http://bugs.php.net/bug.php?id=36612
                        foreach ( $to as $t ) {
@@ -126,7 +127,6 @@ class UserMailer {
                }
 
                if ( is_array( $wgSMTP ) ) {
-                       $found = false;
                        if ( function_exists( 'stream_resolve_include_path' ) ) {
                                $found = stream_resolve_include_path( 'Mail.php' );
                        } else {
@@ -289,10 +289,15 @@ class UserMailer {
                        return $string;
                }
                $out = "=?$charset?Q?";
-               $out .= preg_replace( "/([$replace])/e", 'sprintf("=%02X",ord("$1"))', $string );
+               $out .= preg_replace_callback( "/([$replace])/", 
+                       array( __CLASS__, 'quotedPrintableCallback' ), $string );
                $out .= '?=';
                return $out;
        }
+
+       protected static function quotedPrintableCallback( $matches ) {
+               return sprintf( "=%02X", ord( $matches[1] ) );
+       }
 }
 
 /**