fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [16012]


From: nelson . guerra
Subject: [Fmsystem-commits] [16012]
Date: Tue, 22 Nov 2016 02:48:48 +0000 (UTC)

Revision: 16012
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16012
Author:   nelson224
Date:     2016-11-22 02:48:48 +0000 (Tue, 22 Nov 2016)
Log Message:
-----------


Modified Paths:
--------------
    
branches/dev-syncromind-2/property/inc/import/class.import_component_files.inc.php

Modified: 
branches/dev-syncromind-2/property/inc/import/class.import_component_files.inc.php
===================================================================
--- 
branches/dev-syncromind-2/property/inc/import/class.import_component_files.inc.php
  2016-11-21 15:12:27 UTC (rev 16011)
+++ 
branches/dev-syncromind-2/property/inc/import/class.import_component_files.inc.php
  2016-11-22 02:48:48 UTC (rev 16012)
@@ -225,8 +225,9 @@
                        {
                                for($i = 0; $i < $zip->numFiles; $i++) 
                                {
-                                       $filename = iconv("CP850", "UTF-8", 
$zip->getNameIndex($i));
-                                       $copy_to = $dir.'/'.$filename;
+                                       //$filename = iconv("CP850", "UTF-8", 
$zip->getNameIndex($i));
+                                       $file_name = str_replace('..', '.', 
iconv("CP850", "UTF-8", $zip->getNameIndex($i)));
+                                       $copy_to = $dir.'/'.$file_name;
                                        if (!is_dir(dirname($copy_to)))
                                        {
                                                mkdir(dirname($copy_to), 0777, 
true);
@@ -257,7 +258,8 @@
                        foreach ($entries as $entry) 
                        {
                                //$entry->extract($dir);
-                               $copy_to = $dir.'/'.$entry->getName();
+                               $file_name = str_replace('..', '.', 
$entry->getName());
+                               $copy_to = $dir.'/'.$file_name;
                                if (!is_dir(dirname($copy_to)))
                                {
                                        mkdir(dirname($copy_to), 0777, true);
@@ -430,7 +432,7 @@
                                }
                                
                                $path = $row[(count($row)-2)];
-                               $path_file = $row[(count($row)-1)];
+                               $path_file = str_replace('..', '.', 
$row[(count($row)-1)]);
                                $array_path = explode("\\", $path_file);
                                                
                                $component_files[$row[0]][] = array(
@@ -498,7 +500,7 @@
                                                        {                       
                        
                                                                throw new 
Exception("failed to copy file: '{$file_data['path_file']}'. Component: 
'{$k}'");
                                                        } 
-                                                       
unlink($file_data['path_file']);
+                                                       
//unlink($file_data['path_file']);
                                                        $count_new_files++;
                                                }
                                                
@@ -597,7 +599,7 @@
                        
                        $bofiles = CreateObject('property.bofiles');
                        
-                       $file_name = str_replace(array(' ', '..'), array('_', 
'.'), trim($tmp_file));
+                       $file_name = str_replace(' ', '_', trim($tmp_file));
 
                        $to_file = $bofiles->fakebase . '/generic_document/' 
.$file_name;
 
@@ -615,31 +617,32 @@
                                        'relatives' => array(RELATIVE_NONE | 
VFS_REAL, RELATIVE_ALL)));
                        $bofiles->vfs->override_acl = 0;
 
-                       if ($file_id) 
+                       if (empty($file_id))
                        {
-                               $this->last_files_added[$file_id] = $val_md5sum;
-                               
-                               $md5_sum = trim(strstr($val_md5sum, '_', true));
-                               
-                               $this->db->query("UPDATE phpgw_vfs SET 
md5_sum='{$md5_sum}'"
-                                       . " WHERE file_id='{$file_id}'", 
__LINE__, __FILE__);
-                                       
-                               $metadata['report_date'] = 
phpgwapi_datetime::date_to_timestamp(date('Y-m-d'));
-                               $metadata['title'] = $file_data['name']; 
-                               $metadata['descr'] = $file_data['desription'];
-                               $metadata['path'] = $file_data['path'];
-                               
-                               $values_insert = array
-                                       (
-                                       'file_id' => $file_id,
-                                       'metadata' => "'" . 
json_encode($metadata) . "'"
-                               );
+                               return false;
+                       }
+                       
+                       $this->last_files_added[$file_id] = $val_md5sum;
 
-                               $this->db->query("INSERT INTO 
phpgw_vfs_filedata (" . implode(',', array_keys($values_insert)) . ') VALUES ('
-                                       . implode(",", 
array_values($values_insert)) . ')', __LINE__, __FILE__);
+                       $md5_sum = trim(strstr($val_md5sum, '_', true));
+
+                       $this->db->query("UPDATE phpgw_vfs SET 
md5_sum='{$md5_sum}'"
+                               . " WHERE file_id='{$file_id}'", __LINE__, 
__FILE__);
+
+                       $metadata['report_date'] = 
phpgwapi_datetime::date_to_timestamp(date('Y-m-d'));
+                       $metadata['title'] = $file_data['name']; 
+                       $metadata['descr'] = $file_data['desription'];
+                       $metadata['path'] = $file_data['path'];
+
+                       $values_insert = array
+                               (
+                               'file_id' => $file_id,
+                               'metadata' => "'" . json_encode($metadata) . "'"
+                       );
+
+                       $this->db->query("INSERT INTO phpgw_vfs_filedata (" . 
implode(',', array_keys($values_insert)) . ') VALUES ('
+                               . implode(",", array_values($values_insert)) . 
')', __LINE__, __FILE__);
                                
-                       }
-                       
                        return $file_id;
                }
                




reply via email to

[Prev in Thread] Current Thread [Next in Thread]