2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2010 */
\r
6 /* Inclusive Design Institute */
\r
8 /* This program is free software. You can redistribute it and/or */
\r
9 /* modify it under the terms of the GNU General Public License */
\r
10 /* as published by the Free Software Foundation. */
\r
11 /************************************************************************/
\r
14 * File utility functions
\r
16 * @author Cindy Qi Li
\r
19 if (!defined('TR_INCLUDE_PATH')) exit;
\r
22 * This function gets used by PclZip when creating a zip archive.
\r
24 * @return int whether or not to include the file
\r
25 * @author Joel Kronenberg
\r
27 function preImportCallBack($p_event, &$p_header) {
\r
28 global $IllegalExtentions;
\r
30 if ($p_header['folder'] == 1) {
\r
34 $path_parts = pathinfo($p_header['filename']);
\r
35 $ext = $path_parts['extension'];
\r
37 if (in_array($ext, $IllegalExtentions)) {
\r
45 * This function gets used by PclZip when extracting a zip archive.
\r
46 * @see file_manager/zip.php
\r
48 * @return int whether or not to include the file
\r
49 * @author Joel Kronenberg
\r
51 function preExtractCallBack($p_event, &$p_header) {
\r
52 global $translated_file_names;
\r
54 if ($p_header['folder'] == 1) {
\r
58 if ($translated_file_names[$p_header['index']] == '') {
\r
62 if ($translated_file_names[$p_header['index']]) {
\r
63 $p_header['filename'] = substr($p_header['filename'], 0, -strlen($p_header['stored_filename']));
\r
64 $p_header['filename'] .= $translated_file_names[$p_header['index']];
\r