Ticket #49945: 49945.1.patch
File 49945.1.patch, 36.1 KB (added by , 4 years ago) |
---|
-
src/wp-includes/ID3/getid3.lib.php
diff --git a/src/wp-includes/ID3/getid3.lib.php b/src/wp-includes/ID3/getid3.lib.php index 1d51e8c4f3..7566b39da4 100644
a b 15 15 class getid3_lib 16 16 { 17 17 /** 18 * @param string $string19 * @param bool $hex20 * @param bool $spaces21 * @param string $htmlencoding18 * @param string $string 19 * @param bool $hex 20 * @param bool $spaces 21 * @param string|bool $htmlencoding 22 22 * 23 23 * @return string 24 24 */ … … public static function Float2String($floatvalue, $bits) { 216 216 217 217 default: 218 218 return false; 219 break;220 219 } 221 220 if ($floatvalue >= 0) { 222 221 $signbit = '0'; … … public static function BigEndian2Float($byteword) { 284 283 $floatvalue *= -1; 285 284 } 286 285 return $floatvalue; 287 break;288 286 289 287 default: 290 288 return false; 291 break;292 289 } 293 290 $exponentstring = substr($bitword, 1, $exponentbits); 294 291 $fractionstring = substr($bitword, $exponentbits + 1, $fractionbits); … … public static function LittleEndian2String($number, $minbytes=1, $synchsafe=fals 500 497 } 501 498 502 499 /** 503 * @param array$array1504 * @param array$array2500 * @param mixed $array1 501 * @param mixed $array2 505 502 * 506 503 * @return array|false 507 504 */ … … public static function array_merge_clobber($array1, $array2) { 523 520 } 524 521 525 522 /** 526 * @param array$array1527 * @param array$array2523 * @param mixed $array1 524 * @param mixed $array2 528 525 * 529 526 * @return array|false 530 527 */ … … public static function array_merge_noclobber($array1, $array2) { 544 541 } 545 542 546 543 /** 547 * @param array$array1548 * @param array$array2544 * @param mixed $array1 545 * @param mixed $array2 549 546 * 550 547 * @return array|false|null 551 548 */ … … public static function XML2array($XMLstring) { 735 732 } 736 733 737 734 /** 738 * @param SimpleXMLElement|array $XMLobject735 * @param SimpleXMLElement|array|mixed $XMLobject 739 736 * 740 * @return array737 * @return mixed 741 738 */ 742 739 public static function SimpleXMLelement2array($XMLobject) { 743 740 if (!is_object($XMLobject) && !is_array($XMLobject)) { … … public static function RGADamplitude2dB($amplitude) { 1479 1476 * @return array|false 1480 1477 */ 1481 1478 public static function GetDataImageSize($imgData, &$imageinfo=array()) { 1479 if (PHP_VERSION_ID >= 50400) { 1480 $GetDataImageSize = @getimagesizefromstring($imgData, $imageinfo); 1481 if ($GetDataImageSize === false || !isset($GetDataImageSize[0], $GetDataImageSize[1])) { 1482 return false; 1483 } 1484 $GetDataImageSize['height'] = $GetDataImageSize[0]; 1485 $GetDataImageSize['width'] = $GetDataImageSize[1]; 1486 return $GetDataImageSize; 1487 } 1482 1488 static $tempdir = ''; 1483 1489 if (empty($tempdir)) { 1484 1490 if (function_exists('sys_get_temp_dir')) { … … public static function GetDataImageSize($imgData, &$imageinfo=array()) { 1487 1493 1488 1494 // yes this is ugly, feel free to suggest a better way 1489 1495 if (include_once(dirname(__FILE__).'/getid3.php')) { 1490 if ($getid3_temp = new getID3()) { 1491 if ($getid3_temp_tempdir = $getid3_temp->tempdir) { 1492 $tempdir = $getid3_temp_tempdir; 1493 } 1494 unset($getid3_temp, $getid3_temp_tempdir); 1496 $getid3_temp = new getID3(); 1497 if ($getid3_temp_tempdir = $getid3_temp->tempdir) { 1498 $tempdir = $getid3_temp_tempdir; 1495 1499 } 1500 unset($getid3_temp, $getid3_temp_tempdir); 1496 1501 } 1497 1502 } 1498 1503 $GetDataImageSize = false; … … public static function CopyTagsToComments(&$ThisFileInfo) { 1568 1573 if (!is_int($key) && !ctype_digit($key)) { 1569 1574 $ThisFileInfo['comments'][$tagname][$key] = $value; 1570 1575 } else { 1571 if ( isset($ThisFileInfo['comments'][$tagname])) {1576 if (!isset($ThisFileInfo['comments'][$tagname])) { 1572 1577 $ThisFileInfo['comments'][$tagname] = array($value); 1573 1578 } else { 1574 1579 $ThisFileInfo['comments'][$tagname][] = $value; -
src/wp-includes/ID3/getid3.php
diff --git a/src/wp-includes/ID3/getid3.php b/src/wp-includes/ID3/getid3.php index cb25253e22..a6260f0689 100644
a b class getID3 250 250 */ 251 251 protected $startup_warning = ''; 252 252 253 const VERSION = '1.9.1 8-201907240906';253 const VERSION = '1.9.19-201912131005'; 254 254 const FREAD_BUFFER_SIZE = 32768; 255 255 256 256 const ATTACHMENTS_NONE = false; … … public function __construct() { 266 266 } 267 267 268 268 // Check memory 269 $ this->memory_limit = ini_get('memory_limit');270 if (preg_match('#([0-9]+) ?M#i', $ this->memory_limit, $matches)) {269 $memoryLimit = ini_get('memory_limit'); 270 if (preg_match('#([0-9]+) ?M#i', $memoryLimit, $matches)) { 271 271 // could be stored as "16M" rather than 16777216 for example 272 $ this->memory_limit = $matches[1] * 1048576;273 } elseif (preg_match('#([0-9]+) ?G#i', $ this->memory_limit, $matches)) { // The 'G' modifier is available since PHP 5.1.0272 $memoryLimit = $matches[1] * 1048576; 273 } elseif (preg_match('#([0-9]+) ?G#i', $memoryLimit, $matches)) { // The 'G' modifier is available since PHP 5.1.0 274 274 // could be stored as "2G" rather than 2147483648 for example 275 $ this->memory_limit = $matches[1] * 1073741824;275 $memoryLimit = $matches[1] * 1073741824; 276 276 } 277 $this->memory_limit = $memoryLimit; 278 277 279 if ($this->memory_limit <= 0) { 278 280 // memory limits probably disabled 279 281 } elseif ($this->memory_limit <= 4194304) { … … public function __construct() { 287 289 $this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.'); 288 290 } 289 291 290 if (($mbstring_func_overload = ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) {292 if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) { 291 293 // http://php.net/manual/en/mbstring.overload.php 292 294 // "mbstring.func_overload in php.ini is a positive value that represents a combination of bitmasks specifying the categories of functions to be overloaded. It should be set to 1 to overload the mail() function. 2 for string functions, 4 for regular expression functions" 293 295 // getID3 cannot run when string functions are overloaded. It doesn't matter if mail() or ereg* functions are overloaded since getID3 does not use those. 294 296 $this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n"; 295 297 } 296 298 297 // WORDPRESS CHANGE FROM UPSTREAM298 // Comment out deprecated function299 /*300 // Check for magic_quotes_runtime301 if (function_exists('get_magic_quotes_runtime')) {302 if (get_magic_quotes_runtime()) {303 $this->startup_error .= 'magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).'."\n";299 // check for magic quotes in PHP < 7.4.0 (when these functions became deprecated) 300 if (version_compare(PHP_VERSION, '7.4.0', '<')) { 301 // Check for magic_quotes_runtime 302 if (function_exists('get_magic_quotes_runtime')) { 303 if (get_magic_quotes_runtime()) { 304 $this->startup_error .= 'magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).'."\n"; 305 } 304 306 } 305 } 306 307 // Check for magic_quotes_gpc 308 if (function_exists('magic_quotes_gpc')) { 309 if (get_magic_quotes_gpc()) { 310 $this->startup_error .= 'magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).'."\n"; 307 // Check for magic_quotes_gpc 308 if (function_exists('get_magic_quotes_gpc')) { 309 if (get_magic_quotes_gpc()) { 310 $this->startup_error .= 'magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).'."\n"; 311 } 311 312 } 312 313 } 313 **/314 314 315 315 // Load support library 316 316 if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { … … public function setOption($optArray) { 402 402 } 403 403 404 404 /** 405 * @param string $filename 406 * @param int $filesize 405 * @param string $filename 406 * @param int $filesize 407 * @param resource $fp 407 408 * 408 409 * @return bool 409 410 * … … public function openfile($filename, $filesize=null, $fp=null) { 513 514 /** 514 515 * analyze file 515 516 * 516 * @param string $filename 517 * @param int $filesize 518 * @param string $original_filename 517 * @param string $filename 518 * @param int $filesize 519 * @param string $original_filename 520 * @param resource $fp 519 521 * 520 522 * @return array 521 523 */ … … public function GetFileFormatArray() { 1106 1108 'mime_type' => 'video/MP2T', 1107 1109 ), 1108 1110 1111 // WTV - audio/video - Windows Recorded TV Show 1112 'wtv' => array( 1113 'pattern' => '^\\xB7\\xD8\\x00\\x20\\x37\\x49\\xDA\\x11\\xA6\\x4E\\x00\\x07\\xE9\\x5E\\xAD\\x8D', 1114 'group' => 'audio-video', 1115 'module' => 'wtv', 1116 'mime_type' => 'video/x-ms-wtv', 1117 ), 1118 1109 1119 1110 1120 // Still-Image formats 1111 1121 … … public function getHashdata($algorithm) { 1528 1538 1529 1539 default: 1530 1540 return $this->error('bad algorithm "'.$algorithm.'" in getHashdata()'); 1531 break;1532 1541 } 1533 1542 1534 1543 if (!empty($this->info['fileformat']) && !empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) { -
src/wp-includes/ID3/module.audio-video.asf.php
diff --git a/src/wp-includes/ID3/module.audio-video.asf.php b/src/wp-includes/ID3/module.audio-video.asf.php index 0a2132dd1d..cb680f8930 100644
a b public function Analyze() { 363 363 $thisfile_audio['codec'] = $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['name']); 364 364 365 365 if (!isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) { 366 $thisfile_audio['bitrate'] = (int) (trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000);366 $thisfile_audio['bitrate'] = (int) trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000; 367 367 } 368 368 //if (!isset($thisfile_video['bitrate']) && isset($thisfile_audio['bitrate']) && isset($thisfile_asf['file_properties_object']['max_bitrate']) && ($thisfile_asf_codeclistobject['codec_entries_count'] > 1)) { 369 369 if (empty($thisfile_video['bitrate']) && !empty($thisfile_audio['bitrate']) && !empty($info['bitrate'])) { … … public function Analyze() { 807 807 808 808 case 'wm/track': 809 809 if (empty($thisfile_asf_comments['track_number'])) { 810 $thisfile_asf_comments['track_number'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));810 $thisfile_asf_comments['track_number'] = array(1 + (int) $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); 811 811 } 812 812 break; 813 813 -
src/wp-includes/ID3/module.audio-video.flv.php
diff --git a/src/wp-includes/ID3/module.audio-video.flv.php b/src/wp-includes/ID3/module.audio-video.flv.php index eb292c6136..b6703b5a71 100644
a b public function readData() { 597 597 // null 598 598 case 6: 599 599 return null; 600 break;601 600 602 601 // Mixed array 603 602 case 8: -
src/wp-includes/ID3/module.audio-video.quicktime.php
diff --git a/src/wp-includes/ID3/module.audio-video.quicktime.php b/src/wp-includes/ID3/module.audio-video.quicktime.php index cb1173bdbd..cfe8ff5a8c 100644
a b public function Analyze() { 112 112 if (!empty($info['quicktime']['comments']['location.ISO6709'])) { 113 113 // https://en.wikipedia.org/wiki/ISO_6709 114 114 foreach ($info['quicktime']['comments']['location.ISO6709'] as $ISO6709string) { 115 $latitude = false; 116 $longitude = false; 117 $altitude = false; 115 $ISO6709parsed = array('latitude'=>false, 'longitude'=>false, 'altitude'=>false); 118 116 if (preg_match('#^([\\+\\-])([0-9]{2}|[0-9]{4}|[0-9]{6})(\\.[0-9]+)?([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?(([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?)?/$#', $ISO6709string, $matches)) { 119 117 @list($dummy, $lat_sign, $lat_deg, $lat_deg_dec, $lon_sign, $lon_deg, $lon_deg_dec, $dummy, $alt_sign, $alt_deg, $alt_deg_dec) = $matches; 120 118 121 119 if (strlen($lat_deg) == 2) { // [+-]DD.D 122 $ latitude =floatval(ltrim($lat_deg, '0').$lat_deg_dec);120 $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim($lat_deg, '0').$lat_deg_dec); 123 121 } elseif (strlen($lat_deg) == 4) { // [+-]DDMM.M 124 $ latitude =floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0').$lat_deg_dec / 60);122 $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0').$lat_deg_dec / 60); 125 123 } elseif (strlen($lat_deg) == 6) { // [+-]DDMMSS.S 126 $ latitude =floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lat_deg, 4, 2), '0').$lat_deg_dec / 3600);124 $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lat_deg, 4, 2), '0').$lat_deg_dec / 3600); 127 125 } 128 126 129 127 if (strlen($lon_deg) == 3) { // [+-]DDD.D 130 $ longitude =floatval(ltrim($lon_deg, '0').$lon_deg_dec);128 $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim($lon_deg, '0').$lon_deg_dec); 131 129 } elseif (strlen($lon_deg) == 5) { // [+-]DDDMM.M 132 $ longitude =floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0').$lon_deg_dec / 60);130 $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0').$lon_deg_dec / 60); 133 131 } elseif (strlen($lon_deg) == 7) { // [+-]DDDMMSS.S 134 $ longitude =floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lon_deg, 4, 2), '0').$lon_deg_dec / 3600);132 $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lon_deg, 4, 2), '0').$lon_deg_dec / 3600); 135 133 } 136 134 137 135 if (strlen($alt_deg) == 3) { // [+-]DDD.D 138 $ altitude =floatval(ltrim($alt_deg, '0').$alt_deg_dec);136 $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim($alt_deg, '0').$alt_deg_dec); 139 137 } elseif (strlen($alt_deg) == 5) { // [+-]DDDMM.M 140 $ altitude =floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0').$alt_deg_dec / 60);138 $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0').$alt_deg_dec / 60); 141 139 } elseif (strlen($alt_deg) == 7) { // [+-]DDDMMSS.S 142 $ altitude =floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($alt_deg, 4, 2), '0').$alt_deg_dec / 3600);140 $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($alt_deg, 4, 2), '0').$alt_deg_dec / 3600); 143 141 } 144 142 145 if ($latitude !== false) { 146 $info['quicktime']['comments']['gps_latitude'][] = (($lat_sign == '-') ? -1 : 1) * floatval($latitude); 147 } 148 if ($longitude !== false) { 149 $info['quicktime']['comments']['gps_longitude'][] = (($lon_sign == '-') ? -1 : 1) * floatval($longitude); 150 } 151 if ($altitude !== false) { 152 $info['quicktime']['comments']['gps_altitude'][] = (($alt_sign == '-') ? -1 : 1) * floatval($altitude); 143 foreach (array('latitude', 'longitude', 'altitude') as $key) { 144 if ($ISO6709parsed[$key] !== false) { 145 $value = (($lat_sign == '-') ? -1 : 1) * floatval($ISO6709parsed[$key]); 146 if (!in_array($value, $info['quicktime']['comments']['gps_'.$key])) { 147 $info['quicktime']['comments']['gps_'.$key][] = (($lat_sign == '-') ? -1 : 1) * floatval($ISO6709parsed[$key]); 148 } 149 } 153 150 } 154 151 } 155 if ($ latitude=== false) {152 if ($ISO6709parsed['latitude'] === false) { 156 153 $this->warning('location.ISO6709 string not parsed correctly: "'.$ISO6709string.'", please submit as a bug'); 157 154 } 158 155 break; … … public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset 224 221 225 222 $atom_parent = end($atomHierarchy); // not array_pop($atomHierarchy); see https://www.getid3.org/phpBB3/viewtopic.php?t=1717 226 223 array_push($atomHierarchy, $atomname); 224 $atom_structure = array(); 227 225 $atom_structure['hierarchy'] = implode(' ', $atomHierarchy); 228 226 $atom_structure['name'] = $atomname; 229 227 $atom_structure['size'] = $atomsize; … … public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset 244 242 case 'mdia': // MeDIA container atom 245 243 case 'minf': // Media INFormation container atom 246 244 case 'dinf': // Data INFormation container atom 245 case 'nmhd': // Null Media HeaDer container atom 247 246 case 'udta': // User DaTA container atom 248 247 case 'cmov': // Compressed MOVie container atom 249 248 case 'rmra': // Reference Movie Record Atom … … public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset 1044 1043 1045 1044 1046 1045 case 'stco': // Sample Table Chunk Offset atom 1046 // if (true) { 1047 1047 if ($ParseAllPossibleAtoms) { 1048 1048 $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); 1049 1049 $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 … … public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset 1639 1639 } 1640 1640 break; 1641 1641 1642 case 'uuid': // Atom holding 360fly spatial data?? 1643 /* code in this block by Paul Lewis 2019-Oct-31 */ 1644 /* Sensor Timestamps need to be calculated using the recordings base time at ['quicktime']['moov']['subatoms'][0]['creation_time_unix']. */ 1645 $atom_structure['title'] = '360Fly Sensor Data'; 1646 1647 //Get the UUID ID in first 16 bytes 1648 $uuid_bytes_read = unpack('H8time_low/H4time_mid/H4time_hi/H4clock_seq_hi/H12clock_seq_low', substr($atom_data, 0, 16)); 1649 $atom_structure['uuid_field_id'] = print_r(implode('-', $uuid_bytes_read), true); 1650 1651 //Get the UUID HEADER data 1652 $uuid_bytes_read = unpack('Sheader_size/Sheader_version/Stimescale/Shardware_version/x/x/x/x/x/x/x/x/x/x/x/x/x/x/x/x/', substr($atom_data, 16, 32)); 1653 $atom_structure['uuid_header'] = json_encode($uuid_bytes_read, true); 1654 1655 $start_byte = 48; 1656 $atom_SENSOR_data = substr($atom_data, $start_byte); 1657 $atom_structure['sensor_data']['data_type'] = array( 1658 'fusion_count' => 0, // ID 250 1659 'fusion_data' => array(), 1660 'accel_count' => 0, // ID 1 1661 'accel_data' => array(), 1662 'gyro_count' => 0, // ID 2 1663 'gyro_data' => array(), 1664 'magno_count' => 0, // ID 3 1665 'magno_data' => array(), 1666 'gps_count' => 0, // ID 5 1667 'gps_data' => array(), 1668 'rotation_count' => 0, // ID 6 1669 'rotation_data' => array(), 1670 'unknown_count' => 0, // ID ?? 1671 'unknown_data' => array(), 1672 'debug_list' => '', // Used to debug variables stored as comma delimited strings 1673 ); 1674 $debug_structure['debug_items'] = array(); 1675 // Can start loop here to decode all sensor data in 32 Byte chunks: 1676 foreach (str_split($atom_SENSOR_data, 32) as $sensor_key => $sensor_data) { 1677 // This gets me a data_type code to work out what data is in the next 31 bytes. 1678 $sensor_data_type = substr($sensor_data, 0, 1); 1679 $sensor_data_content = substr($sensor_data, 1); 1680 $uuid_bytes_read = unpack('C*', $sensor_data_type); 1681 $sensor_data_array = array(); 1682 switch ($uuid_bytes_read[1]) { 1683 case 250: 1684 $atom_structure['sensor_data']['data_type']['fusion_count']++; 1685 $uuid_bytes_read = unpack('cmode/Jtimestamp/Gyaw/Gpitch/Groll/x*', $sensor_data_content); 1686 $sensor_data_array['mode'] = $uuid_bytes_read['mode']; 1687 $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; 1688 $sensor_data_array['yaw'] = $uuid_bytes_read['yaw']; 1689 $sensor_data_array['pitch'] = $uuid_bytes_read['pitch']; 1690 $sensor_data_array['roll'] = $uuid_bytes_read['roll']; 1691 array_push($atom_structure['sensor_data']['data_type']['fusion_data'], $sensor_data_array); 1692 break; 1693 case 1: 1694 $atom_structure['sensor_data']['data_type']['accel_count']++; 1695 $uuid_bytes_read = unpack('cmode/Jtimestamp/Gyaw/Gpitch/Groll/x*', $sensor_data_content); 1696 $sensor_data_array['mode'] = $uuid_bytes_read['mode']; 1697 $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; 1698 $sensor_data_array['yaw'] = $uuid_bytes_read['yaw']; 1699 $sensor_data_array['pitch'] = $uuid_bytes_read['pitch']; 1700 $sensor_data_array['roll'] = $uuid_bytes_read['roll']; 1701 array_push($atom_structure['sensor_data']['data_type']['accel_data'], $sensor_data_array); 1702 break; 1703 case 2: 1704 $atom_structure['sensor_data']['data_type']['gyro_count']++; 1705 $uuid_bytes_read = unpack('cmode/Jtimestamp/Gyaw/Gpitch/Groll/x*', $sensor_data_content); 1706 $sensor_data_array['mode'] = $uuid_bytes_read['mode']; 1707 $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; 1708 $sensor_data_array['yaw'] = $uuid_bytes_read['yaw']; 1709 $sensor_data_array['pitch'] = $uuid_bytes_read['pitch']; 1710 $sensor_data_array['roll'] = $uuid_bytes_read['roll']; 1711 array_push($atom_structure['sensor_data']['data_type']['gyro_data'], $sensor_data_array); 1712 break; 1713 case 3: 1714 $atom_structure['sensor_data']['data_type']['magno_count']++; 1715 $uuid_bytes_read = unpack('cmode/Jtimestamp/Gmagx/Gmagy/Gmagz/x*', $sensor_data_content); 1716 $sensor_data_array['mode'] = $uuid_bytes_read['mode']; 1717 $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; 1718 $sensor_data_array['magx'] = $uuid_bytes_read['magx']; 1719 $sensor_data_array['magy'] = $uuid_bytes_read['magy']; 1720 $sensor_data_array['magz'] = $uuid_bytes_read['magz']; 1721 array_push($atom_structure['sensor_data']['data_type']['magno_data'], $sensor_data_array); 1722 break; 1723 case 5: 1724 $atom_structure['sensor_data']['data_type']['gps_count']++; 1725 $uuid_bytes_read = unpack('cmode/Jtimestamp/Glat/Glon/Galt/Gspeed/nbearing/nacc/x*', $sensor_data_content); 1726 $sensor_data_array['mode'] = $uuid_bytes_read['mode']; 1727 $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; 1728 $sensor_data_array['lat'] = $uuid_bytes_read['lat']; 1729 $sensor_data_array['lon'] = $uuid_bytes_read['lon']; 1730 $sensor_data_array['alt'] = $uuid_bytes_read['alt']; 1731 $sensor_data_array['speed'] = $uuid_bytes_read['speed']; 1732 $sensor_data_array['bearing'] = $uuid_bytes_read['bearing']; 1733 $sensor_data_array['acc'] = $uuid_bytes_read['acc']; 1734 //$sensor_data_array = print_r($uuid_bytes_read, true); 1735 array_push($atom_structure['sensor_data']['data_type']['gps_data'], $sensor_data_array); 1736 //array_push($debug_structure['debug_items'], $uuid_bytes_read['timestamp']); 1737 break; 1738 case 6: 1739 $atom_structure['sensor_data']['data_type']['rotation_count']++; 1740 $uuid_bytes_read = unpack('cmode/Jtimestamp/Grotx/Groty/Grotz/x*', $sensor_data_content); 1741 $sensor_data_array['mode'] = $uuid_bytes_read['mode']; 1742 $sensor_data_array['timestamp'] = $uuid_bytes_read['timestamp']; 1743 $sensor_data_array['rotx'] = $uuid_bytes_read['rotx']; 1744 $sensor_data_array['roty'] = $uuid_bytes_read['roty']; 1745 $sensor_data_array['rotz'] = $uuid_bytes_read['rotz']; 1746 array_push($atom_structure['sensor_data']['data_type']['rotation_data'], $sensor_data_array); 1747 break; 1748 default: 1749 $atom_structure['sensor_data']['data_type']['unknown_count']++; 1750 break; 1751 } 1752 } 1753 // if (isset($debug_structure['debug_items']) && count($debug_structure['debug_items']) > 0) { 1754 // $atom_structure['sensor_data']['data_type']['debug_list'] = implode(',', $debug_structure['debug_items']); 1755 // } else { 1756 $atom_structure['sensor_data']['data_type']['debug_list'] = 'No debug items in list!'; 1757 // } 1758 break; 1759 1642 1760 case 'gps ': 1643 1761 // https://dashcamtalk.com/forum/threads/script-to-extract-gps-data-from-novatek-mp4.20808/page-2#post-291730 1644 1762 // The 'gps ' contains simple look up table made up of 8byte rows, that point to the 'free' atoms that contains the actual GPS data. … … public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset 1683 1801 // $GPRMC,094347.000,A,5342.0061,N,00737.9908,W,0.01,156.75,140217,,,A*7D 1684 1802 if (preg_match('#\\$GPRMC,([0-9\\.]*),([AV]),([0-9\\.]*),([NS]),([0-9\\.]*),([EW]),([0-9\\.]*),([0-9\\.]*),([0-9]*),([0-9\\.]*),([EW]?)(,[A])?(\\*[0-9A-F]{2})#', $GPS_free_data, $matches)) { 1685 1803 $GPS_this_GPRMC = array(); 1804 $GPS_this_GPRMC_raw = array(); 1686 1805 list( 1687 $GPS_this_GPRMC ['raw']['gprmc'],1688 $GPS_this_GPRMC ['raw']['timestamp'],1689 $GPS_this_GPRMC ['raw']['status'],1690 $GPS_this_GPRMC ['raw']['latitude'],1691 $GPS_this_GPRMC ['raw']['latitude_direction'],1692 $GPS_this_GPRMC ['raw']['longitude'],1693 $GPS_this_GPRMC ['raw']['longitude_direction'],1694 $GPS_this_GPRMC ['raw']['knots'],1695 $GPS_this_GPRMC ['raw']['angle'],1696 $GPS_this_GPRMC ['raw']['datestamp'],1697 $GPS_this_GPRMC ['raw']['variation'],1698 $GPS_this_GPRMC ['raw']['variation_direction'],1806 $GPS_this_GPRMC_raw['gprmc'], 1807 $GPS_this_GPRMC_raw['timestamp'], 1808 $GPS_this_GPRMC_raw['status'], 1809 $GPS_this_GPRMC_raw['latitude'], 1810 $GPS_this_GPRMC_raw['latitude_direction'], 1811 $GPS_this_GPRMC_raw['longitude'], 1812 $GPS_this_GPRMC_raw['longitude_direction'], 1813 $GPS_this_GPRMC_raw['knots'], 1814 $GPS_this_GPRMC_raw['angle'], 1815 $GPS_this_GPRMC_raw['datestamp'], 1816 $GPS_this_GPRMC_raw['variation'], 1817 $GPS_this_GPRMC_raw['variation_direction'], 1699 1818 $dummy, 1700 $GPS_this_GPRMC ['raw']['checksum'],1819 $GPS_this_GPRMC_raw['checksum'], 1701 1820 ) = $matches; 1821 $GPS_this_GPRMC['raw'] = $GPS_this_GPRMC_raw; 1702 1822 1703 1823 $hour = substr($GPS_this_GPRMC['raw']['timestamp'], 0, 2); 1704 1824 $minute = substr($GPS_this_GPRMC['raw']['timestamp'], 2, 2); … … public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset 1706 1826 $ms = substr($GPS_this_GPRMC['raw']['timestamp'], 6); // may contain decimal seconds 1707 1827 $day = substr($GPS_this_GPRMC['raw']['datestamp'], 0, 2); 1708 1828 $month = substr($GPS_this_GPRMC['raw']['datestamp'], 2, 2); 1709 $year = substr($GPS_this_GPRMC['raw']['datestamp'], 4, 2);1829 $year = (int) substr($GPS_this_GPRMC['raw']['datestamp'], 4, 2); 1710 1830 $year += (($year > 90) ? 1900 : 2000); // complete lack of foresight: datestamps are stored with 2-digit years, take best guess 1711 1831 $GPS_this_GPRMC['timestamp'] = $year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.':'.$second.$ms; 1712 1832 … … public function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') { 2740 2860 $gooddata = explode(';', $data); 2741 2861 } 2742 2862 foreach ($gooddata as $data) { 2863 if (is_array($data) || (!empty($info['quicktime']['comments'][$comment_key]) && in_array($data, $info['quicktime']['comments'][$comment_key]))) { 2864 // avoid duplicate copies of identical data 2865 continue; 2866 } 2743 2867 $info['quicktime']['comments'][$comment_key][] = $data; 2744 2868 } 2745 2869 } -
src/wp-includes/ID3/module.audio-video.riff.php
diff --git a/src/wp-includes/ID3/module.audio-video.riff.php b/src/wp-includes/ID3/module.audio-video.riff.php index 276f131eaa..02adb72d60 100644
a b public function Analyze() { 203 203 unset($thisfile_riff_audio[$streamindex]['raw']); 204 204 $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex]; 205 205 206 $thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]);206 $thisfile_audio = (array) getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]); 207 207 if (substr($thisfile_audio['codec'], 0, strlen('unknown: 0x')) == 'unknown: 0x') { 208 208 $this->warning('Audio codec = '.$thisfile_audio['codec']); 209 209 } -
src/wp-includes/ID3/module.audio.ac3.php
diff --git a/src/wp-includes/ID3/module.audio.ac3.php b/src/wp-includes/ID3/module.audio.ac3.php index 364681b632..6faa4e3d64 100644
a b public function Analyze() { 485 485 /** 486 486 * @param int $length 487 487 * 488 * @return float|int488 * @return int 489 489 */ 490 490 private function readHeaderBSI($length) { 491 491 $data = substr($this->AC3header['bsi'], $this->BSIoffset, $length); -
src/wp-includes/ID3/module.audio.dts.php
diff --git a/src/wp-includes/ID3/module.audio.dts.php b/src/wp-includes/ID3/module.audio.dts.php index 9be8f1ba36..dafaf0bbd2 100644
a b public function Analyze() { 149 149 * @param string $bin 150 150 * @param int $length 151 151 * 152 * @return float|int152 * @return int 153 153 */ 154 154 private function readBinData($bin, $length) { 155 155 $data = substr($bin, $this->readBinDataOffset, $length); … … public static function numChannelsLookup($index) { 252 252 switch ($index) { 253 253 case 0: 254 254 return 1; 255 break;256 255 case 1: 257 256 case 2: 258 257 case 3: 259 258 case 4: 260 259 return 2; 261 break;262 260 case 5: 263 261 case 6: 264 262 return 3; 265 break;266 263 case 7: 267 264 case 8: 268 265 return 4; 269 break;270 266 case 9: 271 267 return 5; 272 break;273 268 case 10: 274 269 case 11: 275 270 case 12: 276 271 return 6; 277 break;278 272 case 13: 279 273 return 7; 280 break;281 274 case 14: 282 275 case 15: 283 276 return 8; 284 break;285 277 } 286 278 return false; 287 279 } … … public static function dialogNormalization($index, $version) { 323 315 switch ($version) { 324 316 case 7: 325 317 return 0 - $index; 326 break;327 318 case 6: 328 319 return 0 - 16 - $index; 329 break;330 320 } 331 321 return false; 332 322 } -
src/wp-includes/ID3/module.audio.mp3.php
diff --git a/src/wp-includes/ID3/module.audio.mp3.php b/src/wp-includes/ID3/module.audio.mp3.php index 4bd75a0219..192317467c 100644
a b public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch=true, $S 719 719 720 720 $thisfile_mpeg_audio_lame['long_version'] = substr($headerstring, $VBRidOffset + 120, 20); 721 721 $thisfile_mpeg_audio_lame['short_version'] = substr($thisfile_mpeg_audio_lame['long_version'], 0, 9); 722 $thisfile_mpeg_audio_lame['numeric_version'] = str_replace('LAME', '', $thisfile_mpeg_audio_lame['short_version']); 723 if (preg_match('#^LAME([0-9\\.a-z]+)#', $thisfile_mpeg_audio_lame['long_version'], $matches)) { 724 $thisfile_mpeg_audio_lame['short_version'] = $matches[0]; 725 $thisfile_mpeg_audio_lame['numeric_version'] = $matches[1]; 726 } 727 foreach (explode('.', $thisfile_mpeg_audio_lame['numeric_version']) as $key => $number) { 728 $thisfile_mpeg_audio_lame['integer_version'][$key] = intval($number); 729 } 722 730 723 if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.90') { 731 //if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.90') { 732 if ((($thisfile_mpeg_audio_lame['integer_version'][0] * 1000) + $thisfile_mpeg_audio_lame['integer_version'][1]) >= 3090) { // cannot use string version compare, may have "LAME3.90" or "LAME3.100" -- see https://github.com/JamesHeinrich/getID3/issues/207 724 733 725 734 // extra 11 chars are not part of version string when LAMEtag present 726 735 unset($thisfile_mpeg_audio_lame['long_version']); … … public function getOnlyMPEGaudioInfoBruteForce() { 1324 1333 if ($MPEGaudioHeaderValidCache[$next4]) { 1325 1334 $this->fseek(-4, SEEK_CUR); 1326 1335 1327 getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]);1328 getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]);1329 getid3_lib::safe_inc($Distribution['version'][$LongMPEGversionLookup[$head4]]);1330 getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]);1331 getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]);1332 if ( $max_frames_scan && (++$frames_scanned >= $max_frames_scan)) {1336 $Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]] = isset($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]) ? ++$Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]] : 1; 1337 $Distribution['layer'][$LongMPEGlayerLookup[$head4]] = isset($Distribution['layer'][$LongMPEGlayerLookup[$head4]]) ? ++$Distribution['layer'][$LongMPEGlayerLookup[$head4]] : 1; 1338 $Distribution['version'][$LongMPEGversionLookup[$head4]] = isset($Distribution['version'][$LongMPEGversionLookup[$head4]]) ? ++$Distribution['version'][$LongMPEGversionLookup[$head4]] : 1; 1339 $Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])] = isset($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]) ? ++$Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])] : 1; 1340 $Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]] = isset($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]) ? ++$Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]] : 1; 1341 if (++$frames_scanned >= $max_frames_scan) { 1333 1342 $pct_data_scanned = ($this->ftell() - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']); 1334 1343 $this->warning('too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.'); 1335 1344 foreach ($Distribution as $key1 => $value1) { -
src/wp-includes/ID3/module.audio.ogg.php
diff --git a/src/wp-includes/ID3/module.audio.ogg.php b/src/wp-includes/ID3/module.audio.ogg.php index 51fee3e1ce..fd69c68558 100644
a b public function ParseVorbisComments() { 615 615 616 616 default: 617 617 return false; 618 break;619 618 } 620 619 621 620 $VendorSize = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); -
src/wp-includes/ID3/module.tag.id3v2.php
diff --git a/src/wp-includes/ID3/module.tag.id3v2.php b/src/wp-includes/ID3/module.tag.id3v2.php index 0c7c34bf6f..d0ddd9ebea 100644
a b public static function IsValidID3v2FrameName($framename, $id3v2majorversion) { 3723 3723 switch ($id3v2majorversion) { 3724 3724 case 2: 3725 3725 return preg_match('#[A-Z][A-Z0-9]{2}#', $framename); 3726 break;3727 3726 3728 3727 case 3: 3729 3728 case 4: 3730 3729 return preg_match('#[A-Z][A-Z0-9]{3}#', $framename); 3731 break;3732 3730 } 3733 3731 return false; 3734 3732 } -
src/wp-includes/ID3/module.tag.lyrics3.php
diff --git a/src/wp-includes/ID3/module.tag.lyrics3.php b/src/wp-includes/ID3/module.tag.lyrics3.php index 80e81658c7..27e51e0b82 100644
a b public function Analyze() { 32 32 33 33 $this->fseek((0 - 128 - 9 - 6), SEEK_END); // end - ID3v1 - "LYRICSEND" - [Lyrics3size] 34 34 $lyrics3_id3v1 = $this->fread(128 + 9 + 6); 35 $lyrics3lsz = substr($lyrics3_id3v1, 0,6); // Lyrics3size35 $lyrics3lsz = (int) substr($lyrics3_id3v1, 0, 6); // Lyrics3size 36 36 $lyrics3end = substr($lyrics3_id3v1, 6, 9); // LYRICSEND or LYRICS200 37 37 $id3v1tag = substr($lyrics3_id3v1, 15, 128); // ID3v1 38 38 … … public function getLyrics3Data($endoffset, $version, $length) { 240 240 default: 241 241 $this->error('Cannot process Lyrics3 version '.$version.' (only v1 and v2)'); 242 242 return false; 243 break;244 243 } 245 244 246 245