From: moodler Date: Thu, 12 Jun 2003 11:35:12 +0000 (+0000) Subject: Modifications so that help falls back on parent language too X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=aa635c4727d3ce9470ad3c5e7a851330a8743af6;p=moodle.git Modifications so that help falls back on parent language too --- diff --git a/help.php b/help.php index abcfb995d4..b10d813b0f 100644 --- a/help.php +++ b/help.php @@ -1,51 +1,50 @@ -dirroot/lang/$lang/help/$file"; - } else { - $filepath = "$CFG->dirroot/lang/$lang/help/$module/$file"; - } - - if (file_exists("$filepath")) { - require_once("$filepath"); // Chosen language + if (detect_munged_arguments("$module/$file")) { + error("Filenames contain illegal characters!"); + } - } else { // Fall back to English + $helpfound = false; + + if (!empty($file)) { + $langs = array(current_language(), get_string("parentlanguage"), "en"); // Fallback + foreach ($langs as $lang) { + if (empty($lang)) { + continue; + } if ($module == "moodle") { - $filepath = "$CFG->dirroot/lang/en/help/$file"; + $filepath = "$CFG->dirroot/lang/$lang/help/$file"; } else { - $filepath = "$CFG->dirroot/lang/en/help/$module/$file"; + $filepath = "$CFG->dirroot/lang/$lang/help/$module/$file"; } - + if (file_exists("$filepath")) { - require_once("$filepath"); - } else { - notify("Can not find the specified help file"); - die; + $helpfound = true; + include("$filepath"); // The actual helpfile + break; } } } else { echo "

"; echo $text; echo "

"; + $helpfound = true; + } + + if (!$helpfound) { + notify("Help file '$file' could not be found!"); } close_window_button();