php8
[web.mtrack] / MTrackWeb / File.php
index ec4c583..443f926 100644 (file)
@@ -130,10 +130,13 @@ class MTrackWeb_File extends MTrackWeb
         require_once 'File/MimeType.php';
         $y = new File_MimeType();
         $this->mimetype = $y->fromFilename($this->file->name);
-        $ext = array_pop(explode('.', $this->file->name));
+        $ext = strtolower(array_pop(explode('.', $this->file->name)));
         
         //$this->mimetype = mtrack_mime_detect($location, $this->file->name);
         // special cases..
+        
+        list($major) = explode('/', $this->mimetype, 2);
+
         switch ($ext) {
             case 'sql':
                 $major = 'text';
@@ -141,7 +144,6 @@ class MTrackWeb_File extends MTrackWeb
             
             
         }
-        list($major) = explode('/', $this->mimetype, 2);
 
         // Obscure-ish special cases for mime types;
         // some .y files look like old image format data
@@ -197,9 +199,21 @@ class MTrackWeb_File extends MTrackWeb
                 require_once 'MTrack/SyntaxHighlight.php';
                 $contents = stream_get_contents($this->tmpfile);
                 $this->nlines = count(explode("\n", $contents));
-                $this->data =  MTrack_SyntaxHighlight::highlightSource(
+                
+                if (!empty($_REQUEST['markup'])) {
+                    // we do a late version call for markup.. 
+                    echo MTrack_SyntaxHighlight::highlightSource(
+                        $contents , null, $this->file->name
+                    );
+                    exit;
+                                       
+                }
+                
+                
+                $this->data =  htmlspecialchars($contents); /* MTrack_SyntaxHighlight::highlightSource(
                         $contents , null, $this->file->name
                    );
+                                          */
                     //var_dump($this->data);
                 for ($i =0; $i < $this->nlines; $i++ ) {
                     $this->ann[] = (object) array(
@@ -214,7 +228,9 @@ class MTrackWeb_File extends MTrackWeb
             default:
                 break; // download only..
         }
-      
+        if (!empty($_REQUEST['markup'])) {
+           $this->jerr("invalid request");
+        }
        
       // 
         //$this->renderEvents();