Index: trunk/extensions/WhiteList/WhitelistAuth.php |
— | — | @@ -219,7 +219,16 @@ |
220 | 220 | AND wl_allow_edit = " . $dbr->addQuotes('1'); |
221 | 221 | } |
222 | 222 | #print $sql; |
223 | | - |
| 223 | + |
| 224 | + // We should also check that $title is not a redirect to a whitelisted page |
| 225 | + $redirecttitle = NULL; |
| 226 | + $article = new Article($title); |
| 227 | + if (is_object($article)) |
| 228 | + { |
| 229 | + $pagetext = $article->getContent(); |
| 230 | + $redirecttitle = Title::newFromRedirect($pagetext); |
| 231 | + } |
| 232 | + |
224 | 233 | /* Loop through each result returned and |
225 | 234 | * check for matches. |
226 | 235 | */ |
— | — | @@ -232,6 +241,15 @@ |
233 | 242 | #wfDebug("\n\nAccess granted based on PAGE [" . $db_result->wl_page_title . "]\n\n"); |
234 | 243 | return WHITELIST_GRANT; |
235 | 244 | } |
| 245 | + if ($redirecttitle) |
| 246 | + { |
| 247 | + if( self::RegexCompare($redirecttitle, $db_result->wl_page_title) ) |
| 248 | + { |
| 249 | + $dbr->freeResult($db_results); |
| 250 | + #wfDebug("\n\nAccess granted based on REDIRECT to PAGE [" . $db_result->wl_page_title . "]\n\n"); |
| 251 | + return WHITELIST_GRANT; |
| 252 | + } |
| 253 | + } |
236 | 254 | } |
237 | 255 | $dbr->freeResult($db_results); |
238 | 256 | |
— | — | @@ -241,6 +259,8 @@ |
242 | 260 | /* Returns true if hit, false otherwise */ |
243 | 261 | static function RegexCompare(&$title, $sql_regex) |
244 | 262 | { |
| 263 | + global $wgWhitelistWildCardInsensitive; |
| 264 | + |
245 | 265 | $ret_val = false; |
246 | 266 | |
247 | 267 | /* Convert regex to PHP format */ |
— | — | @@ -249,14 +269,14 @@ |
250 | 270 | $php_regex = ltrim($php_regex, ":"); |
251 | 271 | |
252 | 272 | /* Generate regex; use | as delimiter as it is an illegal title character. */ |
253 | | - $php_regex_full = '|' . $php_regex . '|'; |
| 273 | + $php_regex_full = '|^' . $php_regex . '$|'; |
254 | 274 | if ($wgWhitelistWildCardInsensitive) |
255 | 275 | $php_regex_full .= 'i'; |
256 | 276 | |
257 | | - #print( $php_regex_full . " [" . $title->getPrefixedText() . "]<br />\n"); |
| 277 | +#print( $php_regex_full . " [" . $title->getPrefixedText() . "]<br />\n"); |
258 | 278 | if (self::preg_test($php_regex_full)) { |
259 | 279 | if( preg_match( $php_regex_full, $title->getPrefixedText() ) ) { |
260 | | - #print("MATCH!!"); |
| 280 | +#print("MATCH!!"); |
261 | 281 | $ret_val = true; |
262 | 282 | } |
263 | 283 | } |
Index: trunk/extensions/WhiteList/SpecialWhitelistEdit.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | |
33 | 33 | $wgExtensionCredits['specialpage'][] = array( |
34 | 34 | 'name' => 'WhiteListEdit', |
35 | | - 'version' => 'v0.8.6', |
| 35 | + 'version' => 'v0.8.7', |
36 | 36 | 'author' => array('Paul Grinberg', 'Mike Sullivan'), |
37 | 37 | 'email' => 'gri6507 at yahoo dot com, ms-mediawiki AT umich DOT edu', |
38 | 38 | 'description' => 'Edit the access permissions of restricted users', |