ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
getid3_szip Class Reference

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g // More...

+ Collaboration diagram for getid3_szip:

Public Member Functions

 getid3_szip (&$fd, &$ThisFileInfo)
 

Detailed Description

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //

Definition at line 17 of file module.archive.szip.php.

Member Function Documentation

◆ getid3_szip()

getid3_szip::getid3_szip ( $fd,
$ThisFileInfo 
)

Definition at line 20 of file module.archive.szip.php.

20 {
21
22 fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
23 $SZIPHeader = fread($fd, 6);
24 if (substr($SZIPHeader, 0, 4) != 'SZ'."\x0A\x04") {
25 $ThisFileInfo['error'][] = 'Expecting "SZ[x0A][x04]" at offset '.$ThisFileInfo['avdataoffset'].', found "'.substr($SZIPHeader, 0, 4).'"';
26 return false;
27 }
28
29 $ThisFileInfo['fileformat'] = 'szip';
30
31 $ThisFileInfo['szip']['major_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 4, 1));
32 $ThisFileInfo['szip']['minor_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 5, 1));
33
34 while (!feof($fd)) {
35 $NextBlockID = fread($fd, 2);
36 switch ($NextBlockID) {
37 case 'SZ':
38 // Note that szip files can be concatenated, this has the same effect as
39 // concatenating the files. this also means that global header blocks
40 // might be present between directory/data blocks.
41 fseek($fd, 4, SEEK_CUR);
42 break;
43
44 case 'BH':
45 $BHheaderbytes = getid3_lib::BigEndian2Int(fread($fd, 3));
46 $BHheaderdata = fread($fd, $BHheaderbytes);
47 $BHheaderoffset = 0;
48 while (strpos($BHheaderdata, "\x00", $BHheaderoffset) > 0) {
49 //filename as \0 terminated string (empty string indicates end)
50 //owner as \0 terminated string (empty is same as last file)
51 //group as \0 terminated string (empty is same as last file)
52 //3 byte filelength in this block
53 //2 byte access flags
54 //4 byte creation time (like in unix)
55 //4 byte modification time (like in unix)
56 //4 byte access time (like in unix)
57
58 $BHdataArray['filename'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00"));
59 $BHheaderoffset += (strlen($BHdataArray['filename']) + 1);
60
61 $BHdataArray['owner'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00"));
62 $BHheaderoffset += (strlen($BHdataArray['owner']) + 1);
63
64 $BHdataArray['group'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00"));
65 $BHheaderoffset += (strlen($BHdataArray['group']) + 1);
66
67 $BHdataArray['filelength'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 3));
68 $BHheaderoffset += 3;
69
70 $BHdataArray['access_flags'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 2));
71 $BHheaderoffset += 2;
72
73 $BHdataArray['creation_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
74 $BHheaderoffset += 4;
75
76 $BHdataArray['modification_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
77 $BHheaderoffset += 4;
78
79 $BHdataArray['access_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
80 $BHheaderoffset += 4;
81
82 $ThisFileInfo['szip']['BH'][] = $BHdataArray;
83 }
84 break;
85
86 default:
87 break 2;
88 }
89 }
90
91 return true;
92
93 }
BigEndian2Int($byteword, $synchsafe=false, $signed=false)
Definition: getid3.lib.php:234

References getid3_lib\BigEndian2Int().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: