Index: trunk/extensions/Interwiki/Interwiki_body.php |
— | — | @@ -4,6 +4,7 @@ |
5 | 5 | * @ingroup SpecialPage |
6 | 6 | */ |
7 | 7 | class SpecialInterwiki extends SpecialPage { |
| 8 | + |
8 | 9 | /** |
9 | 10 | * Constructor - sets up the new special page |
10 | 11 | */ |
— | — | @@ -11,6 +12,10 @@ |
12 | 13 | parent::__construct( 'Interwiki' ); |
13 | 14 | } |
14 | 15 | |
| 16 | + /** |
| 17 | + * Different description will be shown on Special:SpecialPage depending on |
| 18 | + * whether the user has the 'interwiki' right or not. |
| 19 | + */ |
15 | 20 | function getDescription() { |
16 | 21 | global $wgUser; |
17 | 22 | |
— | — | @@ -34,12 +39,12 @@ |
35 | 40 | $admin = $wgUser->isAllowed( 'interwiki' ); |
36 | 41 | $action = $wgRequest->getVal( 'action', $par ); |
37 | 42 | |
38 | | - switch( $action ){ |
| 43 | + switch( $action ) { |
39 | 44 | case 'delete': |
40 | 45 | case 'edit': |
41 | 46 | case 'add': |
42 | 47 | // Check permissions |
43 | | - if( !$admin ){ |
| 48 | + if( !$admin ) { |
44 | 49 | $wgOut->permissionRequired( 'interwiki' ); |
45 | 50 | return; |
46 | 51 | } |
— | — | @@ -52,7 +57,7 @@ |
53 | 58 | break; |
54 | 59 | case 'submit': |
55 | 60 | // Check permissions |
56 | | - if( !$admin ){ |
| 61 | + if( !$admin ) { |
57 | 62 | $wgOut->permissionRequired( 'interwiki' ); |
58 | 63 | return; |
59 | 64 | } |
— | — | @@ -80,7 +85,7 @@ |
81 | 86 | $actionUrl = $this->getTitle()->getLocalURL( 'action=submit' ); |
82 | 87 | $token = $wgUser->editToken(); |
83 | 88 | |
84 | | - switch( $action ){ |
| 89 | + switch( $action ) { |
85 | 90 | case 'delete': |
86 | 91 | |
87 | 92 | $prefix = $wgRequest->getVal( 'prefix' ); |
— | — | @@ -115,7 +120,7 @@ |
116 | 121 | $prefix = $wgRequest->getVal( 'prefix' ); |
117 | 122 | $dbr = wfGetDB( DB_SLAVE ); |
118 | 123 | $row = $dbr->selectRow( 'interwiki', '*', array( 'iw_prefix' => $prefix ), __METHOD__ ); |
119 | | - if( !$row ){ |
| 124 | + if( !$row ) { |
120 | 125 | $this->error( 'interwiki_editerror', $prefix ); |
121 | 126 | return; |
122 | 127 | } |
— | — | @@ -203,8 +208,12 @@ |
204 | 209 | $theurl = $wgRequest->getVal( 'wpInterwikiURL' ); |
205 | 210 | $local = $wgRequest->getCheck( 'wpInterwikiLocal' ) ? 1 : 0; |
206 | 211 | $trans = $wgRequest->getCheck( 'wpInterwikiTrans' ) ? 1 : 0; |
207 | | - $data = array( 'iw_prefix' => $prefix, 'iw_url' => $theurl, |
208 | | - 'iw_local' => $local, 'iw_trans' => $trans ); |
| 212 | + $data = array( |
| 213 | + 'iw_prefix' => $prefix, |
| 214 | + 'iw_url' => $theurl, |
| 215 | + 'iw_local' => $local, |
| 216 | + 'iw_trans' => $trans |
| 217 | + ); |
209 | 218 | |
210 | 219 | if( $do == 'add' ){ |
211 | 220 | $dbw->insert( 'interwiki', $data, __METHOD__, 'IGNORE' ); |
— | — | @@ -226,10 +235,12 @@ |
227 | 236 | } |
228 | 237 | |
229 | 238 | function trans_local( $tl, $msg0, $msg1 ) { |
230 | | - if( $tl === '0' ) |
| 239 | + if( $tl === '0' ) { |
231 | 240 | return $msg0; |
232 | | - if( $tl === '1' ) |
| 241 | + } |
| 242 | + if( $tl === '1' ) { |
233 | 243 | return $msg1; |
| 244 | + } |
234 | 245 | return htmlspecialchars( $tl ); |
235 | 246 | } |
236 | 247 | |