Merge branch 'master' into wip_leon_T7754_fix_download_upload_for_admin
[Pman.Core] / Config.php
index 25595a7..9357316 100644 (file)
@@ -10,9 +10,20 @@ class Pman_Core_Config {
     var $defaults = array(  ); // override... 
     
     
+    // note if other extended 'config's require more, then you porbably need to include these first.
+    var $required_extensions = array(
+        'json',        
+        'curl',
+        'gd',
+        'mbstring',
+        'http'
+    );
+    
     function init($ff, $cfg)
     {
-      
+        
+        
+        
         $cfg = $this->overlayDefaults($cfg);
         
         if (!empty($this->memory_limit)) {
@@ -23,6 +34,17 @@ class Pman_Core_Config {
         
         }
         
+        $this->verifyExtensions();
+        
+        
+        if (!isset($cfg['Pman']['timezone'])) {
+            die("timezone needs setting in Pman[timezone]");
+        }
+        if ($cfg['Pman']['timezone'] != ini_get('date.timezone')) {
+            die("timezone needs setting in php.ini date.timezone = " . $cfg['Pman']['timezone']);
+        }
+        
+        
         return $cfg;
     }
     
@@ -73,6 +95,23 @@ class Pman_Core_Config {
         
         return $cfg;
     }
-    
+    function verifyExtensions()
+    {
+        $error = array();
+        
+        foreach ($this->required_extensions as $e){
+            
+            if(empty($e) || extension_loaded($e)) {
+                continue;
+            }
+            
+            $error[] = "Error: Please install php extension: {$e}";
+        }
+        
+        if(empty($error)){
+           return true; 
+        }
+        die(implode('\n', $error));
+    }
 
 }