The execute method was calling a outputHeader(), and then calling
it's parent implementation which was also calling outputHeader()
causing double output.
Refactor class to use $this->getPageHeader() to output menus
before result list, as that appears to be what that method is
for.
Change-Id: Ic0a79cb73136e636f96e33859dadb384eca38255
* @ingroup SpecialPage
*/
class MIMEsearchPage extends QueryPage {
* @ingroup SpecialPage
*/
class MIMEsearchPage extends QueryPage {
- protected $major, $minor;
+ protected $major, $minor, $mime;
function __construct( $name = 'MIMEsearch' ) {
parent::__construct( $name );
function __construct( $name = 'MIMEsearch' ) {
parent::__construct( $name );
- function execute( $par ) {
- $mime = $par ? $par : $this->getRequest()->getText( 'mime' );
- $mime = trim( $mime );
+ /**
+ * Return HTML to put just before the results.
+ */
+ function getPageHeader() {
- $this->setHeaders();
- $this->outputHeader();
- $this->getOutput()->addHTML(
- Xml::openElement(
+ return Xml::openElement(
'form',
array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => wfScript() )
) .
'form',
array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => wfScript() )
) .
- Xml::openElement( 'fieldset' ) .
- Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) .
- Xml::element( 'legend', null, $this->msg( 'mimesearch' )->text() ) .
- Xml::inputLabel( $this->msg( 'mimetype' )->text(), 'mime', 'mime', 20, $mime ) .
- ' ' .
- Xml::submitButton( $this->msg( 'ilsubmit' )->text() ) .
- Xml::closeElement( 'fieldset' ) .
- Xml::closeElement( 'form' )
- );
+ Xml::openElement( 'fieldset' ) .
+ Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) .
+ Xml::element( 'legend', null, $this->msg( 'mimesearch' )->text() ) .
+ Xml::inputLabel( $this->msg( 'mimetype' )->text(), 'mime', 'mime', 20, $this->mime ) .
+ ' ' .
+ Xml::submitButton( $this->msg( 'ilsubmit' )->text() ) .
+ Xml::closeElement( 'fieldset' ) .
+ Xml::closeElement( 'form' );
+ }
- list( $this->major, $this->minor ) = File::splitMime( $mime );
+ function execute( $par ) {
+ $this->mime = $par ? $par : $this->getRequest()->getText( 'mime' );
+ $this->mime = trim( $this->mime );
+ list( $this->major, $this->minor ) = File::splitMime( $this->mime );
if ( $this->major == '' || $this->minor == '' || $this->minor == 'unknown' ||
!self::isValidType( $this->major )
) {
if ( $this->major == '' || $this->minor == '' || $this->minor == 'unknown' ||
!self::isValidType( $this->major )
) {
+ $this->setHeaders();
+ $this->outputHeader();
+ $this->getOutput()->addHTML( $this->getPageHeader() );