44 $info = &$this->getid3->info;
46 $info[
'fileformat'] =
'tar';
49 $unpack_header =
'a100fname/a8mode/a8uid/a8gid/a12size/a12mtime/a8chksum/a1typflag/a100lnkname/a6magic/a2ver/a32uname/a32gname/a8devmaj/a8devmin/a155prefix';
50 $null_512k = str_repeat(
"\x00", 512);
52 fseek($this->getid3->fp, 0);
53 while (!
feof($this->getid3->fp)) {
54 $buffer =
fread($this->getid3->fp, 512);
55 if (strlen($buffer) < 512) {
61 for ($i = 0; $i < 148; $i++) {
62 $checksum += ord($buffer{$i});
64 for ($i = 148; $i < 156; $i++) {
65 $checksum += ord(
' ');
67 for ($i = 156; $i < 512; $i++) {
68 $checksum += ord($buffer{$i});
70 $attr = unpack($unpack_header, $buffer);
71 $name = (isset($attr[
'fname']) ? trim($attr[
'fname']) :
'');
72 $mode = octdec(isset($attr[
'mode']) ? trim($attr[
'mode']) :
'');
73 $uid = octdec(isset($attr[
'uid']) ? trim($attr[
'uid']) :
'');
74 $gid = octdec(isset($attr[
'gid']) ? trim($attr[
'gid']) :
'');
75 $size = octdec(isset($attr[
'size']) ? trim($attr[
'size']) :
'');
76 $mtime = octdec(isset($attr[
'mtime']) ? trim($attr[
'mtime']) :
'');
77 $chksum = octdec(isset($attr[
'chksum']) ? trim($attr[
'chksum']) :
'');
78 $typflag = (isset($attr[
'typflag']) ? trim($attr[
'typflag']) :
'');
79 $lnkname = (isset($attr[
'lnkname']) ? trim($attr[
'lnkname']) :
'');
80 $magic = (isset($attr[
'magic']) ? trim($attr[
'magic']) :
'');
81 $ver = (isset($attr[
'ver']) ? trim($attr[
'ver']) :
'');
82 $uname = (isset($attr[
'uname']) ? trim($attr[
'uname']) :
'');
83 $gname = (isset($attr[
'gname']) ? trim($attr[
'gname']) :
'');
84 $devmaj = octdec(isset($attr[
'devmaj']) ? trim($attr[
'devmaj']) :
'');
85 $devmin = octdec(isset($attr[
'devmin']) ? trim($attr[
'devmin']) :
'');
86 $prefix = (isset($attr[
'prefix']) ? trim($attr[
'prefix']) :
'');
87 if (($checksum == 256) && ($chksum == 0)) {
92 $name = $prefix .
'/' . $name;
94 if ((preg_match(
'#/$#', $name)) && !$name) {
97 if ($buffer == $null_512k) {
108 fseek($this->getid3->fp, (512 - $diff), SEEK_CUR);
117 'mode' => self::display_perms($mode),
123 'typeflag' => self::get_flag_type($typflag),
124 'linkname' => $lnkname,
129 'devmajor' => $devmaj,
130 'devminor' => $devmin
150 if ($mode & 0x1000) $type =
'p';
151 elseif ($mode & 0x2000) $type =
'c';
152 elseif ($mode & 0x4000) $type =
'd';
153 elseif ($mode & 0x6000) $type =
'b';
154 elseif ($mode & 0x8000) $type =
'-';
155 elseif ($mode & 0xA000) $type =
'l';
156 elseif ($mode & 0xC000) $type =
's';
161 $owner[
'read'] = (($mode & 00400) ?
'r' :
'-');
162 $owner[
'write'] = (($mode & 00200) ?
'w' :
'-');
163 $owner[
'execute'] = (($mode & 00100) ?
'x' :
'-');
164 $group[
'read'] = (($mode & 00040) ?
'r' :
'-');
165 $group[
'write'] = (($mode & 00020) ?
'w' :
'-');
166 $group[
'execute'] = (($mode & 00010) ?
'x' :
'-');
167 $world[
'read'] = (($mode & 00004) ?
'r' :
'-');
168 $world[
'write'] = (($mode & 00002) ?
'w' :
'-');
169 $world[
'execute'] = (($mode & 00001) ?
'x' :
'-');
173 $owner[
'execute'] = ($owner[
'execute'] ==
'x') ?
's' :
'S';
175 $group[
'execute'] = ($group[
'execute'] ==
'x') ?
's' :
'S';
177 $world[
'execute'] = ($world[
'execute'] ==
'x') ?
't' :
'T';
179 $s = sprintf(
'%1s', $type);
180 $s .= sprintf(
'%1s%1s%1s', $owner[
'read'], $owner[
'write'],
182 $s .= sprintf(
'%1s%1s%1s', $group[
'read'], $group[
'write'],
184 $s .= sprintf(
'%1s%1s%1s' .
"\n", $world[
'read'], $world[
'write'],
199 static $flag_types =
array(
209 'K' =>
'LF_LONGLINK',
210 'L' =>
'LF_LONGNAME',
211 'M' =>
'LF_MULTIVOL',
217 return (isset($flag_types[$typflag]) ? $flag_types[$typflag] :
'');
static CreateDeepArray($ArrayPath, $Separator, $Value)
GetId3() by James Heinrich info@getid3.org //.
GetId3() by James Heinrich info@getid3.org //.
display_perms($mode)
Parses the file mode to file permissions.
fseek($bytes, $whence=SEEK_SET)
Create styles array
The data for the language used.
static array_merge_clobber($array1, $array2)
get_flag_type($typflag)
Converts the file type.