Index: branches/wmf/1.18wmf1/extensions/TitleBlacklist/TitleBlacklist.hooks.php |
— | — | @@ -76,10 +76,10 @@ |
77 | 77 | * |
78 | 78 | * @return bool Acceptable |
79 | 79 | */ |
80 | | - private static function acceptNewUserName( $userName, &$err, $override = true ) { |
81 | | - global $wgUser; |
| 80 | + private static function acceptNewUserName( $userName, $permissionsUser, &$err, $override = true ) { |
82 | 81 | $title = Title::makeTitleSafe( NS_USER, $userName ); |
83 | | - $blacklisted = TitleBlacklist::singleton()->userCannot( $title, $wgUser, 'new-account', $override ); |
| 82 | + $blacklisted = TitleBlacklist::singleton()->userCannot( $title, $permissionsUser, |
| 83 | + 'new-account', $override ); |
84 | 84 | if( $blacklisted instanceof TitleBlacklistEntry ) { |
85 | 85 | $message = $blacklisted->getErrorMessage( 'new-account' ); |
86 | 86 | $err = wfMsgWikiHtml( $message, $blacklisted->getRaw(), $userName ); |
— | — | @@ -96,13 +96,14 @@ |
97 | 97 | public static function abortNewAccount( $user, &$message ) { |
98 | 98 | global $wgUser, $wgRequest; |
99 | 99 | $override = $wgRequest->getCheck( 'wpIgnoreTitleBlacklist' ); |
100 | | - return self::acceptNewUserName( $user->getName(), $message, $override ); |
| 100 | + return self::acceptNewUserName( $user->getName(), $wgUser, $message, $override ); |
101 | 101 | } |
102 | 102 | |
103 | 103 | /** CentralAuthAutoCreate hook */ |
104 | 104 | public static function centralAuthAutoCreate( $user, $userName ) { |
105 | 105 | $message = ''; # Will be ignored |
106 | | - return self::acceptNewUserName( $userName, $message ); |
| 106 | + $anon = new User; |
| 107 | + return self::acceptNewUserName( $userName, $anon, $message ); |
107 | 108 | } |
108 | 109 | |
109 | 110 | /** EditFilter hook |
— | — | @@ -169,9 +170,9 @@ |
170 | 171 | |
171 | 172 | /** UserCreateForm hook based on the one from AntiSpoof extension */ |
172 | 173 | public static function addOverrideCheckbox( &$template ) { |
173 | | - global $wgRequest; |
| 174 | + global $wgRequest, $wgUser; |
174 | 175 | |
175 | | - if ( TitleBlacklist::userCanOverride( 'new-account' ) ) { |
| 176 | + if ( TitleBlacklist::userCanOverride( $wgUser, 'new-account' ) ) { |
176 | 177 | $template->addInputItem( 'wpIgnoreTitleBlacklist', |
177 | 178 | $wgRequest->getCheck( 'wpIgnoreTitleBlacklist' ), |
178 | 179 | 'checkbox', 'titleblacklist-override' ); |
Index: branches/wmf/1.18wmf1/extensions/TitleBlacklist/TitleBlacklist.list.php |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | * otherwise FALSE |
154 | 154 | */ |
155 | 155 | public function userCannot( $title, $user, $action = 'edit', $override = true ) { |
156 | | - if( $override && self::userCanOverride( $action ) ) |
| 156 | + if( $override && self::userCanOverride( $user, $action ) ) |
157 | 157 | return false; |
158 | 158 | else |
159 | 159 | return $this->isBlacklisted( $title, $action ); |
— | — | @@ -280,10 +280,9 @@ |
281 | 281 | * |
282 | 282 | * @param $action Action |
283 | 283 | */ |
284 | | - public static function userCanOverride( $action ) { |
285 | | - global $wgUser; |
286 | | - return $wgUser->isAllowed( 'tboverride' ) || |
287 | | - ( $action == 'new-account' && $wgUser->isAllowed( 'tboverride-account' ) ); |
| 284 | + public static function userCanOverride( $user, $action ) { |
| 285 | + return $user->isAllowed( 'tboverride' ) || |
| 286 | + ( $action == 'new-account' && $user->isAllowed( 'tboverride-account' ) ); |
288 | 287 | } |
289 | 288 | } |
290 | 289 | |
Property changes on: branches/wmf/1.18wmf1/extensions/TitleBlacklist |
___________________________________________________________________ |
Modified: svn:mergeinfo |
291 | 290 | Merged /trunk/extensions/TitleBlacklist:r97794,97797 |