X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2FUserMailer.php;h=2a549ac49cfb3e425d04822759fdde08e0c7f036;hb=2fe1b773d3da27e379485e049c239d9ac6cd6365;hp=c5dcfc3a7566b4c56eef673c7e0f142df8aa1f75;hpb=8b3108fe7787c7a3e70bae32fe389958d1ca6106;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/UserMailer.php b/includes/UserMailer.php index c5dcfc3a75..2a549ac49c 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -119,7 +119,7 @@ class UserMailer { */ static function arrayToHeaderString( $headers, $endl = "\n" ) { $strings = array(); - foreach( $headers as $name => $value ) { + foreach ( $headers as $name => $value ) { $strings[] = "$name: $value"; } return implode( $endl, $strings ); @@ -260,7 +260,7 @@ class UserMailer { wfDebug( "PEAR Mail_Mime package is not installed. Falling back to text email.\n" ); } else { - require_once( 'Mail/mime.php' ); + require_once 'Mail/mime.php'; if ( wfIsWindows() ) { $body['text'] = str_replace( "\n", "\r\n", $body['text'] ); $body['html'] = str_replace( "\n", "\r\n", $body['html'] ); @@ -300,7 +300,7 @@ class UserMailer { if ( !stream_resolve_include_path( 'Mail.php' ) ) { throw new MWException( 'PEAR mail package is not installed' ); } - require_once( 'Mail.php' ); + require_once 'Mail.php'; wfSuppressWarnings(); @@ -338,7 +338,7 @@ class UserMailer { # # PHP mail() # - if( count( $to ) > 1 ) { + if ( count( $to ) > 1 ) { $headers['To'] = 'undisclosed-recipients:;'; } $headers = self::arrayToHeaderString( $headers, $endl ); @@ -409,7 +409,7 @@ class UserMailer { */ public static function quotedPrintable( $string, $charset = '' ) { # Probably incomplete; see RFC 2045 - if( empty( $charset ) ) { + if ( empty( $charset ) ) { $charset = 'UTF-8'; } $charset = strtoupper( $charset ); @@ -417,7 +417,7 @@ class UserMailer { $illegal = '\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff='; $replace = $illegal . '\t ?_'; - if( !preg_match( "/[$illegal]/", $string ) ) { + if ( !preg_match( "/[$illegal]/", $string ) ) { return $string; } $out = "=?$charset?Q?"; @@ -605,6 +605,7 @@ class EmailNotification { wfRunHooks( 'UpdateUserMailerFormattedPageStatus', array( &$formattedPageStatus ) ); if ( !in_array( $this->pageStatus, $formattedPageStatus ) ) { + wfProfileOut( __METHOD__ ); throw new MWException( 'Not a valid page status!' ); } @@ -667,11 +668,13 @@ class EmailNotification { } elseif ( $targetUser->getOption( 'enotifusertalkpages' ) && ( !$minorEdit || $targetUser->getOption( 'enotifminoredits' ) ) ) { - if ( $targetUser->isEmailConfirmed() ) { + if ( !$targetUser->isEmailConfirmed() ) { + wfDebug( __METHOD__ . ": talk page owner doesn't have validated email\n" ); + } elseif ( !wfRunHooks( 'AbortTalkPageEmailNotification', array( $targetUser, $title ) ) ) { + wfDebug( __METHOD__ . ": talk page update notification is aborted for this user\n" ); + } else { wfDebug( __METHOD__ . ": sending talk page update notification\n" ); return true; - } else { - wfDebug( __METHOD__ . ": talk page owner doesn't have validated email\n" ); } } else { wfDebug( __METHOD__ . ": talk page owner doesn't want notifications\n" ); @@ -702,14 +705,14 @@ class EmailNotification { if ( $this->oldid ) { // Always show a link to the diff which triggered the mail. See bug 32210. $keys['$NEWPAGE'] = "\n\n" . wfMessage( 'enotif_lastdiff', - $this->title->getCanonicalURL( 'diff=next&oldid=' . $this->oldid ) ) + $this->title->getCanonicalURL( array( 'diff' => 'next', 'oldid' => $this->oldid ) ) ) ->inContentLanguage()->text(); if ( !$wgEnotifImpersonal ) { // For personal mail, also show a link to the diff of all changes // since last visited. $keys['$NEWPAGE'] .= "\n\n" . wfMessage( 'enotif_lastvisited', - $this->title->getCanonicalURL( 'diff=0&oldid=' . $this->oldid ) ) + $this->title->getCanonicalURL( array( 'diff' => '0', 'oldid' => $this->oldid ) ) ) ->inContentLanguage()->text(); } $keys['$OLDID'] = $this->oldid; @@ -790,8 +793,9 @@ class EmailNotification { function compose( $user ) { global $wgEnotifImpersonal; - if ( !$this->composed_common ) + if ( !$this->composed_common ) { $this->composeCommonMailtext(); + } if ( $wgEnotifImpersonal ) { $this->mailTargets[] = new MailAddress( $user );