]> git.mjollnir.org Git - moodle.git/commitdiff
Bug fix for Windows systems
authorfiedorow <fiedorow>
Tue, 8 Jun 2004 20:36:13 +0000 (20:36 +0000)
committerfiedorow <fiedorow>
Tue, 8 Jun 2004 20:36:13 +0000 (20:36 +0000)
filter/algebra/algebradebug.php
filter/algebra/filter.php

index 8732a8a776bb09c956fee56dbdfdd1e4b2cc40eb..b14062b138d1ebc1b3f53cc9a4070a0d8cd41dd4 100644 (file)
     $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);
   }
index 3a45230b63c0196bffddb00eeaf890d90bfd2c56..704eec8f49f4ded0df8b2188a19a29c0560640ca 100644 (file)
 // 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";