12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
<?php
if (!defined('GETID3_INCLUDEPATH')) {
exit;
}
class getid3_7zip extends getid3_handler
{
public function Analyze() {
$info = &$this->getid3->info;
$this->fseek($info['avdataoffset']);
$z7header = $this->fread(32);
$info['7zip']['header']['magic'] = substr($z7header, 0, 6);
if ($info['7zip']['header']['magic'] != '7z'."\xBC\xAF\x27\x1C") {
$this->error('Invalid 7zip stream header magic (expecting 37 7A BC AF 27 1C, found '.getid3_lib::PrintHexBytes($info['7zip']['header']['magic']).') at offset '.$info['avdataoffset']);
return false;
}
$info['fileformat'] = '7zip';
$info['7zip']['header']['version_major'] = getid3_lib::LittleEndian2Int(substr($z7header, 6, 1));
$info['7zip']['header']['version_minor'] = getid3_lib::LittleEndian2Int(substr($z7header, 7, 1));
$info['7zip']['header']['start_header_crc'] = getid3_lib::LittleEndian2Int(substr($z7header, 8, 4));
$info['7zip']['header']['next_header_offset'] = getid3_lib::LittleEndian2Int(substr($z7header, 12, 8));
$info['7zip']['header']['next_header_size'] = getid3_lib::LittleEndian2Int(substr($z7header, 20, 8));
$info['7zip']['header']['next_header_crc'] = getid3_lib::LittleEndian2Int(substr($z7header, 28, 4));
$this->error('7zip parsing not enabled in this version of getID3() ['.$this->getid3->version().']');
return false;
}
}