New pictures for documentation.
[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 {
39 error("Can not find the specified help file");
40 }
65cf9fc3 41 }
42 } else {
43 echo "<P>";
44 echo $text;
45 echo "</P>";
46 }
ed5ab9f7 47?>
229b6580 48</BODY>
49</HTML>
50