Pman/Roo.php
[Pman.Base] / Pman.php
index 2ad9047..65a7348 100644 (file)
--- a/Pman.php
+++ b/Pman.php
@@ -558,8 +558,19 @@ class Pman extends HTML_FlexyFramework_Page
         if (file_exists($cfile)) {
            // $ctime = max(filemtime($cfile), filectime($cfile));
             // otherwise use compile dfile..
-            $cfile = basename(array_pop(glob($cfile . '/' . $mod . '*.js')));
+            $maxm = 0;
+            $ar = glob($cfile . '/' . $mod . '*.js');
+            // default to first..
+            $cfile = basename($ar[count($ar) -1]);
+            foreach($ar as $fn) {
+                if (filemtime($fn) > $maxm) {
+                    $cfile = basename($fn);
+                    $maxm = filemtime($fn);
+                }
+                
+            }
             
+             
             $files = array( $this->rootURL. "/_compiled_/".$mod . "/" . $cfile);
             if (file_exists($lfile)) {
                 array_push($files, $this->rootURL."/_translations_/$mod.js");
@@ -624,16 +635,16 @@ class Pman extends HTML_FlexyFramework_Page
         $e->on_id  = $obj && $pk ? $obj->{$pk[0]}: 0;
         $e->remarks = $remarks;
         $eid = $e->insert();
-        $ff  = FlexyFramework::get();
+        $ff  = HTML_FlexyFramework::get();
         if (empty($ff->Pman['event_log_dir'])) {
             return;
         }
         $file = $ff->Pman['event_log_dir']. date('/Y/m/d/'). $eid . ".php";
         if (!file_exists(dirname($file))) {
-            mkdir(dirname($file),0666,true);
+            mkdir(dirname($file),0700,true);
         }
         file_put_contents($file, var_export(array(
-            'REQUEST_URI' => $SERVER['REQUEST_URI'],
+            'REQUEST_URI' => $_SERVER['REQUEST_URI'],
             'GET' => empty($_GET) ? array() : $_GET,
             'POST' => empty($_POST) ? array() : $_POST,
         ), true));