Merge "Prevent Special:MathShowImage from showing bad content"
This commit is contained in:
commit
cf2ba92c09
|
@ -7,7 +7,7 @@
|
||||||
class SpecialMathShowImage extends SpecialPage {
|
class SpecialMathShowImage extends SpecialPage {
|
||||||
private $noRender = false;
|
private $noRender = false;
|
||||||
private $renderer = null;
|
private $renderer = null;
|
||||||
private $mode = false;
|
private $mode = MW_MATH_MATHML;
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
|
@ -38,11 +38,20 @@ class SpecialMathShowImage extends SpecialPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
function execute( $par ) {
|
function execute( $par ) {
|
||||||
|
global $wgMathValidModes, $wgMathEnableExperimentalInputFormats;
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$hash = $request->getText( 'hash', '' );
|
$hash = $request->getText( 'hash', '' );
|
||||||
$tex = $request->getText( 'tex', '');
|
$tex = $request->getText( 'tex', '' );
|
||||||
$asciimath = $request->getText( 'asciimath', '');
|
if ( $wgMathEnableExperimentalInputFormats ) {
|
||||||
|
$asciimath = $request->getText( 'asciimath', '' );
|
||||||
|
} else {
|
||||||
|
$asciimath = '';
|
||||||
|
}
|
||||||
$this->mode = $request->getInt( 'mode', MW_MATH_MATHML );
|
$this->mode = $request->getInt( 'mode', MW_MATH_MATHML );
|
||||||
|
if ( !in_array( $this->mode, $wgMathValidModes ) ) {
|
||||||
|
// Fallback to the default if an invalid mode was specified
|
||||||
|
$this->mode = MW_MATH_MATHML;
|
||||||
|
}
|
||||||
if ( $hash === '' && $tex === '' && $asciimath === '' ) {
|
if ( $hash === '' && $tex === '' && $asciimath === '' ) {
|
||||||
$this->setHeaders( false );
|
$this->setHeaders( false );
|
||||||
echo $this->printSvgError( 'No Inputhash specified' );
|
echo $this->printSvgError( 'No Inputhash specified' );
|
||||||
|
|
Loading…
Reference in New Issue