X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Pman.php;fp=Pman.php;h=f16ee9bb768af52f773d7a26cc77a3669d5263f0;hb=6ca9af43c1047aaa72a915fcdb5ba1060822045c;hp=44759cb5e7a4f5023f0fec080f28221b237dcdd4;hpb=edf584b992782666bd1eeb0d2365571979df9531;p=Pman.Base diff --git a/Pman.php b/Pman.php index 44759cb..f16ee9b 100644 --- a/Pman.php +++ b/Pman.php @@ -34,6 +34,8 @@ class Pman extends HTML_FlexyFramework_Page var $appModules = ''; + var $authUser; // always contains the authenticated user.. + /** @@ -169,22 +171,44 @@ class Pman extends HTML_FlexyFramework_Page return $au->hasPerm($name,$lvl); } + + function modules() + { + // appModules/appDisable contain a comma limited list of + // both modules and components that can be enabled/disabled.. + $boot = HTML_FlexyFramework::get(); + + // the modules call just lists the modules + $enabled = array('Core' => true); + $am = !empty($boot->enable) ? explode(',', $boot->enable) : array(); + foreach($am as $k) { + if (strpos( $k ,'.') ) { + continue; + } + $enabled[$k] = true; + } + + + $disabled = !empty($boot->disable) ? explode(',', $boot->disable) : array(); + foreach($disabled as $k) { + if ( strpos( $k ,'.') ) { + continue; + } + if (isset($enabled[$k])) { + unset($enabled[$k]); + } + } + //echo '
';       var_Dump($enabled);
+
+        return array_keys($enabled); 
+    }
+    
     function hasModule($name) 
     {
         $this->init();
         if (!strpos( $name,'.') ) {
             // use enable / disable..
-            
-            
-            $enabled =  array('Core') ;
-            $enabled = !empty($this->appModules) ? 
-                array_merge($enabled, explode(',',  $this->appModules)) : 
-                $enabled;
-            $disabled =  explode(',', $this->appDisable ? $this->appDisable: '');
-            
-            //print_R($opts);
-            
-            return in_array($name, $enabled) && !in_array($name, $disabled);
+            return in_array($name, $this->modules()); 
         }
         
         $x = DB_DataObject::factory('Group_Rights');