Commit 96deb1602f89319ab7b6df597689bc2e7e29ddb2
1 parent
67a8fda4
Fixed line endings
Committed by: Megan Watson Reviewed by: Prince Mbekwa
Showing
1 changed file
with
87 additions
and
87 deletions
thirdparty/peclzip/pclzip.lib.php
| @@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
| 27 | 27 | ||
| 28 | // ----- Constants | 28 | // ----- Constants |
| 29 | define( 'PCLZIP_READ_BLOCK_SIZE', 2048 ); | 29 | define( 'PCLZIP_READ_BLOCK_SIZE', 2048 ); |
| 30 | - | 30 | + |
| 31 | // ----- File list separator | 31 | // ----- File list separator |
| 32 | // In version 1.x of PclZip, the separator for file list is a space | 32 | // In version 1.x of PclZip, the separator for file list is a space |
| 33 | // (which is not a very smart choice, specifically for windows paths !). | 33 | // (which is not a very smart choice, specifically for windows paths !). |
| @@ -126,7 +126,7 @@ | @@ -126,7 +126,7 @@ | ||
| 126 | // which is not correctly supported by PHP ... | 126 | // which is not correctly supported by PHP ... |
| 127 | //define( 'PCLZIP_OPT_CRYPT', 77018 ); | 127 | //define( 'PCLZIP_OPT_CRYPT', 77018 ); |
| 128 | define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 ); | 128 | define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 ); |
| 129 | - | 129 | + |
| 130 | // ----- File description attributes | 130 | // ----- File description attributes |
| 131 | define( 'PCLZIP_ATT_FILE_NAME', 79001 ); | 131 | define( 'PCLZIP_ATT_FILE_NAME', 79001 ); |
| 132 | define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 ); | 132 | define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 ); |
| @@ -169,7 +169,7 @@ | @@ -169,7 +169,7 @@ | ||
| 169 | // ----- Internal error handling | 169 | // ----- Internal error handling |
| 170 | var $error_code = 1; | 170 | var $error_code = 1; |
| 171 | var $error_string = ''; | 171 | var $error_string = ''; |
| 172 | - | 172 | + |
| 173 | // ----- Current status of the magic_quotes_runtime | 173 | // ----- Current status of the magic_quotes_runtime |
| 174 | // This value store the php configuration for magic_quotes | 174 | // This value store the php configuration for magic_quotes |
| 175 | // The class can then disable the magic_quotes and reset it after | 175 | // The class can then disable the magic_quotes and reset it after |
| @@ -315,16 +315,16 @@ | @@ -315,16 +315,16 @@ | ||
| 315 | $v_att_list = array(); | 315 | $v_att_list = array(); |
| 316 | $v_filedescr_list = array(); | 316 | $v_filedescr_list = array(); |
| 317 | $p_result_list = array(); | 317 | $p_result_list = array(); |
| 318 | - | 318 | + |
| 319 | // ----- Look if the $p_filelist is really an array | 319 | // ----- Look if the $p_filelist is really an array |
| 320 | if (is_array($p_filelist)) { | 320 | if (is_array($p_filelist)) { |
| 321 | - | 321 | + |
| 322 | // ----- Look if the first element is also an array | 322 | // ----- Look if the first element is also an array |
| 323 | // This will mean that this is a file description entry | 323 | // This will mean that this is a file description entry |
| 324 | if (isset($p_filelist[0]) && is_array($p_filelist[0])) { | 324 | if (isset($p_filelist[0]) && is_array($p_filelist[0])) { |
| 325 | $v_att_list = $p_filelist; | 325 | $v_att_list = $p_filelist; |
| 326 | } | 326 | } |
| 327 | - | 327 | + |
| 328 | // ----- The list is a list of string names | 328 | // ----- The list is a list of string names |
| 329 | else { | 329 | else { |
| 330 | $v_string_list = $p_filelist; | 330 | $v_string_list = $p_filelist; |
| @@ -343,7 +343,7 @@ | @@ -343,7 +343,7 @@ | ||
| 343 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0); | 343 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0); |
| 344 | return 0; | 344 | return 0; |
| 345 | } | 345 | } |
| 346 | - | 346 | + |
| 347 | // ----- Reformat the string list | 347 | // ----- Reformat the string list |
| 348 | if (sizeof($v_string_list) != 0) { | 348 | if (sizeof($v_string_list) != 0) { |
| 349 | foreach ($v_string_list as $v_string) { | 349 | foreach ($v_string_list as $v_string) { |
| @@ -355,7 +355,7 @@ | @@ -355,7 +355,7 @@ | ||
| 355 | } | 355 | } |
| 356 | } | 356 | } |
| 357 | } | 357 | } |
| 358 | - | 358 | + |
| 359 | // ----- For each file in the list check the attributes | 359 | // ----- For each file in the list check the attributes |
| 360 | $v_supported_attributes | 360 | $v_supported_attributes |
| 361 | = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' | 361 | = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' |
| @@ -505,16 +505,16 @@ | @@ -505,16 +505,16 @@ | ||
| 505 | $v_att_list = array(); | 505 | $v_att_list = array(); |
| 506 | $v_filedescr_list = array(); | 506 | $v_filedescr_list = array(); |
| 507 | $p_result_list = array(); | 507 | $p_result_list = array(); |
| 508 | - | 508 | + |
| 509 | // ----- Look if the $p_filelist is really an array | 509 | // ----- Look if the $p_filelist is really an array |
| 510 | if (is_array($p_filelist)) { | 510 | if (is_array($p_filelist)) { |
| 511 | - | 511 | + |
| 512 | // ----- Look if the first element is also an array | 512 | // ----- Look if the first element is also an array |
| 513 | // This will mean that this is a file description entry | 513 | // This will mean that this is a file description entry |
| 514 | if (isset($p_filelist[0]) && is_array($p_filelist[0])) { | 514 | if (isset($p_filelist[0]) && is_array($p_filelist[0])) { |
| 515 | $v_att_list = $p_filelist; | 515 | $v_att_list = $p_filelist; |
| 516 | } | 516 | } |
| 517 | - | 517 | + |
| 518 | // ----- The list is a list of string names | 518 | // ----- The list is a list of string names |
| 519 | else { | 519 | else { |
| 520 | $v_string_list = $p_filelist; | 520 | $v_string_list = $p_filelist; |
| @@ -533,14 +533,14 @@ | @@ -533,14 +533,14 @@ | ||
| 533 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0); | 533 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0); |
| 534 | return 0; | 534 | return 0; |
| 535 | } | 535 | } |
| 536 | - | 536 | + |
| 537 | // ----- Reformat the string list | 537 | // ----- Reformat the string list |
| 538 | if (sizeof($v_string_list) != 0) { | 538 | if (sizeof($v_string_list) != 0) { |
| 539 | foreach ($v_string_list as $v_string) { | 539 | foreach ($v_string_list as $v_string) { |
| 540 | $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; | 540 | $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; |
| 541 | } | 541 | } |
| 542 | } | 542 | } |
| 543 | - | 543 | + |
| 544 | // ----- For each file in the list check the attributes | 544 | // ----- For each file in the list check the attributes |
| 545 | $v_supported_attributes | 545 | $v_supported_attributes |
| 546 | = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' | 546 | = array ( PCLZIP_ATT_FILE_NAME => 'mandatory' |
| @@ -990,7 +990,7 @@ | @@ -990,7 +990,7 @@ | ||
| 990 | // Options : | 990 | // Options : |
| 991 | // PCLZIP_OPT_BY_INDEX : | 991 | // PCLZIP_OPT_BY_INDEX : |
| 992 | // PCLZIP_OPT_BY_NAME : | 992 | // PCLZIP_OPT_BY_NAME : |
| 993 | - // PCLZIP_OPT_BY_EREG : | 993 | + // PCLZIP_OPT_BY_EREG : |
| 994 | // PCLZIP_OPT_BY_PREG : | 994 | // PCLZIP_OPT_BY_PREG : |
| 995 | // Return Values : | 995 | // Return Values : |
| 996 | // 0 on failure, | 996 | // 0 on failure, |
| @@ -1065,7 +1065,7 @@ | @@ -1065,7 +1065,7 @@ | ||
| 1065 | function deleteByIndex($p_index) | 1065 | function deleteByIndex($p_index) |
| 1066 | { | 1066 | { |
| 1067 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'"); | 1067 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'"); |
| 1068 | - | 1068 | + |
| 1069 | $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); | 1069 | $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); |
| 1070 | 1070 | ||
| 1071 | // ----- Return | 1071 | // ----- Return |
| @@ -1119,7 +1119,7 @@ | @@ -1119,7 +1119,7 @@ | ||
| 1119 | if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) | 1119 | if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) |
| 1120 | { | 1120 | { |
| 1121 | $this->privSwapBackMagicQuotes(); | 1121 | $this->privSwapBackMagicQuotes(); |
| 1122 | - | 1122 | + |
| 1123 | // ----- Error log | 1123 | // ----- Error log |
| 1124 | PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); | 1124 | PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); |
| 1125 | 1125 | ||
| @@ -1448,7 +1448,7 @@ | @@ -1448,7 +1448,7 @@ | ||
| 1448 | { | 1448 | { |
| 1449 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", ""); | 1449 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", ""); |
| 1450 | $v_result=1; | 1450 | $v_result=1; |
| 1451 | - | 1451 | + |
| 1452 | // ----- Read the options | 1452 | // ----- Read the options |
| 1453 | $i=0; | 1453 | $i=0; |
| 1454 | while ($i<$p_size) { | 1454 | while ($i<$p_size) { |
| @@ -1645,7 +1645,7 @@ | @@ -1645,7 +1645,7 @@ | ||
| 1645 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo()); | 1645 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo()); |
| 1646 | return PclZip::errorCode(); | 1646 | return PclZip::errorCode(); |
| 1647 | } | 1647 | } |
| 1648 | - | 1648 | + |
| 1649 | // ----- Reduce the index list | 1649 | // ----- Reduce the index list |
| 1650 | // each index item in the list must be a couple with a start and | 1650 | // each index item in the list must be a couple with a start and |
| 1651 | // an end value : [0,3], [5-5], [8-10], ... | 1651 | // an end value : [0,3], [5-5], [8-10], ... |
| @@ -1656,10 +1656,10 @@ | @@ -1656,10 +1656,10 @@ | ||
| 1656 | // ----- Explode the item | 1656 | // ----- Explode the item |
| 1657 | $v_item_list = explode("-", $v_work_list[$j]); | 1657 | $v_item_list = explode("-", $v_work_list[$j]); |
| 1658 | $v_size_item_list = sizeof($v_item_list); | 1658 | $v_size_item_list = sizeof($v_item_list); |
| 1659 | - | 1659 | + |
| 1660 | // ----- TBC : Here we might check that each item is a | 1660 | // ----- TBC : Here we might check that each item is a |
| 1661 | // real integer ... | 1661 | // real integer ... |
| 1662 | - | 1662 | + |
| 1663 | // ----- Look for single value | 1663 | // ----- Look for single value |
| 1664 | if ($v_size_item_list == 1) { | 1664 | if ($v_size_item_list == 1) { |
| 1665 | // ----- Set the option value | 1665 | // ----- Set the option value |
| @@ -1697,7 +1697,7 @@ | @@ -1697,7 +1697,7 @@ | ||
| 1697 | } | 1697 | } |
| 1698 | $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start']; | 1698 | $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start']; |
| 1699 | } | 1699 | } |
| 1700 | - | 1700 | + |
| 1701 | // ----- Sort the items | 1701 | // ----- Sort the items |
| 1702 | if ($v_sort_flag) { | 1702 | if ($v_sort_flag) { |
| 1703 | // TBC : To Be Completed | 1703 | // TBC : To Be Completed |
| @@ -1829,10 +1829,10 @@ | @@ -1829,10 +1829,10 @@ | ||
| 1829 | { | 1829 | { |
| 1830 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", ""); | 1830 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", ""); |
| 1831 | $v_result=1; | 1831 | $v_result=1; |
| 1832 | - | 1832 | + |
| 1833 | // ----- For each file in the list check the attributes | 1833 | // ----- For each file in the list check the attributes |
| 1834 | foreach ($p_file_list as $v_key => $v_value) { | 1834 | foreach ($p_file_list as $v_key => $v_value) { |
| 1835 | - | 1835 | + |
| 1836 | // ----- Check if the option is supported | 1836 | // ----- Check if the option is supported |
| 1837 | if (!isset($v_requested_options[$v_key])) { | 1837 | if (!isset($v_requested_options[$v_key])) { |
| 1838 | // ----- Error log | 1838 | // ----- Error log |
| @@ -1854,7 +1854,7 @@ | @@ -1854,7 +1854,7 @@ | ||
| 1854 | 1854 | ||
| 1855 | $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); | 1855 | $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); |
| 1856 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'"); | 1856 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'"); |
| 1857 | - | 1857 | + |
| 1858 | if ($p_filedescr['filename'] == '') { | 1858 | if ($p_filedescr['filename'] == '') { |
| 1859 | PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'"); | 1859 | PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'"); |
| 1860 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo()); | 1860 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo()); |
| @@ -1922,10 +1922,10 @@ | @@ -1922,10 +1922,10 @@ | ||
| 1922 | } | 1922 | } |
| 1923 | } | 1923 | } |
| 1924 | } | 1924 | } |
| 1925 | - | 1925 | + |
| 1926 | // end foreach | 1926 | // end foreach |
| 1927 | } | 1927 | } |
| 1928 | - | 1928 | + |
| 1929 | // ----- Return | 1929 | // ----- Return |
| 1930 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); | 1930 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); |
| 1931 | return $v_result; | 1931 | return $v_result; |
| @@ -1944,21 +1944,21 @@ | @@ -1944,21 +1944,21 @@ | ||
| 1944 | { | 1944 | { |
| 1945 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", ""); | 1945 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", ""); |
| 1946 | $v_result=1; | 1946 | $v_result=1; |
| 1947 | - | 1947 | + |
| 1948 | // ----- Create a result list | 1948 | // ----- Create a result list |
| 1949 | $v_result_list = array(); | 1949 | $v_result_list = array(); |
| 1950 | - | 1950 | + |
| 1951 | // ----- Look each entry | 1951 | // ----- Look each entry |
| 1952 | for ($i=0; $i<sizeof($p_filedescr_list); $i++) { | 1952 | for ($i=0; $i<sizeof($p_filedescr_list); $i++) { |
| 1953 | // ----- Get filedescr | 1953 | // ----- Get filedescr |
| 1954 | $v_descr = $p_filedescr_list[$i]; | 1954 | $v_descr = $p_filedescr_list[$i]; |
| 1955 | - | 1955 | + |
| 1956 | // ----- Reduce the filename | 1956 | // ----- Reduce the filename |
| 1957 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'"); | 1957 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'"); |
| 1958 | $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename']); | 1958 | $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename']); |
| 1959 | $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']); | 1959 | $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']); |
| 1960 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'"); | 1960 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'"); |
| 1961 | - | 1961 | + |
| 1962 | // ----- Get type of descr | 1962 | // ----- Get type of descr |
| 1963 | if (!file_exists($v_descr['filename'])) { | 1963 | if (!file_exists($v_descr['filename'])) { |
| 1964 | // ----- Error log | 1964 | // ----- Error log |
| @@ -1987,13 +1987,13 @@ | @@ -1987,13 +1987,13 @@ | ||
| 1987 | // skip | 1987 | // skip |
| 1988 | continue; | 1988 | continue; |
| 1989 | } | 1989 | } |
| 1990 | - | 1990 | + |
| 1991 | // ----- Calculate the stored filename | 1991 | // ----- Calculate the stored filename |
| 1992 | $this->privCalculateStoredFilename($v_descr, $p_options); | 1992 | $this->privCalculateStoredFilename($v_descr, $p_options); |
| 1993 | - | 1993 | + |
| 1994 | // ----- Add the descriptor in result list | 1994 | // ----- Add the descriptor in result list |
| 1995 | $v_result_list[sizeof($v_result_list)] = $v_descr; | 1995 | $v_result_list[sizeof($v_result_list)] = $v_descr; |
| 1996 | - | 1996 | + |
| 1997 | // ----- Look for folder | 1997 | // ----- Look for folder |
| 1998 | if ($v_descr['type'] == 'folder') { | 1998 | if ($v_descr['type'] == 'folder') { |
| 1999 | // ----- List of items in folder | 1999 | // ----- List of items in folder |
| @@ -2007,17 +2007,17 @@ | @@ -2007,17 +2007,17 @@ | ||
| 2007 | if (($v_item_handler == '.') || ($v_item_handler == '..')) { | 2007 | if (($v_item_handler == '.') || ($v_item_handler == '..')) { |
| 2008 | continue; | 2008 | continue; |
| 2009 | } | 2009 | } |
| 2010 | - | 2010 | + |
| 2011 | // ----- Compose the full filename | 2011 | // ----- Compose the full filename |
| 2012 | $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler; | 2012 | $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler; |
| 2013 | - | 2013 | + |
| 2014 | // ----- Look for different stored filename | 2014 | // ----- Look for different stored filename |
| 2015 | // Because the name of the folder was changed, the name of the | 2015 | // Because the name of the folder was changed, the name of the |
| 2016 | // files/sub-folders also change | 2016 | // files/sub-folders also change |
| 2017 | if ($v_descr['stored_filename'] != $v_descr['filename']) { | 2017 | if ($v_descr['stored_filename'] != $v_descr['filename']) { |
| 2018 | $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler; | 2018 | $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler; |
| 2019 | } | 2019 | } |
| 2020 | - | 2020 | + |
| 2021 | $v_dirlist_nb++; | 2021 | $v_dirlist_nb++; |
| 2022 | } | 2022 | } |
| 2023 | } | 2023 | } |
| @@ -2025,7 +2025,7 @@ | @@ -2025,7 +2025,7 @@ | ||
| 2025 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped."); | 2025 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped."); |
| 2026 | // TBC : unable to open folder in read mode | 2026 | // TBC : unable to open folder in read mode |
| 2027 | } | 2027 | } |
| 2028 | - | 2028 | + |
| 2029 | // ----- Expand each element of the list | 2029 | // ----- Expand each element of the list |
| 2030 | if ($v_dirlist_nb != 0) { | 2030 | if ($v_dirlist_nb != 0) { |
| 2031 | // ----- Expand | 2031 | // ----- Expand |
| @@ -2033,7 +2033,7 @@ | @@ -2033,7 +2033,7 @@ | ||
| 2033 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); | 2033 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); |
| 2034 | return $v_result; | 2034 | return $v_result; |
| 2035 | } | 2035 | } |
| 2036 | - | 2036 | + |
| 2037 | // ----- Concat the resulting list | 2037 | // ----- Concat the resulting list |
| 2038 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')"); | 2038 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')"); |
| 2039 | $v_result_list = array_merge($v_result_list, $v_dirlist_descr); | 2039 | $v_result_list = array_merge($v_result_list, $v_dirlist_descr); |
| @@ -2042,12 +2042,12 @@ | @@ -2042,12 +2042,12 @@ | ||
| 2042 | else { | 2042 | else { |
| 2043 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand."); | 2043 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand."); |
| 2044 | } | 2044 | } |
| 2045 | - | 2045 | + |
| 2046 | // ----- Free local array | 2046 | // ----- Free local array |
| 2047 | unset($v_dirlist_descr); | 2047 | unset($v_dirlist_descr); |
| 2048 | } | 2048 | } |
| 2049 | } | 2049 | } |
| 2050 | - | 2050 | + |
| 2051 | // ----- Get the result list | 2051 | // ----- Get the result list |
| 2052 | $p_filedescr_list = $v_result_list; | 2052 | $p_filedescr_list = $v_result_list; |
| 2053 | 2053 | ||
| @@ -2068,7 +2068,7 @@ | @@ -2068,7 +2068,7 @@ | ||
| 2068 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list"); | 2068 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list"); |
| 2069 | $v_result=1; | 2069 | $v_result=1; |
| 2070 | $v_list_detail = array(); | 2070 | $v_list_detail = array(); |
| 2071 | - | 2071 | + |
| 2072 | // ----- Magic quotes trick | 2072 | // ----- Magic quotes trick |
| 2073 | $this->privDisableMagicQuotes(); | 2073 | $this->privDisableMagicQuotes(); |
| 2074 | 2074 | ||
| @@ -2429,7 +2429,7 @@ | @@ -2429,7 +2429,7 @@ | ||
| 2429 | // Function : privAddFileList() | 2429 | // Function : privAddFileList() |
| 2430 | // Description : | 2430 | // Description : |
| 2431 | // Parameters : | 2431 | // Parameters : |
| 2432 | - // $p_filedescr_list : An array containing the file description | 2432 | + // $p_filedescr_list : An array containing the file description |
| 2433 | // or directory names to add in the zip | 2433 | // or directory names to add in the zip |
| 2434 | // $p_result_list : list of added files with their properties (specially the status field) | 2434 | // $p_result_list : list of added files with their properties (specially the status field) |
| 2435 | // Return Values : | 2435 | // Return Values : |
| @@ -2449,7 +2449,7 @@ | @@ -2449,7 +2449,7 @@ | ||
| 2449 | // ----- Format the filename | 2449 | // ----- Format the filename |
| 2450 | $p_filedescr_list[$j]['filename'] | 2450 | $p_filedescr_list[$j]['filename'] |
| 2451 | = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); | 2451 | = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); |
| 2452 | - | 2452 | + |
| 2453 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'"); | 2453 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'"); |
| 2454 | 2454 | ||
| 2455 | // ----- Skip empty file names | 2455 | // ----- Skip empty file names |
| @@ -2503,7 +2503,7 @@ | @@ -2503,7 +2503,7 @@ | ||
| 2503 | { | 2503 | { |
| 2504 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'"); | 2504 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'"); |
| 2505 | $v_result=1; | 2505 | $v_result=1; |
| 2506 | - | 2506 | + |
| 2507 | // ----- Working variable | 2507 | // ----- Working variable |
| 2508 | $p_filename = $p_filedescr['filename']; | 2508 | $p_filename = $p_filedescr['filename']; |
| 2509 | 2509 | ||
| @@ -2516,8 +2516,8 @@ | @@ -2516,8 +2516,8 @@ | ||
| 2516 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo()); | 2516 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo()); |
| 2517 | return PclZip::errorCode(); | 2517 | return PclZip::errorCode(); |
| 2518 | } | 2518 | } |
| 2519 | - | ||
| 2520 | - // ----- Look for a stored different filename | 2519 | + |
| 2520 | + // ----- Look for a stored different filename | ||
| 2521 | if (isset($p_filedescr['stored_filename'])) { | 2521 | if (isset($p_filedescr['stored_filename'])) { |
| 2522 | $v_stored_filename = $p_filedescr['stored_filename']; | 2522 | $v_stored_filename = $p_filedescr['stored_filename']; |
| 2523 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"'); | 2523 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"'); |
| @@ -2583,7 +2583,7 @@ | @@ -2583,7 +2583,7 @@ | ||
| 2583 | if ($p_header['stored_filename'] == "") { | 2583 | if ($p_header['stored_filename'] == "") { |
| 2584 | $p_header['status'] = "filtered"; | 2584 | $p_header['status'] = "filtered"; |
| 2585 | } | 2585 | } |
| 2586 | - | 2586 | + |
| 2587 | // ----- Check the path length | 2587 | // ----- Check the path length |
| 2588 | if (strlen($p_header['stored_filename']) > 0xFF) { | 2588 | if (strlen($p_header['stored_filename']) > 0xFF) { |
| 2589 | $p_header['status'] = 'filename_too_long'; | 2589 | $p_header['status'] = 'filename_too_long'; |
| @@ -2630,13 +2630,13 @@ | @@ -2630,13 +2630,13 @@ | ||
| 2630 | $p_header['compressed_size'] = strlen($v_content_compressed); | 2630 | $p_header['compressed_size'] = strlen($v_content_compressed); |
| 2631 | $p_header['compression'] = 8; | 2631 | $p_header['compression'] = 8; |
| 2632 | } | 2632 | } |
| 2633 | - | 2633 | + |
| 2634 | // ----- Look for encryption | 2634 | // ----- Look for encryption |
| 2635 | /* | 2635 | /* |
| 2636 | if ((isset($p_options[PCLZIP_OPT_CRYPT])) | 2636 | if ((isset($p_options[PCLZIP_OPT_CRYPT])) |
| 2637 | && ($p_options[PCLZIP_OPT_CRYPT] != "")) { | 2637 | && ($p_options[PCLZIP_OPT_CRYPT] != "")) { |
| 2638 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File need to be crypted ...."); | 2638 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File need to be crypted ...."); |
| 2639 | - | 2639 | + |
| 2640 | // Should be a random header | 2640 | // Should be a random header |
| 2641 | $v_header = 'xxxxxxxxxxxx'; | 2641 | $v_header = 'xxxxxxxxxxxx'; |
| 2642 | $v_content_compressed = PclZipUtilZipEncrypt($v_content_compressed, | 2642 | $v_content_compressed = PclZipUtilZipEncrypt($v_content_compressed, |
| @@ -2644,10 +2644,10 @@ | @@ -2644,10 +2644,10 @@ | ||
| 2644 | $v_header, | 2644 | $v_header, |
| 2645 | $p_header['crc'], | 2645 | $p_header['crc'], |
| 2646 | "test"); | 2646 | "test"); |
| 2647 | - | 2647 | + |
| 2648 | $p_header['compressed_size'] += 12; | 2648 | $p_header['compressed_size'] += 12; |
| 2649 | $p_header['flag'] = 1; | 2649 | $p_header['flag'] = 1; |
| 2650 | - | 2650 | + |
| 2651 | // ----- Add the header to the data | 2651 | // ----- Add the header to the data |
| 2652 | $v_content_compressed = $v_header.$v_content_compressed; | 2652 | $v_content_compressed = $v_header.$v_content_compressed; |
| 2653 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size after header : ".strlen($v_content_compressed).""); | 2653 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size after header : ".strlen($v_content_compressed).""); |
| @@ -2662,9 +2662,9 @@ | @@ -2662,9 +2662,9 @@ | ||
| 2662 | } | 2662 | } |
| 2663 | 2663 | ||
| 2664 | // ----- Write the compressed (or not) content | 2664 | // ----- Write the compressed (or not) content |
| 2665 | - @fwrite($this->zip_fd, | 2665 | + @fwrite($this->zip_fd, |
| 2666 | $v_content_compressed, $p_header['compressed_size']); | 2666 | $v_content_compressed, $p_header['compressed_size']); |
| 2667 | - | 2667 | + |
| 2668 | // ----- Close the file | 2668 | // ----- Close the file |
| 2669 | @fclose($v_file); | 2669 | @fclose($v_file); |
| 2670 | } | 2670 | } |
| @@ -2730,7 +2730,7 @@ | @@ -2730,7 +2730,7 @@ | ||
| 2730 | { | 2730 | { |
| 2731 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'"); | 2731 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'"); |
| 2732 | $v_result=1; | 2732 | $v_result=1; |
| 2733 | - | 2733 | + |
| 2734 | // ----- Working variables | 2734 | // ----- Working variables |
| 2735 | $p_filename = $p_filedescr['filename']; | 2735 | $p_filename = $p_filedescr['filename']; |
| 2736 | if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { | 2736 | if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { |
| @@ -2757,7 +2757,7 @@ | @@ -2757,7 +2757,7 @@ | ||
| 2757 | $v_stored_filename = $p_filedescr['new_full_name']; | 2757 | $v_stored_filename = $p_filedescr['new_full_name']; |
| 2758 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'"); | 2758 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'"); |
| 2759 | } | 2759 | } |
| 2760 | - | 2760 | + |
| 2761 | // ----- Look for path and/or short name change | 2761 | // ----- Look for path and/or short name change |
| 2762 | else { | 2762 | else { |
| 2763 | 2763 | ||
| @@ -2788,7 +2788,7 @@ | @@ -2788,7 +2788,7 @@ | ||
| 2788 | 2788 | ||
| 2789 | if ( (substr($p_filename, 0, 2) == "./") | 2789 | if ( (substr($p_filename, 0, 2) == "./") |
| 2790 | || (substr($p_remove_dir, 0, 2) == "./")) { | 2790 | || (substr($p_remove_dir, 0, 2) == "./")) { |
| 2791 | - | 2791 | + |
| 2792 | if ( (substr($p_filename, 0, 2) == "./") | 2792 | if ( (substr($p_filename, 0, 2) == "./") |
| 2793 | && (substr($p_remove_dir, 0, 2) != "./")) { | 2793 | && (substr($p_remove_dir, 0, 2) != "./")) { |
| 2794 | $p_remove_dir = "./".$p_remove_dir; | 2794 | $p_remove_dir = "./".$p_remove_dir; |
| @@ -2828,7 +2828,7 @@ | @@ -2828,7 +2828,7 @@ | ||
| 2828 | $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); | 2828 | $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); |
| 2829 | $p_filedescr['stored_filename'] = $v_stored_filename; | 2829 | $p_filedescr['stored_filename'] = $v_stored_filename; |
| 2830 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename'])); | 2830 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename'])); |
| 2831 | - | 2831 | + |
| 2832 | // ----- Return | 2832 | // ----- Return |
| 2833 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); | 2833 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); |
| 2834 | return $v_result; | 2834 | return $v_result; |
| @@ -2991,7 +2991,7 @@ | @@ -2991,7 +2991,7 @@ | ||
| 2991 | { | 2991 | { |
| 2992 | // ----- Magic quotes trick | 2992 | // ----- Magic quotes trick |
| 2993 | $this->privSwapBackMagicQuotes(); | 2993 | $this->privSwapBackMagicQuotes(); |
| 2994 | - | 2994 | + |
| 2995 | // ----- Error log | 2995 | // ----- Error log |
| 2996 | PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); | 2996 | PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode'); |
| 2997 | 2997 | ||
| @@ -3270,7 +3270,7 @@ | @@ -3270,7 +3270,7 @@ | ||
| 3270 | else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) | 3270 | else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX])) |
| 3271 | && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { | 3271 | && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { |
| 3272 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'"); | 3272 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'"); |
| 3273 | - | 3273 | + |
| 3274 | // ----- Look if the index is in the list | 3274 | // ----- Look if the index is in the list |
| 3275 | for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { | 3275 | for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { |
| 3276 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]"); | 3276 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]"); |
| @@ -3310,7 +3310,7 @@ | @@ -3310,7 +3310,7 @@ | ||
| 3310 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped"); | 3310 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped"); |
| 3311 | 3311 | ||
| 3312 | $this->privSwapBackMagicQuotes(); | 3312 | $this->privSwapBackMagicQuotes(); |
| 3313 | - | 3313 | + |
| 3314 | PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, | 3314 | PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, |
| 3315 | "Filename '".$v_header['stored_filename']."' is " | 3315 | "Filename '".$v_header['stored_filename']."' is " |
| 3316 | ."compressed by an unsupported compression " | 3316 | ."compressed by an unsupported compression " |
| @@ -3320,7 +3320,7 @@ | @@ -3320,7 +3320,7 @@ | ||
| 3320 | return PclZip::errorCode(); | 3320 | return PclZip::errorCode(); |
| 3321 | } | 3321 | } |
| 3322 | } | 3322 | } |
| 3323 | - | 3323 | + |
| 3324 | // ----- Check encrypted files | 3324 | // ----- Check encrypted files |
| 3325 | if (($v_extract) && (($v_header['flag'] & 1) == 1)) { | 3325 | if (($v_extract) && (($v_header['flag'] & 1) == 1)) { |
| 3326 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption"); | 3326 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption"); |
| @@ -3357,7 +3357,7 @@ | @@ -3357,7 +3357,7 @@ | ||
| 3357 | 3357 | ||
| 3358 | $v_extract = false; | 3358 | $v_extract = false; |
| 3359 | } | 3359 | } |
| 3360 | - | 3360 | + |
| 3361 | // ----- Look for real extraction | 3361 | // ----- Look for real extraction |
| 3362 | if ($v_extract) | 3362 | if ($v_extract) |
| 3363 | { | 3363 | { |
| @@ -3411,7 +3411,7 @@ | @@ -3411,7 +3411,7 @@ | ||
| 3411 | 3411 | ||
| 3412 | // ----- Next extracted file | 3412 | // ----- Next extracted file |
| 3413 | $v_nb_extracted++; | 3413 | $v_nb_extracted++; |
| 3414 | - | 3414 | + |
| 3415 | // ----- Look for user callback abort | 3415 | // ----- Look for user callback abort |
| 3416 | if ($v_result1 == 2) { | 3416 | if ($v_result1 == 2) { |
| 3417 | break; | 3417 | break; |
| @@ -3563,13 +3563,13 @@ | @@ -3563,13 +3563,13 @@ | ||
| 3563 | if ($p_path != '') { | 3563 | if ($p_path != '') { |
| 3564 | $p_entry['filename'] = $p_path."/".$p_entry['filename']; | 3564 | $p_entry['filename'] = $p_path."/".$p_entry['filename']; |
| 3565 | } | 3565 | } |
| 3566 | - | 3566 | + |
| 3567 | // ----- Check a base_dir_restriction | 3567 | // ----- Check a base_dir_restriction |
| 3568 | if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { | 3568 | if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { |
| 3569 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction"); | 3569 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction"); |
| 3570 | $v_inclusion | 3570 | $v_inclusion |
| 3571 | = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], | 3571 | = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], |
| 3572 | - $p_entry['filename']); | 3572 | + $p_entry['filename']); |
| 3573 | if ($v_inclusion == 0) { | 3573 | if ($v_inclusion == 0) { |
| 3574 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction"); | 3574 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction"); |
| 3575 | 3575 | ||
| @@ -3599,7 +3599,7 @@ | @@ -3599,7 +3599,7 @@ | ||
| 3599 | $p_entry['status'] = "skipped"; | 3599 | $p_entry['status'] = "skipped"; |
| 3600 | $v_result = 1; | 3600 | $v_result = 1; |
| 3601 | } | 3601 | } |
| 3602 | - | 3602 | + |
| 3603 | // ----- Look for abort result | 3603 | // ----- Look for abort result |
| 3604 | if ($v_result == 2) { | 3604 | if ($v_result == 2) { |
| 3605 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction"); | 3605 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction"); |
| @@ -3631,7 +3631,7 @@ | @@ -3631,7 +3631,7 @@ | ||
| 3631 | 3631 | ||
| 3632 | // ----- Change the file status | 3632 | // ----- Change the file status |
| 3633 | $p_entry['status'] = "already_a_directory"; | 3633 | $p_entry['status'] = "already_a_directory"; |
| 3634 | - | 3634 | + |
| 3635 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR | 3635 | // ----- Look for PCLZIP_OPT_STOP_ON_ERROR |
| 3636 | // For historical reason first PclZip implementation does not stop | 3636 | // For historical reason first PclZip implementation does not stop |
| 3637 | // when this kind of error occurs. | 3637 | // when this kind of error occurs. |
| @@ -3764,7 +3764,7 @@ | @@ -3764,7 +3764,7 @@ | ||
| 3764 | $v_binary_data = pack('a'.$v_read_size, $v_buffer); | 3764 | $v_binary_data = pack('a'.$v_read_size, $v_buffer); |
| 3765 | @fwrite($v_dest_file, $v_binary_data, $v_read_size); | 3765 | @fwrite($v_dest_file, $v_binary_data, $v_read_size); |
| 3766 | */ | 3766 | */ |
| 3767 | - @fwrite($v_dest_file, $v_buffer, $v_read_size); | 3767 | + @fwrite($v_dest_file, $v_buffer, $v_read_size); |
| 3768 | $v_size -= $v_read_size; | 3768 | $v_size -= $v_read_size; |
| 3769 | } | 3769 | } |
| 3770 | 3770 | ||
| @@ -3773,7 +3773,7 @@ | @@ -3773,7 +3773,7 @@ | ||
| 3773 | 3773 | ||
| 3774 | // ----- Change the file mtime | 3774 | // ----- Change the file mtime |
| 3775 | touch($p_entry['filename'], $p_entry['mtime']); | 3775 | touch($p_entry['filename'], $p_entry['mtime']); |
| 3776 | - | 3776 | + |
| 3777 | 3777 | ||
| 3778 | } | 3778 | } |
| 3779 | else { | 3779 | else { |
| @@ -3786,11 +3786,11 @@ | @@ -3786,11 +3786,11 @@ | ||
| 3786 | // ----- Read the encryption header | 3786 | // ----- Read the encryption header |
| 3787 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 12 encryption header bytes"); | 3787 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 12 encryption header bytes"); |
| 3788 | $v_encryption_header = @fread($this->zip_fd, 12); | 3788 | $v_encryption_header = @fread($this->zip_fd, 12); |
| 3789 | - | 3789 | + |
| 3790 | // ----- Read the encrypted & compressed file in a buffer | 3790 | // ----- Read the encrypted & compressed file in a buffer |
| 3791 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".($p_entry['compressed_size']-12)."' compressed & encrypted bytes"); | 3791 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".($p_entry['compressed_size']-12)."' compressed & encrypted bytes"); |
| 3792 | $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']-12); | 3792 | $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']-12); |
| 3793 | - | 3793 | + |
| 3794 | // ----- Decrypt the buffer | 3794 | // ----- Decrypt the buffer |
| 3795 | $this->privDecrypt($v_encryption_header, $v_buffer, | 3795 | $this->privDecrypt($v_encryption_header, $v_buffer, |
| 3796 | $p_entry['compressed_size']-12, $p_entry['crc']); | 3796 | $p_entry['compressed_size']-12, $p_entry['crc']); |
| @@ -3802,7 +3802,7 @@ | @@ -3802,7 +3802,7 @@ | ||
| 3802 | // ----- Read the compressed file in a buffer (one shot) | 3802 | // ----- Read the compressed file in a buffer (one shot) |
| 3803 | $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); | 3803 | $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); |
| 3804 | } | 3804 | } |
| 3805 | - | 3805 | + |
| 3806 | // ----- Decompress the file | 3806 | // ----- Decompress the file |
| 3807 | $v_file_content = @gzinflate($v_buffer); | 3807 | $v_file_content = @gzinflate($v_buffer); |
| 3808 | unset($v_buffer); | 3808 | unset($v_buffer); |
| @@ -3812,11 +3812,11 @@ | @@ -3812,11 +3812,11 @@ | ||
| 3812 | // ----- Change the file status | 3812 | // ----- Change the file status |
| 3813 | // TBC | 3813 | // TBC |
| 3814 | $p_entry['status'] = "error"; | 3814 | $p_entry['status'] = "error"; |
| 3815 | - | 3815 | + |
| 3816 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); | 3816 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); |
| 3817 | return $v_result; | 3817 | return $v_result; |
| 3818 | } | 3818 | } |
| 3819 | - | 3819 | + |
| 3820 | // ----- Opening destination file | 3820 | // ----- Opening destination file |
| 3821 | if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { | 3821 | if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { |
| 3822 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode"); | 3822 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode"); |
| @@ -3855,7 +3855,7 @@ | @@ -3855,7 +3855,7 @@ | ||
| 3855 | if ($p_entry['status'] == "aborted") { | 3855 | if ($p_entry['status'] == "aborted") { |
| 3856 | $p_entry['status'] = "skipped"; | 3856 | $p_entry['status'] = "skipped"; |
| 3857 | } | 3857 | } |
| 3858 | - | 3858 | + |
| 3859 | // ----- Look for post-extract callback | 3859 | // ----- Look for post-extract callback |
| 3860 | elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { | 3860 | elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { |
| 3861 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction"); | 3861 | //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction"); |
| @@ -3964,7 +3964,7 @@ | @@ -3964,7 +3964,7 @@ | ||
| 3964 | 3964 | ||
| 3965 | // ----- Read the compressed file in a buffer (one shot) | 3965 | // ----- Read the compressed file in a buffer (one shot) |
| 3966 | $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); | 3966 | $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); |
| 3967 | - | 3967 | + |
| 3968 | // ----- Decompress the file | 3968 | // ----- Decompress the file |
| 3969 | $v_file_content = gzinflate($v_buffer); | 3969 | $v_file_content = gzinflate($v_buffer); |
| 3970 | unset($v_buffer); | 3970 | unset($v_buffer); |
| @@ -4053,7 +4053,7 @@ | @@ -4053,7 +4053,7 @@ | ||
| 4053 | 4053 | ||
| 4054 | // ----- Reading the file | 4054 | // ----- Reading the file |
| 4055 | $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); | 4055 | $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); |
| 4056 | - | 4056 | + |
| 4057 | // ----- Decompress the file | 4057 | // ----- Decompress the file |
| 4058 | if (($p_string = @gzinflate($v_data)) === FALSE) { | 4058 | if (($p_string = @gzinflate($v_data)) === FALSE) { |
| 4059 | // TBC | 4059 | // TBC |
| @@ -4803,7 +4803,7 @@ | @@ -4803,7 +4803,7 @@ | ||
| 4803 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); | 4803 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); |
| 4804 | return $v_result; | 4804 | return $v_result; |
| 4805 | } | 4805 | } |
| 4806 | - | 4806 | + |
| 4807 | // ----- Check that local file header is same as central file header | 4807 | // ----- Check that local file header is same as central file header |
| 4808 | if ($this->privCheckFileHeaders($v_local_header, | 4808 | if ($this->privCheckFileHeaders($v_local_header, |
| 4809 | $v_header_list[$i]) != 1) { | 4809 | $v_header_list[$i]) != 1) { |
| @@ -4896,11 +4896,11 @@ | @@ -4896,11 +4896,11 @@ | ||
| 4896 | // TBC : I should test the result ... | 4896 | // TBC : I should test the result ... |
| 4897 | //@rename($v_zip_temp_name, $this->zipname); | 4897 | //@rename($v_zip_temp_name, $this->zipname); |
| 4898 | PclZipUtilRename($v_zip_temp_name, $this->zipname); | 4898 | PclZipUtilRename($v_zip_temp_name, $this->zipname); |
| 4899 | - | 4899 | + |
| 4900 | // ----- Destroy the temporary archive | 4900 | // ----- Destroy the temporary archive |
| 4901 | unset($v_temp_zip); | 4901 | unset($v_temp_zip); |
| 4902 | } | 4902 | } |
| 4903 | - | 4903 | + |
| 4904 | // ----- Remove every files : reset the file | 4904 | // ----- Remove every files : reset the file |
| 4905 | else if ($v_central_dir['entries'] != 0) { | 4905 | else if ($v_central_dir['entries'] != 0) { |
| 4906 | $this->privCloseFd(); | 4906 | $this->privCloseFd(); |
| @@ -5315,13 +5315,13 @@ | @@ -5315,13 +5315,13 @@ | ||
| 5315 | { | 5315 | { |
| 5316 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDecrypt', "size=".$p_size.""); | 5316 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDecrypt', "size=".$p_size.""); |
| 5317 | $v_result=1; | 5317 | $v_result=1; |
| 5318 | - | 5318 | + |
| 5319 | // ----- To Be Modified ;-) | 5319 | // ----- To Be Modified ;-) |
| 5320 | $v_pwd = "test"; | 5320 | $v_pwd = "test"; |
| 5321 | - | 5321 | + |
| 5322 | $p_buffer = PclZipUtilZipDecrypt($p_buffer, $p_size, $p_encryption_header, | 5322 | $p_buffer = PclZipUtilZipDecrypt($p_buffer, $p_size, $p_encryption_header, |
| 5323 | $p_crc, $v_pwd); | 5323 | $p_crc, $v_pwd); |
| 5324 | - | 5324 | + |
| 5325 | // ----- Return | 5325 | // ----- Return |
| 5326 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); | 5326 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); |
| 5327 | return $v_result; | 5327 | return $v_result; |
| @@ -5471,7 +5471,7 @@ | @@ -5471,7 +5471,7 @@ | ||
| 5471 | } | 5471 | } |
| 5472 | } | 5472 | } |
| 5473 | } | 5473 | } |
| 5474 | - | 5474 | + |
| 5475 | // ----- Look for skip | 5475 | // ----- Look for skip |
| 5476 | if ($v_skip > 0) { | 5476 | if ($v_skip > 0) { |
| 5477 | while ($v_skip > 0) { | 5477 | while ($v_skip > 0) { |
| @@ -5506,7 +5506,7 @@ | @@ -5506,7 +5506,7 @@ | ||
| 5506 | { | 5506 | { |
| 5507 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'"); | 5507 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'"); |
| 5508 | $v_result = 1; | 5508 | $v_result = 1; |
| 5509 | - | 5509 | + |
| 5510 | // ----- Look for path beginning by ./ | 5510 | // ----- Look for path beginning by ./ |
| 5511 | if ( ($p_dir == '.') | 5511 | if ( ($p_dir == '.') |
| 5512 | || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { | 5512 | || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) { |
| @@ -5697,7 +5697,7 @@ | @@ -5697,7 +5697,7 @@ | ||
| 5697 | function PclZipUtilOptionText($p_option) | 5697 | function PclZipUtilOptionText($p_option) |
| 5698 | { | 5698 | { |
| 5699 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'"); | 5699 | //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'"); |
| 5700 | - | 5700 | + |
| 5701 | $v_list = get_defined_constants(); | 5701 | $v_list = get_defined_constants(); |
| 5702 | for (reset($v_list); $v_key = key($v_list); next($v_list)) { | 5702 | for (reset($v_list); $v_key = key($v_list); next($v_list)) { |
| 5703 | $v_prefix = substr($v_key, 0, 10); | 5703 | $v_prefix = substr($v_key, 0, 10); |
| @@ -5709,7 +5709,7 @@ | @@ -5709,7 +5709,7 @@ | ||
| 5709 | return $v_key; | 5709 | return $v_key; |
| 5710 | } | 5710 | } |
| 5711 | } | 5711 | } |
| 5712 | - | 5712 | + |
| 5713 | $v_result = 'Unknown'; | 5713 | $v_result = 'Unknown'; |
| 5714 | 5714 | ||
| 5715 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); | 5715 | //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); |