From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- includes/exception/HttpError.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'includes/exception/HttpError.php') diff --git a/includes/exception/HttpError.php b/includes/exception/HttpError.php index b81c5731..9211bf82 100644 --- a/includes/exception/HttpError.php +++ b/includes/exception/HttpError.php @@ -35,7 +35,7 @@ class HttpError extends MWException { * * @param int $httpCode HTTP status code to send to the client * @param string|Message $content Content of the message - * @param string|Message $header Content of the header (\ and \) + * @param string|Message|null $header Content of the header (\ and \) */ public function __construct( $httpCode, $content, $header = null ) { parent::__construct( $content ); @@ -74,9 +74,7 @@ class HttpError extends MWException { public function report() { $this->doLog(); - $httpMessage = HttpStatus::getMessage( $this->httpCode ); - - header( "Status: {$this->httpCode} {$httpMessage}", true, $this->httpCode ); + HttpStatus::header( $this->httpCode ); header( 'Content-type: text/html; charset=utf-8' ); print $this->getHTML(); @@ -113,21 +111,21 @@ class HttpError extends MWException { */ public function getHTML() { if ( $this->header === null ) { - $header = HttpStatus::getMessage( $this->httpCode ); + $titleHtml = htmlspecialchars( HttpStatus::getMessage( $this->httpCode ) ); } elseif ( $this->header instanceof Message ) { - $header = $this->header->escaped(); + $titleHtml = $this->header->escaped(); } else { - $header = htmlspecialchars( $this->header ); + $titleHtml = htmlspecialchars( $this->header ); } if ( $this->content instanceof Message ) { - $content = $this->content->escaped(); + $contentHtml = $this->content->escaped(); } else { - $content = htmlspecialchars( $this->content ); + $contentHtml = nl2br( htmlspecialchars( $this->content ) ); } return "\n" . - "$header\n" . - "

$header

$content

\n"; + "$titleHtml\n" . + "

$titleHtml

$contentHtml

\n"; } } -- cgit v1.2.3-54-g00ecf