Edit File by line
/home/zeestwma/richards.../wp-inclu.../ID3
File: getid3.php
<?php
[0] Fix | Delete
/////////////////////////////////////////////////////////////////
[1] Fix | Delete
/// getID3() by James Heinrich <info@getid3.org> //
[2] Fix | Delete
// available at https://github.com/JamesHeinrich/getID3 //
[3] Fix | Delete
// or https://www.getid3.org //
[4] Fix | Delete
// or http://getid3.sourceforge.net //
[5] Fix | Delete
// //
[6] Fix | Delete
// Please see readme.txt for more information //
[7] Fix | Delete
// ///
[8] Fix | Delete
/////////////////////////////////////////////////////////////////
[9] Fix | Delete
[10] Fix | Delete
// define a constant rather than looking up every time it is needed
[11] Fix | Delete
if (!defined('GETID3_OS_ISWINDOWS')) {
[12] Fix | Delete
define('GETID3_OS_ISWINDOWS', (stripos(PHP_OS, 'WIN') === 0));
[13] Fix | Delete
}
[14] Fix | Delete
// Get base path of getID3() - ONCE
[15] Fix | Delete
if (!defined('GETID3_INCLUDEPATH')) {
[16] Fix | Delete
define('GETID3_INCLUDEPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
[17] Fix | Delete
}
[18] Fix | Delete
if (!defined('ENT_SUBSTITUTE')) { // PHP5.3 adds ENT_IGNORE, PHP5.4 adds ENT_SUBSTITUTE
[19] Fix | Delete
define('ENT_SUBSTITUTE', (defined('ENT_IGNORE') ? ENT_IGNORE : 8));
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
/*
[23] Fix | Delete
https://www.getid3.org/phpBB3/viewtopic.php?t=2114
[24] Fix | Delete
If you are running into a the problem where filenames with special characters are being handled
[25] Fix | Delete
incorrectly by external helper programs (e.g. metaflac), notably with the special characters removed,
[26] Fix | Delete
and you are passing in the filename in UTF8 (typically via a HTML form), try uncommenting this line:
[27] Fix | Delete
*/
[28] Fix | Delete
//setlocale(LC_CTYPE, 'en_US.UTF-8');
[29] Fix | Delete
[30] Fix | Delete
// attempt to define temp dir as something flexible but reliable
[31] Fix | Delete
$temp_dir = ini_get('upload_tmp_dir');
[32] Fix | Delete
if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) {
[33] Fix | Delete
$temp_dir = '';
[34] Fix | Delete
}
[35] Fix | Delete
if (!$temp_dir && function_exists('sys_get_temp_dir')) { // sys_get_temp_dir added in PHP v5.2.1
[36] Fix | Delete
// sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts
[37] Fix | Delete
$temp_dir = sys_get_temp_dir();
[38] Fix | Delete
}
[39] Fix | Delete
$temp_dir = @realpath($temp_dir); // see https://github.com/JamesHeinrich/getID3/pull/10
[40] Fix | Delete
$open_basedir = ini_get('open_basedir');
[41] Fix | Delete
if ($open_basedir) {
[42] Fix | Delete
// e.g. "/var/www/vhosts/getid3.org/httpdocs/:/tmp/"
[43] Fix | Delete
$temp_dir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $temp_dir);
[44] Fix | Delete
$open_basedir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $open_basedir);
[45] Fix | Delete
if (substr($temp_dir, -1, 1) != DIRECTORY_SEPARATOR) {
[46] Fix | Delete
$temp_dir .= DIRECTORY_SEPARATOR;
[47] Fix | Delete
}
[48] Fix | Delete
$found_valid_tempdir = false;
[49] Fix | Delete
$open_basedirs = explode(PATH_SEPARATOR, $open_basedir);
[50] Fix | Delete
foreach ($open_basedirs as $basedir) {
[51] Fix | Delete
if (substr($basedir, -1, 1) != DIRECTORY_SEPARATOR) {
[52] Fix | Delete
$basedir .= DIRECTORY_SEPARATOR;
[53] Fix | Delete
}
[54] Fix | Delete
if (strpos($temp_dir, $basedir) === 0) {
[55] Fix | Delete
$found_valid_tempdir = true;
[56] Fix | Delete
break;
[57] Fix | Delete
}
[58] Fix | Delete
}
[59] Fix | Delete
if (!$found_valid_tempdir) {
[60] Fix | Delete
$temp_dir = '';
[61] Fix | Delete
}
[62] Fix | Delete
unset($open_basedirs, $found_valid_tempdir, $basedir);
[63] Fix | Delete
}
[64] Fix | Delete
if (!$temp_dir) {
[65] Fix | Delete
$temp_dir = '*'; // invalid directory name should force tempnam() to use system default temp dir
[66] Fix | Delete
}
[67] Fix | Delete
// $temp_dir = '/something/else/'; // feel free to override temp dir here if it works better for your system
[68] Fix | Delete
if (!defined('GETID3_TEMP_DIR')) {
[69] Fix | Delete
define('GETID3_TEMP_DIR', $temp_dir);
[70] Fix | Delete
}
[71] Fix | Delete
unset($open_basedir, $temp_dir);
[72] Fix | Delete
[73] Fix | Delete
// End: Defines
[74] Fix | Delete
[75] Fix | Delete
[76] Fix | Delete
class getID3
[77] Fix | Delete
{
[78] Fix | Delete
/*
[79] Fix | Delete
* Settings
[80] Fix | Delete
*/
[81] Fix | Delete
[82] Fix | Delete
/**
[83] Fix | Delete
* CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE
[84] Fix | Delete
*
[85] Fix | Delete
* @var string
[86] Fix | Delete
*/
[87] Fix | Delete
public $encoding = 'UTF-8';
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252'
[91] Fix | Delete
*
[92] Fix | Delete
* @var string
[93] Fix | Delete
*/
[94] Fix | Delete
public $encoding_id3v1 = 'ISO-8859-1';
[95] Fix | Delete
[96] Fix | Delete
/**
[97] Fix | Delete
* ID3v1 should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'Windows-1251' or 'KOI8-R'. If true attempt to detect these encodings, but may return incorrect values for some tags actually in ISO-8859-1 encoding
[98] Fix | Delete
*
[99] Fix | Delete
* @var bool
[100] Fix | Delete
*/
[101] Fix | Delete
public $encoding_id3v1_autodetect = false;
[102] Fix | Delete
[103] Fix | Delete
/*
[104] Fix | Delete
* Optional tag checks - disable for speed.
[105] Fix | Delete
*/
[106] Fix | Delete
[107] Fix | Delete
/**
[108] Fix | Delete
* Read and process ID3v1 tags
[109] Fix | Delete
*
[110] Fix | Delete
* @var bool
[111] Fix | Delete
*/
[112] Fix | Delete
public $option_tag_id3v1 = true;
[113] Fix | Delete
[114] Fix | Delete
/**
[115] Fix | Delete
* Read and process ID3v2 tags
[116] Fix | Delete
*
[117] Fix | Delete
* @var bool
[118] Fix | Delete
*/
[119] Fix | Delete
public $option_tag_id3v2 = true;
[120] Fix | Delete
[121] Fix | Delete
/**
[122] Fix | Delete
* Read and process Lyrics3 tags
[123] Fix | Delete
*
[124] Fix | Delete
* @var bool
[125] Fix | Delete
*/
[126] Fix | Delete
public $option_tag_lyrics3 = true;
[127] Fix | Delete
[128] Fix | Delete
/**
[129] Fix | Delete
* Read and process APE tags
[130] Fix | Delete
*
[131] Fix | Delete
* @var bool
[132] Fix | Delete
*/
[133] Fix | Delete
public $option_tag_apetag = true;
[134] Fix | Delete
[135] Fix | Delete
/**
[136] Fix | Delete
* Copy tags to root key 'tags' and encode to $this->encoding
[137] Fix | Delete
*
[138] Fix | Delete
* @var bool
[139] Fix | Delete
*/
[140] Fix | Delete
public $option_tags_process = true;
[141] Fix | Delete
[142] Fix | Delete
/**
[143] Fix | Delete
* Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities
[144] Fix | Delete
*
[145] Fix | Delete
* @var bool
[146] Fix | Delete
*/
[147] Fix | Delete
public $option_tags_html = true;
[148] Fix | Delete
[149] Fix | Delete
/*
[150] Fix | Delete
* Optional tag/comment calculations
[151] Fix | Delete
*/
[152] Fix | Delete
[153] Fix | Delete
/**
[154] Fix | Delete
* Calculate additional info such as bitrate, channelmode etc
[155] Fix | Delete
*
[156] Fix | Delete
* @var bool
[157] Fix | Delete
*/
[158] Fix | Delete
public $option_extra_info = true;
[159] Fix | Delete
[160] Fix | Delete
/*
[161] Fix | Delete
* Optional handling of embedded attachments (e.g. images)
[162] Fix | Delete
*/
[163] Fix | Delete
[164] Fix | Delete
/**
[165] Fix | Delete
* Defaults to true (ATTACHMENTS_INLINE) for backward compatibility
[166] Fix | Delete
*
[167] Fix | Delete
* @var bool|string
[168] Fix | Delete
*/
[169] Fix | Delete
public $option_save_attachments = true;
[170] Fix | Delete
[171] Fix | Delete
/*
[172] Fix | Delete
* Optional calculations
[173] Fix | Delete
*/
[174] Fix | Delete
[175] Fix | Delete
/**
[176] Fix | Delete
* Get MD5 sum of data part - slow
[177] Fix | Delete
*
[178] Fix | Delete
* @var bool
[179] Fix | Delete
*/
[180] Fix | Delete
public $option_md5_data = false;
[181] Fix | Delete
[182] Fix | Delete
/**
[183] Fix | Delete
* Use MD5 of source file if available - only FLAC and OptimFROG
[184] Fix | Delete
*
[185] Fix | Delete
* @var bool
[186] Fix | Delete
*/
[187] Fix | Delete
public $option_md5_data_source = false;
[188] Fix | Delete
[189] Fix | Delete
/**
[190] Fix | Delete
* Get SHA1 sum of data part - slow
[191] Fix | Delete
*
[192] Fix | Delete
* @var bool
[193] Fix | Delete
*/
[194] Fix | Delete
public $option_sha1_data = false;
[195] Fix | Delete
[196] Fix | Delete
/**
[197] Fix | Delete
* Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on
[198] Fix | Delete
* PHP_INT_MAX)
[199] Fix | Delete
*
[200] Fix | Delete
* @var bool|null
[201] Fix | Delete
*/
[202] Fix | Delete
public $option_max_2gb_check;
[203] Fix | Delete
[204] Fix | Delete
/**
[205] Fix | Delete
* Read buffer size in bytes
[206] Fix | Delete
*
[207] Fix | Delete
* @var int
[208] Fix | Delete
*/
[209] Fix | Delete
public $option_fread_buffer_size = 32768;
[210] Fix | Delete
[211] Fix | Delete
[212] Fix | Delete
[213] Fix | Delete
// module-specific options
[214] Fix | Delete
[215] Fix | Delete
/** archive.rar
[216] Fix | Delete
* if true use PHP RarArchive extension, if false (non-extension parsing not yet written in getID3)
[217] Fix | Delete
*
[218] Fix | Delete
* @var bool
[219] Fix | Delete
*/
[220] Fix | Delete
public $options_archive_rar_use_php_rar_extension = true;
[221] Fix | Delete
[222] Fix | Delete
/** archive.gzip
[223] Fix | Delete
* Optional file list - disable for speed.
[224] Fix | Delete
* Decode gzipped files, if possible, and parse recursively (.tar.gz for example).
[225] Fix | Delete
*
[226] Fix | Delete
* @var bool
[227] Fix | Delete
*/
[228] Fix | Delete
public $options_archive_gzip_parse_contents = false;
[229] Fix | Delete
[230] Fix | Delete
/** audio.midi
[231] Fix | Delete
* if false only parse most basic information, much faster for some files but may be inaccurate
[232] Fix | Delete
*
[233] Fix | Delete
* @var bool
[234] Fix | Delete
*/
[235] Fix | Delete
public $options_audio_midi_scanwholefile = true;
[236] Fix | Delete
[237] Fix | Delete
/** audio.mp3
[238] Fix | Delete
* Forces getID3() to scan the file byte-by-byte and log all the valid audio frame headers - extremely slow,
[239] Fix | Delete
* unrecommended, but may provide data from otherwise-unusable files.
[240] Fix | Delete
*
[241] Fix | Delete
* @var bool
[242] Fix | Delete
*/
[243] Fix | Delete
public $options_audio_mp3_allow_bruteforce = false;
[244] Fix | Delete
[245] Fix | Delete
/** audio.mp3
[246] Fix | Delete
* number of frames to scan to determine if MPEG-audio sequence is valid
[247] Fix | Delete
* Lower this number to 5-20 for faster scanning
[248] Fix | Delete
* Increase this number to 50+ for most accurate detection of valid VBR/CBR mpeg-audio streams
[249] Fix | Delete
*
[250] Fix | Delete
* @var int
[251] Fix | Delete
*/
[252] Fix | Delete
public $options_audio_mp3_mp3_valid_check_frames = 50;
[253] Fix | Delete
[254] Fix | Delete
/** audio.wavpack
[255] Fix | Delete
* Avoid scanning all frames (break after finding ID_RIFF_HEADER and ID_CONFIG_BLOCK,
[256] Fix | Delete
* significantly faster for very large files but other data may be missed
[257] Fix | Delete
*
[258] Fix | Delete
* @var bool
[259] Fix | Delete
*/
[260] Fix | Delete
public $options_audio_wavpack_quick_parsing = false;
[261] Fix | Delete
[262] Fix | Delete
/** audio-video.flv
[263] Fix | Delete
* Break out of the loop if too many frames have been scanned; only scan this
[264] Fix | Delete
* many if meta frame does not contain useful duration.
[265] Fix | Delete
*
[266] Fix | Delete
* @var int
[267] Fix | Delete
*/
[268] Fix | Delete
public $options_audiovideo_flv_max_frames = 100000;
[269] Fix | Delete
[270] Fix | Delete
/** audio-video.matroska
[271] Fix | Delete
* If true, do not return information about CLUSTER chunks, since there's a lot of them
[272] Fix | Delete
* and they're not usually useful [default: TRUE].
[273] Fix | Delete
*
[274] Fix | Delete
* @var bool
[275] Fix | Delete
*/
[276] Fix | Delete
public $options_audiovideo_matroska_hide_clusters = true;
[277] Fix | Delete
[278] Fix | Delete
/** audio-video.matroska
[279] Fix | Delete
* True to parse the whole file, not only header [default: FALSE].
[280] Fix | Delete
*
[281] Fix | Delete
* @var bool
[282] Fix | Delete
*/
[283] Fix | Delete
public $options_audiovideo_matroska_parse_whole_file = false;
[284] Fix | Delete
[285] Fix | Delete
/** audio-video.quicktime
[286] Fix | Delete
* return all parsed data from all atoms if true, otherwise just returned parsed metadata
[287] Fix | Delete
*
[288] Fix | Delete
* @var bool
[289] Fix | Delete
*/
[290] Fix | Delete
public $options_audiovideo_quicktime_ReturnAtomData = false;
[291] Fix | Delete
[292] Fix | Delete
/** audio-video.quicktime
[293] Fix | Delete
* return all parsed data from all atoms if true, otherwise just returned parsed metadata
[294] Fix | Delete
*
[295] Fix | Delete
* @var bool
[296] Fix | Delete
*/
[297] Fix | Delete
public $options_audiovideo_quicktime_ParseAllPossibleAtoms = false;
[298] Fix | Delete
[299] Fix | Delete
/** audio-video.swf
[300] Fix | Delete
* return all parsed tags if true, otherwise do not return tags not parsed by getID3
[301] Fix | Delete
*
[302] Fix | Delete
* @var bool
[303] Fix | Delete
*/
[304] Fix | Delete
public $options_audiovideo_swf_ReturnAllTagData = false;
[305] Fix | Delete
[306] Fix | Delete
/** graphic.bmp
[307] Fix | Delete
* return BMP palette
[308] Fix | Delete
*
[309] Fix | Delete
* @var bool
[310] Fix | Delete
*/
[311] Fix | Delete
public $options_graphic_bmp_ExtractPalette = false;
[312] Fix | Delete
[313] Fix | Delete
/** graphic.bmp
[314] Fix | Delete
* return image data
[315] Fix | Delete
*
[316] Fix | Delete
* @var bool
[317] Fix | Delete
*/
[318] Fix | Delete
public $options_graphic_bmp_ExtractData = false;
[319] Fix | Delete
[320] Fix | Delete
/** graphic.png
[321] Fix | Delete
* If data chunk is larger than this do not read it completely (getID3 only needs the first
[322] Fix | Delete
* few dozen bytes for parsing).
[323] Fix | Delete
*
[324] Fix | Delete
* @var int
[325] Fix | Delete
*/
[326] Fix | Delete
public $options_graphic_png_max_data_bytes = 10000000;
[327] Fix | Delete
[328] Fix | Delete
/** misc.pdf
[329] Fix | Delete
* return full details of PDF Cross-Reference Table (XREF)
[330] Fix | Delete
*
[331] Fix | Delete
* @var bool
[332] Fix | Delete
*/
[333] Fix | Delete
public $options_misc_pdf_returnXREF = false;
[334] Fix | Delete
[335] Fix | Delete
/** misc.torrent
[336] Fix | Delete
* Assume all .torrent files are less than 1MB and just read entire thing into memory for easy processing.
[337] Fix | Delete
* Override this value if you need to process files larger than 1MB
[338] Fix | Delete
*
[339] Fix | Delete
* @var int
[340] Fix | Delete
*/
[341] Fix | Delete
public $options_misc_torrent_max_torrent_filesize = 1048576;
[342] Fix | Delete
[343] Fix | Delete
[344] Fix | Delete
[345] Fix | Delete
// Public variables
[346] Fix | Delete
[347] Fix | Delete
/**
[348] Fix | Delete
* Filename of file being analysed.
[349] Fix | Delete
*
[350] Fix | Delete
* @var string
[351] Fix | Delete
*/
[352] Fix | Delete
public $filename;
[353] Fix | Delete
[354] Fix | Delete
/**
[355] Fix | Delete
* Filepointer to file being analysed.
[356] Fix | Delete
*
[357] Fix | Delete
* @var resource
[358] Fix | Delete
*/
[359] Fix | Delete
public $fp;
[360] Fix | Delete
[361] Fix | Delete
/**
[362] Fix | Delete
* Result array.
[363] Fix | Delete
*
[364] Fix | Delete
* @var array
[365] Fix | Delete
*/
[366] Fix | Delete
public $info;
[367] Fix | Delete
[368] Fix | Delete
/**
[369] Fix | Delete
* @var string
[370] Fix | Delete
*/
[371] Fix | Delete
public $tempdir = GETID3_TEMP_DIR;
[372] Fix | Delete
[373] Fix | Delete
/**
[374] Fix | Delete
* @var int
[375] Fix | Delete
*/
[376] Fix | Delete
public $memory_limit = 0;
[377] Fix | Delete
[378] Fix | Delete
/**
[379] Fix | Delete
* @var string
[380] Fix | Delete
*/
[381] Fix | Delete
protected $startup_error = '';
[382] Fix | Delete
[383] Fix | Delete
/**
[384] Fix | Delete
* @var string
[385] Fix | Delete
*/
[386] Fix | Delete
protected $startup_warning = '';
[387] Fix | Delete
[388] Fix | Delete
const VERSION = '1.9.23-202310190849';
[389] Fix | Delete
const FREAD_BUFFER_SIZE = 32768;
[390] Fix | Delete
[391] Fix | Delete
const ATTACHMENTS_NONE = false;
[392] Fix | Delete
const ATTACHMENTS_INLINE = true;
[393] Fix | Delete
[394] Fix | Delete
/**
[395] Fix | Delete
* @throws getid3_exception
[396] Fix | Delete
*/
[397] Fix | Delete
public function __construct() {
[398] Fix | Delete
[399] Fix | Delete
// Check for PHP version
[400] Fix | Delete
$required_php_version = '5.3.0';
[401] Fix | Delete
if (version_compare(PHP_VERSION, $required_php_version, '<')) {
[402] Fix | Delete
$this->startup_error .= 'getID3() requires PHP v'.$required_php_version.' or higher - you are running v'.PHP_VERSION."\n";
[403] Fix | Delete
return;
[404] Fix | Delete
}
[405] Fix | Delete
[406] Fix | Delete
// Check memory
[407] Fix | Delete
$memoryLimit = ini_get('memory_limit');
[408] Fix | Delete
if (preg_match('#([0-9]+) ?M#i', $memoryLimit, $matches)) {
[409] Fix | Delete
// could be stored as "16M" rather than 16777216 for example
[410] Fix | Delete
$memoryLimit = $matches[1] * 1048576;
[411] Fix | Delete
} elseif (preg_match('#([0-9]+) ?G#i', $memoryLimit, $matches)) { // The 'G' modifier is available since PHP 5.1.0
[412] Fix | Delete
// could be stored as "2G" rather than 2147483648 for example
[413] Fix | Delete
$memoryLimit = $matches[1] * 1073741824;
[414] Fix | Delete
}
[415] Fix | Delete
$this->memory_limit = $memoryLimit;
[416] Fix | Delete
[417] Fix | Delete
if ($this->memory_limit <= 0) {
[418] Fix | Delete
// memory limits probably disabled
[419] Fix | Delete
} elseif ($this->memory_limit <= 4194304) {
[420] Fix | Delete
$this->startup_error .= 'PHP has less than 4MB available memory and will very likely run out. Increase memory_limit in php.ini'."\n";
[421] Fix | Delete
} elseif ($this->memory_limit <= 12582912) {
[422] Fix | Delete
$this->startup_warning .= 'PHP has less than 12MB available memory and might run out if all modules are loaded. Increase memory_limit in php.ini'."\n";
[423] Fix | Delete
}
[424] Fix | Delete
[425] Fix | Delete
// Check safe_mode off
[426] Fix | Delete
if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
[427] Fix | Delete
$this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.');
[428] Fix | Delete
}
[429] Fix | Delete
[430] Fix | Delete
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
[431] Fix | Delete
if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) {
[432] Fix | Delete
// http://php.net/manual/en/mbstring.overload.php
[433] Fix | Delete
// "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"
[434] Fix | Delete
// 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.
[435] Fix | Delete
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
[436] Fix | Delete
$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";
[437] Fix | Delete
}
[438] Fix | Delete
[439] Fix | Delete
// check for magic quotes in PHP < 5.4.0 (when these options were removed and getters always return false)
[440] Fix | Delete
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
[441] Fix | Delete
// Check for magic_quotes_runtime
[442] Fix | Delete
if (function_exists('get_magic_quotes_runtime')) {
[443] Fix | Delete
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated
[444] Fix | Delete
if (get_magic_quotes_runtime()) { // @phpstan-ignore-line
[445] Fix | Delete
$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";
[446] Fix | Delete
}
[447] Fix | Delete
}
[448] Fix | Delete
// Check for magic_quotes_gpc
[449] Fix | Delete
if (function_exists('get_magic_quotes_gpc')) {
[450] Fix | Delete
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_gpcDeprecated
[451] Fix | Delete
if (get_magic_quotes_gpc()) { // @phpstan-ignore-line
[452] Fix | Delete
$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";
[453] Fix | Delete
}
[454] Fix | Delete
}
[455] Fix | Delete
}
[456] Fix | Delete
[457] Fix | Delete
// Load support library
[458] Fix | Delete
if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) {
[459] Fix | Delete
$this->startup_error .= 'getid3.lib.php is missing or corrupt'."\n";
[460] Fix | Delete
}
[461] Fix | Delete
[462] Fix | Delete
if ($this->option_max_2gb_check === null) {
[463] Fix | Delete
$this->option_max_2gb_check = (PHP_INT_MAX <= 2147483647);
[464] Fix | Delete
}
[465] Fix | Delete
[466] Fix | Delete
[467] Fix | Delete
// Needed for Windows only:
[468] Fix | Delete
// Define locations of helper applications for Shorten, VorbisComment, MetaFLAC
[469] Fix | Delete
// as well as other helper functions such as head, etc
[470] Fix | Delete
// This path cannot contain spaces, but the below code will attempt to get the
[471] Fix | Delete
// 8.3-equivalent path automatically
[472] Fix | Delete
// IMPORTANT: This path must include the trailing slash
[473] Fix | Delete
if (GETID3_OS_ISWINDOWS && !defined('GETID3_HELPERAPPSDIR')) {
[474] Fix | Delete
[475] Fix | Delete
$helperappsdir = GETID3_INCLUDEPATH.'..'.DIRECTORY_SEPARATOR.'helperapps'; // must not have any space in this path
[476] Fix | Delete
[477] Fix | Delete
if (!is_dir($helperappsdir)) {
[478] Fix | Delete
$this->startup_warning .= '"'.$helperappsdir.'" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist'."\n";
[479] Fix | Delete
} elseif (strpos(realpath($helperappsdir), ' ') !== false) {
[480] Fix | Delete
$DirPieces = explode(DIRECTORY_SEPARATOR, realpath($helperappsdir));
[481] Fix | Delete
$path_so_far = array();
[482] Fix | Delete
foreach ($DirPieces as $key => $value) {
[483] Fix | Delete
if (strpos($value, ' ') !== false) {
[484] Fix | Delete
if (!empty($path_so_far)) {
[485] Fix | Delete
$commandline = 'dir /x '.escapeshellarg(implode(DIRECTORY_SEPARATOR, $path_so_far));
[486] Fix | Delete
$dir_listing = `$commandline`;
[487] Fix | Delete
$lines = explode("\n", $dir_listing);
[488] Fix | Delete
foreach ($lines as $line) {
[489] Fix | Delete
$line = trim($line);
[490] Fix | Delete
if (preg_match('#^([0-9/]{10}) +([0-9:]{4,5}( [AP]M)?) +(<DIR>|[0-9,]+) +([^ ]{0,11}) +(.+)$#', $line, $matches)) {
[491] Fix | Delete
list($dummy, $date, $time, $ampm, $filesize, $shortname, $filename) = $matches;
[492] Fix | Delete
if ((strtoupper($filesize) == '<DIR>') && (strtolower($filename) == strtolower($value))) {
[493] Fix | Delete
$value = $shortname;
[494] Fix | Delete
}
[495] Fix | Delete
}
[496] Fix | Delete
}
[497] Fix | Delete
} else {
[498] Fix | Delete
$this->startup_warning .= 'GETID3_HELPERAPPSDIR must not have any spaces in it - use 8dot3 naming convention if neccesary. You can run "dir /x" from the commandline to see the correct 8.3-style names.'."\n";
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function