DataObjects/core.sql
[Pman.Core] / DataObjects / Events.php
index 339cd30..b1d23a6 100644 (file)
@@ -35,6 +35,7 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
     //  ------------ROO HOOKS------------------------------------
     function applyFilters($q, $au ,$roo)
     {
+     
         $tn = $this->tableName();
         if (!empty($q['query']['from'])) {
             $dt = date('Y-m-d' , strtotime($q['query']['from']));
@@ -425,23 +426,26 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
                 $p['passwd'] = '******';
             }
         }
-         $i=0;
-         $files = array();
+        $i=0;
+        $files = array();
         foreach ($_FILES as $k=>$f){
+            if (empty($f['tmp_name']) || !file_exists($f['tmp_name'])) {
+                continue;
+            }
             $i++;
             $files[$k] = $f;
-            $files[$k]['tmp_name'] = $this->id . '.' . 'file_'. $i.'.jpg';
-            $nf = $ff->Pman['event_log_dir']. '/'. $user. date('/Y/m/d/'). $this->id . ".file_$i";
+            $files[$k]['tmp_name'] = $this->id . '.file_'. $i.'.jpg';
+            $nf = $ff->Pman['event_log_dir']. '/'. $this->id . ".file_$i.jpg";
             if (!copy($f['tmp_name'], $nf)) {
-                echo "failed to copy $file...\n";
+                print_r("failed to copy {$f['tmp_name']}...\n");
             }
         }
-        print_r($files);
+        
         file_put_contents($file, json_encode(array(
             'REQUEST_URI' => empty($_SERVER['REQUEST_URI']) ? 'cli' : $_SERVER['REQUEST_URI'],
             'GET' => empty($_GET) ? array() : $_GET,
             'POST' =>$p,
-            'FILES' => $_FILES,
+            'FILES' => $files,
         )));
         
     }