]> git.mjollnir.org Git - moodle.git/commitdiff
Reverting previous fix, since it's now done across the board by file.php
authormoodler <moodler>
Tue, 9 Mar 2004 06:28:31 +0000 (06:28 +0000)
committermoodler <moodler>
Tue, 9 Mar 2004 06:28:31 +0000 (06:28 +0000)
mod/resource/fetch.php
mod/resource/view.php

index 9ce62b58c123cba4579fe0cc6bee0397ae66c53d..0dfd3e4f787cfd01ccf3853e1ab20001d68a0634 100644 (file)
@@ -1,11 +1,11 @@
-<?php
+<?php  // $Id$
+       // Fetches an external URL and passes it through the filters
 
     require_once("../../config.php");
     require_once("lib.php");
  
     require_variable($id);     // Course Module ID
-    optional_variable($url);   // url to fetch, or
-    optional_variable($file);  // file to fetch
+    require_variable($url);    // url to fetch
     
     if (! $cm = get_record("course_modules", "id", $id)) {
         error("Course Module ID was incorrect");
         error("Resource ID was incorrect");
     }
 
-    if ($url) {
+    $content = resource_fetch_remote_file($cm, $url);
 
-        $content = resource_fetch_remote_file($cm, $url);
+    echo format_text($content->results, FORMAT_HTML);
 
-        echo format_text($content->results, FORMAT_HTML);
-
-    } else if ($file) {
-
-        $pathinfo = urldecode($file);
-    
-        if (! $args = parse_slash_arguments($pathinfo)) {
-            error("No valid arguments supplied");
-        }
-    
-        $numargs = count($args);
-        $courseid = (integer)$args[0];
-
-        if ($courseid != $course->id) {      // Light security check
-            error("Course IDs don't match");
-        }
-    
-        if ($course->category) {
-            require_login($courseid);
-        }
-    
-        $pathname = "$CFG->dataroot$pathinfo";
-        $filename = $args[$numargs-1];
-    
-        if (file_exists($pathname)) {
-            $lastmodified = filemtime($pathname);
-    
-            header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
-            header("Pragma: ");
-            header("Content-disposition: inline; filename=$filename");
-            header("Content-length: ".filesize($pathname));
-            header("Content-type: text/html");
-
-            $content = implode('', file($pathname));
-            echo format_text($content, FORMAT_HTML);
-
-        } else {
-            error("Sorry, but the file you are looking for was not found ($pathname)", "course/view.php?id=$courseid");
-        }
-    }
 ?>
index ef1f834072c9e99f065d0a2041e984c5becabc33..26eee6561c0515eef833396752a1b79473d04426 100644 (file)
             }
             $fullurl = "$CFG->wwwroot$relativeurl";
 
-            if ($CFG->resource_filterexternalpages and $resourcetype == "html") {
-                $fullurl = "$CFG->wwwroot/mod/resource/fetch.php?id=$cm->id&file=/$course->id/$resource->reference";
-            }
-
 
             /// Check whether this is supposed to be a popup, but was called directly