Index: trunk/extensions/MassEditRegex/MassEditRegex.i18n.php |
— | — | @@ -50,6 +50,8 @@ |
51 | 51 | 'masseditregex-badregex' => 'Invalid regex:', |
52 | 52 | 'masseditregex-editfailed' => 'Edit failed:', |
53 | 53 | 'masseditregex-tooltip-execute' => 'Apply these changes to each page', |
| 54 | + |
| 55 | + 'right-masseditregex' => 'Replace page contents using regular expressions', |
54 | 56 | ); |
55 | 57 | |
56 | 58 | /** Message documentation (Message documentation) |
— | — | @@ -61,6 +63,8 @@ |
62 | 64 | 'masseditregex-desc' => '{{desc}}', |
63 | 65 | 'masseditregextext' => 'Replace <code>/en/</code> in the middle in link <code>http://php.net/manual/en/function.preg-replace.php</code> with your language code between slashes, if that page exists. Otherwise leave it as is to link to the English documentation, or choose an appropriate fallback language code.', |
64 | 66 | 'masseditregex-hint-headmatch' => "Noun. This is a column header for the 'match' regexes.", |
| 67 | + |
| 68 | + 'right-masseditregex' => '{{doc-right|masseditregex}}', |
65 | 69 | ); |
66 | 70 | |
67 | 71 | /** Afrikaans (Afrikaans) |
— | — | @@ -433,6 +437,8 @@ |
434 | 438 | 'masseditregex-badregex' => 'Ungültiger regulärer Ausdruck:', |
435 | 439 | 'masseditregex-editfailed' => 'Bearbeitung fehlgeschlagen:', |
436 | 440 | 'masseditregex-tooltip-execute' => 'Diese Änderungen an jeder Seite durchführen', |
| 441 | + |
| 442 | + 'right-masseditregex' => 'Textersetzungen mit regulären Ausdrücken durchführen', |
437 | 443 | ); |
438 | 444 | |
439 | 445 | /** German (formal address) (Deutsch (Sie-Form)) |
Index: trunk/extensions/MassEditRegex/MassEditRegex.php |
— | — | @@ -30,3 +30,6 @@ |
31 | 31 | $wgAutoloadClasses['MassEditRegex'] = $dir . 'MassEditRegex.class.php'; |
32 | 32 | $wgSpecialPages['MassEditRegex'] = 'MassEditRegex'; |
33 | 33 | $wgSpecialPageGroups['MassEditRegex'] = 'pagetools'; |
| 34 | + |
| 35 | +// Required permission to use Special:MassEditRegex |
| 36 | +$wgAvailableRights[] = 'masseditregex'; |
Index: trunk/extensions/MassEditRegex/MassEditRegex.class.php |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | private $sk; |
36 | 36 | |
37 | 37 | function __construct() { |
38 | | - parent::__construct( 'MassEditRegex', 'bot' ); |
| 38 | + parent::__construct( 'MassEditRegex', 'masseditregex' ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | function execute( $par ) { |
— | — | @@ -42,11 +42,26 @@ |
43 | 43 | |
44 | 44 | $this->setHeaders(); |
45 | 45 | |
46 | | - #if ( !$wgUser->isAllowed( 'bot' ) ) { |
47 | | - # $wgOut->permissionRequired( 'bot' ); |
48 | | - # return; |
49 | | - #} |
| 46 | + # Check permissions |
| 47 | + if ( !$wgUser->isAllowed( 'masseditregex' ) ) { |
| 48 | + $this->displayRestrictionError(); |
| 49 | + return; |
| 50 | + } |
50 | 51 | |
| 52 | + # Show a message if the database is in read-only mode |
| 53 | + if ( wfReadOnly() ) { |
| 54 | + $wgOut->readOnlyPage(); |
| 55 | + return; |
| 56 | + } |
| 57 | + |
| 58 | + # If user is blocked, s/he doesn't need to access this page |
| 59 | + if ( $wgUser->isBlocked() ) { |
| 60 | + $wgOut->blockedPage(); |
| 61 | + return; |
| 62 | + } |
| 63 | + |
| 64 | + wfLoadExtensionMessages('MassEditRegex'); |
| 65 | + |
51 | 66 | $this->outputHeader(); |
52 | 67 | |
53 | 68 | $strPageList = $wgRequest->getText( 'wpPageList', 'Sandbox' ); |