Edit File by line
/home/barbar84/www/extracte.../filemang...
File: pclzip.lib.php
$i = 0;
[5500] Fix | Delete
$j = 0;
[5501] Fix | Delete
while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
[5502] Fix | Delete
[5503] Fix | Delete
// ----- Look for empty dir (path reduction)
[5504] Fix | Delete
if ($v_list_dir[$i] == '') {
[5505] Fix | Delete
$i++;
[5506] Fix | Delete
continue;
[5507] Fix | Delete
}
[5508] Fix | Delete
if ($v_list_path[$j] == '') {
[5509] Fix | Delete
$j++;
[5510] Fix | Delete
continue;
[5511] Fix | Delete
}
[5512] Fix | Delete
[5513] Fix | Delete
// ----- Compare the items
[5514] Fix | Delete
if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) {
[5515] Fix | Delete
$v_result = 0;
[5516] Fix | Delete
}
[5517] Fix | Delete
[5518] Fix | Delete
// ----- Next items
[5519] Fix | Delete
$i++;
[5520] Fix | Delete
$j++;
[5521] Fix | Delete
}
[5522] Fix | Delete
[5523] Fix | Delete
// ----- Look if everything seems to be the same
[5524] Fix | Delete
if ($v_result) {
[5525] Fix | Delete
// ----- Skip all the empty items
[5526] Fix | Delete
while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
[5527] Fix | Delete
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
[5528] Fix | Delete
[5529] Fix | Delete
if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
[5530] Fix | Delete
// ----- There are exactly the same
[5531] Fix | Delete
$v_result = 2;
[5532] Fix | Delete
}
[5533] Fix | Delete
else if ($i < $v_list_dir_size) {
[5534] Fix | Delete
// ----- The path is shorter than the dir
[5535] Fix | Delete
$v_result = 0;
[5536] Fix | Delete
}
[5537] Fix | Delete
}
[5538] Fix | Delete
[5539] Fix | Delete
// ----- Return
[5540] Fix | Delete
return $v_result;
[5541] Fix | Delete
}
[5542] Fix | Delete
// --------------------------------------------------------------------------------
[5543] Fix | Delete
[5544] Fix | Delete
// --------------------------------------------------------------------------------
[5545] Fix | Delete
// Function : PclZipUtilCopyBlock()
[5546] Fix | Delete
// Description :
[5547] Fix | Delete
// Parameters :
[5548] Fix | Delete
// $p_mode : read/write compression mode
[5549] Fix | Delete
// 0 : src & dest normal
[5550] Fix | Delete
// 1 : src gzip, dest normal
[5551] Fix | Delete
// 2 : src normal, dest gzip
[5552] Fix | Delete
// 3 : src & dest gzip
[5553] Fix | Delete
// Return Values :
[5554] Fix | Delete
// --------------------------------------------------------------------------------
[5555] Fix | Delete
function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
[5556] Fix | Delete
{
[5557] Fix | Delete
$v_result = 1;
[5558] Fix | Delete
[5559] Fix | Delete
if ($p_mode==0)
[5560] Fix | Delete
{
[5561] Fix | Delete
while ($p_size != 0)
[5562] Fix | Delete
{
[5563] Fix | Delete
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
[5564] Fix | Delete
$v_buffer = @fread($p_src, $v_read_size);
[5565] Fix | Delete
@fwrite($p_dest, $v_buffer, $v_read_size);
[5566] Fix | Delete
$p_size -= $v_read_size;
[5567] Fix | Delete
}
[5568] Fix | Delete
}
[5569] Fix | Delete
else if ($p_mode==1)
[5570] Fix | Delete
{
[5571] Fix | Delete
while ($p_size != 0)
[5572] Fix | Delete
{
[5573] Fix | Delete
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
[5574] Fix | Delete
$v_buffer = @gzread($p_src, $v_read_size);
[5575] Fix | Delete
@fwrite($p_dest, $v_buffer, $v_read_size);
[5576] Fix | Delete
$p_size -= $v_read_size;
[5577] Fix | Delete
}
[5578] Fix | Delete
}
[5579] Fix | Delete
else if ($p_mode==2)
[5580] Fix | Delete
{
[5581] Fix | Delete
while ($p_size != 0)
[5582] Fix | Delete
{
[5583] Fix | Delete
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
[5584] Fix | Delete
$v_buffer = @fread($p_src, $v_read_size);
[5585] Fix | Delete
@gzwrite($p_dest, $v_buffer, $v_read_size);
[5586] Fix | Delete
$p_size -= $v_read_size;
[5587] Fix | Delete
}
[5588] Fix | Delete
}
[5589] Fix | Delete
else if ($p_mode==3)
[5590] Fix | Delete
{
[5591] Fix | Delete
while ($p_size != 0)
[5592] Fix | Delete
{
[5593] Fix | Delete
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
[5594] Fix | Delete
$v_buffer = @gzread($p_src, $v_read_size);
[5595] Fix | Delete
@gzwrite($p_dest, $v_buffer, $v_read_size);
[5596] Fix | Delete
$p_size -= $v_read_size;
[5597] Fix | Delete
}
[5598] Fix | Delete
}
[5599] Fix | Delete
[5600] Fix | Delete
// ----- Return
[5601] Fix | Delete
return $v_result;
[5602] Fix | Delete
}
[5603] Fix | Delete
// --------------------------------------------------------------------------------
[5604] Fix | Delete
[5605] Fix | Delete
// --------------------------------------------------------------------------------
[5606] Fix | Delete
// Function : PclZipUtilRename()
[5607] Fix | Delete
// Description :
[5608] Fix | Delete
// This function tries to do a simple rename() function. If it fails, it
[5609] Fix | Delete
// tries to copy the $p_src file in a new $p_dest file and then unlink the
[5610] Fix | Delete
// first one.
[5611] Fix | Delete
// Parameters :
[5612] Fix | Delete
// $p_src : Old filename
[5613] Fix | Delete
// $p_dest : New filename
[5614] Fix | Delete
// Return Values :
[5615] Fix | Delete
// 1 on success, 0 on failure.
[5616] Fix | Delete
// --------------------------------------------------------------------------------
[5617] Fix | Delete
function PclZipUtilRename($p_src, $p_dest)
[5618] Fix | Delete
{
[5619] Fix | Delete
$v_result = 1;
[5620] Fix | Delete
[5621] Fix | Delete
// ----- Try to rename the files
[5622] Fix | Delete
if (!@rename($p_src, $p_dest)) {
[5623] Fix | Delete
[5624] Fix | Delete
// ----- Try to copy & unlink the src
[5625] Fix | Delete
if (!@copy($p_src, $p_dest)) {
[5626] Fix | Delete
$v_result = 0;
[5627] Fix | Delete
}
[5628] Fix | Delete
else if (!@unlink($p_src)) {
[5629] Fix | Delete
$v_result = 0;
[5630] Fix | Delete
}
[5631] Fix | Delete
}
[5632] Fix | Delete
[5633] Fix | Delete
// ----- Return
[5634] Fix | Delete
return $v_result;
[5635] Fix | Delete
}
[5636] Fix | Delete
// --------------------------------------------------------------------------------
[5637] Fix | Delete
[5638] Fix | Delete
// --------------------------------------------------------------------------------
[5639] Fix | Delete
// Function : PclZipUtilOptionText()
[5640] Fix | Delete
// Description :
[5641] Fix | Delete
// Translate option value in text. Mainly for debug purpose.
[5642] Fix | Delete
// Parameters :
[5643] Fix | Delete
// $p_option : the option value.
[5644] Fix | Delete
// Return Values :
[5645] Fix | Delete
// The option text value.
[5646] Fix | Delete
// --------------------------------------------------------------------------------
[5647] Fix | Delete
function PclZipUtilOptionText($p_option)
[5648] Fix | Delete
{
[5649] Fix | Delete
[5650] Fix | Delete
$v_list = get_defined_constants();
[5651] Fix | Delete
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
[5652] Fix | Delete
$v_prefix = substr($v_key, 0, 10);
[5653] Fix | Delete
if (( ($v_prefix == 'PCLZIP_OPT')
[5654] Fix | Delete
|| ($v_prefix == 'PCLZIP_CB_')
[5655] Fix | Delete
|| ($v_prefix == 'PCLZIP_ATT'))
[5656] Fix | Delete
&& ($v_list[$v_key] == $p_option)) {
[5657] Fix | Delete
return $v_key;
[5658] Fix | Delete
}
[5659] Fix | Delete
}
[5660] Fix | Delete
[5661] Fix | Delete
$v_result = 'Unknown';
[5662] Fix | Delete
[5663] Fix | Delete
return $v_result;
[5664] Fix | Delete
}
[5665] Fix | Delete
// --------------------------------------------------------------------------------
[5666] Fix | Delete
[5667] Fix | Delete
// --------------------------------------------------------------------------------
[5668] Fix | Delete
// Function : PclZipUtilTranslateWinPath()
[5669] Fix | Delete
// Description :
[5670] Fix | Delete
// Translate windows path by replacing '\' by '/' and optionally removing
[5671] Fix | Delete
// drive letter.
[5672] Fix | Delete
// Parameters :
[5673] Fix | Delete
// $p_path : path to translate.
[5674] Fix | Delete
// $p_reCopy_disk_letter : true | false
[5675] Fix | Delete
// Return Values :
[5676] Fix | Delete
// The path translated.
[5677] Fix | Delete
// --------------------------------------------------------------------------------
[5678] Fix | Delete
function PclZipUtilTranslateWinPath($p_path, $p_reCopy_disk_letter=true)
[5679] Fix | Delete
{
[5680] Fix | Delete
if (stristr(php_uname(), 'windows')) {
[5681] Fix | Delete
// ----- Look for potential disk letter
[5682] Fix | Delete
if (($p_reCopy_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
[5683] Fix | Delete
$p_path = substr($p_path, $v_position+1);
[5684] Fix | Delete
}
[5685] Fix | Delete
// ----- Change potential windows directory separator
[5686] Fix | Delete
if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
[5687] Fix | Delete
$p_path = strtr($p_path, '\\', '/');
[5688] Fix | Delete
}
[5689] Fix | Delete
}
[5690] Fix | Delete
return $p_path;
[5691] Fix | Delete
}
[5692] Fix | Delete
// --------------------------------------------------------------------------------
[5693] Fix | Delete
[5694] Fix | Delete
[5695] Fix | Delete
?>
[5696] Fix | Delete
[5697] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function