IP : 18.117.120.35Hostname : server86.web-hosting.comKernel : Linux server86.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64Disable Function : None :) OS : Linux
PATH:
/
home/
servlmvm/
./
./
public_html/
wp-includes/
./
ID3/
module.tag.id3v1.php/
/
<?php
///////////////////////////////////////////////////////////////// /// getID3() by James Heinrich <info@getid3.org> // // available at https://github.com/JamesHeinrich/getID3 // // or https://www.getid3.org // // or http://getid3.sourceforge.net // // see readme.txt for more details // ///////////////////////////////////////////////////////////////// // // // module.tag.id3v1.php // // module for analyzing ID3v1 tags // // dependencies: NONE // // /// /////////////////////////////////////////////////////////////////
if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers exit; }
class getid3_id3v1 extends getid3_handler { /** * @return bool */ public function Analyze() { $info = &$this->getid3->info;
if (!getid3_lib::intValueSupported($info['filesize'])) { $this->warning('Unable to check for ID3v1 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); return false; }
// If second-last byte of comment field is null and last byte of comment field is non-null // then this is ID3v1.1 and the comment field is 28 bytes long and the 30th byte is the track number if (($id3v1tag[125] === "\x00") && ($id3v1tag[126] !== "\x00")) { $ParsedID3v1['track_number'] = ord(substr($ParsedID3v1['comment'], 29, 1)); $ParsedID3v1['comment'] = substr($ParsedID3v1['comment'], 0, 28); } $ParsedID3v1['comment'] = $this->cutfield($ParsedID3v1['comment']);
$ParsedID3v1['genre'] = $this->LookupGenreName($ParsedID3v1['genreid']); if (!empty($ParsedID3v1['genre'])) { unset($ParsedID3v1['genreid']); } if (empty($ParsedID3v1['genre']) || ($ParsedID3v1['genre'] == 'Unknown')) { unset($ParsedID3v1['genre']); }
foreach ($ParsedID3v1 as $key => $value) { $ParsedID3v1['comments'][$key][0] = $value; } $ID3v1encoding = $this->getid3->encoding_id3v1; if ($this->getid3->encoding_id3v1_autodetect) { // ID3v1 encoding detection hack START // ID3v1 is defined as always using ISO-8859-1 encoding, but it is not uncommon to find files tagged with ID3v1 using Windows-1251 or other character sets // Since ID3v1 has no concept of character sets there is no certain way to know we have the correct non-ISO-8859-1 character set, but we can guess foreach ($ParsedID3v1['comments'] as $tag_key => $valuearray) { foreach ($valuearray as $key => $value) { if (preg_match('#^[\\x00-\\x40\\x80-\\xFF]+$#', $value) && !ctype_digit((string) $value)) { // check for strings with only characters above chr(128) and punctuation/numbers, but not just numeric strings (e.g. track numbers or years) foreach (array('Windows-1251', 'KOI8-R') as $id3v1_bad_encoding) { if (function_exists('mb_convert_encoding') && @mb_convert_encoding($value, $id3v1_bad_encoding, $id3v1_bad_encoding) === $value) { $ID3v1encoding = $id3v1_bad_encoding; $this->warning('ID3v1 detected as '.$id3v1_bad_encoding.' text encoding in '.$tag_key); break 3; } elseif (function_exists('iconv') && @iconv($id3v1_bad_encoding, $id3v1_bad_encoding, $value) === $value) { $ID3v1encoding = $id3v1_bad_encoding; $this->warning('ID3v1 detected as '.$id3v1_bad_encoding.' text encoding in '.$tag_key); break 3; } } } } } // ID3v1 encoding detection hack END }
// ID3v1 data is supposed to be padded with NULL characters, but some taggers pad with spaces $GoodFormatID3v1tag = $this->GenerateID3v1Tag( $ParsedID3v1['title'], $ParsedID3v1['artist'], $ParsedID3v1['album'], $ParsedID3v1['year'], (isset($ParsedID3v1['genre']) ? $this->LookupGenreID($ParsedID3v1['genre']) : false), $ParsedID3v1['comment'], (!empty($ParsedID3v1['track_number']) ? $ParsedID3v1['track_number'] : '')); $ParsedID3v1['padding_valid'] = true; if ($id3v1tag !== $GoodFormatID3v1tag) { $ParsedID3v1['padding_valid'] = false; $this->warning('Some ID3v1 fields do not use NULL characters for padding'); }
if (substr($preid3v1, 0, 3) == 'TAG') { // The way iTunes handles tags is, well, brain-damaged. // It completely ignores v1 if ID3v2 is present. // This goes as far as adding a new v1 tag *even if there already is one*
// A suspected double-ID3v1 tag has been detected, but it could be that // the "TAG" identifier is a legitimate part of an APE or Lyrics3 tag if (substr($preid3v1, 96, 8) == 'APETAGEX') { // an APE tag footer was found before the last ID3v1, assume false "TAG" synch } elseif (substr($preid3v1, 119, 6) == 'LYRICS') { // a Lyrics3 tag footer was found before the last ID3v1, assume false "TAG" synch } else { // APE and Lyrics3 footers not found - assume double ID3v1 $this->warning('Duplicate ID3v1 tag detected - this has been known to happen with iTunes'); $info['avdataend'] -= 128; } }