1 | <?php
|
---|
2 | session_id($_COOKIE['jupload']);
|
---|
3 | session_start();
|
---|
4 | $files = $_SESSION['juvar.files'];
|
---|
5 | unset($_SESSION['juvar.files']);
|
---|
6 | session_write_close();
|
---|
7 |
|
---|
8 | include_once("../../header.session.inc.php");
|
---|
9 |
|
---|
10 | $GLOBALS['phpgw_info']['flags'] = array
|
---|
11 | (
|
---|
12 | 'currentapp' => 'filemanager',
|
---|
13 | 'noheader' => True,
|
---|
14 | 'nonavbar' => True,
|
---|
15 | 'nofooter' => True,
|
---|
16 | 'noappheader' => True,
|
---|
17 | 'enable_browser_class' => True
|
---|
18 | );
|
---|
19 |
|
---|
20 |
|
---|
21 | include_once("../../header.inc.php");
|
---|
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 |
|
---|
44 | $bo = CreateObject('filemanager.bofilemanager');
|
---|
45 |
|
---|
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) )
|
---|
67 | {
|
---|
68 | exec("rm -f ".escapeshellcmd(escapeshellarg($fullName)));
|
---|
69 | }
|
---|
70 | }
|
---|
71 | }
|
---|
72 |
|
---|
73 | echo "<script type='text/javascript' src='../js/after_upload.js'></script>";
|
---|
74 |
|
---|
75 | ?> |
---|