mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-18 02:39:56 +09:00
merge from 1.5.3.2 (~r11225)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@11226 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
54e3a72065
commit
77f5aa2671
313 changed files with 8058 additions and 14251 deletions
|
|
@ -99,6 +99,10 @@ class tar {
|
|||
// PRIVATE ACCESS FUNCTION
|
||||
function __parseNullPaddedString($string) {
|
||||
$position = strpos($string,chr(0));
|
||||
if(!$position)
|
||||
{
|
||||
$position = strlen($string);
|
||||
}
|
||||
return substr($string,0,$position);
|
||||
}
|
||||
|
||||
|
|
@ -109,6 +113,7 @@ class tar {
|
|||
// Read Files from archive
|
||||
$tar_length = strlen($this->tar_file);
|
||||
$main_offset = 0;
|
||||
$flag_longlink = false;
|
||||
while($main_offset < $tar_length) {
|
||||
// If we read a block of 512 nulls, we are at the end of the archive
|
||||
if(substr($this->tar_file,$main_offset,512) == str_repeat(chr(0),512))
|
||||
|
|
@ -141,6 +146,8 @@ class tar {
|
|||
// Parse Group name
|
||||
$file_gname = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset + 297,32));
|
||||
|
||||
$file_type = substr($this->tar_file,$main_offset + 156,1);
|
||||
|
||||
// Make sure our file is valid
|
||||
if($this->__computeUnsignedChecksum(substr($this->tar_file,$main_offset,512)) != $file_chksum)
|
||||
return false;
|
||||
|
|
@ -159,42 +166,67 @@ class tar {
|
|||
$activeFile["endheader"] = substr($this->tar_file,$main_offset + 500,12);
|
||||
*/
|
||||
|
||||
if($file_size > 0) {
|
||||
// Increment number of files
|
||||
$this->numFiles++;
|
||||
if(strtolower($file_type) == 'l' || $file_name == '././@LongLink')
|
||||
{
|
||||
$flag_longlink = true;
|
||||
$longlink_name = $this->__parseNullPaddedString($file_contents);
|
||||
}
|
||||
elseif($file_type == '0') {
|
||||
// Increment number of files
|
||||
$this->numFiles++;
|
||||
|
||||
// Create us a new file in our array
|
||||
$activeFile = &$this->files[];
|
||||
// Create us a new file in our array
|
||||
$activeFile = &$this->files[];
|
||||
|
||||
// Asign Values
|
||||
$activeFile["name"] = $file_name;
|
||||
$activeFile["mode"] = $file_mode;
|
||||
$activeFile["size"] = $file_size;
|
||||
$activeFile["time"] = $file_time;
|
||||
$activeFile["user_id"] = $file_uid;
|
||||
$activeFile["group_id"] = $file_gid;
|
||||
$activeFile["user_name"] = $file_uname;
|
||||
$activeFile["group_name"] = $file_gname;
|
||||
$activeFile["checksum"] = $file_chksum;
|
||||
$activeFile["file"] = $file_contents;
|
||||
// Asign Values
|
||||
if($flag_longlink)
|
||||
{
|
||||
$activeFile["name"] = $longlink_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activeFile["name"] = $file_name;
|
||||
}
|
||||
$activeFile["type"] = $file_type;
|
||||
$activeFile["mode"] = $file_mode;
|
||||
$activeFile["size"] = $file_size;
|
||||
$activeFile["time"] = $file_time;
|
||||
$activeFile["user_id"] = $file_uid;
|
||||
$activeFile["group_id"] = $file_gid;
|
||||
$activeFile["user_name"] = $file_uname;
|
||||
$activeFile["group_name"] = $file_gname;
|
||||
$activeFile["checksum"] = $file_chksum;
|
||||
$activeFile["file"] = $file_contents;
|
||||
|
||||
} else {
|
||||
// Increment number of directories
|
||||
$this->numDirectories++;
|
||||
$flag_longlink = false;
|
||||
|
||||
// Create a new directory in our array
|
||||
$activeDir = &$this->directories[];
|
||||
} elseif($file_type == '5') {
|
||||
// Increment number of directories
|
||||
$this->numDirectories++;
|
||||
|
||||
// Assign values
|
||||
$activeDir["name"] = $file_name;
|
||||
$activeDir["mode"] = $file_mode;
|
||||
$activeDir["time"] = $file_time;
|
||||
$activeDir["user_id"] = $file_uid;
|
||||
$activeDir["group_id"] = $file_gid;
|
||||
$activeDir["user_name"] = $file_uname;
|
||||
$activeDir["group_name"] = $file_gname;
|
||||
$activeDir["checksum"] = $file_chksum;
|
||||
}
|
||||
// Create a new directory in our array
|
||||
$activeDir = &$this->directories[];
|
||||
|
||||
// Assign values
|
||||
if($flag_longlink)
|
||||
{
|
||||
$activeDir["name"] = $longlink_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$activeDir["name"] = $file_name;
|
||||
}
|
||||
$activeDir["type"] = $file_type;
|
||||
$activeDir["mode"] = $file_mode;
|
||||
$activeDir["time"] = $file_time;
|
||||
$activeDir["user_id"] = $file_uid;
|
||||
$activeDir["group_id"] = $file_gid;
|
||||
$activeDir["user_name"] = $file_uname;
|
||||
$activeDir["group_name"] = $file_gname;
|
||||
$activeDir["checksum"] = $file_chksum;
|
||||
|
||||
$flag_longlink = false;
|
||||
}
|
||||
|
||||
// Move our offset the number of blocks we have processed
|
||||
$main_offset += 512 + (ceil($file_size / 512) * 512);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue