ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
getid3_szip Class Reference

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

+ Inheritance diagram for getid3_szip:
+ Collaboration diagram for getid3_szip:

Public Member Functions

 Analyze ()
 
- Public Member Functions inherited from getid3_handler
 __construct (getID3 $getid3, $call_module=null)
 
 Analyze ()
 
 AnalyzeString ($string)
 
 setStringMode ($string)
 
 saveAttachment ($name, $offset, $length, $image_mime=null)
 

Additional Inherited Members

- Protected Member Functions inherited from getid3_handler
 ftell ()
 
 fread ($bytes)
 
 fseek ($bytes, $whence=SEEK_SET)
 
 feof ()
 
 isDependencyFor ($module)
 
 error ($text)
 
 warning ($text)
 
 notice ($text)
 
- Protected Attributes inherited from getid3_handler
 $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 //

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

Member Function Documentation

◆ Analyze()

getid3_szip::Analyze ( )

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

References $info, getid3_lib\BigEndian2Int(), getid3_handler\error(), getid3_handler\feof(), getid3_handler\fread(), getid3_handler\fseek(), and getid3_lib\PrintHexBytes().

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

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