From f1fb0bc169837f2f0fe9ff4322243aca656f213a Mon Sep 17 00:00:00 2001 From: Nick Jenkins Date: Mon, 19 Mar 2007 07:08:58 +0000 Subject: [PATCH] * Prevent E_STRICT error when '$wgDebugDumpSql = true', and a path has been defined for $wgDebugLogFile, but $wgDebugLogFile does not exist yet: "filesize(): stat failed for sql-log.txt in includes/GlobalFunctions.php on line 219" * Removing unused global $IP. * Indentation of an if/else block. * Trivial comment typo. * Prevent PHP Fatal error: "Call to a member function getText() on a non-object in includes/SpecialListusers.php on line 46", when opening a URL such as http://192.168.0.64/wiki/index.php/Special:Listusers?username=%22%27%3E (i.e. when "Display users starting at:" username supplied in Special:Listusers is not a valid MediaWiki title). * Fix HTML validation of protection form (i.e. when "action=protect"). --- includes/GlobalFunctions.php | 3 +-- includes/MimeMagic.php | 2 +- includes/ProtectionForm.php | 9 ++++----- includes/SpecialListusers.php | 4 +++- includes/SpecialUndelete.php | 9 +++++---- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 878a6d6998..8a39524bea 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -22,7 +22,6 @@ $wgTotalViews = -1; $wgTotalEdits = -1; -global $IP; require_once dirname(__FILE__) . '/LogPage.php'; require_once dirname(__FILE__) . '/normal/UtfNormalUtil.php'; require_once dirname(__FILE__) . '/XmlFunctions.php'; @@ -240,7 +239,7 @@ function wfLogDBError( $text ) { function wfErrorLog( $text, $file ) { wfSuppressWarnings(); $exists = file_exists( $file ); - $size = filesize( $file ); + $size = $exists ? filesize( $file ) : false; if ( !$exists || ( $size !== false && $size + strlen( $text ) < 0x7fffffff ) ) { error_log( $text, 3, $file ); } diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index f70914b0cf..2ef32c4f8a 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -339,7 +339,7 @@ class MimeMagic { } - /** mime type detection. This uses detectMimeType to detect the mim type of the file, + /** mime type detection. This uses detectMimeType to detect the mime type of the file, * but applies additional checks to determine some well known file formats that may be missed * or misinterpreter by the default mime detection (namely xml based formats like XHTML or SVG). * diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 662b1df779..659ba1f16c 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -213,14 +213,14 @@ class ProtectionForm { $out .= "\n"; $out .= "\n"; - $out .= "\n"; - $out .= "\n"; - global $wgEnableCascadingProtection; if ($wgEnableCascadingProtection) $out .= $this->buildCascadeInput(); + $out .= "
\n"; + $out .= "\n"; + $out .= $this->buildExpiryInput(); if( !$this->disabled ) { @@ -285,8 +285,7 @@ class ProtectionForm { function buildCascadeInput() { $id = 'mwProtect-cascade'; - $ci = "" . wfCheckLabel( wfMsg( 'protect-cascade' ), $id, $id, $this->mCascade, $this->disabledAttrib) . ""; - + $ci = wfCheckLabel( wfMsg( 'protect-cascade' ), $id, $id, $this->mCascade, $this->disabledAttrib); return $ci; } diff --git a/includes/SpecialListusers.php b/includes/SpecialListusers.php index 8a05c38001..f0ac1252c8 100644 --- a/includes/SpecialListusers.php +++ b/includes/SpecialListusers.php @@ -43,7 +43,9 @@ class UsersPager extends AlphabeticPager { $this->requestedUser = ''; if ( $un != '' ) { $username = Title::makeTitleSafe( NS_USER, $un ); - $this->requestedUser = $username->getText(); + if( ! is_null( $username ) ) { + $this->requestedUser = $username->getText(); + } } parent::__construct(); } diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 8aaf785ed8..e450884924 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -773,10 +773,11 @@ class UndeleteForm { $userLink = $sk->userLink( $row->ar_user, $row->ar_user_text ) . $sk->userToolLinks( $row->ar_user, $row->ar_user_text ); $stxt = ''; if (!is_null($size = $row->ar_len)) { - if ($size == 0) - $stxt = wfMsgHtml('historyempty'); - else - $stxt = wfMsgHtml('historysize', $wgLang->formatNum( $size ) ); + if ($size == 0) { + $stxt = wfMsgHtml('historyempty'); + } else { + $stxt = wfMsgHtml('historysize', $wgLang->formatNum( $size ) ); + } } $comment = $sk->commentBlock( $row->ar_comment ); $wgOut->addHTML( "
  • $checkBox $pageLink . . $userLink $stxt $comment
  • \n" ); -- 2.20.1