]> git.mjollnir.org Git - moodle.git/commitdiff
Ah, that's nicer-looking code. (got rid of the HTML header)
authormartin <martin>
Sun, 11 Aug 2002 14:22:38 +0000 (14:22 +0000)
committermartin <martin>
Sun, 11 Aug 2002 14:22:38 +0000 (14:22 +0000)
help.php

index 3070e850a4daef7dbc10b76d4e9b67f005604e2f..17b185189597bffcc460a27fcfa4b038a71a7d94 100644 (file)
--- a/help.php
+++ b/help.php
   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>";