From f6d65e533c62f6deb21342d4901ece24497b433e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 4 Jun 2015 07:31:04 +0200 Subject: Update to MediaWiki 1.25.1 --- includes/specials/SpecialFileDuplicateSearch.php | 52 +++++++++++++----------- 1 file changed, 29 insertions(+), 23 deletions(-) (limited to 'includes/specials/SpecialFileDuplicateSearch.php') diff --git a/includes/specials/SpecialFileDuplicateSearch.php b/includes/specials/SpecialFileDuplicateSearch.php index fc26c903..da79bb81 100644 --- a/includes/specials/SpecialFileDuplicateSearch.php +++ b/includes/specials/SpecialFileDuplicateSearch.php @@ -110,25 +110,31 @@ class FileDuplicateSearchPage extends QueryPage { $out = $this->getOutput(); # Create the input form - $out->addHTML( - Html::openElement( - 'form', - array( 'id' => 'fileduplicatesearch', 'method' => 'get', 'action' => wfScript() ) - ) . "\n" . - Html::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) . "\n" . - Html::openElement( 'fieldset' ) . "\n" . - Html::element( 'legend', null, $this->msg( 'fileduplicatesearch-legend' )->text() ) . "\n" . - Xml::inputLabel( - $this->msg( 'fileduplicatesearch-filename' )->text(), - 'filename', - 'filename', - 50, - $this->filename - ) . "\n" . - Xml::submitButton( $this->msg( 'fileduplicatesearch-submit' )->text() ) . "\n" . - Html::closeElement( 'fieldset' ) . "\n" . - Html::closeElement( 'form' ) + $formFields = array( + 'filename' => array( + 'type' => 'text', + 'name' => 'filename', + 'label-message' => 'fileduplicatesearch-filename', + 'id' => 'filename', + 'size' => 50, + 'value' => $this->filename, + 'cssclass' => 'mw-ui-input-inline' + ), + ); + $hiddenFields = array( + 'title' => $this->getPageTitle()->getPrefixedDBKey(), ); + $htmlForm = HTMLForm::factory( 'inline', $formFields, $this->getContext() ); + $htmlForm->addHiddenFields( $hiddenFields ); + $htmlForm->setAction( wfScript() ); + $htmlForm->setMethod( 'get' ); + $htmlForm->setSubmitProgressive(); + $htmlForm->setSubmitTextMsg( $this->msg( 'fileduplicatesearch-submit' ) ); + $htmlForm->setWrapperLegendMsg( 'fileduplicatesearch-legend' ); + + // The form should be visible always, even if it was submitted (e.g. to perform another action). + // To bypass the callback validation of HTMLForm, use prepareForm() and displayForm(). + $htmlForm->prepareForm()->displayForm( false ); if ( $this->file ) { $this->hash = $this->file->getSha1(); @@ -196,7 +202,7 @@ class FileDuplicateSearchPage extends QueryPage { * * @param Skin $skin * @param File $result - * @return string + * @return string HTML */ function formatResult( $skin, $result ) { global $wgContLang; @@ -204,15 +210,14 @@ class FileDuplicateSearchPage extends QueryPage { $nt = $result->getTitle(); $text = $wgContLang->convert( $nt->getText() ); $plink = Linker::link( - Title::newFromText( $nt->getPrefixedText() ), - $text + $nt, + htmlspecialchars( $text ) ); $userText = $result->getUser( 'text' ); if ( $result->isLocal() ) { $userId = $result->getUser( 'id' ); $user = Linker::userLink( $userId, $userText ); - $user .= $this->getContext()->msg( 'word-separator' )->plain(); $user .= ''; $user .= Linker::userToolLinks( $userId, $userText ); $user .= ''; @@ -220,7 +225,8 @@ class FileDuplicateSearchPage extends QueryPage { $user = htmlspecialchars( $userText ); } - $time = $this->getLanguage()->userTimeAndDate( $result->getTimestamp(), $this->getUser() ); + $time = htmlspecialchars( $this->getLanguage()->userTimeAndDate( + $result->getTimestamp(), $this->getUser() ) ); return "$plink . . $user . . $time"; } -- cgit v1.2.3-54-g00ecf