Pman/Roo.php
[Pman.Base] / Pman.php
index 2fbc00f..66d6e83 100644 (file)
--- 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..
+    
    
     
     /**
@@ -174,31 +176,31 @@ class Pman extends HTML_FlexyFramework_Page
     {
         // 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($this->appModules) ? explode(',',  $this->appModules) : array();
+         $am = !empty($boot->enable) ? explode(',',  $boot->enable) : array();
         foreach($am as $k) {
             if (strpos( $k ,'.') ) {
                 continue;
             }
             $enabled[$k] = true;
         }
-        $disabled =  explode(',', $this->appDisable ? $this->appDisable: '');
+        
+        
+        $disabled =  !empty($boot->disable) ?  explode(',', $boot->disable) : array();
         foreach($disabled as $k) {
-            if (!$with_component && strpos( $k ,'.') ) {
+            if ( strpos( $k ,'.') ) {
                 continue;
             }
             if (isset($enabled[$k])) {
                 unset($enabled[$k]);
-            }
-            
+            }   
         }
-        return array_keys($enabled);
-     
-        //print_R($opts);
-        
-        return in_array($name, $enabled) && !in_array($name, $disabled);
+         //echo '<PRE>';       var_Dump($enabled);
+
+        return array_keys($enabled); 
     }
     
     function hasModule($name) 
@@ -206,17 +208,7 @@ class Pman extends HTML_FlexyFramework_Page
         $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');
@@ -472,7 +464,9 @@ class Pman extends HTML_FlexyFramework_Page
         ) {
             header('Content-type: text/html');
             echo "<HTML><HEAD></HEAD><BODY>";
-            echo  $json->encodeUnsafe(array('success'=> true, 'data' => $str));
+            // encode html characters so they can be read..
+            echo  str_replace(array('<','>'), array('\u003c','\u003e'),
+                        $json->encodeUnsafe(array('success'=> true, 'data' => $str)));
             echo "</BODY></HTML>";
             exit;
         }
@@ -676,7 +670,8 @@ class Pman extends HTML_FlexyFramework_Page
      * 
      * @param {String} action  - group/name of event
      * @param {DataObject|false} obj - dataobject action occured on.
-     * @param {String} any remarks 
+     * @param {String} any remarks
+     * @return {Number} id of event created.
      */
     
     function addEvent($act, $obj = false, $remarks = '') 
@@ -690,7 +685,7 @@ class Pman extends HTML_FlexyFramework_Page
         $eid = $e->insert();
         $ff  = HTML_FlexyFramework::get();
         if (empty($ff->Pman['event_log_dir'])) {
-            return;
+            return $eid;
         }
         $file = $ff->Pman['event_log_dir']. date('/Y/m/d/'). $eid . ".php";
         if (!file_exists(dirname($file))) {
@@ -702,7 +697,7 @@ class Pman extends HTML_FlexyFramework_Page
             'POST' => empty($_POST) ? array() : $_POST,
         ), true));
         
-        
+        return $eid;
         
     }