File: view.php

package info (click to toggle)
moodle 1.4.4.dfsg.1-3sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 57,876 kB
  • ctags: 29,496
  • sloc: php: 271,617; sql: 5,084; xml: 702; perl: 638; sh: 403; java: 283; makefile: 42; pascal: 21
file content (40 lines) | stat: -rw-r--r-- 1,138 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?PHP  // $Id: view.php,v 1.6 2004/05/16 10:26:04 stronk7 Exp $

    require("../config.php");

    optional_variable($id);      // course context
    require_variable($file);    // file in this directory to view

    $file = clean_filename($file);

    if ($CFG->forcelogin) {
        require_login();
    }

    if ($id) {
        if (! $course = get_record("course", "id", $id)) {
            error("Course is misconfigured");
        }
        $strhelp = get_string("help");
        print_header("$course->shortname: $strhelp", "$course->fullname", 
                     "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> $strhelp");
    } else {
        if (! $site = get_site()) {
            error("Site is misconfigured");
        }
        $strdocumentation = get_string("documentation");
        print_header("$site->shortname: $strhelp", "$site->fullname", 
                     "<a href=\"view.php?file=contents.html\">$strdocumentation</a>");
        
    }

    echo "<blockquote>";

    if (! document_file($file, true)) {
        notify("404 - File Not Found");
    }

    echo "</blockquote>";

?>