Merge "Allow basic grant holders to autocreate accounts"
[lhc/web/wiklou.git] / includes / block / AbstractBlock.php
index 0357f8d..f654404 100644 (file)
@@ -31,13 +31,22 @@ use User;
  * @since 1.34 Factored out from DatabaseBlock (previously Block).
  */
 abstract class AbstractBlock {
-       /** @var string */
+       /**
+        * @deprecated since 1.34. Use getReason and setReason instead.
+        * @var string
+        */
        public $mReason;
 
-       /** @var string */
+       /**
+        * @deprecated since 1.34. Use getTimestamp and setTimestamp instead.
+        * @var string
+        */
        public $mTimestamp;
 
-       /** @var string */
+       /**
+        * @deprecated since 1.34. Use getExpiry and setExpiry instead.
+        * @var string
+        */
        public $mExpiry = '';
 
        /** @var bool */
@@ -49,7 +58,10 @@ abstract class AbstractBlock {
        /** @var bool */
        protected $blockCreateAccount = false;
 
-       /** @var bool */
+       /**
+        * @deprecated since 1.34. Use getHideName and setHideName instead.
+        * @var bool
+        */
        public $mHideName = false;
 
        /** @var User|string */
@@ -513,10 +525,13 @@ abstract class AbstractBlock {
         * @return array
         */
        public function getBlockErrorParams( IContextSource $context ) {
+               $lang = $context->getLanguage();
+
                $blocker = $this->getBlocker();
                if ( $blocker instanceof User ) { // local user
                        $blockerUserpage = $blocker->getUserPage();
-                       $link = "[[{$blockerUserpage->getPrefixedText()}|{$blockerUserpage->getText()}]]";
+                       $blockerText = $lang->embedBidi( $blockerUserpage->getText() );
+                       $link = "[[{$blockerUserpage->getPrefixedText()}|{$blockerText}]]";
                } else { // foreign user
                        $link = $blocker;
                }
@@ -528,19 +543,18 @@ abstract class AbstractBlock {
 
                /* $ip returns who *is* being blocked, $intended contains who was meant to be blocked.
                 * This could be a username, an IP range, or a single IP. */
-               $intended = $this->getTarget();
-               $lang = $context->getLanguage();
+               $intended = (string)$this->getTarget();
 
                return [
                        $link,
                        $reason,
                        $context->getRequest()->getIP(),
-                       $this->getByName(),
+                       $lang->embedBidi( $this->getByName() ),
                        // TODO: SystemBlock replaces this with the system block type. Clean up
                        // error params so that this is not necessary.
                        $this->getId(),
                        $lang->formatExpiry( $this->getExpiry() ),
-                       (string)$intended,
+                       $lang->embedBidi( $intended ),
                        $lang->userTimeAndDate( $this->getTimestamp(), $context->getUser() ),
                ];
        }