01tonythomas has uploaded a new change for review. https://gerrit.wikimedia.org/r/115399
Change subject: Implementing HTML Email ...................................................................... Implementing HTML Email You need to set the variable $wgEmailContentType = 'text/html'; in LocalSettings.php to get new emails in text/html format Bug: 13303 Code Courtesy : Vitaliy Filippov <[email protected]> Change-Id: I147a1e0d7e12297c1855c89c041808eecd6fa32f --- M includes/UserMailer.php 1 file changed, 22 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/99/115399/1 diff --git a/includes/UserMailer.php b/includes/UserMailer.php index e1d00d3..c0c1aad 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -155,16 +155,20 @@ * @param $from MailAddress: sender's email * @param string $subject email's subject. * @param string $body email's text or Array of two strings to be the text and html bodies + * @param $contentType String: optional custom Content-Type (default: $wgEmailContentType; charset=UTF-8) * @param $replyto MailAddress: optional reply-to email (default: null). * @param string $contentType optional custom Content-Type (default: text/plain; charset=UTF-8) * @throws MWException * @return Status object */ - public static function send( $to, $from, $subject, $body, $replyto = null, $contentType = 'text/plain; charset=UTF-8' ) { - global $wgSMTP, $wgEnotifMaxRecips, $wgAdditionalMailParams, $wgAllowHTMLEmail; + public static function send( $to, $from, $subject, $body, $replyto = null, $contentType = null ) { + global $wgSMTP, $wgEnotifMaxRecips, $wgAdditionalMailParams, $wgEmailContentType, $wgAllowHTMLEmail; $mime = null; if ( !is_array( $to ) ) { $to = array( $to ); + } + if ( is_null( $contentType ) ) { + $contentType = $wgEmailContentType.'; charset=UTF-8'; } // mail body must have some content @@ -282,8 +286,7 @@ $body = str_replace( "\n", "\r\n", $body ); } $headers['MIME-Version'] = '1.0'; - $headers['Content-type'] = ( is_null( $contentType ) ? - 'text/plain; charset=UTF-8' : $contentType ); + $headers['Content-type'] = $contentType; $headers['Content-transfer-encoding'] = '8bit'; } @@ -514,14 +517,17 @@ $watchers = array(); if ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) { $dbw = wfGetDB( DB_MASTER ); - $res = $dbw->select( array( 'watchlist' ), + $userCondition = array( + 'user_id' => wl_user, + 'wl_title' => $title->getDBkey(), + 'wl_namespace' => $title->getNamespace(), + 'wl_user != '.intval( $editor->getID() ), + 'wl_notificationtimestamp IS NULL', + ); + wfRunHooks('EnotifUserCondition', array(&$this, &$userCondition)); + $res = $dbw->select( array( 'watchlist', 'user' ), array( 'wl_user' ), - array( - 'wl_user != ' . intval( $editor->getID() ), - 'wl_namespace' => $title->getNamespace(), - 'wl_title' => $title->getDBkey(), - 'wl_notificationtimestamp IS NULL', - ), __METHOD__ + $userCondition, __METHOD__ ); foreach ( $res as $row ) { $watchers[] = intval( $row->wl_user ); @@ -749,6 +755,7 @@ $keys['$PAGETITLE'] = $this->title->getPrefixedText(); $keys['$PAGETITLE_URL'] = $this->title->getCanonicalURL(); + $keys['$PAGETITLE_URL_NOENC'] = urldecode( $this->title->getCanonicalUrl() ); $keys['$PAGEMINOREDIT'] = $this->minorEdit ? wfMessage( 'minoredit' )->inContentLanguage()->text() : ''; $keys['$UNWATCHURL'] = $this->title->getCanonicalURL( 'action=unwatch' ); @@ -771,12 +778,13 @@ $postTransformKeys['$PAGESUMMARY'] = $this->summary == '' ? ' - ' : $this->summary; // Now build message's subject and body - // Messages: // enotif_subject_deleted, enotif_subject_created, enotif_subject_moved, // enotif_subject_restored, enotif_subject_changed $this->subject = wfMessage( 'enotif_subject_' . $this->pageStatus )->inContentLanguage() ->params( $pageTitle, $keys['$PAGEEDITOR'] )->text(); + + wfRunHooks('EnotifComposeCommonMailtext', array(&$this, &$keys)); // Messages: // enotif_body_intro_deleted, enotif_body_intro_created, enotif_body_intro_moved, @@ -871,6 +879,8 @@ $wgContLang->userTime( $this->timestamp, $watchingUser ) ), $this->body ); + wfRunHooks( 'EnotifPersonalizeMailtext', array( &$this, &$watchingUser, &$body ) ); + return UserMailer::send( $to, $this->from, $this->subject, $body, $this->replyto ); } -- To view, visit https://gerrit.wikimedia.org/r/115399 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I147a1e0d7e12297c1855c89c041808eecd6fa32f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: 01tonythomas <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
