]> git.mjollnir.org Git - moodle.git/commitdiff
Use parentlanguage when printing documentation
authormoodler <moodler>
Thu, 12 Jun 2003 11:55:29 +0000 (11:55 +0000)
committermoodler <moodler>
Thu, 12 Jun 2003 11:55:29 +0000 (11:55 +0000)
lib/moodlelib.php

index 0b023ddac441ecac076ad3682db83985a27758f9..27d42cbec1e52468f4390b8c26d1418b81493d53 100644 (file)
@@ -1088,32 +1088,27 @@ function document_file($file, $include=true) {
 
     global $CFG;
 
+    $file = clean_filename($file);
+
     if (empty($file)) {
-        echo "Error 404";
         return false;
     }
 
-    $lang = current_language();
-
-    $file = clean_filename($file);
+    $langs = array(current_language(), get_string("parentlanguage"), "en");
 
-    $info->filepath = "$CFG->dirroot/lang/$lang/docs/$file";
-    $info->urlpath  = "$CFG->wwwroot/lang/$lang/docs/$file";
+    foreach ($langs as $lang) {
+        $info->filepath = "$CFG->dirroot/lang/$lang/docs/$file";
+        $info->urlpath  = "$CFG->wwwroot/lang/$lang/docs/$file";
 
-    if (!file_exists($info->filepath)) {
-        $info->filepath = "$CFG->dirroot/lang/en/docs/$file";
-        $info->urlpath  = "$CFG->wwwroot/lang/en/docs/$file";
-        if (!file_exists($info->filepath)) {
-            error("Error 404 - $file does not exist");
-            return NULL;
+        if (file_exists($info->filepath)) {
+            if ($include) {
+                include($info->filepath);
+            }
+            return $info;
         }
     }
 
-    if ($include) {
-        include($info->filepath);
-    }
-
-    return $info;
+    return false;
 }