From: fiedorow Date: Tue, 8 Jun 2004 20:36:13 +0000 (+0000) Subject: Bug fix for Windows systems X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=49dfcc3b4f4d3ceb90b7264b139e2f4405b80122;p=moodle.git Bug fix for Windows systems --- diff --git a/filter/algebra/algebradebug.php b/filter/algebra/algebradebug.php index 8732a8a776..b14062b138 100644 --- a/filter/algebra/algebradebug.php +++ b/filter/algebra/algebradebug.php @@ -11,6 +11,10 @@ $CFG->texfilterdir = "filter/tex"; $CFG->algebrafilterdir = "filter/algebra"; $CFG->algebraimagedir = "filter/algebra"; + if ( (PHP_OS == "WINNT") || (PHP_OS == "WIN32") || (PHP_OS == "Windows") ) { + $CFG->algebrafilterdirwin = "filter\\algebra"; + } + $query = urldecode($_SERVER['QUERY_STRING']); error_reporting(E_ALL); @@ -86,7 +90,7 @@ function algebra2tex($algebra) { if ( (PHP_OS == "WINNT") || (PHP_OS == "WIN32") || (PHP_OS == "Windows") ) { $algebra = "\"". str_replace('"','\"',$algebra) . "\""; - $cmd = "cd $CFG->dirroot/$CFG->algebrafilterdir & algebra2tex.pl $algebra"; + $cmd = "cd $CFG->dirroot\\$CFG->algebrafilterdirwin & algebra2tex.pl $algebra"; } else { $algebra = escapeshellarg($algebra); $cmd = "cd $CFG->dirroot/$CFG->algebrafilterdir; ./algebra2tex.pl $algebra"; @@ -211,7 +215,12 @@ function tex2image($texexp, $md5) { break; } if (!$cmd) { + if (is_executable("$CFG->dirroot/$CFG->texfilterdir/mimetex")) { /// Use the custom binary + $commandpath="$CFG->dirroot/$CFG->texfilterdir/mimetex"; + $cmd = "$CFG->dirroot/$CFG->texfilterdir/mimetex -e $pathname ". escapeshellarg($texexp); + } else { error($error_message1); + } } system($cmd, $status); } diff --git a/filter/algebra/filter.php b/filter/algebra/filter.php index 3a45230b63..704eec8f49 100644 --- a/filter/algebra/filter.php +++ b/filter/algebra/filter.php @@ -42,6 +42,11 @@ // File path to the directory where mathml_filter.php resides $CFG->algebrafilterdir = "filter/algebra"; $CFG->texfilterdir = "filter/tex"; + if ( (PHP_OS == "WINNT") || (PHP_OS == "WIN32") || (PHP_OS == "Windows") ) { + $CFG->algebrafilterdirwin = "filter\\algebra"; + } + + /// These lines are important - the variable must match the name /// of the actual function below @@ -161,7 +166,7 @@ function algebra_filter ($courseid, $text) { $algebra = preg_replace('!\r\n?!',' ',$algebra); if ( (PHP_OS == "WINNT") || (PHP_OS == "WIN32") || (PHP_OS == "Windows") ) { $algebra = "\"". str_replace('"','\"',$algebra) . "\""; - $cmd = "cd $CFG->dirroot/$CFG->algebrafilterdir & algebra2tex.pl $algebra"; + $cmd = "cd $CFG->dirroot\\$CFG->algebrafilterdirwin & algebra2tex.pl $algebra"; } else { $algebra = escapeshellarg($algebra); $cmd = "cd $CFG->dirroot/$CFG->algebrafilterdir; ./algebra2tex.pl $algebra";