r83697 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83696‎ | r83697 | r83698 >
Date:14:20, 11 March 2011
Author:ashley
Status:deferred
Tags:
Comment:
Interwiki: minor tweaks
Modified paths:
  • /trunk/extensions/Interwiki/Interwiki_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Interwiki/Interwiki_body.php
@@ -4,6 +4,7 @@
55 * @ingroup SpecialPage
66 */
77 class SpecialInterwiki extends SpecialPage {
 8+
89 /**
910 * Constructor - sets up the new special page
1011 */
@@ -11,6 +12,10 @@
1213 parent::__construct( 'Interwiki' );
1314 }
1415
 16+ /**
 17+ * Different description will be shown on Special:SpecialPage depending on
 18+ * whether the user has the 'interwiki' right or not.
 19+ */
1520 function getDescription() {
1621 global $wgUser;
1722
@@ -34,12 +39,12 @@
3540 $admin = $wgUser->isAllowed( 'interwiki' );
3641 $action = $wgRequest->getVal( 'action', $par );
3742
38 - switch( $action ){
 43+ switch( $action ) {
3944 case 'delete':
4045 case 'edit':
4146 case 'add':
4247 // Check permissions
43 - if( !$admin ){
 48+ if( !$admin ) {
4449 $wgOut->permissionRequired( 'interwiki' );
4550 return;
4651 }
@@ -52,7 +57,7 @@
5358 break;
5459 case 'submit':
5560 // Check permissions
56 - if( !$admin ){
 61+ if( !$admin ) {
5762 $wgOut->permissionRequired( 'interwiki' );
5863 return;
5964 }
@@ -80,7 +85,7 @@
8186 $actionUrl = $this->getTitle()->getLocalURL( 'action=submit' );
8287 $token = $wgUser->editToken();
8388
84 - switch( $action ){
 89+ switch( $action ) {
8590 case 'delete':
8691
8792 $prefix = $wgRequest->getVal( 'prefix' );
@@ -115,7 +120,7 @@
116121 $prefix = $wgRequest->getVal( 'prefix' );
117122 $dbr = wfGetDB( DB_SLAVE );
118123 $row = $dbr->selectRow( 'interwiki', '*', array( 'iw_prefix' => $prefix ), __METHOD__ );
119 - if( !$row ){
 124+ if( !$row ) {
120125 $this->error( 'interwiki_editerror', $prefix );
121126 return;
122127 }
@@ -203,8 +208,12 @@
204209 $theurl = $wgRequest->getVal( 'wpInterwikiURL' );
205210 $local = $wgRequest->getCheck( 'wpInterwikiLocal' ) ? 1 : 0;
206211 $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+ );
209218
210219 if( $do == 'add' ){
211220 $dbw->insert( 'interwiki', $data, __METHOD__, 'IGNORE' );
@@ -226,10 +235,12 @@
227236 }
228237
229238 function trans_local( $tl, $msg0, $msg1 ) {
230 - if( $tl === '0' )
 239+ if( $tl === '0' ) {
231240 return $msg0;
232 - if( $tl === '1' )
 241+ }
 242+ if( $tl === '1' ) {
233243 return $msg1;
 244+ }
234245 return htmlspecialchars( $tl );
235246 }
236247

Status & tagging log