fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15969]


From: nelson . guerra
Subject: [Fmsystem-commits] [15969]
Date: Wed, 9 Nov 2016 02:21:57 +0000 (UTC)

Revision: 15969
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15969
Author:   nelson224
Date:     2016-11-09 02:21:57 +0000 (Wed, 09 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-09 02:21:22 UTC (rev 15968)
+++ 
branches/dev-syncromind-2/property/inc/import/class.import_component_files.inc.php
  2016-11-09 02:21:57 UTC (rev 15969)
@@ -9,7 +9,7 @@
                        
                        $this->fakebase = '/temp_files_components';
                        $this->path_upload_dir = 
$GLOBALS['phpgw_info']['server']['files_dir'].$this->fakebase.'/';
-                       
+
                        $this->last_files_added = array();
                }
                
@@ -220,6 +220,8 @@
                
                private function _un_zip($file, $dir)
                {
+                       @set_time_limit(5 * 60);
+
                        $zip = new ZipArchive;
                        if ($zip->open($file) === TRUE) 
                        {
@@ -233,6 +235,8 @@
                
                private function _un_rar($file, $dir)
                {
+                       @set_time_limit(5 * 60);
+                       
                        $archive = RarArchive::open($file);
                        $entries = $archive->getEntries();
                        foreach ($entries as $entry) {
@@ -248,35 +252,95 @@
                        rar_close($rar_file);*/
                }
                
+               /*
+               private function _upload_compresed_file()
+               {
+                       @set_time_limit(5 * 60);
+                       
+                       if (!$_FILES['compressed_file']['tmp_name'])
+                       {
+                               return false;
+                       }
+                       
+                       $path_file = 
$this->path_upload_dir.$_FILES['compressed_file']['name'];
+                       
+                       if 
(!move_uploaded_file($_FILES['compressed_file']['tmp_name'], $path_file))
+                       {
+                               return false;
+                       }                       
+                       
+                       $info = pathinfo($path_file);
+                       $path_dir = $this->path_upload_dir.$info['filename'];
+                       
+                       if (is_dir($path_dir))
+                       {
+                               exec("rm -Rf '{$path_dir}'", $ret);
+                       }
+                       
+                       if ($info['extension'] == 'zip')
+                       {
+                               $this->_un_zip($path_file, $path_dir);
+                       } 
+                       else if ($info['extension'] == 'rar')
+                       {
+                               $this->_un_rar($path_file, $path_dir);
+                       }
+       
+
+                       return true;
+               }*/
+       
+               private function _uncompresed_file($file_name)
+               {
+                       $path_file = $this->path_upload_dir.$file_name;         
+                       $info = pathinfo($path_file);
+                       $path_dir = $this->path_upload_dir.$info['filename'];
+
+                       /*if (is_dir($path_dir))
+                       {
+                               exec("rm -Rf '{$path_dir}'", $ret);
+                       }*/
+                       
+                       if ($info['extension'] == 'zip')
+                       {
+                               $this->_un_zip($path_file, $path_dir);
+                       } 
+                       else if ($info['extension'] == 'rar')
+                       {
+                               $this->_un_rar($path_file, $path_dir);
+                       }
+       
+
+                       return true;
+               }
+               
+               
                private function _get_uploaded_files()
                {
-                       $file = 'Dokumentasjon.zip';
-                       $info = pathinfo($this->path_upload_dir.$file);
-                       $dir = $info['filename'];
+                       $compressed_file = 
phpgw::get_var('compressed_file_check');
+                       $compressed_file_name = 
phpgw::get_var('compressed_file_name');
                        
-                       if (is_dir($this->path_upload_dir.$dir))
+                       $dir_name = '';
+                       if ($compressed_file)
                        {
-                               $list_files  = 
$this->_get_dir_contents($this->path_upload_dir.$dir);
+                               $this->_uncompresed_file($compressed_file_name);
+                               
+                               $info = 
pathinfo($this->path_upload_dir.$compressed_file_name);
+                               $dir_name = $info['filename'];
                        }
-                       else if (is_file($this->path_upload_dir.$file))
+                       
+                       $list_files = array();
+                       
+                       if (is_dir($this->path_upload_dir.$dir_name))
                        {
-                               if ($info['extension'] == 'zip')
-                               {
-                                       
$this->_un_zip($this->path_upload_dir.$file, $this->path_upload_dir.$dir);
-                               } 
-                               else if ($info['extension'] == 'rar')
-                               {
-                                       
$this->_un_rar($this->path_upload_dir.$file, $this->path_upload_dir.$dir);
-                               }
-                               
-                               $list_files  = 
$this->_get_dir_contents($this->path_upload_dir.$dir);
-                       }       
+                               $list_files  = 
$this->_get_dir_contents($this->path_upload_dir.$dir_name);
+                       }
 
                        return $list_files;
                }
                
                private function _get_dir_contents($dir, &$results = array())
-               {
+               {                       
                        $content = scandir($dir);
                        $patrones = array('(\\/)', '(\\\\)', '(")');
                        $sustituciones = array('_', '_', '_');




reply via email to

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