r83961 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83960‎ | r83961 | r83962 >
Date:20:51, 14 March 2011
Author:reedy
Status:ok
Tags:
Comment:
TitleBlacklist

Fix undefined $user

Documentation, braces
Modified paths:
  • /trunk/extensions/TitleBlacklist/TitleBlacklist.hooks.php (modified) (history)
  • /trunk/extensions/TitleBlacklist/TitleBlacklist.list.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TitleBlacklist/TitleBlacklist.hooks.php
@@ -12,7 +12,17 @@
1313 * @ingroup Extensions
1414 */
1515 class TitleBlacklistHooks {
16 - /** getUserPermissionsErrorsExpensive hook */
 16+
 17+ /**
 18+ * getUserPermissionsErrorsExpensive hook
 19+ *
 20+ * @static
 21+ * @param Title $title
 22+ * @param User $user
 23+ * @param $action
 24+ * @param $result
 25+ * @return bool
 26+ */
1727 public static function userCan( $title, $user, $action, &$result ) {
1828 global $wgTitleBlacklist;
1929 if( $action == 'create' || $action == 'edit' || $action == 'upload' ) {
@@ -28,13 +38,23 @@
2939 return true;
3040 }
3141
32 - /** AbortMove hook */
 42+ /**
 43+ * AbortMove hook
 44+ *
 45+ * @static
 46+ * @param Title $old
 47+ * @param Title $nt
 48+ * @param User $user
 49+ * @param $err
 50+ * @return bool
 51+ */
3352 public static function abortMove( $old, $nt, $user, &$err ) {
3453 global $wgTitleBlacklist;
3554 efInitTitleBlacklist();
3655 $blacklisted = $wgTitleBlacklist->userCannot( $nt, $user, 'move' );
37 - if( !$blacklisted )
 56+ if( !$blacklisted ) {
3857 $blacklisted = $wgTitleBlacklist->userCannot( $old, $user, 'edit' );
 58+ }
3959 if( $blacklisted instanceof TitleBlacklistEntry ) {
4060 $err = wfMsgWikiHtml( $blacklisted->getErrorMessage( 'move' ),
4161 htmlspecialchars( $blacklisted->getRaw() ),
Index: trunk/extensions/TitleBlacklist/TitleBlacklist.list.php
@@ -312,8 +312,10 @@
313313 wfSuppressWarnings();
314314 $match = preg_match( "/^(?:{$this->mRegex})$/us" . ( isset( $this->mParams['casesensitive'] ) ? '' : 'i' ), $title->getFullText() );
315315 wfRestoreWarnings();
 316+
 317+ global $wgUser;
316318 if( $match ) {
317 - if( isset( $this->mParams['autoconfirmed'] ) && $user->isAllowed( 'autoconfirmed' ) ) {
 319+ if( isset( $this->mParams['autoconfirmed'] ) && $wgUser->isAllowed( 'autoconfirmed' ) ) {
318320 return true;
319321 }
320322 if( isset( $this->mParams['moveonly'] ) && $action != 'move' ) {

Status & tagging log