ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

 getid3_szip (&$fd, &$ThisFileInfo)
 
 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 17 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\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  $info['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 $info['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  }
$info
Definition: example_052.php:80
fread($bytes)
Definition: getid3.php:1685
BigEndian2Int($byteword, $synchsafe=false, $signed=false)
Definition: getid3.lib.php:234
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
PrintHexBytes($string, $hex=true, $spaces=true, $htmlsafe=true)
Definition: getid3.lib.php:17
+ Here is the call graph for this function:

◆ getid3_szip()

getid3_szip::getid3_szip ( $fd,
$ThisFileInfo 
)

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

References getid3_lib\BigEndian2Int(), getid3_handler\feof(), getid3_handler\fread(), and getid3_handler\fseek().

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  }
fread($bytes)
Definition: getid3.php:1685
BigEndian2Int($byteword, $synchsafe=false, $signed=false)
Definition: getid3.lib.php:234
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:

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