Fixed a link
[moodle.git] / help.php
CommitLineData
229b6580 1<?PHP
2 /// help.php - prints a very simple page and includes a
3 /// page content or a string from elsewhere
4 /// Usually this will appear in a popup
65cf9fc3 5 /// See helpbutton() in lib/moodlelib.php
229b6580 6
7 include("config.php");
8
65cf9fc3 9 optional_variable($file, "");
10 optional_variable($text, "No text to display");
11 optional_variable($module, "moodle");
12
5c0ee23c 13 $lang = current_language();
14
70442fe3 15 print_header();
16
229b6580 17 if (ereg("\\.\\.", $file)) {
70442fe3 18 error("Filenames can not contain \"..\"");
229b6580 19 }
20
70442fe3 21 if ($file) {
65cf9fc3 22 if ($module == "moodle") {
5c0ee23c 23 $filepath = "$CFG->dirroot/lang/$lang/help/$file";
65cf9fc3 24 } else {
5c0ee23c 25 $filepath = "$CFG->dirroot/lang/$lang/help/$module/$file";
65cf9fc3 26 }
27
70442fe3 28 if (file_exists("$filepath")) {
29 include("$filepath"); // Chosen language
30
31 } else { // Fall back to English
32 if ($module == "moodle") {
33 $filepath = "$CFG->dirroot/lang/en/help/$file";
34 } else {
35 $filepath = "$CFG->dirroot/lang/en/help/$module/$file";
36 }
37
38 if (file_exists("$filepath")) {
39 include("$filepath");
40 } else {
0a260c54 41 notify("Can not find the specified help file");
42 die;
70442fe3 43 }
65cf9fc3 44 }
45 } else {
46 echo "<P>";
47 echo $text;
48 echo "</P>";
49 }
e5dfd0f3 50
51 close_window_button();
ed5ab9f7 52?>
229b6580 53</BODY>
54</HTML>
55