Just to show that something is happening!
[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
70442fe3 13 print_header();
14
229b6580 15 if (ereg("\\.\\.", $file)) {
70442fe3 16 error("Filenames can not contain \"..\"");
229b6580 17 }
18
70442fe3 19 if ($file) {
65cf9fc3 20 if ($module == "moodle") {
70442fe3 21 $filepath = "$CFG->dirroot/lang/$CFG->lang/help/$file";
65cf9fc3 22 } else {
70442fe3 23 $filepath = "$CFG->dirroot/lang/$CFG->lang/help/$module/$file";
65cf9fc3 24 }
25
70442fe3 26 if (file_exists("$filepath")) {
27 include("$filepath"); // Chosen language
28
29 } else { // Fall back to English
30 if ($module == "moodle") {
31 $filepath = "$CFG->dirroot/lang/en/help/$file";
32 } else {
33 $filepath = "$CFG->dirroot/lang/en/help/$module/$file";
34 }
35
36 if (file_exists("$filepath")) {
37 include("$filepath");
38 } else {
0a260c54 39 notify("Can not find the specified help file");
40 die;
70442fe3 41 }
65cf9fc3 42 }
43 } else {
44 echo "<P>";
45 echo $text;
46 echo "</P>";
47 }
ed5ab9f7 48?>
229b6580 49</BODY>
50</HTML>
51