ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
GetId3\Module\Archive\Szip Class Reference

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

+ Inheritance diagram for GetId3\Module\Archive\Szip:
+ Collaboration diagram for GetId3\Module\Archive\Szip:

Public Member Functions

 analyze ()
 
- Public Member Functions inherited from GetId3\Handler\BaseHandler
 __construct (GetId3Core $getid3, $call_module=null)
 
 analyze ()
 Analyze from file pointer. More...
 
 AnalyzeString (&$string)
 Analyze from string instead. More...
 
 saveAttachment (&$ThisFileInfoIndex, $filename, $offset, $length)
 

Additional Inherited Members

- Protected Member Functions inherited from GetId3\Handler\BaseHandler
 ftell ()
 
 fread ($bytes)
 
 fseek ($bytes, $whence=SEEK_SET)
 
 feof ()
 
 isDependencyFor ($module)
 
 error ($text)
 
 warning ($text)
 
- Protected Attributes inherited from GetId3\Handler\BaseHandler
 $getid3
 
 $data_string_flag = false
 
 $data_string = ''
 
 $data_string_position = 0
 
 $data_string_length = 0
 

Detailed Description

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

module for analyzing SZIP compressed files

Author
James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g http://www.getid3.org

Definition at line 29 of file Szip.php.

Member Function Documentation

◆ analyze()

GetId3\Module\Archive\Szip::analyze ( )
Returns
boolean

Reimplemented from GetId3\Handler\BaseHandler.

Definition at line 35 of file Szip.php.

36 {
37 $info = &$this->getid3->info;
38
39 fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
40 $SZIPHeader = fread($this->getid3->fp, 6);
41 if (substr($SZIPHeader, 0, 4) != "SZ\x0A\x04") {
42 $info['error'][] = 'Expecting "53 5A 0A 04" at offset ' . $info['avdataoffset'] . ', found "' . Helper::PrintHexBytes(substr($SZIPHeader,
43 0,
44 4)) . '"';
45
46 return false;
47 }
48 $info['fileformat'] = 'szip';
49 $info['szip']['major_version'] = Helper::BigEndian2Int(substr($SZIPHeader,
50 4,
51 1));
52 $info['szip']['minor_version'] = Helper::BigEndian2Int(substr($SZIPHeader,
53 5,
54 1));
55
56 while (!feof($this->getid3->fp)) {
57 $NextBlockID = fread($this->getid3->fp, 2);
58 switch ($NextBlockID) {
59 case 'SZ':
60 // Note that szip files can be concatenated, this has the same effect as
61 // concatenating the files. this also means that global header blocks
62 // might be present between directory/data blocks.
63 fseek($this->getid3->fp, 4, SEEK_CUR);
64 break;
65
66 case 'BH':
67 $BHheaderbytes = Helper::BigEndian2Int(fread($this->getid3->fp,
68 3));
69 $BHheaderdata = fread($this->getid3->fp, $BHheaderbytes);
70 $BHheaderoffset = 0;
71 while (strpos($BHheaderdata, "\x00", $BHheaderoffset) > 0) {
72 //filename as \0 terminated string (empty string indicates end)
73 //owner as \0 terminated string (empty is same as last file)
74 //group as \0 terminated string (empty is same as last file)
75 //3 byte filelength in this block
76 //2 byte access flags
77 //4 byte creation time (like in unix)
78 //4 byte modification time (like in unix)
79 //4 byte access time (like in unix)
80
81 $BHdataArray['filename'] = substr($BHheaderdata,
82 $BHheaderoffset,
83 strcspn($BHheaderdata,
84 "\x00"));
85 $BHheaderoffset += (strlen($BHdataArray['filename']) + 1);
86
87 $BHdataArray['owner'] = substr($BHheaderdata,
88 $BHheaderoffset,
89 strcspn($BHheaderdata,
90 "\x00"));
91 $BHheaderoffset += (strlen($BHdataArray['owner']) + 1);
92
93 $BHdataArray['group'] = substr($BHheaderdata,
94 $BHheaderoffset,
95 strcspn($BHheaderdata,
96 "\x00"));
97 $BHheaderoffset += (strlen($BHdataArray['group']) + 1);
98
99 $BHdataArray['filelength'] = Helper::BigEndian2Int(substr($BHheaderdata,
100 $BHheaderoffset,
101 3));
102 $BHheaderoffset += 3;
103
104 $BHdataArray['access_flags'] = Helper::BigEndian2Int(substr($BHheaderdata,
105 $BHheaderoffset,
106 2));
107 $BHheaderoffset += 2;
108
109 $BHdataArray['creation_time'] = Helper::BigEndian2Int(substr($BHheaderdata,
110 $BHheaderoffset,
111 4));
112 $BHheaderoffset += 4;
113
114 $BHdataArray['modification_time'] = Helper::BigEndian2Int(substr($BHheaderdata,
115 $BHheaderoffset,
116 4));
117 $BHheaderoffset += 4;
118
119 $BHdataArray['access_time'] = Helper::BigEndian2Int(substr($BHheaderdata,
120 $BHheaderoffset,
121 4));
122 $BHheaderoffset += 4;
123
124 $info['szip']['BH'][] = $BHdataArray;
125 }
126 break;
127
128 default:
129 break 2;
130 }
131 }
132
133 return true;
134 }
fseek($bytes, $whence=SEEK_SET)
static BigEndian2Int($byteword, $synchsafe=false, $signed=false)
Definition: Helper.php:374
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
Definition: Helper.php:36
$info
Definition: example_052.php:80

References $info, GetId3\Lib\Helper\BigEndian2Int(), GetId3\Handler\BaseHandler\feof(), GetId3\Handler\BaseHandler\fread(), GetId3\Handler\BaseHandler\fseek(), and GetId3\Lib\Helper\PrintHexBytes().

+ Here is the call graph for this function:

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