Release of 1.0.7
[moodle.git] / help.php
blob18e95bcbc0c44781209ec7c732e148a3dfcec34f
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
5 /// See helpbutton() in lib/moodlelib.php
7 include("config.php");
9 optional_variable($file, "");
10 optional_variable($text, "No text to display");
11 optional_variable($module, "moodle");
13 $lang = current_language();
15 print_header();
17 if (ereg("\\.\\.", $file)) {
18 error("Filenames can not contain \"..\"");
21 if ($file) {
22 if ($module == "moodle") {
23 $filepath = "$CFG->dirroot/lang/$lang/help/$file";
24 } else {
25 $filepath = "$CFG->dirroot/lang/$lang/help/$module/$file";
28 if (file_exists("$filepath")) {
29 include("$filepath"); // Chosen language
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";
38 if (file_exists("$filepath")) {
39 include("$filepath");
40 } else {
41 notify("Can not find the specified help file");
42 die;
45 } else {
46 echo "<P>";
47 echo $text;
48 echo "</P>";
51 close_window_button();
53 </BODY>
54 </HTML>