Permalink
Browse files

Ah, that's nicer-looking code. (got rid of the HTML header)

  • Loading branch information...
1 parent 11d87ec commit 70442fe3c47d5d30d7bbfbd315258c91b386b6d2 martin committed Aug 11, 2002
Showing with 21 additions and 14 deletions.
  1. +21 −14 help.php
View
@@ -10,27 +10,34 @@
optional_variable($text, "No text to display");
optional_variable($module, "moodle");
+ print_header();
+
if (ereg("\\.\\.", $file)) {
- error("Error: Filenames can not contain \"..\"");
+ error("Filenames can not contain \"..\"");
}
-?>
-<HTML>
-<HEAD>
-<LINK rel="stylesheet" href="<?=$CFG->wwwroot?>/theme/<?=$CFG->theme?>/styles.css">
-</HEAD>
-<BODY BGCOLOR="<?=$THEME->body ?>">
-<? if ($file) {
+ if ($file) {
if ($module == "moodle") {
- $langpath = "$CFG->dirroot/lang";
+ $filepath = "$CFG->dirroot/lang/$CFG->lang/help/$file";
} else {
- $langpath = "$CFG->dirroot/mod/$module/lang";
+ $filepath = "$CFG->dirroot/lang/$CFG->lang/help/$module/$file";
}
- if (file_exists("$langpath/$CFG->lang/page/$file")) {
- include("$langpath/$CFG->lang/page/$file");
- } else {
- include("$langpath/en/page/$file");
+ 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 {
+ error("Can not find the specified help file");
+ }
}
} else {
echo "<P>";

0 comments on commit 70442fe

Please sign in to comment.