Index: trunk/phase3/includes/specials/SpecialUnblock.php |
— | — | @@ -38,13 +38,14 @@ |
39 | 39 | global $wgUser, $wgOut, $wgRequest; |
40 | 40 | |
41 | 41 | # Check permissions |
42 | | - if( !$wgUser->isAllowed( 'block' ) ) { |
43 | | - $wgOut->permissionRequired( 'block' ); |
| 42 | + if( !$this->userCanExecute( $wgUser ) ) { |
| 43 | + $this->displayRestrictionError(); |
44 | 44 | return; |
45 | 45 | } |
| 46 | + |
46 | 47 | # Check for database lock |
47 | 48 | if( wfReadOnly() ) { |
48 | | - $wgOut->readOnlyPage(); |
| 49 | + throw new ReadOnlyError; |
49 | 50 | return; |
50 | 51 | } |
51 | 52 | |
Index: trunk/phase3/includes/specials/SpecialLockdb.php |
— | — | @@ -38,8 +38,9 @@ |
39 | 39 | |
40 | 40 | $this->setHeaders(); |
41 | 41 | |
42 | | - if( !$wgUser->isAllowed( 'siteadmin' ) ) { |
43 | | - $wgOut->permissionRequired( 'siteadmin' ); |
| 42 | + # Permission check |
| 43 | + if( !$this->userCanExecute( $wgUser ) ) { |
| 44 | + $this->displayRestrictionError(); |
44 | 45 | return; |
45 | 46 | } |
46 | 47 | |
Index: trunk/phase3/includes/specials/SpecialUnlockdb.php |
— | — | @@ -33,12 +33,13 @@ |
34 | 34 | } |
35 | 35 | |
36 | 36 | public function execute( $par ) { |
37 | | - global $wgUser, $wgOut, $wgRequest; |
| 37 | + global $wgUser, $wgRequest; |
38 | 38 | |
39 | 39 | $this->setHeaders(); |
40 | 40 | |
41 | | - if( !$wgUser->isAllowed( 'siteadmin' ) ) { |
42 | | - $wgOut->permissionRequired( 'siteadmin' ); |
| 41 | + # Permission check |
| 42 | + if( !$this->userCanExecute( $wgUser ) ) { |
| 43 | + $this->displayRestrictionError(); |
43 | 44 | return; |
44 | 45 | } |
45 | 46 | |
Index: trunk/phase3/includes/specials/SpecialBlock.php |
— | — | @@ -59,17 +59,17 @@ |
60 | 60 | public function execute( $par ) { |
61 | 61 | global $wgUser, $wgOut, $wgRequest; |
62 | 62 | |
63 | | - # Can't block when the database is locked |
64 | | - if( wfReadOnly() ) { |
65 | | - $wgOut->readOnlyPage(); |
66 | | - return; |
67 | | - } |
68 | 63 | # Permission check |
69 | 64 | if( !$this->userCanExecute( $wgUser ) ) { |
70 | | - $wgOut->permissionRequired( 'block' ); |
| 65 | + $this->displayRestrictionError(); |
71 | 66 | return; |
72 | 67 | } |
73 | 68 | |
| 69 | + # Can't block when the database is locked |
| 70 | + if( wfReadOnly() ) { |
| 71 | + throw new ReadOnlyError; |
| 72 | + } |
| 73 | + |
74 | 74 | # Extract variables from the request. Try not to get into a situation where we |
75 | 75 | # need to extract *every* variable from the form just for processing here, but |
76 | 76 | # there are legitimate uses for some variables |