From: skodak Date: Mon, 14 Aug 2006 06:24:34 +0000 (+0000) Subject: prevent access to filters when disabled in filter settings SC#291; merged from MOODLE... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=33851b5c16c8c89a33cf9411f8dc62afb962ec9c;p=moodle.git prevent access to filters when disabled in filter settings SC#291; merged from MOODLE_16_STABLE --- diff --git a/filter/algebra/algebradebug.php b/filter/algebra/algebradebug.php index 6ae4967107..c1b04acc82 100644 --- a/filter/algebra/algebradebug.php +++ b/filter/algebra/algebradebug.php @@ -7,6 +7,14 @@ require_once("../../config.php"); + if (empty($CFG->textfilters)) { + error ('Filter not enabled!'); + } else { + $filters = explode(',', $CFG->textfilters); + if (array_search('filter/algebra', $filters) === FALSE) { + error ('Filter not enabled!'); + } + } $CFG->texfilterdir = "filter/tex"; $CFG->algebrafilterdir = "filter/algebra"; diff --git a/filter/algebra/pix.php b/filter/algebra/pix.php index d0218474d8..8fd51bff89 100644 --- a/filter/algebra/pix.php +++ b/filter/algebra/pix.php @@ -6,6 +6,16 @@ $nomoodlecookie = true; // Because it interferes with caching require_once('../../config.php'); + + if (empty($CFG->textfilters)) { + error ('Filter not enabled!'); + } else { + $filters = explode(',', $CFG->textfilters); + if (array_search('filter/algebra', $filters) === FALSE) { + error ('Filter not enabled!'); + } + } + require_once($CFG->libdir.'/filelib.php'); $CFG->texfilterdir = 'filter/tex'; diff --git a/filter/tex/pix.php b/filter/tex/pix.php index 0b79fba73f..1977c8eb88 100644 --- a/filter/tex/pix.php +++ b/filter/tex/pix.php @@ -6,6 +6,16 @@ $nomoodlecookie = true; // Because it interferes with caching require_once('../../config.php'); + + if (empty($CFG->textfilters)) { + error ('Filter not enabled!'); + } else { + $filters = explode(',', $CFG->textfilters); + if (array_search('filter/tex', $filters) === FALSE) { + error ('Filter not enabled!'); + } + } + require_once($CFG->libdir.'/filelib.php'); require_once('defaultsettings.php' ); require_once('latex.php'); diff --git a/filter/tex/texdebug.php b/filter/tex/texdebug.php index d6e41ae49f..2db14a7c73 100644 --- a/filter/tex/texdebug.php +++ b/filter/tex/texdebug.php @@ -7,6 +7,15 @@ require_once("../../config.php"); + if (empty($CFG->textfilters)) { + error ('Filter not enabled!'); + } else { + $filters = explode(',', $CFG->textfilters); + if (array_search('filter/tex', $filters) === FALSE) { + error ('Filter not enabled!'); + } + } + $CFG->texfilterdir = "filter/tex"; $CFG->teximagedir = "filter/tex"; diff --git a/filter/tex/texed.php b/filter/tex/texed.php index 5d61b11935..c0069428f4 100644 --- a/filter/tex/texed.php +++ b/filter/tex/texed.php @@ -7,6 +7,15 @@ require_once("../../config.php"); + if (empty($CFG->textfilters)) { + error ('Filter not enabled!'); + } else { + $filters = explode(',', $CFG->textfilters); + if (array_search('filter/tex', $filters) === FALSE) { + error ('Filter not enabled!'); + } + } + $CFG->texfilterdir = "filter/tex"; $CFG->teximagedir = "filter/tex";