DataObjects/core.sql
[Pman.Core] / I18n.php
index 37ebb0a..abffb4f 100644 (file)
--- a/I18n.php
+++ b/I18n.php
@@ -111,6 +111,11 @@ class Pman_Core_I18n extends Pman
      
         $lbits = $this->guessUsersLanguage();
          
+        if ($this->authUser && !empty($_REQUEST['_debug'])) {
+            DB_DataObject::debugLevel(1);
+        }
+        
+        
         
         $i = DB_DataObject::Factory('I18n');
         
@@ -181,7 +186,8 @@ class Pman_Core_I18n extends Pman
         $ar = array();
         foreach($langs as $lang)
         {
-            $rlang = array_shift(explode('_', strtoupper($lang)));
+            //$rlang = array_shift(explode('_', strtoupper($lang)));
+            $rlang = array_shift(explode('_', $lang));
             
             $ar[$lang] = array();
             $i = DB_DataObject::Factory('I18n');
@@ -286,11 +292,15 @@ class Pman_Core_I18n extends Pman
         }
         $target = ini_get('session.save_path').'/eurofxref-daily.xml';
         if (!file_exists($target) || filemtime($target) < (time() - 60*60*24)) {
-            $f = file_get_contents('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml');
+            // this may fail...
+            $f = @file_get_contents('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml');
             if (!strlen($f)) {
-                return false;
+                $target = dirname(__FILE__).'/eurofxref-daily.xml';
+                
+                
+            } else {
+                file_put_contents($target,$f);
             }
-            file_put_contents($target,$f);
         } 
         $dom = simplexml_load_file($target);
         $this->rates['EUR'] = 1.0;