Too many bugs, not enough time!
[moodle.git] / mod / resource / fetch.php
blob0dfd3e4f787cfd01ccf3853e1ab20001d68a0634
1 <?php // $Id$
2 // Fetches an external URL and passes it through the filters
4 require_once("../../config.php");
5 require_once("lib.php");
7 require_variable($id); // Course Module ID
8 require_variable($url); // url to fetch
10 if (! $cm = get_record("course_modules", "id", $id)) {
11 error("Course Module ID was incorrect");
14 if (! $course = get_record("course", "id", $cm->course)) {
15 error("Course is misconfigured");
18 if (! $resource = get_record("resource", "id", $cm->instance)) {
19 error("Resource ID was incorrect");
22 $content = resource_fetch_remote_file($cm, $url);
24 echo format_text($content->results, FORMAT_HTML);