Changeset 4915 for branches/2.2/filemanager/inc/after_upload.php
- Timestamp:
- 08/09/11 17:14:05 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/filemanager/inc/after_upload.php
r3610 r4915 21 21 include_once("../../header.inc.php"); 22 22 23 24 function 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 23 44 $bo = CreateObject('filemanager.bofilemanager'); 24 45 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 ))) 46 foreach ($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) ) 31 67 { 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))); 40 69 } 70 } 41 71 } 42 72
Note: See TracChangeset
for help on using the changeset viewer.