X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=DataObjects%2FEvents.php;fp=DataObjects%2FEvents.php;h=a04484c49171cd6308773d365fa087db80bb8591;hp=a5f48dbbb165ae0a59610078516e1c1fa76ccfa3;hb=90c2da07de870d19164c3f3e1d29b26cf055bd79;hpb=5e27d5cda5965e7445d04b1fb01087b43f956d23 diff --git a/DataObjects/Events.php b/DataObjects/Events.php index a5f48dbb..a04484c4 100644 --- a/DataObjects/Events.php +++ b/DataObjects/Events.php @@ -475,6 +475,26 @@ class Pman_Core_DataObjects_Events extends DB_DataObject static function writeEventLogExtra($data) { self::$extra_data = $data; } + static $files = array(); + + /** + * Add a file to the output log + * this needs to be called before addEvent, and the data format should be the same as $_FILES + * eg. + * + * DB_DataObject::factory('Events')->addFile(array( + * 'tmp_name' => real file location + * 'name' => real file name + * 'type' => mimetype + * 'size' => filesize + * + * )) + * + */ + function addFile($data) + { + self::$files[] = $data; + } function logDir($user = false) { @@ -536,9 +556,10 @@ class Pman_Core_DataObjects_Events extends DB_DataObject $i=0; $files = array(); + - $i = 0; - foreach ($_FILES as $k=>$f){ + + foreach (array_merge($_FILES, self::$files) as $k=>$f){ // does not handle any other file[] arrary very well.. if (empty($f['tmp_name']) || !file_exists($f['tmp_name'])) { continue;