fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15729]


From: nelson . guerra
Subject: [Fmsystem-commits] [15729]
Date: Sat, 24 Sep 2016 02:22:10 +0000 (UTC)

Revision: 15729
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15729
Author:   nelson224
Date:     2016-09-24 02:22:10 +0000 (Sat, 24 Sep 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-09-24 02:21:14 UTC (rev 15728)
+++ 
branches/dev-syncromind-2/property/inc/import/class.import_component_files.inc.php
  2016-09-24 02:22:10 UTC (rev 15729)
@@ -6,9 +6,69 @@
                {
                        $this->acl = & $GLOBALS['phpgw']->acl;
                        $this->db = & $GLOBALS['phpgw']->db;
-                       $this->tmp_upload_dir = 
'/var/lib/phpgw/syncromind/test/';
+                       $this->vfs = CreateObject('phpgwapi.vfs');
+                       
+                       $this->fakebase = '/temp_files_components';
+                       $this->tmp_upload_dir = 
$GLOBALS['phpgw_info']['server']['files_dir'].$this->fakebase.'/';
                }
                
+               public function get_upload_dir()
+               {
+                       return $this->tmp_upload_dir;
+               }
+               
+               public function check_upload_dir()
+               {
+                       $rs = $this->create_document_dir();
+                       if (!$rs)
+                       {
+                               $receipt['error'] = lang('failed to create 
directory') . ' :' . $this->fakebase;
+                       }
+                       
+                       if(!$this->vfs->acl_check(array(
+                                       'string'        => $this->fakebase,
+                                       'relatives'     => array(32),
+                                       'operation'     => PHPGW_ACL_READ
+                               ))
+                               && !$this->vfs->acl_check(array(
+                                       'string'        => $this->fakebase,
+                                       'relatives'     => array(32),
+                                       'operation'     => PHPGW_ACL_DELETE
+                               ))
+                       )
+                       {
+                               $receipt['error'] = lang('Not have permission 
to access the directory') . ' :' . $this->fakebase;
+                       }
+                               
+                       return $receipt;
+               }
+               
+               public function create_document_dir()
+               {
+                       $receipt = true;
+                       
+                       if (!$this->vfs->file_exists(array(
+                                       'string' => $this->fakebase,
+                                       'relatives' => array(RELATIVE_NONE)
+                               )))
+                       {
+                               $this->vfs->override_acl = 1;
+                               if (!$this->vfs->mkdir(array(
+                                               'string' => $this->fakebase,
+                                               'relatives' => array(
+                                                       RELATIVE_NONE
+                                               )
+                                       )))
+                               {
+                                       $receipt = false;
+                               }
+                               
+                               $this->vfs->override_acl = 0;
+                       }
+
+                       return $receipt;
+               }
+               
                private function _valid_row($row)
                {
                        if (empty($row[0]) && empty($row[(count($row)-1)]))




reply via email to

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