Extension:SpecialInterwiki/SpecialInterwiki.php

This extension is now in Subversion. This is an outdated version. Please download from here. \n";			} elseif ($do == "delete2" && $safePost) {				if (!$admin) { $wgOut->permissionRequired('interwiki'); return; }				$prefix = $wgRequest->getVal('prefix');				$reason = $wgRequest->getText('reason');				$dbw =& wfGetDB( DB_MASTER );				$dbw->delete( 'interwiki', array( 'iw_prefix' => $prefix ), $fname );				if ($dbw->affectedRows == 0) {					$wgOut->addWikiText( wfMsg( 'interwiki_delfailed', $prefix ) );				} else {					$wgOut->addWikiText( wfMsg( 'interwiki_deleted', $prefix ) . '

' . wfMsg ( 'returnto', 'Special:Log/interwiki' ) ); # I don't know how to add a link to Special:Interwiki					$log = new LogPage( 'interwiki' );					$log->addEntry( 'interwiki', $selfTitle, wfMsgForContent( 'interwiki_log_deleted', $prefix, $reason ) );				}			} elseif ($do == "add") {				if (!$admin) { $wgOut->permissionRequired('interwiki'); return; };				$action = $selfTitle->escapeLocalURL( "do=add2");				$topmessage = wfMsgHtml('interwiki_addtext');				$prefixmessage = wfMsgHtml('interwiki_prefix');				$transmessage = wfMsgHtml('interwiki_trans');				$localmessage = wfMsgHtml('interwiki_local');				$reasonmessage = wfMsgHtml('interwiki_reasonfield');				$urlmessage = wfMsgHtml('interwiki_url');				$button = wfMsgHtml('interwiki_addbutton');				$token = htmlspecialchars( $wgUser->editToken );				$out = " 					 $topmessage 					   \n";			} elseif ($do == "add2" && $safePost) {				if (!$admin) { $wgOut->permissionRequired('interwiki'); return; }				$prefix = $wgRequest->getVal('prefix');				$reason = $wgRequest->getText('reason');				$theurl = $wgRequest->getVal('theurl');				$local = $wgRequest->getCheck('local') ? 1 : 0;				$trans = $wgRequest->getCheck('trans') ? 1 : 0;				$dbw =& wfGetDB( DB_MASTER );				$dbw->insert( 'interwiki',					array(						'iw_prefix' => $prefix,						'iw_url'   => $theurl,						'iw_local'  => $local,						'iw_trans'  => $trans ),					$fname,					'IGNORE' );				if( $dbw->affectedRows == 0 ) {					$wgOut->addWikiText( wfMsg( 'interwiki_addfailed', $prefix ) );				} else {					$wgOut->addWikiText( wfMsg( 'interwiki_added', $prefix ) . '

' . wfMsg ( 'returnto', 'Special:Log/interwiki' ) ); # I don't know how to add a link to Special:Interwiki					$log = new LogPage( 'interwiki' );					$log->addEntry( 'interwiki', $selfTitle, wfMsgForContent( 'interwiki_log_added', $prefix, $theurl, $trans, $local, $reason ) );				}			} else {				$dbr =& wfGetDB( DB_SLAVE );				$res = $dbr->select( 'interwiki', '*' );				$prefixmessage = wfMsgHtml('interwiki_prefix');				$urlmessage = wfMsgHtml('interwiki_url');				$localmessage = wfMsgHtml('interwiki_local');				$transmessage = wfMsgHtml('interwiki_trans');				$deletemessage = wfMsgHtml('delete');               $errormessage = wfMsgHtml('interwiki_error');				$addtext = wfMsgHtml('interwiki_addtext');				if ($admin) {                               $skin = $wgUser->getSkin;                               $out = $skin->makeLinkObj( $selfTitle, $addtext, 'do=add' );				} else {					$out = ''; }				$out .= "

";			}			$wgOut->addHTML($out);		}	}	SpecialPage::addPage( new Interwiki ); }

function wfInterwikiAddLogType( &$types ) { if ( !in_array( 'interwiki', $types ) ) $types[] = 'interwiki'; return true; }

function wfInterwikiAddLogName( &$names ) { $names['interwiki'] = 'interwiki_logpagename'; return true; }

function wfInterwikiAddLogHeader( &$headers ) { $headers['interwiki'] = 'interwiki_logpagetext'; return true; }

function wfInterwikiAddActionText( &$actions ) { $actions['interwiki/interwiki'] = 'interwiki_logentry'; return true; }