From 70442fe3c47d5d30d7bbfbd315258c91b386b6d2 Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 11 Aug 2002 14:22:38 +0000 Subject: [PATCH] Ah, that's nicer-looking code. (got rid of the HTML header) --- help.php | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/help.php b/help.php index 3070e850a4..17b1851895 100644 --- a/help.php +++ b/help.php @@ -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 \"..\""); } -?> - - - - - -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 "

"; -- 2.39.5