Added/Removed spaces around string concatenation
[lhc/web/wiklou.git] / includes / Exception.php
index 855eb09..93fddac 100644 (file)
@@ -467,9 +467,39 @@ class ThrottledError extends ErrorPageError {
  */
 class UserBlockedError extends ErrorPageError {
        public function __construct( Block $block ) {
-               // @todo FIXME: Implement a more proper way to get context here.
-               $params = $block->getPermissionsError( RequestContext::getMain() );
-               parent::__construct( 'blockedtitle', array_shift( $params ), $params );
+               global $wgLang, $wgRequest;
+
+               $blocker = $block->getBlocker();
+               if ( $blocker instanceof User ) { // local user
+                       $blockerUserpage = $block->getBlocker()->getUserPage();
+                       $link = "[[{$blockerUserpage->getPrefixedText()}|{$blockerUserpage->getText()}]]";
+               } else { // foreign user
+                       $link = $blocker;
+               }
+
+               $reason = $block->mReason;
+               if( $reason == '' ) {
+                       $reason = wfMessage( 'blockednoreason' )->text();
+               }
+
+               /* $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 = $block->getTarget();
+
+               parent::__construct(
+                       'blockedtitle',
+                       $block->mAuto ? 'autoblockedtext' : 'blockedtext',
+                       array(
+                               $link,
+                               $reason,
+                               $wgRequest->getIP(),
+                               $block->getByName(),
+                               $block->getId(),
+                               $wgLang->formatExpiry( $block->mExpiry ),
+                               $intended,
+                               $wgLang->timeanddate( wfTimestamp( TS_MW, $block->mTimestamp ), true )
+                       )
+               );
        }
 }
 
@@ -587,7 +617,7 @@ class HttpError extends MWException {
                        $content = htmlspecialchars( $this->content );
                }
 
-               return "<!DOCTYPE html>\n".
+               return "<!DOCTYPE html>\n" .
                        "<html><head><title>$header</title></head>\n" .
                        "<body><h1>$header</h1><p>$content</p></body></html>\n";
        }
@@ -691,8 +721,10 @@ class MWExceptionHandler {
                // Final cleanup
                if ( $wgFullyInitialised ) {
                        try {
-                               wfLogProfilingData(); // uses $wgRequest, hence the $wgFullyInitialised condition
-                       } catch ( Exception $e ) {}
+                               // uses $wgRequest, hence the $wgFullyInitialised condition
+                               wfLogProfilingData();
+                       } catch ( Exception $e ) {
+                       }
                }
 
                // Exit value should be nonzero for the benefit of shell jobs