4.51 release

pull/522/head
warlee 2023-04-07 22:52:28 +08:00
parent 3443d9e5dd
commit 56b3ea54f6
26 changed files with 263 additions and 248 deletions

View File

@ -1,3 +1,6 @@
### ver4.51 `2022/4/6`
- 兼容性调整
### ver4.50 `2022/11/17`
- 安全问题修复.

File diff suppressed because one or more lines are too long

View File

@ -158,7 +158,8 @@ class kodRarArchive {
//windows :...D... 93691 82633 88% 2016-12-09 02:20 396CC62C 000/a/32486963.png
//linux: :-rwxr-xr-x 93691 82643 88% 2016-12-09 02:20 396CC62C 000/a/32486963.png
$reg = '/\s*([-\.\w]+)\s+(\d+)\s+(\d+)\s+\d+%|-+>\s+(\d{2,4}-\d{2}-\d{2} \d{2}:\d{2})\s+\w+\s+(.*)\n/i';
// $reg = '/\s*([-\.\w]+)\s+(\d+)\s+(\d+)\s+\d+%|-+>\s+(\d{2,4}-\d{2}-\d{2} \d{2}:\d{2})\s+\w+\s+(.*)\n/i';
$reg = '/\s*([-\.\w]+)\s+(\d+)\s+(\d+)\s+\d+%\s+(\d{2,4}-\d{2}-\d{2} \d{2}:\d{2})\s+\w+\s+(.*)\n/i';
preg_match_all($reg,$match[1]."\n",$matchItem);
if( !is_array($matchItem) ||
count($matchItem) != 6 ||

View File

@ -173,14 +173,14 @@ if (!defined("PCL_TAR"))
// 1 on success,
// Or an error code (see list on top).
// --------------------------------------------------------------------------------
function PclTarAdd($p_tarname, $p_filelist)
function PclTarAdd($p_tarname, $p_filelist, $p_mode="")
{
TrFctStart(__FILE__, __LINE__, "PclTarAdd", "tar=$p_tarname, file=$p_filelist");
$v_result=1;
$v_list_detail = array();
// ----- Extract the tar format from the extension
if (($p_mode = PclTarHandleExtension($p_tarname)) == "")
if ($p_mode == "" && ($p_mode = PclTarHandleExtension($p_tarname)) == "")
{
// ----- Return
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
@ -317,7 +317,7 @@ if (!defined("PCL_TAR"))
// filename, size, mode, uid, gid, mtime, typeflag, status
// Exemple : $v_list = PclTarList("my.tar");
// for ($i=0; $i<sizeof($v_list); $i++)
// echo "Filename :'".$v_list[$i][filename]."'<br>";
// echo "Filename :'".$v_list[$i]['filename']."'<br>";
// --------------------------------------------------------------------------------
function PclTarList($p_tarname, $p_mode="")
{
@ -1860,14 +1860,14 @@ if (!defined("PCL_TAR"))
gzputs($p_tar, $v_binary_data_last, 356);
// ----- Set the properties in the header "structure"
$p_header[filename] = $v_reduce_filename;
$p_header[mode] = $v_perms;
$p_header[uid] = $v_uid;
$p_header[gid] = $v_gid;
$p_header[size] = $v_size;
$p_header[mtime] = $v_mtime;
$p_header[typeflag] = $v_typeflag;
$p_header[status] = "added";
$p_header['filename'] = $v_reduce_filename;
$p_header['mode'] = $v_perms;
$p_header['uid'] = $v_uid;
$p_header['gid'] = $v_gid;
$p_header['size'] = $v_size;
$p_header['mtime'] = $v_mtime;
$p_header['typeflag'] = $v_typeflag;
$p_header['status'] = "added";
// ----- Return
TrFctEnd(__FILE__, __LINE__, $v_result);
@ -2057,7 +2057,7 @@ if (!defined("PCL_TAR"))
}
// ----- Look for empty blocks to skip
if ($v_header[filename] == "")
if ($v_header['filename'] == "")
{
TrFctMessage(__FILE__, __LINE__, 2, "Empty block found. End of archive ?");
continue;
@ -2078,7 +2078,7 @@ if (!defined("PCL_TAR"))
}
}
TrFctMessage(__FILE__, __LINE__, 2, "Found file '$v_header[filename]', size '$v_header[size]'");
TrFctMessage(__FILE__, __LINE__, 2, "Found file '{$v_header['filename']}', size '{$v_header['size']}'");
//add by warlee;解压 设置编码
@ -2096,24 +2096,24 @@ if (!defined("PCL_TAR"))
// ----- Look for partial extract
if ((!$v_extract_all) && (is_array($p_file_list)))
{
TrFctMessage(__FILE__, __LINE__, 2, "Look if the file '$v_header[filename]' need to be extracted");
TrFctMessage(__FILE__, __LINE__, 2, "Look if the file '{$v_header['filename']}' need to be extracted");
// ----- By default no unzip if the file is not found
$v_extract_file = FALSE;
// ----- Look into the file list
for ($i=0; $i<sizeof($p_file_list); $i++)
{
TrFctMessage(__FILE__, __LINE__, 2, "Compare archived file '$v_header[filename]' from asked list file '".$p_file_list[$i]."'");
TrFctMessage(__FILE__, __LINE__, 2, "Compare archived file '{$v_header['filename']}' from asked list file '".$p_file_list[$i]."'");
// ----- Look if it is a directory
if (substr($p_file_list[$i], -1) == "/")
{
TrFctMessage(__FILE__, __LINE__, 3, "Compare file '$v_header[filename]' with directory '$p_file_list[$i]'");
TrFctMessage(__FILE__, __LINE__, 3, "Compare file '{$v_header['filename']}' with directory '$p_file_list[$i]'");
// ----- Look if the directory is in the filename path
if ((strlen($v_header[filename]) > strlen($p_file_list[$i])) && (substr($v_header[filename], 0, strlen($p_file_list[$i])) == $p_file_list[$i]))
if ((strlen($v_header['filename']) > strlen($p_file_list[$i])) && (substr($v_header['filename'], 0, strlen($p_file_list[$i])) == $p_file_list[$i]))
{
// ----- The file is in the directory, so extract it
TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' is in directory '$p_file_list[$i]' : extract it");
TrFctMessage(__FILE__, __LINE__, 2, "File '{$v_header['filename']}' is in directory '{$p_file_list[$i]}' : extract it");
$v_extract_file = TRUE;
// ----- End of loop
@ -2122,10 +2122,10 @@ if (!defined("PCL_TAR"))
}
// ----- It is a file, so compare the file names
else if ($p_file_list[$i] == $v_header[filename])
else if ($p_file_list[$i] == $v_header['filename'])
{
// ----- File found
TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' should be extracted");
TrFctMessage(__FILE__, __LINE__, 2, "File '{$v_header['filename']}' should be extracted");
$v_extract_file = TRUE;
// ----- End of loop
@ -2138,7 +2138,7 @@ if (!defined("PCL_TAR"))
// ----- Trace
if (!$v_extract_file)
{
TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' should not be extracted");
TrFctMessage(__FILE__, __LINE__, 2, "File '{$v_header['filename']}' should not be extracted");
}
}
else
@ -2152,12 +2152,12 @@ if (!defined("PCL_TAR"))
{
// ----- Look for path to remove
if (($p_remove_path != "")
&& (substr($v_header[filename], 0, $p_remove_path_size) == $p_remove_path))
&& (substr($v_header['filename'], 0, $p_remove_path_size) == $p_remove_path))
{
TrFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '{$v_header['filename']}'");
// ----- Remove the path
$v_header[filename] = substr($v_header[filename], $p_remove_path_size);
TrFctMessage(__FILE__, __LINE__, 3, "Reslting file is '$v_header[filename]'");
$v_header['filename'] = substr($v_header['filename'], $p_remove_path_size);
TrFctMessage(__FILE__, __LINE__, 3, "Reslting file is '{$v_header['filename']}'");
}
// ----- Add the path to the file
@ -2172,51 +2172,51 @@ if (!defined("PCL_TAR"))
}
// ----- Add the path
if (substr($v_header[filename], 0, 1) == "/")
$v_header[filename] = $p_path.$v_header[filename];
if (substr($v_header['filename'], 0, 1) == "/")
$v_header['filename'] = $p_path.$v_header['filename'];
else
$v_header[filename] = $p_path."/".$v_header[filename];
$v_header['filename'] = $p_path."/".$v_header['filename'];
}
// ----- Trace
TrFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '$v_header[filename]', size '$v_header[size]'");
TrFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '{$v_header['filename']}', size '{$v_header['size']}'");
// ----- Check that the file does not exists
if (file_exists($v_header[filename]))
if (file_exists($v_header['filename']))
{
TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' already exists");
TrFctMessage(__FILE__, __LINE__, 2, "File '{$v_header['filename']}' already exists");
// ----- Look if file is a directory
if (is_dir($v_header[filename]))
if (is_dir($v_header['filename']))
{
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is a directory");
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '{$v_header['filename']}' is a directory");
// ----- Change the file status
$v_header[status] = "already_a_directory";
$v_header['status'] = "already_a_directory";
// ----- Skip the extract
$v_extraction_stopped = 1;
$v_extract_file = 0;
}
// ----- Look if file is write protected
else if (!is_writeable($v_header[filename]))
else if (!is_writeable($v_header['filename']))
{
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is write protected");
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '{$v_header['filename']}' is write protected");
// ----- Change the file status
$v_header[status] = "write_protected";
$v_header['status'] = "write_protected";
// ----- Skip the extract
$v_extraction_stopped = 1;
$v_extract_file = 0;
}
// ----- Look if the extracted file is older
else if (filemtime($v_header[filename]) > $v_header[mtime])
else if (filemtime($v_header['filename']) > $v_header['mtime'])
{
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", $v_header[mtime]).")");
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '{$v_header['filename']}' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $v_header['mtime']).")");
// ----- Change the file status
$v_header[status] = "newer_exist";
$v_header['status'] = "newer_exist";
// ----- Skip the extract
$v_extraction_stopped = 1;
@ -2227,12 +2227,12 @@ if (!defined("PCL_TAR"))
// ----- Check the directory availability and create it if necessary
else
{
if ($v_header[typeflag]=="5")
$v_dir_to_check = $v_header[filename];
else if (!strstr($v_header[filename], "/"))
if ($v_header['typeflag']=="5")
$v_dir_to_check = $v_header['filename'];
else if (!strstr($v_header['filename'], "/"))
$v_dir_to_check = "";
else
$v_dir_to_check = dirname($v_header[filename]);
$v_dir_to_check = dirname($v_header['filename']);
//changed by warlee; 解压新建目录不建立tar下的PaxHeader临时目录
if( $v_header['typeflag'] == '-10' || $v_header['typeflag'] == 'g'){
@ -2241,10 +2241,10 @@ if (!defined("PCL_TAR"))
if (($v_result = PclTarHandlerDirCheck($v_dir_to_check)) != 1)
{
TrFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '{$v_header['filename']}'");
// ----- Change the file status
$v_header[status] = "path_creation_fail";
$v_header['status'] = "path_creation_fail";
// ----- Skip the extract
$v_extraction_stopped = 1;
@ -2252,30 +2252,30 @@ if (!defined("PCL_TAR"))
}
}
// ----- Do the extraction
if (($v_extract_file) && ($v_header[typeflag]!="5") && ($v_header[typeflag]!="-10"))
//changed by warlee; add $v_header[typeflag]
if (($v_extract_file) && ($v_header['typeflag']!="5") && ($v_header['typeflag']!="-10"))
//changed by warlee; add $v_header['typeflag']
{
// ----- Open the destination file in write mode
if (($v_dest_file = @fopen($v_header[filename], "wb")) == 0)
if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0)
{
TrFctMessage(__FILE__, __LINE__, 2, "Error while opening '$v_header[filename]' in write binary mode");
TrFctMessage(__FILE__, __LINE__, 2, "Error while opening '{$v_header['filename']}' in write binary mode");
// ----- Change the file status
$v_header[status] = "write_error";
$v_header['status'] = "write_error";
// ----- Jump to next file
TrFctMessage(__FILE__, __LINE__, 2, "Jump to next file");
if ($p_tar_mode == "tar")
fseek($v_tar, ftell($v_tar)+(ceil(($v_header[size]/512))*512));
fseek($v_tar, ftell($v_tar)+(ceil(($v_header['size']/512))*512));
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header['size']/512))*512));
}
else
{
TrFctMessage(__FILE__, __LINE__, 2, "Start extraction of '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Start extraction of '{$v_header['filename']}'");
// ----- Read data
$n = floor($v_header[size]/512);
$n = floor($v_header['size']/512);
for ($i=0; $i<$n; $i++)
{
TrFctMessage(__FILE__, __LINE__, 3, "Read complete 512 bytes block number ".($i+1));
@ -2285,28 +2285,28 @@ if (!defined("PCL_TAR"))
$v_content = gzread($v_tar, 512);
fwrite($v_dest_file, $v_content, 512);
}
if (($v_header[size] % 512) != 0)
if (($v_header['size'] % 512) != 0)
{
TrFctMessage(__FILE__, __LINE__, 3, "Read last ".($v_header[size] % 512)." bytes in a 512 block");
TrFctMessage(__FILE__, __LINE__, 3, "Read last ".($v_header['size'] % 512)." bytes in a 512 block");
if ($p_tar_mode == "tar")
$v_content = fread($v_tar, 512);
else
$v_content = gzread($v_tar, 512);
fwrite($v_dest_file, $v_content, ($v_header[size] % 512));
fwrite($v_dest_file, $v_content, ($v_header['size'] % 512));
}
// ----- Close the destination file
fclose($v_dest_file);
// ----- Change the file mode, mtime
touch($v_header[filename], $v_header[mtime]);
//chmod($v_header[filename], DecOct($v_header[mode]));
touch($v_header['filename'], $v_header['mtime']);
//chmod($v_header['filename'], DecOct($v_header['mode']));
}
// ----- Check the file size
clearstatcache();
//changed by warlee; 大小对比时查看是否存在
if (file_exists($v_header[filename]) && filesize($v_header[filename]) != $v_header[size])
if (file_exists($v_header['filename']) && filesize($v_header['filename']) != $v_header['size'])
{
// ----- Close the archive file
if ($p_tar_mode == "tar")
@ -2315,7 +2315,7 @@ if (!defined("PCL_TAR"))
gzclose($v_tar);
// ----- Error log
PclErrorLog(-7, "Extracted file '$v_header[filename]' does not have the correct file size '".filesize($v_filename)."' ('$v_header[size]' expected). Archive may be corrupted.");
PclErrorLog(-7, "Extracted file '{$v_header['filename']}' does not have the correct file size '".filesize($v_filename)."' ('{$v_header['size']}' expected). Archive may be corrupted.");
// ----- Return
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
@ -2328,14 +2328,14 @@ if (!defined("PCL_TAR"))
else
{
TrFctMessage(__FILE__, __LINE__, 2, "Extraction of file '$v_header[filename]' skipped.");
TrFctMessage(__FILE__, __LINE__, 2, "Extraction of file '{$v_header['filename']}' skipped.");
// ----- Jump to next file
TrFctMessage(__FILE__, __LINE__, 2, "Jump to next file");
if ($p_tar_mode == "tar")
fseek($v_tar, ftell($v_tar)+(ceil(($v_header[size]/512))*512));
fseek($v_tar, ftell($v_tar)+(ceil(($v_header['size']/512))*512));
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header['size']/512))*512));
}
}
@ -2343,14 +2343,14 @@ if (!defined("PCL_TAR"))
else
{
// ----- Trace
TrFctMessage(__FILE__, __LINE__, 2, "Jump file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Jump file '{$v_header['filename']}'");
TrFctMessage(__FILE__, __LINE__, 4, "Position avant jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
// ----- Jump to next file
if ($p_tar_mode == "tar")
fseek($v_tar, ($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))+(ceil(($v_header[size]/512))*512));
fseek($v_tar, ($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))+(ceil(($v_header['size']/512))*512));
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header['size']/512))*512));
TrFctMessage(__FILE__, __LINE__, 4, "Position après jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
}
@ -2363,12 +2363,12 @@ if (!defined("PCL_TAR"))
// ----- File name and properties are logged if listing mode or file is extracted
if ($v_listing || $v_extract_file || $v_extraction_stopped)
{
TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file '{$v_header['filename']}'");
// ----- Log extracted files
if (($v_file_dir = dirname($v_header[filename])) == $v_header[filename])
if (($v_file_dir = dirname($v_header['filename'])) == $v_header['filename'])
$v_file_dir = "";
if ((substr($v_header[filename], 0, 1) == "/") && ($v_file_dir == ""))
if ((substr($v_header['filename'], 0, 1) == "/") && ($v_file_dir == ""))
$v_file_dir = "/";
// ----- Add the array describing the file into the list
@ -2539,23 +2539,23 @@ if (!defined("PCL_TAR"))
}
// ----- Look for empty blocks to skip
if ($v_header[filename] == "")
if ($v_header['filename'] == "")
{
TrFctMessage(__FILE__, __LINE__, 2, "Empty block found. End of archive ?");
continue;
}
TrFctMessage(__FILE__, __LINE__, 2, "Found file '$v_header[filename]', size '$v_header[size]'");
TrFctMessage(__FILE__, __LINE__, 2, "Found file {$v_header['filename']}, size '{$v_header['size']}'");
// ----- Look if file is in the range to be extracted
if (($p_index_current >= $p_index_start) && ($p_index_current <= $p_index_stop))
{
TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' is in the range to be extracted");
TrFctMessage(__FILE__, __LINE__, 2, "File {$v_header['filename']} is in the range to be extracted");
$v_extract_file = TRUE;
}
else
{
TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' is out of the range");
TrFctMessage(__FILE__, __LINE__, 2, "File {$v_header['filename']} is out of the range");
$v_extract_file = FALSE;
}
@ -2574,14 +2574,14 @@ if (!defined("PCL_TAR"))
else
{
// ----- Trace
TrFctMessage(__FILE__, __LINE__, 2, "Jump file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Jump file {$v_header['filename']}");
TrFctMessage(__FILE__, __LINE__, 4, "Position avant jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
// ----- Jump to next file
if ($p_tar_mode == "tar")
fseek($v_tar, ($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))+(ceil(($v_header[size]/512))*512));
fseek($v_tar, ($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))+(ceil(($v_header['size']/512))*512));
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header['size']/512))*512));
TrFctMessage(__FILE__, __LINE__, 4, "Position après jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
}
@ -2594,12 +2594,12 @@ if (!defined("PCL_TAR"))
// ----- File name and properties are logged if listing mode or file is extracted
if ($v_extract_file)
{
TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file {$v_header['filename']}");
// ----- Log extracted files
if (($v_file_dir = dirname($v_header[filename])) == $v_header[filename])
if (($v_file_dir = dirname($v_header['filename'])) == $v_header['filename'])
$v_file_dir = "";
if ((substr($v_header[filename], 0, 1) == "/") && ($v_file_dir == ""))
if ((substr($v_header['filename'], 0, 1) == "/") && ($v_file_dir == ""))
$v_file_dir = "/";
// ----- Add the array describing the file into the list
@ -2638,12 +2638,12 @@ if (!defined("PCL_TAR"))
// ----- Look for path to remove
if (($p_remove_path != "")
&& (substr($v_header[filename], 0, $p_remove_path_size) == $p_remove_path))
&& (substr($v_header['filename'], 0, $p_remove_path_size) == $p_remove_path))
{
TrFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file {$v_header['filename']}");
// ----- Remove the path
$v_header[filename] = substr($v_header[filename], $p_remove_path_size);
TrFctMessage(__FILE__, __LINE__, 3, "Resulting file is '$v_header[filename]'");
$v_header['filename'] = substr($v_header['filename'], $p_remove_path_size);
TrFctMessage(__FILE__, __LINE__, 3, "Resulting file is {$v_header['filename']}");
}
// ----- Add the path to the file
@ -2658,51 +2658,51 @@ if (!defined("PCL_TAR"))
}
// ----- Add the path
if (substr($v_header[filename], 0, 1) == "/")
$v_header[filename] = $p_path.$v_header[filename];
if (substr($v_header['filename'], 0, 1) == "/")
$v_header['filename'] = $p_path.$v_header['filename'];
else
$v_header[filename] = $p_path."/".$v_header[filename];
$v_header['filename'] = $p_path."/".$v_header['filename'];
}
// ----- Trace
TrFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '$v_header[filename]', size '$v_header[size]'");
TrFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) {$v_header['filename']}, size '{$v_header['size']}'");
// ----- Check that the file does not exists
if (file_exists($v_header[filename]))
if (file_exists($v_header['filename']))
{
TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' already exists");
TrFctMessage(__FILE__, __LINE__, 2, "File {$v_header['filename']} already exists");
// ----- Look if file is a directory
if (is_dir($v_header[filename]))
if (is_dir($v_header['filename']))
{
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is a directory");
TrFctMessage(__FILE__, __LINE__, 2, "Existing file {$v_header['filename']} is a directory");
// ----- Change the file status
$v_header[status] = "already_a_directory";
$v_header['status'] = "already_a_directory";
// ----- Skip the extract
$v_extraction_stopped = 1;
$v_extract_file = 0;
}
// ----- Look if file is write protected
else if (!is_writeable($v_header[filename]))
else if (!is_writeable($v_header['filename']))
{
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is write protected");
TrFctMessage(__FILE__, __LINE__, 2, "Existing file {$v_header['filename']} is write protected");
// ----- Change the file status
$v_header[status] = "write_protected";
$v_header['status'] = "write_protected";
// ----- Skip the extract
$v_extraction_stopped = 1;
$v_extract_file = 0;
}
// ----- Look if the extracted file is older
else if (filemtime($v_header[filename]) > $v_header[mtime])
else if (filemtime($v_header['filename']) > $v_header['mtime'])
{
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", $v_header[mtime]).")");
TrFctMessage(__FILE__, __LINE__, 2, "Existing file {$v_header['filename']} is newer (".date("l dS of F Y h:i:s A", filemtime($v_header['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $v_header['mtime']).")");
// ----- Change the file status
$v_header[status] = "newer_exist";
$v_header['status'] = "newer_exist";
// ----- Skip the extract
$v_extraction_stopped = 1;
@ -2713,19 +2713,19 @@ if (!defined("PCL_TAR"))
// ----- Check the directory availability and create it if necessary
else
{
if ($v_header[typeflag]=="5")
$v_dir_to_check = $v_header[filename];
else if (!strstr($v_header[filename], "/"))
if ($v_header['typeflag']=="5")
$v_dir_to_check = $v_header['filename'];
else if (!strstr($v_header['filename'], "/"))
$v_dir_to_check = "";
else
$v_dir_to_check = dirname($v_header[filename]);
$v_dir_to_check = dirname($v_header['filename']);
if (($v_result = PclTarHandlerDirCheck($v_dir_to_check)) != 1)
{
TrFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Unable to create path for {$v_header['filename']}");
// ----- Change the file status
$v_header[status] = "path_creation_fail";
$v_header['status'] = "path_creation_fail";
// ----- Skip the extract
$v_extraction_stopped = 1;
@ -2734,29 +2734,29 @@ if (!defined("PCL_TAR"))
}
// ----- Do the real bytes extraction (if not a directory)
if (($v_extract_file) && ($v_header[typeflag]!="5"))
if (($v_extract_file) && ($v_header['typeflag']!="5"))
{
// ----- Open the destination file in write mode
if (($v_dest_file = @fopen($v_header[filename], "wb")) == 0)
if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0)
{
TrFctMessage(__FILE__, __LINE__, 2, "Error while opening '$v_header[filename]' in write binary mode");
TrFctMessage(__FILE__, __LINE__, 2, "Error while opening {$v_header['filename']} in write binary mode");
// ----- Change the file status
$v_header[status] = "write_error";
$v_header['status'] = "write_error";
// ----- Jump to next file
TrFctMessage(__FILE__, __LINE__, 2, "Jump to next file");
if ($p_tar_mode == "tar")
fseek($v_tar, ftell($v_tar)+(ceil(($v_header[size]/512))*512));
fseek($v_tar, ftell($v_tar)+(ceil(($v_header['size']/512))*512));
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header['size']/512))*512));
}
else
{
TrFctMessage(__FILE__, __LINE__, 2, "Start extraction of '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Start extraction of {$v_header['filename']}");
// ----- Read data
$n = floor($v_header[size]/512);
$n = floor($v_header['size']/512);
for ($i=0; $i<$n; $i++)
{
TrFctMessage(__FILE__, __LINE__, 3, "Read complete 512 bytes block number ".($i+1));
@ -2766,30 +2766,30 @@ if (!defined("PCL_TAR"))
$v_content = gzread($v_tar, 512);
fwrite($v_dest_file, $v_content, 512);
}
if (($v_header[size] % 512) != 0)
if (($v_header['size'] % 512) != 0)
{
TrFctMessage(__FILE__, __LINE__, 3, "Read last ".($v_header[size] % 512)." bytes in a 512 block");
TrFctMessage(__FILE__, __LINE__, 3, "Read last ".($v_header['size'] % 512)." bytes in a 512 block");
if ($p_tar_mode == "tar")
$v_content = fread($v_tar, 512);
else
$v_content = gzread($v_tar, 512);
fwrite($v_dest_file, $v_content, ($v_header[size] % 512));
fwrite($v_dest_file, $v_content, ($v_header['size'] % 512));
}
// ----- Close the destination file
fclose($v_dest_file);
// ----- Change the file mode, mtime
touch($v_header[filename], $v_header[mtime]);
//chmod($v_header[filename], DecOct($v_header[mode]));
touch($v_header['filename'], $v_header['mtime']);
//chmod($v_header['filename'], DecOct($v_header['mode']));
}
// ----- Check the file size
clearstatcache();
if (filesize($v_header[filename]) != $v_header[size])
if (filesize($v_header['filename']) != $v_header['size'])
{
// ----- Error log
PclErrorLog(-7, "Extracted file '$v_header[filename]' does not have the correct file size '".filesize($v_filename)."' ('$v_header[size]' expected). Archive may be corrupted.");
PclErrorLog(-7, "Extracted file {$v_header['filename']} does not have the correct file size '".filesize($v_filename)."' ('{$v_header['size']}' expected). Archive may be corrupted.");
// ----- Return
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
@ -2801,14 +2801,14 @@ if (!defined("PCL_TAR"))
}
else
{
TrFctMessage(__FILE__, __LINE__, 2, "Extraction of file '$v_header[filename]' skipped.");
TrFctMessage(__FILE__, __LINE__, 2, "Extraction of file {$v_header['filename']} skipped.");
// ----- Jump to next file
TrFctMessage(__FILE__, __LINE__, 2, "Jump to next file");
if ($p_tar_mode == "tar")
fseek($v_tar, ftell($v_tar)+(ceil(($v_header[size]/512))*512));
fseek($v_tar, ftell($v_tar)+(ceil(($v_header['size']/512))*512));
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header['size']/512))*512));
}
// ----- Return
@ -2932,32 +2932,32 @@ if (!defined("PCL_TAR"))
}
// ----- Look for empty blocks to skip
if ($v_header[filename] == "")
if ($v_header['filename'] == "")
{
TrFctMessage(__FILE__, __LINE__, 2, "Empty block found. End of archive ?");
continue;
}
TrFctMessage(__FILE__, __LINE__, 2, "Found file '$v_header[filename]', size '$v_header[size]'");
TrFctMessage(__FILE__, __LINE__, 2, "Found file {$v_header['filename']}, size '{$v_header['size']}'");
// ----- Look for filenames to delete
for ($i=0, $v_delete_file=FALSE; ($i<sizeof($p_file_list)) && (!$v_delete_file); $i++)
{
// ----- Compare the file names
// if ($p_file_list[$i] == $v_header[filename])
if (($v_len = strcmp($p_file_list[$i], $v_header[filename])) <= 0)
// if ($p_file_list[$i] == $v_header['filename'])
if (($v_len = strcmp($p_file_list[$i], $v_header['filename'])) <= 0)
{
if ($v_len==0)
{
TrFctMessage(__FILE__, __LINE__, 3, "Found that '$v_header[filename]' need to be deleted");
TrFctMessage(__FILE__, __LINE__, 3, "Found that {$v_header['filename']} need to be deleted");
$v_delete_file = TRUE;
}
else
{
TrFctMessage(__FILE__, __LINE__, 3, "Look if '$v_header[filename]' is a file in $p_file_list[$i]");
if (substr($v_header[filename], strlen($p_file_list[$i]), 1) == "/")
TrFctMessage(__FILE__, __LINE__, 3, "Look if {$v_header['filename']} is a file in $p_file_list[$i]");
if (substr($v_header['filename'], strlen($p_file_list[$i]), 1) == "/")
{
TrFctMessage(__FILE__, __LINE__, 3, "'$v_header[filename]' is a file in $p_file_list[$i]");
TrFctMessage(__FILE__, __LINE__, 3, "{$v_header['filename']} is a file in $p_file_list[$i]");
$v_delete_file = TRUE;
}
}
@ -2967,7 +2967,7 @@ if (!defined("PCL_TAR"))
// ----- Copy files that do not need to be deleted
if (!$v_delete_file)
{
TrFctMessage(__FILE__, __LINE__, 2, "Keep file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Keep file {$v_header['filename']}");
// ----- Write the file header
if ($p_tar_mode == "tar")
@ -2980,7 +2980,7 @@ if (!defined("PCL_TAR"))
}
// ----- Write the file data
$n = ceil($v_header[size]/512);
$n = ceil($v_header['size']/512);
for ($i=0; $i<$n; $i++)
{
TrFctMessage(__FILE__, __LINE__, 3, "Read complete 512 bytes block number ".($i+1));
@ -2997,11 +2997,11 @@ if (!defined("PCL_TAR"))
}
// ----- File name and properties are logged if listing mode or file is extracted
TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file {$v_header['filename']}");
// ----- Add the array describing the file into the list
$p_list_detail[$v_nb] = $v_header;
$p_list_detail[$v_nb][status] = "ok";
$p_list_detail[$v_nb]['status'] = "ok";
// ----- Increment
$v_nb++;
@ -3011,14 +3011,14 @@ if (!defined("PCL_TAR"))
else
{
// ----- Trace
TrFctMessage(__FILE__, __LINE__, 2, "Start deletion of '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Start deletion of {$v_header['filename']}");
TrFctMessage(__FILE__, __LINE__, 4, "Position avant jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
// ----- Jump to next file
if ($p_tar_mode == "tar")
fseek($v_tar, ftell($v_tar)+(ceil(($v_header[size]/512))*512));
fseek($v_tar, ftell($v_tar)+(ceil(($v_header['size']/512))*512));
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header['size']/512))*512));
TrFctMessage(__FILE__, __LINE__, 4, "Position après jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
}
@ -3224,13 +3224,13 @@ if (!defined("PCL_TAR"))
}
// ----- Look for empty blocks to skip
if ($v_header[filename] == "")
if ($v_header['filename'] == "")
{
TrFctMessage(__FILE__, __LINE__, 2, "Empty block found. End of archive ?");
continue;
}
TrFctMessage(__FILE__, __LINE__, 2, "Found file '$v_header[filename]', size '$v_header[size]'");
TrFctMessage(__FILE__, __LINE__, 2, "Found file {$v_header['filename']}, size '{$v_header['size']}'");
// ----- Look for filenames to update
for ($i=0, $v_update_file=FALSE, $v_found_file=FALSE; ($i<sizeof($v_stored_list)) && (!$v_update_file); $i++)
@ -3238,18 +3238,18 @@ if (!defined("PCL_TAR"))
TrFctMessage(__FILE__, __LINE__, 4, "Compare with file '$v_stored_list[$i]'");
// ----- Compare the file names
if ($v_stored_list[$i] == $v_header[filename])
if ($v_stored_list[$i] == $v_header['filename'])
{
TrFctMessage(__FILE__, __LINE__, 3, "File '$v_stored_list[$i]' is present in archive");
TrFctMessage(__FILE__, __LINE__, 3, "File '$v_stored_list[$i]' mtime=".filemtime($p_file_list[$i])." ".date("l dS of F Y h:i:s A", filemtime($p_file_list[$i])));
TrFctMessage(__FILE__, __LINE__, 3, "Archived mtime=".$v_header[mtime]." ".date("l dS of F Y h:i:s A", $v_header[mtime]));
TrFctMessage(__FILE__, __LINE__, 3, "Archived mtime=".$v_header['mtime']." ".date("l dS of F Y h:i:s A", $v_header['mtime']));
// ----- Store found informations
$v_found_file = TRUE;
$v_current_filename = $p_file_list[$i];
// ----- Look if the file need to be updated
if (filemtime($p_file_list[$i]) > $v_header[mtime])
if (filemtime($p_file_list[$i]) > $v_header['mtime'])
{
TrFctMessage(__FILE__, __LINE__, 3, "File '$p_file_list[$i]' need to be updated");
$v_update_file = TRUE;
@ -3265,14 +3265,14 @@ if (!defined("PCL_TAR"))
}
else
{
TrFctMessage(__FILE__, __LINE__, 4, "File '$p_file_list[$i]' is not '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 4, "File '$p_file_list[$i]' is not {$v_header['filename']}");
}
}
// ----- Copy files that do not need to be updated
if (!$v_update_file)
{
TrFctMessage(__FILE__, __LINE__, 2, "Keep file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Keep file {$v_header['filename']}");
// ----- Write the file header
if ($p_tar_mode == "tar")
@ -3285,7 +3285,7 @@ if (!defined("PCL_TAR"))
}
// ----- Write the file data
$n = ceil($v_header[size]/512);
$n = ceil($v_header['size']/512);
for ($j=0; $j<$n; $j++)
{
TrFctMessage(__FILE__, __LINE__, 3, "Read complete 512 bytes block number ".($j+1));
@ -3302,11 +3302,11 @@ if (!defined("PCL_TAR"))
}
// ----- File name and properties are logged if listing mode or file is extracted
TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file {$v_header['filename']}");
// ----- Add the array describing the file into the list
$p_list_detail[$v_nb] = $v_header;
$p_list_detail[$v_nb][status] = ($v_found_file?"not_updated":"ok");
$p_list_detail[$v_nb]['status'] = ($v_found_file?"not_updated":"ok");
// ----- Increment
$v_nb++;
@ -3319,7 +3319,7 @@ if (!defined("PCL_TAR"))
TrFctMessage(__FILE__, __LINE__, 2, "Start update of file '$v_current_filename'");
// ----- Store the old file size
$v_old_size = $v_header[size];
$v_old_size = $v_header['size'];
// ----- Add the file
if (($v_result = PclTarHandleAddFile($v_temp_tar, $v_current_filename, $p_tar_mode, $v_header, $p_add_dir, $p_remove_dir)) != 1)
@ -3343,7 +3343,7 @@ if (!defined("PCL_TAR"))
}
// ----- Trace
TrFctMessage(__FILE__, __LINE__, 2, "Skip old file '$v_header[filename]'");
TrFctMessage(__FILE__, __LINE__, 2, "Skip old file {$v_header['filename']}");
// ----- Jump to next file
if ($p_tar_mode == "tar")
@ -3353,7 +3353,7 @@ if (!defined("PCL_TAR"))
// ----- Add the array describing the file into the list
$p_list_detail[$v_nb] = $v_header;
$p_list_detail[$v_nb][status] = "updated";
$p_list_detail[$v_nb]['status'] = "updated";
// ----- Increment
$v_nb++;
@ -3397,7 +3397,7 @@ if (!defined("PCL_TAR"))
// ----- Add the array describing the file into the list
$p_list_detail[$v_nb] = $v_header;
$p_list_detail[$v_nb][status] = "added";
$p_list_detail[$v_nb]['status'] = "added";
// ----- Increment
$v_nb++;
@ -3510,8 +3510,8 @@ if (!defined("PCL_TAR"))
// ----- Look for no more block
if (strlen($v_binary_data)==0)
{
$v_header[filename] = "";
$v_header[status] = "empty";
$v_header['filename'] = "";
$v_header['status'] = "empty";
// ----- Return
TrFctEnd(__FILE__, __LINE__, $v_result, "End of archive found");
@ -3521,8 +3521,8 @@ if (!defined("PCL_TAR"))
// ----- Look for invalid block size
if (strlen($v_binary_data) != 512)
{
$v_header[filename] = "";
$v_header[status] = "invalid_header";
$v_header['filename'] = "";
$v_header['status'] = "invalid_header";
TrFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
// ----- Error log
@ -3557,26 +3557,26 @@ if (!defined("PCL_TAR"))
$v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", $v_binary_data);
// ----- Extract the checksum for check
$v_header[checksum] = OctDec(trim($v_data[checksum]));
TrFctMessage(__FILE__, __LINE__, 3, "File checksum : $v_header[checksum]");
if ($v_header[checksum] != $v_checksum)
$v_header['checksum'] = OctDec(trim($v_data['checksum']));
TrFctMessage(__FILE__, __LINE__, 3, "File checksum : {$v_header['checksum']}");
if ($v_header['checksum'] != $v_checksum)
{
TrFctMessage(__FILE__, __LINE__, 2, "File checksum is invalid : $v_checksum calculated, $v_header[checksum] expected");
TrFctMessage(__FILE__, __LINE__, 2, "File checksum is invalid : $v_checksum calculated, {$v_header['checksum']} expected");
$v_header[filename] = "";
$v_header[status] = "invalid_header";
$v_header['filename'] = "";
$v_header['status'] = "invalid_header";
// ----- Look for last block (empty block)
if (($v_checksum == 256) && ($v_header[checksum] == 0))
if (($v_checksum == 256) && ($v_header['checksum'] == 0))
{
$v_header[status] = "empty";
$v_header['status'] = "empty";
// ----- Return
TrFctEnd(__FILE__, __LINE__, $v_result, "End of archive found");
return $v_result;
}
// ----- Error log
PclErrorLog(-13, "Invalid checksum : $v_checksum calculated, $v_header[checksum] expected");
PclErrorLog(-13, "Invalid checksum : $v_checksum calculated, {$v_header['checksum']} expected");
// ----- Return
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString());
@ -3585,43 +3585,43 @@ if (!defined("PCL_TAR"))
TrFctMessage(__FILE__, __LINE__, 2, "File checksum is valid ($v_checksum)");
// ----- Extract the properties
$v_header[filename] = trim($v_data[filename]);
TrFctMessage(__FILE__, __LINE__, 2, "Name : '$v_header[filename]'");
$v_header[mode] = OctDec(trim($v_data[mode]));
TrFctMessage(__FILE__, __LINE__, 2, "Mode : '".DecOct($v_header[mode])."'");
$v_header[uid] = OctDec(trim($v_data[uid]));
TrFctMessage(__FILE__, __LINE__, 2, "Uid : '$v_header[uid]'");
$v_header[gid] = OctDec(trim($v_data[gid]));
TrFctMessage(__FILE__, __LINE__, 2, "Gid : '$v_header[gid]'");
$v_header[size] = OctDec(trim($v_data[size]));
TrFctMessage(__FILE__, __LINE__, 2, "Size : '$v_header[size]'");
$v_header[mtime] = OctDec(trim($v_data[mtime]));
TrFctMessage(__FILE__, __LINE__, 2, "Date : ".date("l dS of F Y h:i:s A", $v_header[mtime]));
if (($v_header[typeflag] = $v_data[typeflag]) == "5")
$v_header['filename'] = trim($v_data['filename']);
TrFctMessage(__FILE__, __LINE__, 2, "Name : {$v_header['filename']}");
$v_header['mode'] = OctDec(trim($v_data['mode']));
TrFctMessage(__FILE__, __LINE__, 2, "Mode : '".DecOct($v_header['mode'])."'");
$v_header['uid'] = OctDec(trim($v_data['uid']));
TrFctMessage(__FILE__, __LINE__, 2, "Uid : '{$v_header['uid']}'");
$v_header['gid'] = OctDec(trim($v_data['gid']));
TrFctMessage(__FILE__, __LINE__, 2, "Gid : '{$v_header['gid']}'");
$v_header['size'] = OctDec(trim($v_data['size']));
TrFctMessage(__FILE__, __LINE__, 2, "Size : '{$v_header['size']}'");
$v_header['mtime'] = OctDec(trim($v_data['mtime']));
TrFctMessage(__FILE__, __LINE__, 2, "Date : ".date("l dS of F Y h:i:s A", $v_header['mtime']));
if (($v_header['typeflag'] = $v_data['typeflag']) == "5")
{
$v_header[size] = 0;
TrFctMessage(__FILE__, __LINE__, 2, "Size (folder) : '$v_header[size]'");
$v_header['size'] = 0;
TrFctMessage(__FILE__, __LINE__, 2, "Size (folder) : '{$v_header['size']}'");
}
TrFctMessage(__FILE__, __LINE__, 2, "File typeflag : $v_header[typeflag]");
TrFctMessage(__FILE__, __LINE__, 2, "File typeflag : {$v_header['typeflag']}");
/* ----- All these fields are removed form the header because they do not carry interesting info
$v_header[link] = trim($v_data[link]);
TrFctMessage(__FILE__, __LINE__, 2, "Linkname : $v_header[linkname]");
$v_header[magic] = trim($v_data[magic]);
TrFctMessage(__FILE__, __LINE__, 2, "Magic : $v_header[magic]");
$v_header[version] = trim($v_data[version]);
TrFctMessage(__FILE__, __LINE__, 2, "Version : $v_header[version]");
$v_header[uname] = trim($v_data[uname]);
TrFctMessage(__FILE__, __LINE__, 2, "Uname : $v_header[uname]");
$v_header[gname] = trim($v_data[gname]);
TrFctMessage(__FILE__, __LINE__, 2, "Gname : $v_header[gname]");
$v_header[devmajor] = trim($v_data[devmajor]);
TrFctMessage(__FILE__, __LINE__, 2, "Devmajor : $v_header[devmajor]");
$v_header[devminor] = trim($v_data[devminor]);
TrFctMessage(__FILE__, __LINE__, 2, "Devminor : $v_header[devminor]");
$v_header['link'] = trim($v_data['link']);
TrFctMessage(__FILE__, __LINE__, 2, "Linkname : $v_header['linkname']");
$v_header['magic'] = trim($v_data['magic']);
TrFctMessage(__FILE__, __LINE__, 2, "Magic : $v_header['magic']");
$v_header['version'] = trim($v_data['version']);
TrFctMessage(__FILE__, __LINE__, 2, "Version : $v_header['version']");
$v_header['uname'] = trim($v_data['uname']);
TrFctMessage(__FILE__, __LINE__, 2, "Uname : $v_header['uname']");
$v_header['gname'] = trim($v_data['gname']);
TrFctMessage(__FILE__, __LINE__, 2, "Gname : $v_header['gname']");
$v_header['devmajor'] = trim($v_data['devmajor']);
TrFctMessage(__FILE__, __LINE__, 2, "Devmajor : $v_header['devmajor']");
$v_header['devminor'] = trim($v_data['devminor']);
TrFctMessage(__FILE__, __LINE__, 2, "Devminor : $v_header['devminor']");
*/
// ----- Set the status field
$v_header[status] = "ok";
$v_header['status'] = "ok";
// ----- Return
TrFctEnd(__FILE__, __LINE__, $v_result);
@ -3682,7 +3682,7 @@ if (!defined("PCL_TAR"))
// ----- Create the directory
TrFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
if (!@mkdir($p_dir, 0777))
if (!@mkdir($p_dir, DEFAULT_PERRMISSIONS))
{
// ----- Error log
PclErrorLog(-8, "Unable to create directory '$p_dir'");

View File

@ -2700,7 +2700,11 @@
}
// ----- Read the file content
$v_content = @fread($v_file, $p_header['size']);
$v_content = '';
if($p_header['size'] > 0){
$v_content = @fread($v_file, $p_header['size']);
}
// ----- Close the file
@fclose($v_file);
@ -3918,10 +3922,14 @@
// ----- Read the compressed file in a buffer (one shot)
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
$v_buffer = '';
if($p_entry['compressed_size'] != 0){
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
}
// ----- Decompress the file
$v_file_content = gzinflate($v_buffer);
$v_file_content = @gzinflate($v_buffer);
unset($v_buffer);
if ($v_file_content === FALSE) {
@ -4126,7 +4134,7 @@
if ($p_entry['status'] == 'ok') {
// ----- Do the extraction (if not a folder)
if (!(($p_entry['external']&0x00000010)==0x00000010)) {
if (!(($p_entry['external']&0x00000010)==0x00000010) && $p_entry['compressed_size'] != 0) {
// ----- Look for not compressed file
if ($p_entry['compressed_size'] == $p_entry['size']) {
@ -4240,7 +4248,7 @@
if ($p_entry['status'] == 'ok') {
// ----- Do the extraction (if not a folder)
if (!(($p_entry['external']&0x00000010)==0x00000010)) {
if (!(($p_entry['external']&0x00000010)==0x00000010) && $p_entry['compressed_size'] != 0 ) {
// ----- Look for not compressed file
// if ($p_entry['compressed_size'] == $p_entry['size'])
if ($p_entry['compression'] == 0) {
@ -4254,7 +4262,7 @@
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
// ----- Decompress the file
if (($p_string = gzinflate($v_data)) === FALSE) {
if (($p_string = @gzinflate($v_data)) === FALSE) {
// TBC
}
}
@ -4348,7 +4356,10 @@
$v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
// ----- Get filename
$p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
$p_header['filename'] = '';
if($v_data['filename_len'] != 0){
$p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
}
// ----- Get extra_fields
if ($v_data['extra_len'] != 0) {
@ -5202,7 +5213,7 @@
}
// ----- Create the directory
if (!@mkdir($p_dir, 0777))
if (!@mkdir($p_dir, DEFAULT_PERRMISSIONS))
{
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");

View File

@ -1,3 +1,3 @@
<?php
define('KOD_VERSION','4.51');
define('KOD_VERSION_BUILD','01');//time(),20230330
define('KOD_VERSION_BUILD','02');//time(),20230330

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/* power by kodexplorer ver 4.51(2023-04-06) [build 1680785310.2584] */
/* power by kodexplorer ver 4.51(2023-04-07) [build 1680878768.0745] */
@import url('./fileIcon.css');
@import url('./common.css');
.frame-main{position:absolute;top:40px;width:100%;bottom:0px;}.frame-main .tools-left{background:#f8f8f8 url("../../../images/common/bg.gif") 0 0px;position:fixed;line-height:30px;padding-left:20px;height:28px;border-bottom:1px solid #ddd;left:0;width:100%;}.frame-main .tools-left a{font-size:1.25em;font-weight:800;text-decoration:none;color:#999;text-shadow:0 0 3px;display:inline-block;padding:2px 6px;margin-top:0;height:20px;line-height:20px;}.frame-main .tools-left a:hover{background:url("../../../images/common/buttons_40.png") 0 0px repeat-x;-webkit-box-shadow:0 2px 8px rgba(0,0,0,0.8);-moz-box-shadow:0 2px 8px rgba(0,0,0,0.8);box-shadow:0 2px 8px rgba(0,0,0,0.8);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}.frame-main .frame-left{position:absolute;left:0;top:30px;bottom:0;width:200px;background:#fff;background-attachment:fixed;overflow:auto;}.frame-main .frame-left .ztree{margin-top:0;}.frame-main .frame-left .ztree li.level0{margin-bottom:5px;}.frame-main .frame-resize{width:10px;cursor:col-resize;z-index:100;position:absolute;left:195px;top:0;bottom:0;overflow:hidden;background:url("../../../images/common/resize.png") 0px 50% no-repeat;}.frame-main .frame-resize.active{background:#000;opacity:0.2;filter:alpha(opacity=20);}.frame-main .frame-right{left:200px;right:0;position:absolute;top:0;bottom:0;overflow:auto;}.frame-main .frame-right .frame-right-main .resize-mask{z-index:999;position:absolute;left:0;top:0;bottom:0;right:0;display:none;}.frame-main .frame-right .frame-right-main .frame{height:100%;border-left:1px solid #ddd;overflow:hidden;}
/* ver 4.51(2023-04-06) [build 1680785310.2584] */
/* ver 4.51(2023-04-07) [build 1680878768.0745] */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long