equal
deleted
inserted
replaced
1169 |
1169 |
1170 // ----- Reset the error handler |
1170 // ----- Reset the error handler |
1171 $this->privErrorReset(); |
1171 $this->privErrorReset(); |
1172 |
1172 |
1173 // ----- Look if the $p_archive is a PclZip object |
1173 // ----- Look if the $p_archive is a PclZip object |
1174 if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) |
1174 if (is_object($p_archive) && $p_archive instanceof pclzip) |
1175 { |
1175 { |
1176 |
1176 |
1177 // ----- Duplicate the archive |
1177 // ----- Duplicate the archive |
1178 $v_result = $this->privDuplicate($p_archive->zipname); |
1178 $v_result = $this->privDuplicate($p_archive->zipname); |
1179 } |
1179 } |
1233 if (!$this->privCheckFormat()) { |
1233 if (!$this->privCheckFormat()) { |
1234 return(0); |
1234 return(0); |
1235 } |
1235 } |
1236 |
1236 |
1237 // ----- Look if the $p_archive_to_add is a PclZip object |
1237 // ----- Look if the $p_archive_to_add is a PclZip object |
1238 if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) |
1238 if (is_object($p_archive_to_add) && $p_archive_to_add instanceof pclzip) |
1239 { |
1239 { |
1240 |
1240 |
1241 // ----- Merge the archive |
1241 // ----- Merge the archive |
1242 $v_result = $this->privMerge($p_archive_to_add); |
1242 $v_result = $this->privMerge($p_archive_to_add); |
1243 } |
1243 } |
2672 PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); |
2672 PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); |
2673 return PclZip::errorCode(); |
2673 return PclZip::errorCode(); |
2674 } |
2674 } |
2675 |
2675 |
2676 // ----- Read the file content |
2676 // ----- Read the file content |
2677 $v_content = @fread($v_file, $p_header['size']); |
2677 if ($p_header['size'] > 0) { |
|
2678 $v_content = @fread($v_file, $p_header['size']); |
|
2679 } |
|
2680 else { |
|
2681 $v_content = ''; |
|
2682 } |
2678 |
2683 |
2679 // ----- Close the file |
2684 // ----- Close the file |
2680 @fclose($v_file); |
2685 @fclose($v_file); |
2681 |
2686 |
2682 // ----- Calculate the CRC |
2687 // ----- Calculate the CRC |
3882 // ----- Look for extract in memory |
3887 // ----- Look for extract in memory |
3883 else { |
3888 else { |
3884 |
3889 |
3885 |
3890 |
3886 // ----- Read the compressed file in a buffer (one shot) |
3891 // ----- Read the compressed file in a buffer (one shot) |
3887 $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); |
3892 if ($p_entry['compressed_size'] > 0) { |
|
3893 $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); |
|
3894 } |
|
3895 else { |
|
3896 $v_buffer = ''; |
|
3897 } |
3888 |
3898 |
3889 // ----- Decompress the file |
3899 // ----- Decompress the file |
3890 $v_file_content = @gzinflate($v_buffer); |
3900 $v_file_content = @gzinflate($v_buffer); |
3891 unset($v_buffer); |
3901 unset($v_buffer); |
3892 if ($v_file_content === FALSE) { |
3902 if ($v_file_content === FALSE) { |
4094 if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
4104 if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
4095 // ----- Look for not compressed file |
4105 // ----- Look for not compressed file |
4096 if ($p_entry['compressed_size'] == $p_entry['size']) { |
4106 if ($p_entry['compressed_size'] == $p_entry['size']) { |
4097 |
4107 |
4098 // ----- Read the file in a buffer (one shot) |
4108 // ----- Read the file in a buffer (one shot) |
4099 $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); |
4109 if ($p_entry['compressed_size'] > 0) { |
|
4110 $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); |
|
4111 } |
|
4112 else { |
|
4113 $v_buffer = ''; |
|
4114 } |
4100 |
4115 |
4101 // ----- Send the file to the output |
4116 // ----- Send the file to the output |
4102 echo $v_buffer; |
4117 echo $v_buffer; |
4103 unset($v_buffer); |
4118 unset($v_buffer); |
4104 } |
4119 } |
4105 else { |
4120 else { |
4106 |
4121 |
4107 // ----- Read the compressed file in a buffer (one shot) |
4122 // ----- Read the compressed file in a buffer (one shot) |
4108 $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); |
4123 if ($p_entry['compressed_size'] > 0) { |
|
4124 $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); |
|
4125 } |
|
4126 else { |
|
4127 $v_buffer = ''; |
|
4128 } |
4109 |
4129 |
4110 // ----- Decompress the file |
4130 // ----- Decompress the file |
4111 $v_file_content = gzinflate($v_buffer); |
4131 $v_file_content = gzinflate($v_buffer); |
4112 unset($v_buffer); |
4132 unset($v_buffer); |
4113 |
4133 |
4207 // ----- Look for not compressed file |
4227 // ----- Look for not compressed file |
4208 // if ($p_entry['compressed_size'] == $p_entry['size']) |
4228 // if ($p_entry['compressed_size'] == $p_entry['size']) |
4209 if ($p_entry['compression'] == 0) { |
4229 if ($p_entry['compression'] == 0) { |
4210 |
4230 |
4211 // ----- Reading the file |
4231 // ----- Reading the file |
4212 $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); |
4232 if ($p_entry['compressed_size'] > 0) { |
|
4233 $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); |
|
4234 } |
|
4235 else { |
|
4236 $p_string = ''; |
|
4237 } |
4213 } |
4238 } |
4214 else { |
4239 else { |
4215 |
4240 |
4216 // ----- Reading the file |
4241 // ----- Reading the file |
4217 $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); |
4242 if ($p_entry['compressed_size'] > 0) { |
|
4243 $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); |
|
4244 } |
|
4245 else { |
|
4246 $v_data = ''; |
|
4247 } |
4218 |
4248 |
4219 // ----- Decompress the file |
4249 // ----- Decompress the file |
4220 if (($p_string = @gzinflate($v_data)) === FALSE) { |
4250 if (($p_string = @gzinflate($v_data)) === FALSE) { |
4221 // TBC |
4251 // TBC |
4222 } |
4252 } |