r45114 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45113‎ | r45114 | r45115 >
Date:02:58, 28 December 2008
Author:soxred93
Status:deferred
Tags:
Comment:
Quick hack to allow disallowing local editing of the interwiki table.
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialInterwiki.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
@@ -3630,3 +3630,9 @@
36313631 * See http://universaleditbutton.org for more background information
36323632 */
36333633 $wgUniversalEditButton = true;
 3634+
 3635+/**
 3636+* Enable the Interwiki special page.
 3637+* Disable for wikis that have their interwiki table updated automatically from a central location (like Wikimedia)
 3638+*/
 3639+$wgEnableSpecialInterwiki = true;
Index: trunk/phase3/includes/specials/SpecialInterwiki.php
@@ -11,7 +11,7 @@
1212 }
1313
1414 function execute( $par ) {
15 - global $wgRequest, $wgOut, $wgUser;
 15+ global $wgRequest, $wgOut, $wgUser, $wgEnableSpecialInterwiki;
1616
1717 $this->setHeaders();
1818 $this->outputHeader();
@@ -28,6 +28,10 @@
2929 case "delete":
3030 case "edit" :
3131 case "add" :
 32+ if( !$wgEnableSpecialInterwiki ) {
 33+ $wgOut->addWikiMsg( 'interwiki-not-enabled' );
 34+ return;
 35+ }
3236 if( !$admin ){
3337 $wgOut->permissionRequired( 'interwiki' );
3438 return;
@@ -35,6 +39,10 @@
3640 $this->showForm( $action );
3741 break;
3842 case "submit":
 43+ if( !$wgEnableSpecialInterwiki ) {
 44+ $wgOut->addWikiMsg( 'interwiki-not-enabled' );
 45+ return;
 46+ }
3947 if( !$admin ){
4048 $wgOut->permissionRequired( 'interwiki' );
4149 return;
@@ -205,7 +213,7 @@
206214 }
207215
208216 function showList( $admin ) {
209 - global $wgUser, $wgOut;
 217+ global $wgUser, $wgOut, $wgEnableSpecialInterwiki;
210218 $prefixmessage = wfMsgHtml( 'interwiki_prefix' );
211219 $urlmessage = wfMsgHtml( 'interwiki_url' );
212220 $localmessage = wfMsgHtml( 'interwiki_local' );
@@ -214,7 +222,7 @@
215223 $wgOut->addWikiMsg( 'interwiki_intro' );
216224 $selfTitle = $this->getTitle();
217225
218 - if ( $admin ) {
 226+ if ( $admin && $wgEnableSpecialInterwiki ) {
219227 $skin = $wgUser->getSkin();
220228 $addtext = wfMsgHtml( 'interwiki_addtext' );
221229 $addlink = $skin->link( $selfTitle, $addtext, array(), array( 'action' => 'add' ) );
@@ -233,7 +241,7 @@
234242 <br />
235243 <table width='100%' style='border:1px solid #aaa;' class='wikitable'>
236244 <tr id='interwikitable-header'><th>$prefixmessage</th> <th>$urlmessage</th> <th>$localmessage</th> <th>$transmessage</th>";
237 - if( $admin ) {
 245+ if( $admin && $wgEnableSpecialInterwiki ) {
238246 $deletemessage = wfMsgHtml( 'delete' );
239247 $editmessage = wfMsgHtml( 'edit' );
240248 $out .= "<th>$editmessage</th>";
@@ -250,7 +258,7 @@
251259 <td class='mw-interwikitable-url'>$url</td>
252260 <td class='mw-interwikitable-local'>$local</td>
253261 <td class='mw-interwikitable-trans'>$trans</td>";
254 - if( $admin ) {
 262+ if( $admin && $wgEnableSpecialInterwiki ) {
255263 $out .= '<td class="mw-interwikitable-modify">';
256264 $out .= $skin->link( $selfTitle, $editmessage, array(),
257265 array( 'action' => 'edit', 'prefix' => $s->iw_prefix ) );
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2217,6 +2217,7 @@
22182218 'interwiki_log_deleted' => 'removed prefix "$2" from the interwiki table',
22192219 'interwiki_log_edited' => 'modified prefix "$2" : ($3) (trans: $4) (local: $5) in the interwiki table',
22202220 'interwiki_logentry' => '', # do not translate or duplicate this message to other languages
 2221+'interwiki-not-enabled' => 'Editing of the interwiki table is not on the wiki.',
22212222 'interwiki_prefix' => 'Prefix',
22222223 'interwiki_reasonfield' => 'Reason',
22232224 'interwiki_trans' => 'Allow interwiki transclusions',

Status & tagging log