Merge "Fix: Special page ShowMathImage should read the mode as string"

This commit is contained in:
jenkins-bot 2015-08-11 20:34:30 +00:00 committed by Gerrit Code Review
commit 7388292cab
1 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,7 @@ class SpecialMathShowImage extends SpecialPage {
} else { } else {
$asciimath = ''; $asciimath = '';
} }
$this->mode = $request->getInt( 'mode', 'mathml' ); $this->mode = MathHooks::mathModeToString( $request->getText( 'mode' ), 'mathml' );
if ( !in_array( $this->mode, MathRenderer::getValidModes() ) ) { if ( !in_array( $this->mode, MathRenderer::getValidModes() ) ) {
// Fallback to the default if an invalid mode was specified // Fallback to the default if an invalid mode was specified
$this->mode = 'mathml'; $this->mode = 'mathml';
@ -58,7 +58,7 @@ class SpecialMathShowImage extends SpecialPage {
$this->setHeaders( false ); $this->setHeaders( false );
echo $this->printSvgError( 'No Inputhash specified' ); echo $this->printSvgError( 'No Inputhash specified' );
} else { } else {
if ( $tex === '' && $asciimath === ''){ if ( $tex === '' && $asciimath === '' ){
switch ( $this->mode ) { switch ( $this->mode ) {
case 'png': case 'png':
$this->renderer = MathTexvc::newFromMd5( $hash ); $this->renderer = MathTexvc::newFromMd5( $hash );
@ -116,7 +116,7 @@ class SpecialMathShowImage extends SpecialPage {
/** /**
* Prints the specified error message as svg. * Prints the specified error message as svg.
* @param string $msg error message * @param string $msg error message
* @return xml svg image with the error message * @return string xml svg image with the error message
*/ */
private function printSvgError( $msg ) { private function printSvgError( $msg ) {
global $wgDebugComments; global $wgDebugComments;