changeset 107:d5f3efba33e2

Support for common files between languages.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Mon, 07 Mar 2016 20:44:15 +0100
parents d0698ec07b0b
children f2996720e6d6
files InputParser.inc
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/InputParser.inc	Mon Mar 07 17:12:32 2016 +0100
+++ b/InputParser.inc	Mon Mar 07 20:44:15 2016 +0100
@@ -223,6 +223,9 @@
       else {
 	$src = $file->getAttribute("src");
 	$fname = $options->getBasePath() . "/${lang}/${src}";
+	if (!file_exists($fname) ) {
+	  $fname = $options->getBasePath() . "/common/${src}";
+	}
 	$file_content = $options->getCache()->loadFile($fname);
       }
       if(floatval($file_content)<0) {
@@ -289,6 +292,10 @@
       $conf = $param->getAttribute("default");
 
     $confFile = $options->getBasePath() . "/${lang}/${conf}.xml";
+    if (! file_exists($confFile) ) {
+      $confFile = $options->getBasePath() . "/common/${conf}.xml";
+    }
+
     $options->getCache()->cache_time($confFile);
     $doc = new DOMDocument();
     $doc->load($confFile);
@@ -310,6 +317,9 @@
 	$src = $include->getAttribute("src");
 	$subdoc = new DOMDocument();
 	$subfile = $options->getBasePath() . "/${lang}/${src}";
+	if (! file_exists($subfile) ) {
+	  $subfile = $options->getBasePath() . "/common/${src}";
+	}
 	$subdoc->load("$subfile");
 	$options->getCache()->cache_time($subfile);
 	$parent = $include->parentNode;