From 87ec7ad22e8b9cb385381093600180985a86fddd Mon Sep 17 00:00:00 2001
From: Siebrand Mazeland ",
" $outpointf"
)->escaped();
+
return ' ';
}
@@ -531,7 +534,6 @@ class SpecialAllpages extends IncludableSpecialPage {
)
);
}
-
}
/**
diff --git a/includes/specials/SpecialAncientpages.php b/includes/specials/SpecialAncientpages.php
index 5d0b79f390..b0830327be 100644
--- a/includes/specials/SpecialAncientpages.php
+++ b/includes/specials/SpecialAncientpages.php
@@ -78,6 +78,7 @@ class AncientPagesPage extends QueryPage {
$title,
htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )
);
+
return $this->getLanguage()->specialList( $link, htmlspecialchars( $d ) );
}
diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php
index 2a5e5047a4..645de2363c 100644
--- a/includes/specials/SpecialBlock.php
+++ b/includes/specials/SpecialBlock.php
@@ -444,6 +444,7 @@ class SpecialBlock extends FormSpecialPage {
} elseif ( IP::isIPAddress( $target ) ) {
return Title::makeTitleSafe( NS_USER, $target );
}
+
return null;
}
@@ -510,6 +511,7 @@ class SpecialBlock extends FormSpecialPage {
$status = self::validateTarget( $value, $form->getUser() );
if ( !$status->isOK() ) {
$errors = $status->getErrorsArray();
+
return call_user_func_array( array( $form, 'msg' ), $errors[0] );
} else {
return true;
@@ -954,4 +956,5 @@ class SpecialBlock extends FormSpecialPage {
}
# BC @since 1.18
-class IPBlockForm extends SpecialBlock {}
+class IPBlockForm extends SpecialBlock {
+}
diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php
index 4868a75fd8..b83b499cbe 100644
--- a/includes/specials/SpecialBlockList.php
+++ b/includes/specials/SpecialBlockList.php
@@ -59,6 +59,7 @@ class SpecialBlockList extends SpecialPage {
# B/C @since 1.18: Unblock interface is now at Special:Unblock
$title = SpecialPage::getTitleFor( 'Unblock', $this->target );
$out->redirect( $title->getFullURL() );
+
return;
}
@@ -182,10 +183,8 @@ class SpecialBlockList extends SpecialPage {
$pager->getBody() .
$pager->getNavigationBar()
);
-
} elseif ( $this->target ) {
$out->addWikiMsg( 'ipblocklist-no-results' );
-
} else {
$out->addWikiMsg( 'ipblocklist-empty' );
}
@@ -482,5 +481,4 @@ class HTMLBlockedUsersItemSelect extends HTMLSelectField {
return true;
}
-
}
diff --git a/includes/specials/SpecialBlockme.php b/includes/specials/SpecialBlockme.php
index 1e5b524408..c3d6080c22 100644
--- a/includes/specials/SpecialBlockme.php
+++ b/includes/specials/SpecialBlockme.php
@@ -41,6 +41,7 @@ class SpecialBlockme extends UnlistedSpecialPage {
$ip = $this->getRequest()->getIP();
if ( !$wgBlockOpenProxies || $this->getRequest()->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) {
$this->getOutput()->addWikiMsg( 'proxyblocker-disabled' );
+
return;
}
diff --git a/includes/specials/SpecialBooksources.php b/includes/specials/SpecialBooksources.php
index b3933c517d..3170c29ecf 100644
--- a/includes/specials/SpecialBooksources.php
+++ b/includes/specials/SpecialBooksources.php
@@ -95,6 +95,7 @@ class SpecialBookSources extends SpecialPage {
return true;
}
}
+
return false;
}
@@ -124,6 +125,7 @@ class SpecialBookSources extends SpecialPage {
$form .= ' ' . Xml::submitButton( $this->msg( 'booksources-go' )->text() ) . "' . $out . '
' . $this->getOutput()->parseInline( $status->getWikiText( 'mailerror' ) ) . '
' ); + return false; } diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index 95fbb0d632..3f6552087c 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -54,11 +54,13 @@ class SpecialChangePassword extends UnlistedSpecialPage { $user = $this->getUser(); if ( !$request->wasPosted() && !$user->isLoggedIn() ) { $this->error( $this->msg( 'resetpass-no-info' )->text() ); + return; } if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) { $this->doReturnTo(); + return; } @@ -69,6 +71,7 @@ class SpecialChangePassword extends UnlistedSpecialPage { $this->mDomain = $wgAuth->getDomain(); if ( !$wgAuth->allowPasswordChange() ) { $this->error( $this->msg( 'resetpass_forbidden' )->text() ); + return; } @@ -90,6 +93,7 @@ class SpecialChangePassword extends UnlistedSpecialPage { $login->setContext( $this->getContext() ); $login->execute( null ); } + return; } catch ( PasswordError $e ) { $this->error( $e->getMessage() ); @@ -218,6 +222,7 @@ class SpecialChangePassword extends UnlistedSpecialPage { $out .= "\n"; $out .= ""; } + return $out; } diff --git a/includes/specials/SpecialComparePages.php b/includes/specials/SpecialComparePages.php index 3b82326bcb..fc6b0c58c2 100644 --- a/includes/specials/SpecialComparePages.php +++ b/includes/specials/SpecialComparePages.php @@ -136,6 +136,7 @@ class SpecialComparePages extends SpecialPage { return $title->getLatestRevID(); } } + return null; } @@ -150,6 +151,7 @@ class SpecialComparePages extends SpecialPage { if ( !$title->exists() ) { return $this->msg( 'compare-title-not-exists' )->parseAsBlock(); } + return true; } @@ -161,6 +163,7 @@ class SpecialComparePages extends SpecialPage { if ( $revision === null ) { return $this->msg( 'compare-revision-not-exists' )->parseAsBlock(); } + return true; } diff --git a/includes/specials/SpecialConfirmemail.php b/includes/specials/SpecialConfirmemail.php index c8190c8fbe..47808d1112 100644 --- a/includes/specials/SpecialConfirmemail.php +++ b/includes/specials/SpecialConfirmemail.php @@ -125,6 +125,7 @@ class EmailConfirmation extends UnlistedSpecialPage { $user = User::newFromConfirmationCode( $code ); if ( !is_object( $user ) ) { $this->getOutput()->addWikiMsg( 'confirmemail_invalid' ); + return; } @@ -167,6 +168,7 @@ class EmailInvalidation extends UnlistedSpecialPage { $user = User::newFromConfirmationCode( $code ); if ( !is_object( $user ) ) { $this->getOutput()->addWikiMsg( 'confirmemail_invalid' ); + return; } diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 932f05e14a..a0351a4805 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -64,6 +64,7 @@ class SpecialContributions extends SpecialPage { if ( !strlen( $target ) ) { $out->addHTML( $this->getForm() ); + return; } @@ -76,11 +77,13 @@ class SpecialContributions extends SpecialPage { $nt = Title::makeTitleSafe( NS_USER, $target ); if ( !$nt ) { $out->addHTML( $this->getForm() ); + return; } $userObj = User::newFromName( $nt->getText(), false ); if ( !$userObj ) { $out->addHTML( $this->getForm() ); + return; } $id = $userObj->getID(); @@ -158,6 +161,7 @@ class SpecialContributions extends SpecialPage { $url = wfAppendQuery( wfScript( 'api' ), $apiParams ); $out->redirect( $url, '301' ); + return; } @@ -270,6 +274,7 @@ class SpecialContributions extends SpecialPage { $oldMsg = $this->msg( 'contribsub' ); if ( $oldMsg->exists() ) { $linksWithParentheses = $this->msg( 'parentheses' )->rawParams( $links )->escaped(); + return $oldMsg->rawParams( "$user $linksWithParentheses" ); } @@ -308,6 +313,7 @@ class SpecialContributions extends SpecialPage { ); } } + # Block log link $tools[] = Linker::linkKnown( SpecialPage::getTitleFor( 'Log', 'block' ), @@ -347,6 +353,7 @@ class SpecialContributions extends SpecialPage { } wfRunHooks( 'ContributionsToolLinks', array( $id, $userpage, &$tools ) ); + return $tools; } @@ -496,32 +503,32 @@ class SpecialContributions extends SpecialPage { 'class' => 'namespaceselector', ) ) . ' ' . - Html::rawElement( - 'span', - array( 'style' => 'white-space: nowrap' ), - Xml::checkLabel( - $this->msg( 'invert' )->text(), - 'nsInvert', - 'nsInvert', - $this->opts['nsInvert'], - array( - 'title' => $this->msg( 'tooltip-invert' )->text(), - 'class' => 'mw-input' - ) - ) . ' ' - ) . - Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ), - Xml::checkLabel( - $this->msg( 'namespace_association' )->text(), - 'associated', - 'associated', - $this->opts['associated'], - array( - 'title' => $this->msg( 'tooltip-namespace_association' )->text(), - 'class' => 'mw-input' - ) - ) . ' ' - ) + Html::rawElement( + 'span', + array( 'style' => 'white-space: nowrap' ), + Xml::checkLabel( + $this->msg( 'invert' )->text(), + 'nsInvert', + 'nsInvert', + $this->opts['nsInvert'], + array( + 'title' => $this->msg( 'tooltip-invert' )->text(), + 'class' => 'mw-input' + ) + ) . ' ' + ) . + Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ), + Xml::checkLabel( + $this->msg( 'namespace_association' )->text(), + 'associated', + 'associated', + $this->opts['associated'], + array( + 'title' => $this->msg( 'tooltip-namespace_association' )->text(), + 'class' => 'mw-input' + ) + ) . ' ' + ) ); if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) { @@ -644,6 +651,7 @@ class ContribsPager extends ReverseChronologicalPager { function getDefaultQuery() { $query = parent::getDefaultQuery(); $query['target'] = $this->target; + return $query; } @@ -753,6 +761,7 @@ class ContribsPager extends ReverseChronologicalPager { ); wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) ); + return $queryInfo; } @@ -1030,6 +1039,7 @@ class ContribsPager extends ReverseChronologicalPager { } wfProfileOut( __METHOD__ ); + return $ret; } diff --git a/includes/specials/SpecialDeadendpages.php b/includes/specials/SpecialDeadendpages.php index 6978d6bb96..44137c1ea0 100644 --- a/includes/specials/SpecialDeadendpages.php +++ b/includes/specials/SpecialDeadendpages.php @@ -59,24 +59,29 @@ class DeadendPagesPage extends PageQueryPage { function getQueryInfo() { return array( 'tables' => array( 'page', 'pagelinks' ), - 'fields' => array( 'namespace' => 'page_namespace', - 'title' => 'page_title', - 'value' => 'page_title' + 'fields' => array( + 'namespace' => 'page_namespace', + 'title' => 'page_title', + 'value' => 'page_title' ), - 'conds' => array( 'pl_from IS NULL', - 'page_namespace' => MWNamespace::getContentNamespaces(), - 'page_is_redirect' => 0 + 'conds' => array( + 'pl_from IS NULL', + 'page_namespace' => MWNamespace::getContentNamespaces(), + 'page_is_redirect' => 0 ), - 'join_conds' => array( 'pagelinks' => array( 'LEFT JOIN', array( - 'page_id=pl_from' - ) ) ) + 'join_conds' => array( + 'pagelinks' => array( + 'LEFT JOIN', + array( 'page_id=pl_from' ) + ) + ) ); } function getOrderFields() { // For some crazy reason ordering by a constant // causes a filesort - if( count( MWNamespace::getContentNamespaces() ) > 1 ) { + if ( count( MWNamespace::getContentNamespaces() ) > 1 ) { return array( 'page_namespace', 'page_title' ); } else { return array( 'page_title' ); diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 901c7f911f..28ca24b922 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -49,6 +49,7 @@ class DeletedContribsPager extends IndexPager { function getDefaultQuery() { $query = parent::getDefaultQuery(); $query['target'] = $this->target; + return $query; } @@ -63,6 +64,7 @@ class DeletedContribsPager extends IndexPager { $conds[] = $this->mDb->bitAnd( 'ar_deleted', Revision::SUPPRESSED_USER ) . ' != ' . Revision::SUPPRESSED_USER; } + return array( 'tables' => array( 'archive' ), 'fields' => array( @@ -255,6 +257,7 @@ class DeletedContribsPager extends IndexPager { $ret = Html::rawElement( 'li', array(), $ret ) . "\n"; wfProfileOut( __METHOD__ ); + return $ret; } @@ -290,6 +293,7 @@ class DeletedContributionsPage extends SpecialPage { if ( !$this->userCanExecute( $user ) ) { $this->displayRestrictionError(); + return; } @@ -307,6 +311,7 @@ class DeletedContributionsPage extends SpecialPage { if ( !strlen( $target ) ) { $out->addHTML( $this->getForm( '' ) ); + return; } @@ -316,6 +321,7 @@ class DeletedContributionsPage extends SpecialPage { $userObj = User::newFromName( $target, false ); if ( !$userObj ) { $out->addHTML( $this->getForm( '' ) ); + return; } $this->getSkin()->setRelevantUser( $userObj ); @@ -334,6 +340,7 @@ class DeletedContributionsPage extends SpecialPage { $pager = new DeletedContribsPager( $this->getContext(), $target, $options['namespace'] ); if ( !$pager->getNumRows() ) { $out->addWikiMsg( 'nocontribs' ); + return; } diff --git a/includes/specials/SpecialDisambiguations.php b/includes/specials/SpecialDisambiguations.php index 51262b4007..ceecd15b97 100644 --- a/includes/specials/SpecialDisambiguations.php +++ b/includes/specials/SpecialDisambiguations.php @@ -54,32 +54,35 @@ class DisambiguationsPage extends QueryPage { # If the text can be treated as a title, use it verbatim. # Otherwise, pull the titles from the links table $dp = Title::newFromText( $dMsgText ); - if( $dp ) { - if( $dp->getNamespace() != NS_TEMPLATE ) { + if ( $dp ) { + if ( $dp->getNamespace() != NS_TEMPLATE ) { # @todo FIXME: We assume the disambiguation message is a template but # the page can potentially be from another namespace :/ wfDebug( "Mediawiki:disambiguationspage message does not refer to a template!\n" ); } $linkBatch->addObj( $dp ); } else { - # Get all the templates linked from the Mediawiki:Disambiguationspage - $disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' ); - $res = $dbr->select( - array( 'pagelinks', 'page' ), - 'pl_title', - array( 'page_id = pl_from', - 'pl_namespace' => NS_TEMPLATE, - 'page_namespace' => $disPageObj->getNamespace(), - 'page_title' => $disPageObj->getDBkey() - ), __METHOD__ ); - - foreach ( $res as $row ) { - $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title )); - } + # Get all the templates linked from the Mediawiki:Disambiguationspage + $disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' ); + $res = $dbr->select( + array( 'pagelinks', 'page' ), + 'pl_title', + array( + 'page_id = pl_from', + 'pl_namespace' => NS_TEMPLATE, + 'page_namespace' => $disPageObj->getNamespace(), + 'page_title' => $disPageObj->getDBkey() + ), + __METHOD__ + ); + + foreach ( $res as $row ) { + $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title ) ); + } } $set = $linkBatch->constructSet( 'tl', $dbr ); - if( $set === false ) { + if ( $set === false ) { # We must always return a valid SQL query, but this way # the DB will always quickly return an empty result $set = 'FALSE'; diff --git a/includes/specials/SpecialDoubleRedirects.php b/includes/specials/SpecialDoubleRedirects.php index 7564b00e74..c364f70fa9 100644 --- a/includes/specials/SpecialDoubleRedirects.php +++ b/includes/specials/SpecialDoubleRedirects.php @@ -122,10 +122,17 @@ class DoubleRedirectsPage extends QueryPage { // using the filter of reallyGetQueryInfo. if ( $result && !isset( $result->nsb ) ) { $dbr = wfGetDB( DB_SLAVE ); - $qi = $this->reallyGetQueryInfo( $result->namespace, - $result->title ); - $res = $dbr->select( $qi['tables'], $qi['fields'], - $qi['conds'], __METHOD__ ); + $qi = $this->reallyGetQueryInfo( + $result->namespace, + $result->title + ); + $res = $dbr->select( + $qi['tables'], + $qi['fields'], + $qi['conds'], + __METHOD__ + ); + if ( $res ) { $result = $dbr->fetchObject( $res ); } @@ -166,7 +173,7 @@ class DoubleRedirectsPage extends QueryPage { $lang = $this->getLanguage(); $arr = $lang->getArrow() . $lang->getDirMark(); - return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" ); + return ( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" ); } protected function getGroupName() { diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index ad06d5f5b5..f297039ea6 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -35,7 +35,6 @@ * @author Rob Church$1
", $ret ); } $out->addHTML( $this->userForm( $this->mTarget ) ); + return false; } @@ -147,13 +157,13 @@ class SpecialEmailUser extends UnlistedSpecialPage { $form->setWrapperLegendMsg( 'email-legend' ); $form->loadData(); - if( !wfRunHooks( 'EmailUserForm', array( &$form ) ) ) { + if ( !wfRunHooks( 'EmailUserForm', array( &$form ) ) ) { return false; } $result = $form->show(); - if( $result === true || ( $result instanceof Status && $result->isGood() ) ) { + if ( $result === true || ( $result instanceof Status && $result->isGood() ) ) { $out->setPageTitle( $this->msg( 'emailsent' ) ); $out->addWikiMsg( 'emailsenttext' ); $out->returnToMain( false, $this->mTargetObj->getUserPage() ); @@ -169,18 +179,22 @@ class SpecialEmailUser extends UnlistedSpecialPage { public static function getTarget( $target ) { if ( $target == '' ) { wfDebug( "Target is empty.\n" ); + return 'notarget'; } $nu = User::newFromName( $target ); - if( !$nu instanceof User || !$nu->getId() ) { + if ( !$nu instanceof User || !$nu->getId() ) { wfDebug( "Target is invalid user.\n" ); + return 'notarget'; } elseif ( !$nu->isEmailConfirmed() ) { wfDebug( "User has no valid email.\n" ); + return 'noemail'; } elseif ( !$nu->canReceiveEmail() ) { wfDebug( "User does not allow user emails.\n" ); + return 'nowikiemail'; } @@ -196,31 +210,36 @@ class SpecialEmailUser extends UnlistedSpecialPage { */ public static function getPermissionsError( $user, $editToken ) { global $wgEnableEmail, $wgEnableUserEmail; - if( !$wgEnableEmail || !$wgEnableUserEmail ) { + + if ( !$wgEnableEmail || !$wgEnableUserEmail ) { return 'usermaildisabled'; } - if( !$user->isAllowed( 'sendemail' ) ) { + if ( !$user->isAllowed( 'sendemail' ) ) { return 'badaccess'; } - if( !$user->isEmailConfirmed() ) { + if ( !$user->isEmailConfirmed() ) { return 'mailnologin'; } - if( $user->isBlockedFromEmailuser() ) { + if ( $user->isBlockedFromEmailuser() ) { wfDebug( "User is blocked from sending e-mail.\n" ); + return "blockedemailuser"; } - if( $user->pingLimiter( 'emailuser' ) ) { + if ( $user->pingLimiter( 'emailuser' ) ) { wfDebug( "Ping limiter triggered.\n" ); + return 'actionthrottledtext'; } $hookErr = false; + wfRunHooks( 'UserCanSendEmail', array( &$user, &$hookErr ) ); wfRunHooks( 'EmailUserPermissionsErrors', array( $user, $editToken, &$hookErr ) ); + if ( $hookErr ) { return $hookErr; } @@ -236,14 +255,25 @@ class SpecialEmailUser extends UnlistedSpecialPage { */ protected function userForm( $name ) { global $wgScript; - $string = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'askusername' ) ) . + $string = Xml::openElement( + 'form', + array( 'method' => 'get', 'action' => $wgScript, 'id' => 'askusername' ) + ) . Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . Xml::openElement( 'fieldset' ) . Html::rawElement( 'legend', null, $this->msg( 'emailtarget' )->parse() ) . - Xml::inputLabel( $this->msg( 'emailusername' )->text(), 'target', 'emailusertarget', 30, $name ) . ' ' . + Xml::inputLabel( + $this->msg( 'emailusername' )->text(), + 'target', + 'emailusertarget', + 30, + $name + ) . + ' ' . Xml::submitButton( $this->msg( 'emailusernamesubmit' )->text() ) . Xml::closeElement( 'fieldset' ) . Xml::closeElement( 'form' ) . "\n"; + return $string; } @@ -273,9 +303,10 @@ class SpecialEmailUser extends UnlistedSpecialPage { global $wgUserEmailUseReplyTo; $target = self::getTarget( $data['Target'] ); - if( !$target instanceof User ) { + if ( !$target instanceof User ) { return $context->msg( $target . 'text' )->parseAsBlock(); } + $to = new MailAddress( $target ); $from = new MailAddress( $context->getUser() ); $subject = $data['Subject']; @@ -287,11 +318,11 @@ class SpecialEmailUser extends UnlistedSpecialPage { $from->name, $to->name )->inContentLanguage()->text(); $error = ''; - if( !wfRunHooks( 'EmailUser', array( &$to, &$from, &$subject, &$text, &$error ) ) ) { + if ( !wfRunHooks( 'EmailUser', array( &$to, &$from, &$subject, &$text, &$error ) ) ) { return $error; } - if( $wgUserEmailUseReplyTo ) { + if ( $wgUserEmailUseReplyTo ) { // Put the generic wiki autogenerated address in the From: // header and reserve the user for Reply-To. // @@ -299,6 +330,7 @@ class SpecialEmailUser extends UnlistedSpecialPage { // wiki-borne mails from direct mails and protects against // SPF and bounce problems with some mailers (see below). global $wgPasswordSender, $wgPasswordSenderName; + $mailFrom = new MailAddress( $wgPasswordSender, $wgPasswordSenderName ); $replyTo = $from; } else { @@ -321,7 +353,7 @@ class SpecialEmailUser extends UnlistedSpecialPage { $status = UserMailer::send( $to, $mailFrom, $subject, $text, $replyTo ); - if( !$status->isGood() ) { + if ( !$status->isGood() ) { return $status; } else { // if the user requested a copy of this mail, do this now, @@ -336,6 +368,7 @@ class SpecialEmailUser extends UnlistedSpecialPage { } wfRunHooks( 'EmailUserComplete', array( $to, $from, $subject, $text ) ); + return $status; } } diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index ef86e8e93f..61ed34d473 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -29,7 +29,6 @@ * @ingroup SpecialPage */ class SpecialExport extends SpecialPage { - private $curonly, $doExport, $pageLinkDepth, $templates; private $images; @@ -75,8 +74,7 @@ class SpecialExport extends SpecialPage { } } } - } - elseif( $request->getCheck( 'addns' ) && $wgExportFromNamespaces ) { + } elseif ( $request->getCheck( 'addns' ) && $wgExportFromNamespaces ) { $page = $request->getText( 'pages' ); $nsindex = $request->getText( 'nsindex', '' ); @@ -89,8 +87,7 @@ class SpecialExport extends SpecialPage { $page .= "\n" . implode( "\n", $nspages ); } } - } - elseif( $request->getCheck( 'exportall' ) && $wgExportAllowAll ) { + } elseif ( $request->getCheck( 'exportall' ) && $wgExportAllowAll ) { $this->doExport = true; $exportall = true; @@ -100,13 +97,12 @@ class SpecialExport extends SpecialPage { doExport(...) further down) */ $page = ''; $history = ''; - } - elseif( $request->wasPosted() && $par == '' ) { + } elseif ( $request->wasPosted() && $par == '' ) { $page = $request->getText( 'pages' ); $this->curonly = $request->getCheck( 'curonly' ); $rawOffset = $request->getVal( 'offset' ); - if( $rawOffset ) { + if ( $rawOffset ) { $offset = wfTimestamp( TS_MW, $rawOffset ); } else { $offset = null; @@ -127,15 +123,17 @@ class SpecialExport extends SpecialPage { if ( $limit > 0 && ( $wgExportMaxHistory == 0 || $limit < $wgExportMaxHistory ) ) { $history['limit'] = $limit; } + if ( !is_null( $offset ) ) { $history['offset'] = $offset; } + if ( strtolower( $dir ) == 'desc' ) { $history['dir'] = 'desc'; } } - if( $page != '' ) { + if ( $page != '' ) { $this->doExport = true; } } else { @@ -143,18 +141,18 @@ class SpecialExport extends SpecialPage { $page = $request->getText( 'pages', $par ); $historyCheck = $request->getCheck( 'history' ); - if( $historyCheck ) { + if ( $historyCheck ) { $history = WikiExporter::FULL; } else { $history = WikiExporter::CURRENT; } - if( $page != '' ) { + if ( $page != '' ) { $this->doExport = true; } } - if( !$wgExportAllowHistory ) { + if ( !$wgExportAllowHistory ) { // Override $history = WikiExporter::CURRENT; } @@ -172,7 +170,7 @@ class SpecialExport extends SpecialPage { wfResetOutputBuffers(); $request->response()->header( "Content-type: application/xml; charset=utf-8" ); - if( $request->getCheck( 'wpDownload' ) ) { + if ( $request->getCheck( 'wpDownload' ) ) { // Provide a sane filename suggestion $filename = urlencode( $wgSitename . '-' . wfTimestampNow() . '.xml' ); $request->response()->header( "Content-disposition: attachment;filename={$filename}" ); @@ -188,8 +186,16 @@ class SpecialExport extends SpecialPage { $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL( 'action=submit' ) ) ); - $form .= Xml::inputLabel( $this->msg( 'export-addcattext' )->text(), 'catname', 'catname', 40 ) . ' '; - $form .= Xml::submitButton( $this->msg( 'export-addcat' )->text(), array( 'name' => 'addcat' ) ) . '\n$1\n
", array( 'fileduplicatesearch-noresults', wfEscapeWikiText( $this->filename ) ) ); } - if( $this->hash != '' ) { + if ( $this->hash != '' ) { # Show a thumbnail of the file $img = $this->file; if ( $img ) { $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) ); - if( $thumb ) { + if ( $thumb ) { $out->addHTML( '\n$1\n
", array( 'fileduplicatesearch-result-1', wfEscapeWikiText( $this->filename ) ) @@ -172,14 +181,16 @@ class FileDuplicateSearchPage extends QueryPage { function doBatchLookups( $list ) { $batch = new LinkBatch(); - foreach( $list as $file ) { + /** @var File $file */ + foreach ( $list as $file ) { $batch->addObj( $file->getTitle() ); - if( $file->isLocal() ) { + if ( $file->isLocal() ) { $userName = $file->getUser( 'text' ); $batch->add( NS_USER, $userName ); $batch->add( NS_USER_TALK, $userName ); } } + $batch->execute(); } diff --git a/includes/specials/SpecialFilepath.php b/includes/specials/SpecialFilepath.php index dc56b5ae5b..d4b0285550 100644 --- a/includes/specials/SpecialFilepath.php +++ b/includes/specials/SpecialFilepath.php @@ -27,7 +27,6 @@ * @ingroup SpecialPage */ class SpecialFilepath extends SpecialPage { - function __construct() { parent::__construct( 'Filepath' ); } @@ -55,6 +54,7 @@ class SpecialFilepath extends SpecialPage { // If a width is requested... if ( $width != -1 ) { $mto = $file->transform( array( 'width' => $width, 'height' => $height ) ); + // ... and we can if ( $mto && !$mto->isError() ) { // ... change the URL to point to a thumbnail. @@ -76,14 +76,23 @@ class SpecialFilepath extends SpecialPage { global $wgScript; $this->getOutput()->addHTML( - Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'specialfilepath' ) ) . - Html::openElement( 'fieldset' ) . - Html::element( 'legend', null, $this->msg( 'filepath' )->text() ) . - Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . - Xml::inputLabel( $this->msg( 'filepath-page' )->text(), 'file', 'file', 25, is_object( $title ) ? $title->getText() : '' ) . ' ' . - Xml::submitButton( $this->msg( 'filepath-submit' )->text() ) . "\n" . - Html::closeElement( 'fieldset' ) . - Html::closeElement( 'form' ) + Html::openElement( + 'form', + array( 'method' => 'get', 'action' => $wgScript, 'id' => 'specialfilepath' ) + ) . + Html::openElement( 'fieldset' ) . + Html::element( 'legend', null, $this->msg( 'filepath' )->text() ) . + Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . + Xml::inputLabel( + $this->msg( 'filepath-page' )->text(), + 'file', + 'file', + 25, + is_object( $title ) ? $title->getText() : '' + ) . ' ' . + Xml::submitButton( $this->msg( 'filepath-submit' )->text() ) . "\n" . + Html::closeElement( 'fieldset' ) . + Html::closeElement( 'form' ) ); } diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 68b002466a..0d54bb39bb 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -30,7 +30,6 @@ * @ingroup SpecialPage */ class SpecialImport extends SpecialPage { - private $interwiki = false; private $namespace; private $rootpage = ''; @@ -108,13 +107,13 @@ class SpecialImport extends SpecialPage { $source = Status::newFatal( 'import-token-mismatch' ); } elseif ( $sourceName == 'upload' ) { $isUpload = true; - if( $user->isAllowed( 'importupload' ) ) { + if ( $user->isAllowed( 'importupload' ) ) { $source = ImportStreamSource::newFromUpload( "xmlimport" ); } else { throw new PermissionsError( 'importupload' ); } } elseif ( $sourceName == "interwiki" ) { - if( !$user->isAllowed( 'import' ) ) { + if ( !$user->isAllowed( 'import' ) ) { throw new PermissionsError( 'import' ); } $this->interwiki = $request->getVal( 'interwiki' ); @@ -136,24 +135,40 @@ class SpecialImport extends SpecialPage { } $out = $this->getOutput(); - if( !$source->isGood() ) { - $out->wrapWikiMsg( "\n$1\n
", array( 'importfailed', $source->getWikiText() ) ); + if ( !$source->isGood() ) { + $out->wrapWikiMsg( + "\n$1\n
", + array( 'importfailed', $source->getWikiText() ) + ); } else { $importer = new WikiImporter( $source->value ); - if( !is_null( $this->namespace ) ) { + if ( !is_null( $this->namespace ) ) { $importer->setTargetNamespace( $this->namespace ); } - if( !is_null( $this->rootpage ) ) { + if ( !is_null( $this->rootpage ) ) { $statusRootPage = $importer->setTargetRootPage( $this->rootpage ); - if( !$statusRootPage->isGood() ) { - $out->wrapWikiMsg( "\n$1\n
", array( 'import-options-wrong', $statusRootPage->getWikiText(), count( $statusRootPage->getErrorsArray() ) ) ); + if ( !$statusRootPage->isGood() ) { + $out->wrapWikiMsg( + "\n$1\n
", + array( + 'import-options-wrong', + $statusRootPage->getWikiText(), + count( $statusRootPage->getErrorsArray() ) + ) + ); + return; } } $out->addWikiMsg( "importstart" ); - $reporter = new ImportReporter( $importer, $isUpload, $this->interwiki, $this->logcomment ); + $reporter = new ImportReporter( + $importer, + $isUpload, + $this->interwiki, + $this->logcomment + ); $reporter->setContext( $this->getContext() ); $exception = false; @@ -167,10 +182,16 @@ class SpecialImport extends SpecialPage { if ( $exception ) { # No source or XML parse error - $out->wrapWikiMsg( "\n$1\n
", array( 'importfailed', $exception->getMessage() ) ); - } elseif( !$result->isGood() ) { + $out->wrapWikiMsg( + "\n$1\n
", + array( 'importfailed', $exception->getMessage() ) + ); + } elseif ( !$result->isGood() ) { # Zero revisions - $out->wrapWikiMsg( "\n$1\n
", array( 'importfailed', $result->getWikiText() ) ); + $out->wrapWikiMsg( + "\n$1\n
", + array( 'importfailed', $result->getWikiText() ) + ); } else { # Success! $out->addWikiMsg( 'importsuccess' ); @@ -186,158 +207,191 @@ class SpecialImport extends SpecialPage { $user = $this->getUser(); $out = $this->getOutput(); - if( $user->isAllowed( 'importupload' ) ) { + if ( $user->isAllowed( 'importupload' ) ) { $out->addHTML( Xml::fieldset( $this->msg( 'import-upload' )->text() ) . - Xml::openElement( 'form', array( 'enctype' => 'multipart/form-data', 'method' => 'post', - 'action' => $action, 'id' => 'mw-import-upload-form' ) ) . - $this->msg( 'importtext' )->parseAsBlock() . - Html::hidden( 'action', 'submit' ) . - Html::hidden( 'source', 'upload' ) . - Xml::openElement( 'table', array( 'id' => 'mw-import-table-upload' ) ) . - - "