SECURITY: rate-limit and prevent blocked users from changing email
[lhc/web/wiklou.git] / includes / CommentStoreComment.php
index 7ed86d6..9f1681d 100644 (file)
@@ -19,6 +19,7 @@
  *
  * @file
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * CommentStoreComment represents a comment stored by CommentStore. The fields
@@ -49,7 +50,7 @@ class CommentStoreComment {
        public function __construct( $id, $text, Message $message = null, array $data = null ) {
                $this->id = $id;
                $this->text = $text;
-               $this->message = $message ?: new RawMessage( '$1', [ $text ] );
+               $this->message = $message ?: new RawMessage( '$1', [ Message::plaintextParam( $text ) ] );
                $this->data = $data;
        }
 
@@ -63,8 +64,6 @@ class CommentStoreComment {
         * @return CommentStoreComment
         */
        public static function newUnsavedComment( $comment, array $data = null ) {
-               global $wgContLang;
-
                if ( $comment instanceof CommentStoreComment ) {
                        return $comment;
                }
@@ -79,7 +78,8 @@ class CommentStoreComment {
 
                if ( $comment instanceof Message ) {
                        $message = clone $comment;
-                       $text = $message->inLanguage( $wgContLang ) // Avoid $wgForceUIMsgAsContentMsg
+                       // Avoid $wgForceUIMsgAsContentMsg
+                       $text = $message->inLanguage( MediaWikiServices::getInstance()->getContentLanguage() )
                                ->setInterfaceMessageFlag( true )
                                ->text();
                        return new CommentStoreComment( null, $text, $message, $data );