function linkParameters() {
return array( 'mime' => "{$this->major}/{$this->minor}" );
}
-
+
public function getQueryInfo() {
return array(
'tables' => array( 'image' ),
'img_minor_mime' => $this->minor )
);
}
-
+
function execute( $par ) {
global $wgRequest, $wgOut;
$mime = $par ? $par : $wgRequest->getText( 'mime' );
-
+
$this->setHeaders();
$this->outputHeader();
$wgOut->addHTML(
Xml::closeElement( 'form' )
);
- list( $this->major, $this->minor ) = self::parseMIME( $mime );
- if ( $this->major == '' || $this->minor == '' || !self::isValidType( $this->major ) ) {
+ list( $this->major, $this->minor ) = File::splitMime( $mime );
+ if ( $this->major == '' || $this->minor == '' || $this->minor == 'unknown' ||
+ !self::isValidType( $this->major ) ) {
return;
}
parent::execute( $par );
}
-
+
function formatResult( $skin, $result ) {
global $wgContLang, $wgLang;
return "($download) $plink . . $dimensions . . $bytes . . $user . . $time";
}
-
- protected static function parseMIME( $str ) {
- // searched for an invalid MIME type.
- if( strpos( $str, '/' ) === false ) {
- return array( '', '' );
- }
- list( $major, $minor ) = explode( '/', $str, 2 );
-
- return array(
- ltrim( $major, ' ' ),
- rtrim( $minor, ' ' )
- );
- }
-
+ /**
+ * @param $type string
+ * @return bool
+ */
protected static function isValidType( $type ) {
// From maintenance/tables.sql => img_major_mime
$types = array(