Changeset 3354:a9db771a5a70 for inc
- Timestamp:
- 10/05/16 17:14:00 (9 years ago)
- Branch:
- 2.10
- Children:
- 3357:9bbeb2691a23, 3358:8c3a4eda8e2b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.media.php
r3299 r3354 943 943 $zip = new fileUnzip($f->file); 944 944 $zip->setExcludePattern($this->exclude_pattern); 945 $ zip->getList(false,'#(^|/)(__MACOSX|\.svn|\.DS_Store|\.directory|Thumbs\.db)(/|$)#');945 $list = $zip->getList(false,'#(^|/)(__MACOSX|\.svn|\.DS_Store|\.directory|Thumbs\.db)(/|$)#'); 946 946 947 947 if ($create_dir) … … 968 968 $zip->unzipAll($target); 969 969 $zip->close(); 970 971 // Clean-up all extracted filenames 972 $clean = function ($name) { 973 $n = text::deaccent($name); 974 $n = preg_replace('/^[.]/u','',$n); 975 return preg_replace('/[^A-Za-z0-9._\-\/]/u','_',$n); 976 }; 977 foreach ($list as $zk => $zv) { 978 // Check if extracted file exists 979 $zf = $target.'/'.$zk; 980 if (!$zv['is_dir'] && file_exists($zf)) { 981 $zt = $clean($zf); 982 if ($zt != $zf) { 983 rename($zf,$zt); 984 } 985 } 986 } 987 970 988 return dirname($f->relname).'/'.$destination; 971 989 }
Note: See TracChangeset
for help on using the changeset viewer.