If modules have a config.php file in them then a link to this is
[moodle.git] / help.php
CommitLineData
aa635c47 1<?PHP /// $Id$
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
229b6580 6
aa635c47 7 require_once("config.php");
229b6580 8
aa635c47 9 optional_variable($file, "");
10 optional_variable($text, "No text to display");
11 optional_variable($module, "moodle");
65cf9fc3 12
aa635c47 13 print_header();
5c0ee23c 14
aa635c47 15 if (detect_munged_arguments("$module/$file")) {
16 error("Filenames contain illegal characters!");
17 }
70442fe3 18
aa635c47 19 $helpfound = false;
20
21 if (!empty($file)) {
22 $langs = array(current_language(), get_string("parentlanguage"), "en"); // Fallback
23 foreach ($langs as $lang) {
24 if (empty($lang)) {
25 continue;
26 }
70442fe3 27 if ($module == "moodle") {
aa635c47 28 $filepath = "$CFG->dirroot/lang/$lang/help/$file";
70442fe3 29 } else {
aa635c47 30 $filepath = "$CFG->dirroot/lang/$lang/help/$module/$file";
70442fe3 31 }
aa635c47 32
70442fe3 33 if (file_exists("$filepath")) {
aa635c47 34 $helpfound = true;
35 include("$filepath"); // The actual helpfile
36 break;
70442fe3 37 }
65cf9fc3 38 }
39 } else {
6c8e8b5e 40 echo "<p>";
65cf9fc3 41 echo $text;
6c8e8b5e 42 echo "</p>";
aa635c47 43 $helpfound = true;
44 }
45
46 if (!$helpfound) {
47 notify("Help file '$file' could not be found!");
65cf9fc3 48 }
e5dfd0f3 49
50 close_window_button();
95b50076 51
52 echo "<center><p><a href=\"help.php?file=index.html\">".get_string("helpindex")."</a><p></center>";
ed5ab9f7 53?>
6c8e8b5e 54</body>
55</html>
229b6580 56