Ignore:
Timestamp:
08/09/11 17:14:05 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #2199 - Corrigido bug para criar e mover arquivos dentro do filemanager

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/filemanager/inc/after_upload.php

    r3610 r4915  
    2121include_once("../../header.inc.php"); 
    2222 
     23 
     24function convert_char( $String ) 
     25{ 
     26                $String = trim( str_replace( "\'", "", $String) ); 
     27                $String = str_replace( "'", "", $String ); 
     28                $String = str_replace( "ç", "c", $String ); 
     29                $String = str_replace( "Ç", "C", $String ); 
     30                $String = ereg_replace( "[áàâã]", "a", $String ); 
     31                $String = ereg_replace( "[ÁÀÂÃ]", "A", $String ); 
     32                $String = ereg_replace( "[éÚê]", "e", $String ); 
     33                $String = ereg_replace( "[ÉÈÊ]", "E", $String ); 
     34                $String = ereg_replace( "[íìîï]", "i", $String ); 
     35                $String = ereg_replace( "[ÍÌÎ]", "I", $String ); 
     36                $String = ereg_replace( "[óòÎõ]", "o", $String ); 
     37                $String = ereg_replace( "[ÓÒÔÕ]", "O", $String ); 
     38                $String = ereg_replace( "[úùû]", "u", $String ); 
     39                $String = ereg_replace( "[ÚÙÛ]", "U", $String ); 
     40                 
     41                return $String; 
     42} 
     43 
    2344$bo = CreateObject('filemanager.bofilemanager'); 
    2445 
    25 foreach ($files as $f) { 
    26                 if ($bo->vfs->cp(array( 
    27                         'from'=> $f['fullName'], 
    28                         'to'=> $f['name'], 
    29                         'relatives'     => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 
    30                 ))) 
     46foreach ($files as $f) 
     47{ 
     48        $newName = convert_char( $f['name'] ); 
     49         
     50        $_array = array( 
     51                        'from'          => $f['fullName'], 
     52                        'to'            => $newName, 
     53                        'relatives'     => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 
     54        ); 
     55         
     56        if ( $bo->vfs->cp($_array) ) 
     57        { 
     58                $bo->vfs->set_attributes(array( 
     59                        'string'                => $newName, 
     60                        'relatives'             => array( RELATIVE_ALL ), 
     61                        'attributes'    => array( 'mime_type' => $f['mimetype'] ) 
     62                )); 
     63                 
     64                $fullName = $f['fullName']; 
     65                 
     66                if( file_exists($fullName) ) 
    3167                { 
    32                                 $bo->vfs->set_attributes(array( 
    33                                 'string'=> $f['name'], 
    34                                 'relatives'     => array(RELATIVE_ALL), 
    35                                 'attributes'=> array( 
    36                                 'mime_type' => $f['mimetype'] 
    37                                 ) 
    38                         )); 
    39                         exec("rm -f ".escapeshellcmd(escapeshellarg($f['fullName']))); 
     68                        exec("rm -f ".escapeshellcmd(escapeshellarg($fullName))); 
    4069                } 
     70        } 
    4171} 
    4272 
Note: See TracChangeset for help on using the changeset viewer.