Changeset 12042 for trunk/wp-admin/includes/class-pclzip.php
- Timestamp:
- 10/15/2009 08:26:21 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/class-pclzip.php (modified) (97 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-pclzip.php
r11993 r12042 30 30 define( 'PCLZIP_READ_BLOCK_SIZE', 2048 ); 31 31 } 32 32 33 33 // ----- File list separator 34 34 // In version 1.x of PclZip, the separator for file list is a space … … 69 69 // ----- Optional threshold ratio for use of temporary files 70 70 // Pclzip sense the size of the file to add/extract and decide to 71 // use or not temporary file. The algorythm is looking for 71 // use or not temporary file. The algorythm is looking for 72 72 // memory_limit of PHP and apply a ratio. 73 73 // threshold = memory_limit * ratio. … … 153 153 define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 ); 154 154 define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias 155 155 156 156 // ----- File description attributes 157 157 define( 'PCLZIP_ATT_FILE_NAME', 79001 ); … … 199 199 var $error_code = 1; 200 200 var $error_string = ''; 201 201 202 202 // ----- Current status of the magic_quotes_runtime 203 203 // This value store the php configuration for magic_quotes … … 333 333 } 334 334 } 335 335 336 336 // ----- Look for default option values 337 337 $this->privOptionDefaultThreshold($v_options); … … 342 342 $v_filedescr_list = array(); 343 343 $p_result_list = array(); 344 344 345 345 // ----- Look if the $p_filelist is really an array 346 346 if (is_array($p_filelist)) { 347 347 348 348 // ----- Look if the first element is also an array 349 349 // This will mean that this is a file description entry … … 351 351 $v_att_list = $p_filelist; 352 352 } 353 353 354 354 // ----- The list is a list of string names 355 355 else { … … 369 369 return 0; 370 370 } 371 371 372 372 // ----- Reformat the string list 373 373 if (sizeof($v_string_list) != 0) { … … 380 380 } 381 381 } 382 382 383 383 // ----- For each file in the list check the attributes 384 384 $v_supported_attributes … … 529 529 $v_filedescr_list = array(); 530 530 $p_result_list = array(); 531 531 532 532 // ----- Look if the $p_filelist is really an array 533 533 if (is_array($p_filelist)) { 534 534 535 535 // ----- Look if the first element is also an array 536 536 // This will mean that this is a file description entry … … 538 538 $v_att_list = $p_filelist; 539 539 } 540 540 541 541 // ----- The list is a list of string names 542 542 else { … … 556 556 return 0; 557 557 } 558 558 559 559 // ----- Reformat the string list 560 560 if (sizeof($v_string_list) != 0) { … … 563 563 } 564 564 } 565 565 566 566 // ----- For each file in the list check the attributes 567 567 $v_supported_attributes … … 997 997 // PCLZIP_OPT_BY_INDEX : 998 998 // PCLZIP_OPT_BY_NAME : 999 // PCLZIP_OPT_BY_EREG : 999 // PCLZIP_OPT_BY_EREG : 1000 1000 // PCLZIP_OPT_BY_PREG : 1001 1001 // Return Values : … … 1065 1065 function deleteByIndex($p_index) 1066 1066 { 1067 1067 1068 1068 $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); 1069 1069 … … 1115 1115 { 1116 1116 $this->privSwapBackMagicQuotes(); 1117 1117 1118 1118 // ----- Error log 1119 1119 PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); … … 1427 1427 { 1428 1428 $v_result=1; 1429 1429 1430 1430 // ----- Read the options 1431 1431 $i=0; … … 1467 1467 return PclZip::errorCode(); 1468 1468 } 1469 1469 1470 1470 // ----- Check for incompatible options 1471 1471 if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { … … 1473 1473 return PclZip::errorCode(); 1474 1474 } 1475 1475 1476 1476 // ----- Check the value 1477 1477 $v_value = $p_options_list[$i+1]; … … 1492 1492 return PclZip::errorCode(); 1493 1493 } 1494 1494 1495 1495 $v_result_list[$p_options_list[$i]] = true; 1496 1496 break; … … 1507 1507 return PclZip::errorCode(); 1508 1508 } 1509 1509 1510 1510 $v_result_list[$p_options_list[$i]] = true; 1511 1511 break; … … 1656 1656 return PclZip::errorCode(); 1657 1657 } 1658 1658 1659 1659 // ----- Reduce the index list 1660 1660 // each index item in the list must be a couple with a start and … … 1667 1667 $v_item_list = explode("-", $v_work_list[$j]); 1668 1668 $v_size_item_list = sizeof($v_item_list); 1669 1669 1670 1670 // ----- TBC : Here we might check that each item is a 1671 1671 // real integer ... 1672 1672 1673 1673 // ----- Look for single value 1674 1674 if ($v_size_item_list == 1) { … … 1704 1704 $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start']; 1705 1705 } 1706 1706 1707 1707 // ----- Sort the items 1708 1708 if ($v_sort_flag) { … … 1807 1807 } 1808 1808 } 1809 1809 1810 1810 // ----- Look for default values 1811 1811 if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { 1812 1812 1813 1813 } 1814 1814 … … 1827 1827 { 1828 1828 $v_result=1; 1829 1829 1830 1830 if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) 1831 1831 || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { 1832 1832 return $v_result; 1833 1833 } 1834 1834 1835 1835 // ----- Get 'memory_limit' configuration value 1836 1836 $v_memory_limit = ini_get('memory_limit'); 1837 1837 $v_memory_limit = trim($v_memory_limit); 1838 1838 $last = strtolower(substr($v_memory_limit, -1)); 1839 1839 1840 1840 if($last == 'g') 1841 1841 //$v_memory_limit = $v_memory_limit*1024*1024*1024; … … 1846 1846 if($last == 'k') 1847 1847 $v_memory_limit = $v_memory_limit*1024; 1848 1848 1849 1849 $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO); 1850 1850 1851 1851 1852 1852 // ----- Sanity check : No threshold if value lower than 1M … … 1854 1854 unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); 1855 1855 } 1856 1856 1857 1857 // ----- Return 1858 1858 return $v_result; … … 1871 1871 { 1872 1872 $v_result=1; 1873 1873 1874 1874 // ----- For each file in the list check the attributes 1875 1875 foreach ($p_file_list as $v_key => $v_value) { 1876 1876 1877 1877 // ----- Check if the option is supported 1878 1878 if (!isset($v_requested_options[$v_key])) { … … 1893 1893 1894 1894 $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); 1895 1895 1896 1896 if ($p_filedescr['filename'] == '') { 1897 1897 PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'"); … … 1974 1974 } 1975 1975 } 1976 1976 1977 1977 // end foreach 1978 1978 } 1979 1979 1980 1980 // ----- Return 1981 1981 return $v_result; … … 1990 1990 // just ignore the item. 1991 1991 // Then prepare the information that will be stored for that file. 1992 // When its a folder, expand the folder with all the files that are in that 1992 // When its a folder, expand the folder with all the files that are in that 1993 1993 // folder (recursively). 1994 1994 // Parameters : … … 2000 2000 { 2001 2001 $v_result=1; 2002 2002 2003 2003 // ----- Create a result list 2004 2004 $v_result_list = array(); 2005 2005 2006 2006 // ----- Look each entry 2007 2007 for ($i=0; $i<sizeof($p_filedescr_list); $i++) { 2008 2008 2009 2009 // ----- Get filedescr 2010 2010 $v_descr = $p_filedescr_list[$i]; 2011 2011 2012 2012 // ----- Reduce the filename 2013 2013 $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false); 2014 2014 $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']); 2015 2015 2016 2016 // ----- Look for real file or folder 2017 2017 if (file_exists($v_descr['filename'])) { … … 2031 2031 } 2032 2032 } 2033 2033 2034 2034 // ----- Look for string added as file 2035 2035 else if (isset($v_descr['content'])) { 2036 2036 $v_descr['type'] = 'virtual_file'; 2037 2037 } 2038 2038 2039 2039 // ----- Missing file 2040 2040 else { … … 2045 2045 return PclZip::errorCode(); 2046 2046 } 2047 2047 2048 2048 // ----- Calculate the stored filename 2049 2049 $this->privCalculateStoredFilename($v_descr, $p_options); 2050 2050 2051 2051 // ----- Add the descriptor in result list 2052 2052 $v_result_list[sizeof($v_result_list)] = $v_descr; 2053 2053 2054 2054 // ----- Look for folder 2055 2055 if ($v_descr['type'] == 'folder') { … … 2064 2064 continue; 2065 2065 } 2066 2066 2067 2067 // ----- Compose the full filename 2068 2068 $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler; 2069 2069 2070 2070 // ----- Look for different stored filename 2071 2071 // Because the name of the folder was changed, the name of the … … 2080 2080 } 2081 2081 } 2082 2082 2083 2083 $v_dirlist_nb++; 2084 2084 } 2085 2085 2086 2086 @closedir($v_folder_handler); 2087 2087 } … … 2089 2089 // TBC : unable to open folder in read mode 2090 2090 } 2091 2091 2092 2092 // ----- Expand each element of the list 2093 2093 if ($v_dirlist_nb != 0) { … … 2096 2096 return $v_result; 2097 2097 } 2098 2098 2099 2099 // ----- Concat the resulting list 2100 2100 $v_result_list = array_merge($v_result_list, $v_dirlist_descr); … … 2102 2102 else { 2103 2103 } 2104 2104 2105 2105 // ----- Free local array 2106 2106 unset($v_dirlist_descr); 2107 2107 } 2108 2108 } 2109 2109 2110 2110 // ----- Get the result list 2111 2111 $p_filedescr_list = $v_result_list; … … 2126 2126 $v_result=1; 2127 2127 $v_list_detail = array(); 2128 2128 2129 2129 // ----- Magic quotes trick 2130 2130 $this->privDisableMagicQuotes(); … … 2456 2456 // Description : 2457 2457 // Parameters : 2458 // $p_filedescr_list : An array containing the file description 2458 // $p_filedescr_list : An array containing the file description 2459 2459 // or directory names to add in the zip 2460 2460 // $p_result_list : list of added files with their properties (specially the status field) … … 2474 2474 $p_filedescr_list[$j]['filename'] 2475 2475 = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); 2476 2476 2477 2477 2478 2478 // ----- Skip empty file names … … 2526 2526 { 2527 2527 $v_result=1; 2528 2528 2529 2529 // ----- Working variable 2530 2530 $p_filename = $p_filedescr['filename']; … … 2538 2538 return PclZip::errorCode(); 2539 2539 } 2540 2541 // ----- Look for a stored different filename 2540 2541 // ----- Look for a stored different filename 2542 2542 /* TBC : Removed 2543 2543 if (isset($p_filedescr['stored_filename'])) { … … 2574 2574 $p_header['size'] = filesize($p_filename); 2575 2575 } 2576 2576 2577 2577 // ----- Look for regular folder 2578 2578 else if ($p_filedescr['type']=='folder') { … … 2581 2581 $p_header['size'] = filesize($p_filename); 2582 2582 } 2583 2583 2584 2584 // ----- Look for virtual file 2585 2585 else if ($p_filedescr['type'] == 'virtual_file') { … … 2587 2587 $p_header['size'] = strlen($p_filedescr['content']); 2588 2588 } 2589 2589 2590 2590 2591 2591 // ----- Look for filetime … … 2638 2638 $p_header['status'] = "filtered"; 2639 2639 } 2640 2640 2641 2641 // ----- Check the path length 2642 2642 if (strlen($p_header['stored_filename']) > 0xFF) { … … 2650 2650 if ($p_filedescr['type'] == 'file') { 2651 2651 // ----- Look for using temporary file to zip 2652 if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 2652 if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 2653 2653 && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) 2654 2654 || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) … … 2659 2659 } 2660 2660 } 2661 2661 2662 2662 // ----- Use "in memory" zip algo 2663 2663 else { … … 2677 2677 // ----- Calculate the CRC 2678 2678 $p_header['crc'] = @crc32($v_content); 2679 2679 2680 2680 // ----- Look for no compression 2681 2681 if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { … … 2684 2684 $p_header['compression'] = 0; 2685 2685 } 2686 2686 2687 2687 // ----- Look for normal compression 2688 2688 else { … … 2694 2694 $p_header['compression'] = 8; 2695 2695 } 2696 2696 2697 2697 // ----- Call the header generation 2698 2698 if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { … … 2710 2710 // ----- Look for a virtual file (a file from string) 2711 2711 else if ($p_filedescr['type'] == 'virtual_file') { 2712 2712 2713 2713 $v_content = $p_filedescr['content']; 2714 2714 2715 2715 // ----- Calculate the CRC 2716 2716 $p_header['crc'] = @crc32($v_content); 2717 2717 2718 2718 // ----- Look for no compression 2719 2719 if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { … … 2722 2722 $p_header['compression'] = 0; 2723 2723 } 2724 2724 2725 2725 // ----- Look for normal compression 2726 2726 else { … … 2732 2732 $p_header['compression'] = 8; 2733 2733 } 2734 2734 2735 2735 // ----- Call the header generation 2736 2736 if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { … … 2797 2797 { 2798 2798 $v_result=PCLZIP_ERR_NO_ERROR; 2799 2799 2800 2800 // ----- Working variable 2801 2801 $p_filename = $p_filedescr['filename']; … … 2892 2892 // ----- Unlink the temporary file 2893 2893 @unlink($v_gzip_temp_name); 2894 2894 2895 2895 // ----- Return 2896 2896 return $v_result; … … 2909 2909 { 2910 2910 $v_result=1; 2911 2911 2912 2912 // ----- Working variables 2913 2913 $p_filename = $p_filedescr['filename']; … … 2937 2937 $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']); 2938 2938 } 2939 2939 2940 2940 // ----- Look for path and/or short name change 2941 2941 else { … … 2967 2967 if ( (substr($p_filename, 0, 2) == "./") 2968 2968 || (substr($p_remove_dir, 0, 2) == "./")) { 2969 2969 2970 2970 if ( (substr($p_filename, 0, 2) == "./") 2971 2971 && (substr($p_remove_dir, 0, 2) != "./")) { … … 2990 2990 } 2991 2991 } 2992 2992 2993 2993 // ----- Remove drive letter if any 2994 2994 $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename); 2995 2995 2996 2996 // ----- Look for path to add 2997 2997 if ($p_add_dir != "") { … … 3006 3006 $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); 3007 3007 $p_filedescr['stored_filename'] = $v_stored_filename; 3008 3008 3009 3009 // ----- Return 3010 3010 return $v_result; … … 3157 3157 // ----- Magic quotes trick 3158 3158 $this->privSwapBackMagicQuotes(); 3159 3159 3160 3160 // ----- Error log 3161 3161 PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); … … 3388 3388 // ----- Look for extract by ereg rule 3389 3389 // ereg() is deprecated with PHP 5.3 3390 /* 3390 /* 3391 3391 else if ( (isset($p_options[PCLZIP_OPT_BY_EREG])) 3392 3392 && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { … … 3410 3410 else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) 3411 3411 && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { 3412 3412 3413 3413 // ----- Look if the index is in the list 3414 3414 for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { … … 3443 3443 3444 3444 $this->privSwapBackMagicQuotes(); 3445 3445 3446 3446 PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, 3447 3447 "Filename '".$v_header['stored_filename']."' is " … … 3452 3452 } 3453 3453 } 3454 3454 3455 3455 // ----- Check encrypted files 3456 3456 if (($v_extract) && (($v_header['flag'] & 1) == 1)) { … … 3484 3484 $v_extract = false; 3485 3485 } 3486 3486 3487 3487 // ----- Look for real extraction 3488 3488 if ($v_extract) … … 3533 3533 // ----- Next extracted file 3534 3534 $v_nb_extracted++; 3535 3535 3536 3536 // ----- Look for user callback abort 3537 3537 if ($v_result1 == 2) { … … 3669 3669 $p_entry['filename'] = $p_path."/".$p_entry['filename']; 3670 3670 } 3671 3671 3672 3672 // ----- Check a base_dir_restriction 3673 3673 if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { 3674 3674 $v_inclusion 3675 3675 = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], 3676 $p_entry['filename']); 3676 $p_entry['filename']); 3677 3677 if ($v_inclusion == 0) { 3678 3678 … … 3701 3701 $v_result = 1; 3702 3702 } 3703 3703 3704 3704 // ----- Look for abort result 3705 3705 if ($v_result == 2) { … … 3728 3728 // ----- Change the file status 3729 3729 $p_entry['status'] = "already_a_directory"; 3730 3730 3731 3731 // ----- Look for PCLZIP_OPT_STOP_ON_ERROR 3732 3732 // For historical reason first PclZip implementation does not stop … … 3801 3801 3802 3802 if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { 3803 3803 3804 3804 // ----- Change the file status 3805 3805 $p_entry['status'] = "path_creation_fail"; 3806 3806 3807 3807 // ----- Return 3808 3808 //return $v_result; … … 3843 3843 @fwrite($v_dest_file, $v_binary_data, $v_read_size); 3844 3844 */ 3845 @fwrite($v_dest_file, $v_buffer, $v_read_size); 3845 @fwrite($v_dest_file, $v_buffer, $v_read_size); 3846 3846 $v_size -= $v_read_size; 3847 3847 } … … 3852 3852 // ----- Change the file mtime 3853 3853 touch($p_entry['filename'], $p_entry['mtime']); 3854 3854 3855 3855 3856 3856 } … … 3865 3865 3866 3866 // ----- Look for using temporary file to unzip 3867 if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 3867 if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 3868 3868 && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) 3869 3869 || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) … … 3874 3874 } 3875 3875 } 3876 3876 3877 3877 // ----- Look for extract in memory 3878 3878 else { 3879 3879 3880 3880 3881 3881 // ----- Read the compressed file in a buffer (one shot) 3882 3882 $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); 3883 3883 3884 3884 // ----- Decompress the file 3885 3885 $v_file_content = @gzinflate($v_buffer); 3886 3886 unset($v_buffer); 3887 3887 if ($v_file_content === FALSE) { 3888 3888 3889 3889 // ----- Change the file status 3890 3890 // TBC 3891 3891 $p_entry['status'] = "error"; 3892 3892 3893 3893 return $v_result; 3894 3894 } 3895 3895 3896 3896 // ----- Opening destination file 3897 3897 if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { 3898 3898 3899 3899 // ----- Change the file status 3900 3900 $p_entry['status'] = "write_error"; 3901 3901 3902 3902 return $v_result; 3903 3903 } 3904 3904 3905 3905 // ----- Write the uncompressed data 3906 3906 @fwrite($v_dest_file, $v_file_content, $p_entry['size']); 3907 3907 unset($v_file_content); 3908 3908 3909 3909 // ----- Closing the destination file 3910 3910 @fclose($v_dest_file); 3911 3911 3912 3912 } 3913 3913 … … 3930 3930 $p_entry['status'] = "skipped"; 3931 3931 } 3932 3932 3933 3933 // ----- Look for post-extract callback 3934 3934 elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { … … 3963 3963 { 3964 3964 $v_result=1; 3965 3965 3966 3966 // ----- Creates a temporary file 3967 3967 $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz'; … … 4024 4024 // ----- Delete the temporary file 4025 4025 @unlink($v_gzip_temp_name); 4026 4026 4027 4027 // ----- Return 4028 4028 return $v_result; … … 4102 4102 // ----- Read the compressed file in a buffer (one shot) 4103 4103 $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); 4104 4104 4105 4105 // ----- Decompress the file 4106 4106 $v_file_content = gzinflate($v_buffer); … … 4181 4181 $v_result = 1; 4182 4182 } 4183 4183 4184 4184 // ----- Look for abort result 4185 4185 if ($v_result == 2) { … … 4203 4203 // if ($p_entry['compressed_size'] == $p_entry['size']) 4204 4204 if ($p_entry['compression'] == 0) { 4205 4205 4206 4206 // ----- Reading the file 4207 4207 $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); 4208 4208 } 4209 4209 else { 4210 4210 4211 4211 // ----- Reading the file 4212 4212 $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); 4213 4213 4214 4214 // ----- Decompress the file 4215 4215 if (($p_string = @gzinflate($v_data)) === FALSE) { … … 4217 4217 } 4218 4218 } 4219 4219 4220 4220 // ----- Trace 4221 4221 } … … 4223 4223 // TBC : error : can not extract a folder in a string 4224 4224 } 4225 4225 4226 4226 } 4227 4227 … … 4230 4230 $p_entry['status'] = "skipped"; 4231 4231 } 4232 4232 4233 4233 // ----- Look for post-extract callback 4234 4234 elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { … … 4237 4237 $v_local_header = array(); 4238 4238 $this->privConvertHeader2FileInfo($p_entry, $v_local_header); 4239 4239 4240 4240 // ----- Swap the content to header 4241 4241 $v_local_header['content'] = $p_string; … … 4497 4497 if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { 4498 4498 } 4499 4499 4500 4500 // ----- Look for flag bit 3 4501 4501 if (($p_local_header['flag'] & 8) == 8) { … … 4583 4583 // ----- Add the byte 4584 4584 //$v_bytes = ($v_bytes << 8) | Ord($v_byte); 4585 // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number 4586 // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. 4587 $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); 4585 // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number 4586 // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. 4587 $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); 4588 4588 4589 4589 // ----- Compare the bytes … … 4863 4863 return $v_result; 4864 4864 } 4865 4865 4866 4866 // ----- Check that local file header is same as central file header 4867 4867 if ($this->privCheckFileHeaders($v_local_header, … … 4947 4947 //@rename($v_zip_temp_name, $this->zipname); 4948 4948 PclZipUtilRename($v_zip_temp_name, $this->zipname); 4949 4949 4950 4950 // ----- Destroy the temporary archive 4951 4951 unset($v_temp_zip); 4952 4952 } 4953 4953 4954 4954 // ----- Remove every files : reset the file 4955 4955 else if ($v_central_dir['entries'] != 0) { … … 5438 5438 } 5439 5439 } 5440 5440 5441 5441 // ----- Look for skip 5442 5442 if ($v_skip > 0) { … … 5471 5471 { 5472 5472 $v_result = 1; 5473 5473 5474 5474 // ----- Look for path beginning by ./ 5475 5475 if ( ($p_dir == '.') … … 5639 5639 function PclZipUtilOptionText($p_option) 5640 5640 { 5641 5641 5642 5642 $v_list = get_defined_constants(); 5643 5643 for (reset($v_list); $v_key = key($v_list); next($v_list)) { … … 5650 5650 } 5651 5651 } 5652 5652 5653 5653 $v_result = 'Unknown'; 5654 5654
Note: See TracChangeset
for help on using the changeset viewer.