2008-04-03 21:00:22 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2009-08-27 13:02:57 +00:00
|
|
|
* Implements Special:Interwiki
|
2008-12-31 18:44:54 +00:00
|
|
|
* @ingroup SpecialPage
|
2008-04-03 21:00:22 +00:00
|
|
|
*/
|
|
|
|
class SpecialInterwiki extends SpecialPage {
|
2011-03-11 14:20:39 +00:00
|
|
|
|
2009-08-27 13:02:57 +00:00
|
|
|
/**
|
|
|
|
* Constructor - sets up the new special page
|
|
|
|
*/
|
|
|
|
public function __construct() {
|
2008-04-03 21:00:22 +00:00
|
|
|
parent::__construct( 'Interwiki' );
|
|
|
|
}
|
|
|
|
|
2011-03-11 14:20:39 +00:00
|
|
|
/**
|
|
|
|
* Different description will be shown on Special:SpecialPage depending on
|
2011-07-19 12:45:38 +00:00
|
|
|
* whether the user can modify the data.
|
2011-03-11 14:20:39 +00:00
|
|
|
*/
|
2010-01-22 21:19:01 +00:00
|
|
|
function getDescription() {
|
2011-07-20 15:29:34 +00:00
|
|
|
return wfMessage( $this->canModify() ?
|
2011-07-21 05:43:08 +00:00
|
|
|
'interwiki' : 'interwiki-title-norights' )->plain();
|
2010-01-22 21:19:01 +00:00
|
|
|
}
|
|
|
|
|
2009-08-27 13:02:57 +00:00
|
|
|
/**
|
|
|
|
* Show the special page
|
|
|
|
*
|
|
|
|
* @param $par Mixed: parameter passed to the page or null
|
|
|
|
*/
|
|
|
|
public function execute( $par ) {
|
2008-04-03 21:00:22 +00:00
|
|
|
global $wgRequest, $wgOut, $wgUser;
|
|
|
|
|
|
|
|
$this->setHeaders();
|
2008-12-31 18:44:54 +00:00
|
|
|
$this->outputHeader();
|
|
|
|
|
2011-08-28 17:37:56 +00:00
|
|
|
$wgOut->addModuleStyles( 'SpecialInterwiki' );
|
2011-07-19 12:45:38 +00:00
|
|
|
|
|
|
|
$action = $par ? $par : $wgRequest->getVal( 'action', $par );
|
2011-06-12 11:45:15 +00:00
|
|
|
$return = $this->getTitle();
|
2008-04-03 21:00:22 +00:00
|
|
|
|
2011-03-11 14:20:39 +00:00
|
|
|
switch( $action ) {
|
2009-08-27 13:02:57 +00:00
|
|
|
case 'delete':
|
|
|
|
case 'edit':
|
|
|
|
case 'add':
|
2011-07-19 12:45:38 +00:00
|
|
|
if( $this->canModify( $wgOut ) ) {
|
2011-07-20 15:29:34 +00:00
|
|
|
$wgOut->addHTML( $this->showForm( $action ) );
|
2008-04-03 21:00:22 +00:00
|
|
|
}
|
2011-06-11 22:14:03 +00:00
|
|
|
$wgOut->returnToMain( false, $return );
|
2008-12-31 18:44:54 +00:00
|
|
|
break;
|
2009-08-27 13:02:57 +00:00
|
|
|
case 'submit':
|
2011-07-19 12:45:38 +00:00
|
|
|
if( !$this->canModify( $wgOut ) ) {
|
|
|
|
# Error msg added by canModify()
|
2011-06-11 22:14:03 +00:00
|
|
|
} elseif( !$wgRequest->wasPosted() || !$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
|
|
|
|
// Prevent cross-site request forgeries
|
2008-12-31 18:44:54 +00:00
|
|
|
$wgOut->addWikiMsg( 'sessionfailure' );
|
2011-06-11 22:14:03 +00:00
|
|
|
} else {
|
|
|
|
$this->doSubmit();
|
2008-12-31 18:44:54 +00:00
|
|
|
}
|
2011-06-11 22:14:03 +00:00
|
|
|
$wgOut->returnToMain( false, $return );
|
2008-12-31 18:44:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-07-19 12:45:38 +00:00
|
|
|
$this->showList();
|
2008-12-31 18:44:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-19 12:45:38 +00:00
|
|
|
/**
|
|
|
|
* Returns boolean whether the user can modify the data.
|
|
|
|
* @param $out If $wgOut object given, it adds the respective error message.
|
|
|
|
* @return Boolean
|
|
|
|
*/
|
|
|
|
public function canModify( $out = false ) {
|
|
|
|
global $wgUser, $wgInterwikiCache;
|
|
|
|
if( !$wgUser->isAllowed( 'interwiki' ) ) {
|
|
|
|
# Check permissions
|
2011-07-20 15:29:34 +00:00
|
|
|
if( $out ) { throw new PermissionsError( 'interwiki' ); }
|
2011-07-19 12:45:38 +00:00
|
|
|
return false;
|
|
|
|
} elseif( $wgInterwikiCache ) {
|
|
|
|
# Editing the interwiki cache is not supported
|
|
|
|
if( $out ) { $out->addWikiMsg( 'interwiki-cached' ); }
|
|
|
|
return false;
|
|
|
|
} elseif( wfReadOnly() ) {
|
|
|
|
# Is the database in read-only mode?
|
|
|
|
if( $out ) { $out->readOnlyPage(); }
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2011-06-21 10:49:52 +00:00
|
|
|
|
2011-07-19 12:45:38 +00:00
|
|
|
function showForm( $action ) {
|
2011-07-20 15:29:34 +00:00
|
|
|
global $wgRequest, $wgUser;
|
|
|
|
|
|
|
|
$prefix = $wgRequest->getVal( 'prefix' );
|
|
|
|
$wpPrefix = '';
|
|
|
|
$label = array( 'class' => 'mw-label' );
|
|
|
|
$input = array( 'class' => 'mw-input' );
|
|
|
|
|
|
|
|
if( $action == 'delete' ) {
|
2011-07-20 19:58:55 +00:00
|
|
|
$topmessage = wfMessage( 'interwiki_delquestion', $prefix )->text();
|
|
|
|
$intromessage = wfMessage( 'interwiki_deleting', $prefix )->text();
|
2011-07-20 15:29:34 +00:00
|
|
|
$wpPrefix = Html::hidden( 'wpInterwikiPrefix', $prefix );
|
|
|
|
$button = 'delete';
|
|
|
|
$formContent = '';
|
|
|
|
} elseif( $action == 'edit' ) {
|
|
|
|
$dbr = wfGetDB( DB_SLAVE );
|
|
|
|
$row = $dbr->selectRow( 'interwiki', '*', array( 'iw_prefix' => $prefix ), __METHOD__ );
|
|
|
|
if( !$row ) {
|
|
|
|
$this->error( 'interwiki_editerror', $prefix );
|
|
|
|
return;
|
2008-04-03 21:00:22 +00:00
|
|
|
}
|
2011-07-20 15:29:34 +00:00
|
|
|
$prefix = $row->iw_prefix;
|
|
|
|
$defaulturl = $row->iw_url;
|
|
|
|
$trans = $row->iw_trans;
|
|
|
|
$local = $row->iw_local;
|
|
|
|
$wpPrefix = Html::hidden( 'wpInterwikiPrefix', $row->iw_prefix );
|
2011-07-20 19:58:55 +00:00
|
|
|
$topmessage = wfMessage( 'interwiki_edittext' )->text();
|
|
|
|
$intromessage = wfMessage( 'interwiki_editintro' )->text();
|
2011-07-20 15:29:34 +00:00
|
|
|
$button = 'edit';
|
|
|
|
} elseif( $action == 'add' ) {
|
2011-07-23 23:42:14 +00:00
|
|
|
$prefix = $wgRequest->getVal( 'wpInterwikiPrefix', $wgRequest->getVal( 'prefix' ) );
|
2011-07-20 15:29:34 +00:00
|
|
|
$prefix = Xml::input( 'wpInterwikiPrefix', 20, $prefix,
|
|
|
|
array( 'tabindex' => 1, 'id' => 'mw-interwiki-prefix', 'maxlength' => 20 ) );
|
|
|
|
$local = $wgRequest->getCheck( 'wpInterwikiLocal' );
|
|
|
|
$trans = $wgRequest->getCheck( 'wpInterwikiTrans' );
|
2011-07-23 23:42:14 +00:00
|
|
|
$defaulturl = $wgRequest->getVal( 'wpInterwikiURL', wfMessage( 'interwiki-defaulturl' )->text() );
|
2011-07-20 19:58:55 +00:00
|
|
|
$topmessage = wfMessage( 'interwiki_addtext' )->text();
|
|
|
|
$intromessage = wfMessage( 'interwiki_addintro' )->text();
|
2011-07-20 15:29:34 +00:00
|
|
|
$button = 'interwiki_addbutton';
|
|
|
|
}
|
2008-04-03 21:00:22 +00:00
|
|
|
|
2011-07-20 15:29:34 +00:00
|
|
|
if( $action == 'add' || $action == 'edit' ) {
|
|
|
|
$formContent = Html::rawElement( 'tr', null,
|
2011-07-20 19:58:55 +00:00
|
|
|
Html::element( 'td', $label, wfMessage( 'interwiki-prefix-label' )->text() ) .
|
2011-07-20 15:29:34 +00:00
|
|
|
Html::rawElement( 'td', null, '<tt>' . $prefix . '</tt>' )
|
|
|
|
) . Html::rawElement( 'tr', null,
|
2011-07-20 19:58:55 +00:00
|
|
|
Html::rawElement( 'td', $label, Xml::label( wfMessage( 'interwiki-local-label' )->text(), 'mw-interwiki-local' ) ) .
|
2011-07-20 15:29:34 +00:00
|
|
|
Html::rawElement( 'td', $input, Xml::check( 'wpInterwikiLocal', $local, array( 'id' => 'mw-interwiki-local' ) ) )
|
|
|
|
) . Html::rawElement( 'tr', null,
|
2011-07-20 19:58:55 +00:00
|
|
|
Html::rawElement( 'td', $label, Xml::label( wfMessage( 'interwiki-trans-label' )->text(), 'mw-interwiki-trans' ) ) .
|
2011-07-20 15:29:34 +00:00
|
|
|
Html::rawElement( 'td', $input, Xml::check( 'wpInterwikiTrans', $trans, array( 'id' => 'mw-interwiki-trans' ) ) )
|
|
|
|
) . Html::rawElement( 'tr', null,
|
2011-07-20 19:58:55 +00:00
|
|
|
Html::rawElement( 'td', $label, Xml::label( wfMessage( 'interwiki-url-label' )->text(), 'mw-interwiki-url' ) ) .
|
2011-07-20 15:29:34 +00:00
|
|
|
Html::rawElement( 'td', $input, Xml::input( 'wpInterwikiURL', 60, $defaulturl,
|
|
|
|
array( 'tabindex' => 1, 'maxlength' => 200, 'id' => 'mw-interwiki-url' ) ) )
|
2008-04-03 21:00:22 +00:00
|
|
|
);
|
2008-12-31 18:44:54 +00:00
|
|
|
}
|
2011-07-20 15:29:34 +00:00
|
|
|
|
|
|
|
return Xml::fieldset( $topmessage, Html::rawElement( 'form',
|
|
|
|
array( 'id' => "mw-interwiki-{$action}form", 'method' => 'post',
|
|
|
|
'action' => $this->getTitle()->getLocalURL( 'action=submit' ) ),
|
2011-07-20 16:25:53 +00:00
|
|
|
Html::rawElement( 'p', null, $intromessage ) .
|
2011-07-20 15:29:34 +00:00
|
|
|
Html::rawElement( 'table', array( 'id' => "mw-interwiki-{$action}" ),
|
|
|
|
$formContent . Html::rawElement( 'tr', null,
|
2011-07-20 19:58:55 +00:00
|
|
|
Html::rawElement( 'td', $label, Xml::label( wfMessage( 'interwiki_reasonfield' )->text(),
|
2011-07-20 15:29:34 +00:00
|
|
|
"mw-interwiki-{$action}reason" ) ) .
|
|
|
|
Html::rawElement( 'td', $input, Xml::input( 'wpInterwikiReason', 60, '',
|
|
|
|
array( 'tabindex' => 1, 'id' => "mw-interwiki-{$action}reason", 'maxlength' => 200 ) ) )
|
|
|
|
) . Html::rawElement( 'tr', null,
|
|
|
|
Html::rawElement( 'td', null, '' ) .
|
|
|
|
Html::rawElement( 'td', array( 'class' => 'mw-submit' ),
|
|
|
|
Xml::submitButton( wfMessage( $button )->text(), array( 'id' => 'mw-interwiki-submit' ) ) )
|
|
|
|
) . $wpPrefix .
|
|
|
|
Html::hidden( 'wpEditToken', $wgUser->editToken() ) .
|
|
|
|
Html::hidden( 'wpInterwikiAction', $action )
|
|
|
|
)
|
|
|
|
) );
|
2008-12-31 18:44:54 +00:00
|
|
|
}
|
2008-04-03 21:00:22 +00:00
|
|
|
|
2008-12-31 18:44:54 +00:00
|
|
|
function doSubmit() {
|
|
|
|
global $wgRequest, $wgOut;
|
|
|
|
$prefix = $wgRequest->getVal( 'wpInterwikiPrefix' );
|
|
|
|
$do = $wgRequest->getVal( 'wpInterwikiAction' );
|
2011-04-22 19:35:00 +00:00
|
|
|
// show an error if the prefix is invalid (only when adding one)
|
|
|
|
if( preg_match( '/[\s:&=]/', $prefix ) && $do == 'add' ) {
|
2008-12-31 18:44:54 +00:00
|
|
|
$this->error( 'interwiki-badprefix', htmlspecialchars( $prefix ) );
|
|
|
|
$this->showForm( $do );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$reason = $wgRequest->getText( 'wpInterwikiReason' );
|
|
|
|
$selfTitle = $this->getTitle();
|
|
|
|
$dbw = wfGetDB( DB_MASTER );
|
|
|
|
switch( $do ){
|
2009-08-27 13:02:57 +00:00
|
|
|
case 'delete':
|
2008-12-31 18:44:54 +00:00
|
|
|
$dbw->delete( 'interwiki', array( 'iw_prefix' => $prefix ), __METHOD__ );
|
2008-04-03 21:00:22 +00:00
|
|
|
|
2008-12-31 18:44:54 +00:00
|
|
|
if ( $dbw->affectedRows() == 0 ) {
|
|
|
|
$this->error( 'interwiki_delfailed', $prefix );
|
|
|
|
$this->showForm( $do );
|
|
|
|
} else {
|
2009-08-27 13:02:57 +00:00
|
|
|
$wgOut->addWikiMsg( 'interwiki_deleted', $prefix );
|
2008-12-31 18:44:54 +00:00
|
|
|
$log = new LogPage( 'interwiki' );
|
|
|
|
$log->addEntry( 'iw_delete', $selfTitle, $reason, array( $prefix ) );
|
2008-04-03 21:00:22 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-08-27 13:02:57 +00:00
|
|
|
case 'edit':
|
|
|
|
case 'add':
|
2008-12-31 18:44:54 +00:00
|
|
|
$theurl = $wgRequest->getVal( 'wpInterwikiURL' );
|
|
|
|
$local = $wgRequest->getCheck( 'wpInterwikiLocal' ) ? 1 : 0;
|
|
|
|
$trans = $wgRequest->getCheck( 'wpInterwikiTrans' ) ? 1 : 0;
|
2011-03-11 14:20:39 +00:00
|
|
|
$data = array(
|
|
|
|
'iw_prefix' => $prefix,
|
|
|
|
'iw_url' => $theurl,
|
|
|
|
'iw_local' => $local,
|
|
|
|
'iw_trans' => $trans
|
|
|
|
);
|
2011-06-11 22:14:03 +00:00
|
|
|
|
|
|
|
if( $prefix == '' || $theurl == '' ) {
|
|
|
|
$this->error( 'interwiki-submit-empty' );
|
|
|
|
$this->showForm( $do );
|
|
|
|
return;
|
|
|
|
}
|
2008-04-03 21:00:22 +00:00
|
|
|
|
2008-12-31 18:44:54 +00:00
|
|
|
if( $do == 'add' ){
|
|
|
|
$dbw->insert( 'interwiki', $data, __METHOD__, 'IGNORE' );
|
|
|
|
} else {
|
|
|
|
$dbw->update( 'interwiki', $data, array( 'iw_prefix' => $prefix ), __METHOD__, 'IGNORE' );
|
2008-04-03 21:00:22 +00:00
|
|
|
}
|
|
|
|
|
2008-12-31 18:44:54 +00:00
|
|
|
if( $dbw->affectedRows() == 0 ) {
|
|
|
|
$this->error( "interwiki_{$do}failed", $prefix );
|
|
|
|
$this->showForm( $do );
|
|
|
|
} else {
|
|
|
|
$wgOut->addWikiMsg( "interwiki_{$do}ed", $prefix );
|
|
|
|
$log = new LogPage( 'interwiki' );
|
2009-08-27 13:02:57 +00:00
|
|
|
$log->addEntry( 'iw_' . $do, $selfTitle, $reason, array( $prefix, $theurl, $trans, $local ) );
|
2008-04-03 21:00:22 +00:00
|
|
|
}
|
2008-12-31 18:44:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-04-03 21:00:22 +00:00
|
|
|
|
2011-07-19 12:45:38 +00:00
|
|
|
function showList() {
|
|
|
|
global $wgOut;
|
|
|
|
|
|
|
|
$canModify = $this->canModify();
|
2009-02-07 03:30:23 +00:00
|
|
|
|
2008-12-31 18:44:54 +00:00
|
|
|
$wgOut->addWikiMsg( 'interwiki_intro' );
|
2011-07-19 12:45:38 +00:00
|
|
|
$wgOut->addHTML(
|
|
|
|
Html::rawElement( 'table', array( 'class' => 'mw-interwikitable wikitable intro' ),
|
|
|
|
self::addInfoRow( 'start', 'interwiki_prefix', 'interwiki_prefix_intro' ) .
|
|
|
|
self::addInfoRow( 'start', 'interwiki_url', 'interwiki_url_intro' ) .
|
|
|
|
self::addInfoRow( 'start', 'interwiki_local', 'interwiki_local_intro' ) .
|
|
|
|
self::addInfoRow( 'end', 'interwiki_0', 'interwiki_local_0_intro' ) .
|
|
|
|
self::addInfoRow( 'end', 'interwiki_1', 'interwiki_local_1_intro' ) .
|
|
|
|
self::addInfoRow( 'start', 'interwiki_trans', 'interwiki_trans_intro' ) .
|
|
|
|
self::addInfoRow( 'end', 'interwiki_0', 'interwiki_local_0_intro' ) .
|
|
|
|
self::addInfoRow( 'end', 'interwiki_1', 'interwiki_local_1_intro' )
|
|
|
|
) . "\n"
|
|
|
|
);
|
2009-02-07 03:30:23 +00:00
|
|
|
$wgOut->addWikiMsg( 'interwiki_intro_footer' );
|
2008-12-31 18:44:54 +00:00
|
|
|
|
2011-07-19 12:45:38 +00:00
|
|
|
if ( $canModify ) {
|
2011-07-20 15:29:34 +00:00
|
|
|
$addtext = wfMessage( 'interwiki_addtext' )->escaped();
|
2011-07-19 12:45:38 +00:00
|
|
|
$addlink = Linker::linkKnown( $this->getTitle( 'add' ), $addtext );
|
2011-06-11 22:14:03 +00:00
|
|
|
$wgOut->addHTML( '<p class="mw-interwiki-addlink">' . $addlink . '</p>' );
|
2008-12-31 18:44:54 +00:00
|
|
|
}
|
2008-04-03 21:00:22 +00:00
|
|
|
|
2011-07-19 12:45:38 +00:00
|
|
|
if( !method_exists( 'Interwiki', 'getAllPrefixes' ) ) {
|
|
|
|
# version 2.0 is not backwards compatible (but still display nice error)
|
2008-12-31 18:44:54 +00:00
|
|
|
$this->error( 'interwiki_error' );
|
|
|
|
return;
|
|
|
|
}
|
2011-07-19 12:45:38 +00:00
|
|
|
$iwPrefixes = Interwiki::getAllPrefixes( null );
|
|
|
|
|
|
|
|
if ( !is_array( $iwPrefixes ) || count( $iwPrefixes ) == 0 ) {
|
|
|
|
# If the interwiki table is empty, display an error message
|
|
|
|
$this->error( 'interwiki_error' );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$out = '';
|
|
|
|
|
|
|
|
# Output the table header
|
|
|
|
$out .= Html::openElement( 'table', array( 'class' => 'mw-interwikitable wikitable sortable body' ) ) . "\n";
|
|
|
|
$out .= Html::openElement( 'tr', array( 'id' => 'interwikitable-header' ) ) .
|
2011-07-20 15:29:34 +00:00
|
|
|
Html::element( 'th', null, wfMessage( 'interwiki_prefix' ) ) .
|
|
|
|
Html::element( 'th', null, wfMessage( 'interwiki_url' ) ) .
|
|
|
|
Html::element( 'th', null, wfMessage( 'interwiki_local' ) ) .
|
|
|
|
Html::element( 'th', null, wfMessage( 'interwiki_trans' ) ) .
|
|
|
|
( $canModify ? Html::element( 'th', array( 'class' => 'unsortable' ), wfMessage( 'interwiki_edit' ) ) : '' );
|
2011-07-19 12:45:38 +00:00
|
|
|
$out .= Html::closeElement( 'tr' ) . "\n";
|
2009-08-27 13:02:57 +00:00
|
|
|
|
2011-06-11 22:14:03 +00:00
|
|
|
$selfTitle = $this->getTitle();
|
|
|
|
|
2011-07-19 12:45:38 +00:00
|
|
|
foreach( $iwPrefixes as $i => $iwPrefix ) {
|
|
|
|
$out .= Html::openElement( 'tr', array( 'class' => 'mw-interwikitable-row' ) );
|
|
|
|
$out .= Html::element( 'td', array( 'class' => 'mw-interwikitable-prefix' ),
|
|
|
|
htmlspecialchars( $iwPrefix['iw_prefix'] ) );
|
|
|
|
$out .= Html::element( 'td', array( 'class' => 'mw-interwikitable-url' ), $iwPrefix['iw_url'] );
|
|
|
|
$out .= Html::element( 'td', array( 'class' => 'mw-interwikitable-local' ),
|
2011-07-20 15:29:34 +00:00
|
|
|
( isset( $iwPrefix['iw_local'] ) ? wfMessage( 'interwiki_' . $iwPrefix['iw_local'] ) : '-' ) );
|
2011-07-19 12:45:38 +00:00
|
|
|
$out .= Html::element( 'td', array( 'class' => 'mw-interwikitable-trans' ),
|
2011-07-20 15:29:34 +00:00
|
|
|
( isset( $iwPrefix['iw_trans'] ) ? wfMessage( 'interwiki_' . $iwPrefix['iw_trans'] ) : '-' ) );
|
2011-07-19 12:45:38 +00:00
|
|
|
if( $canModify ) {
|
|
|
|
$out .= Html::rawElement( 'td', array( 'class' => 'mw-interwikitable-modify' ),
|
2011-07-20 15:29:34 +00:00
|
|
|
Linker::linkKnown( $selfTitle, wfMessage( 'edit' )->escaped(), array(),
|
2011-07-19 12:45:38 +00:00
|
|
|
array( 'action' => 'edit', 'prefix' => $iwPrefix['iw_prefix'] ) ) .
|
2011-07-20 15:29:34 +00:00
|
|
|
wfMessage( 'comma-separator' ) .
|
|
|
|
Linker::linkKnown( $selfTitle, wfMessage( 'delete' )->escaped(), array(),
|
2011-07-19 12:45:38 +00:00
|
|
|
array( 'action' => 'delete', 'prefix' => $iwPrefix['iw_prefix'] ) )
|
|
|
|
);
|
2008-04-03 21:00:22 +00:00
|
|
|
}
|
2011-07-19 12:45:38 +00:00
|
|
|
$out .= Html::closeElement( 'tr' ) . "\n";
|
2008-04-03 21:00:22 +00:00
|
|
|
}
|
2011-07-19 12:45:38 +00:00
|
|
|
$out .= Html::closeElement( 'table' );
|
|
|
|
|
2008-12-31 18:44:54 +00:00
|
|
|
$wgOut->addHTML( $out );
|
|
|
|
}
|
2009-08-27 13:02:57 +00:00
|
|
|
|
2011-07-19 12:45:38 +00:00
|
|
|
static function addInfoRow( $align = 'start', $title, $text ) {
|
|
|
|
return Html::rawElement( 'tr', null,
|
2011-07-20 15:29:34 +00:00
|
|
|
Html::rawElement( 'th', array( 'class' => 'mw-align-' . $align ), wfMessage( $title )->escaped() ) .
|
|
|
|
Html::rawElement( 'td', null, wfMessage( $text )->parse() )
|
2011-07-19 12:45:38 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-12-31 18:44:54 +00:00
|
|
|
function error() {
|
|
|
|
global $wgOut;
|
|
|
|
$args = func_get_args();
|
|
|
|
$wgOut->wrapWikiMsg( "<p class='error'>$1</p>", $args );
|
2008-04-03 21:00:22 +00:00
|
|
|
}
|
2009-08-27 13:02:57 +00:00
|
|
|
|
2010-12-09 11:57:55 +00:00
|
|
|
}
|