moodle/help.php

52 lines
1.4 KiB
PHP
Raw Normal View History

2002-03-11 03:18:13 +00:00
<?PHP
/// help.php - prints a very simple page and includes a
/// page content or a string from elsewhere
/// Usually this will appear in a popup
2002-07-21 08:34:25 +00:00
/// See helpbutton() in lib/moodlelib.php
2002-03-11 03:18:13 +00:00
include("config.php");
2002-07-21 08:34:25 +00:00
optional_variable($file, "");
optional_variable($text, "No text to display");
optional_variable($module, "moodle");
print_header();
2002-03-11 03:18:13 +00:00
if (ereg("\\.\\.", $file)) {
error("Filenames can not contain \"..\"");
2002-03-11 03:18:13 +00:00
}
if ($file) {
2002-07-21 08:34:25 +00:00
if ($module == "moodle") {
$filepath = "$CFG->dirroot/lang/$CFG->lang/help/$file";
2002-07-21 08:34:25 +00:00
} else {
$filepath = "$CFG->dirroot/lang/$CFG->lang/help/$module/$file";
2002-07-21 08:34:25 +00:00
}
if (file_exists("$filepath")) {
include("$filepath"); // Chosen language
} else { // Fall back to English
if ($module == "moodle") {
$filepath = "$CFG->dirroot/lang/en/help/$file";
} else {
$filepath = "$CFG->dirroot/lang/en/help/$module/$file";
}
if (file_exists("$filepath")) {
include("$filepath");
} else {
2002-08-18 15:24:44 +00:00
notify("Can not find the specified help file");
die;
}
2002-07-21 08:34:25 +00:00
}
} else {
echo "<P>";
echo $text;
echo "</P>";
}
2002-07-02 07:09:26 +00:00
?>
2002-03-11 03:18:13 +00:00
</BODY>
</HTML>