OKAY! THIS IS IT! MOODLE 1.6!
[moodle.git] / doc / view.php
blob6e91b59132d3ce37246ab2dfa841e1d8cf14f0b4
1 <?PHP // $Id$
3 require("../config.php");
5 $id = optional_param('id',0,PARAM_INT); // course context
6 $file = required_param('file',PARAM_FILE); // file in this directory to view
8 $file = clean_filename($file);
10 if ($CFG->forcelogin) {
11 require_login();
14 if ($id) {
15 if (! $course = get_record("course", "id", $id)) {
16 error("Course is misconfigured");
18 $strhelp = get_string("help");
19 print_header("$course->shortname: $strhelp", "$course->fullname",
20 "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> $strhelp");
21 } else {
22 if (! $site = get_site()) {
23 error("Site is misconfigured");
25 $strdocumentation = get_string("documentation");
26 print_header("$site->shortname: $strhelp", "$site->fullname",
27 "<a href=\"view.php?file=contents.html\">$strdocumentation</a>");
31 echo "<blockquote>";
33 if (! document_file($file, true)) {
34 notify("404 - File Not Found");
37 echo "</blockquote>";