Valider 46b8862a rédigé par brunobergot@gmail.com's avatar brunobergot@gmail.com
Parcourir les fichiers

version 2.10.25 : maj de la lib getID3 en version 1.9.10

Ne faudrait-il pas ajouter cette lib aux crédits du plugins ainsi que mejs ?
parent 432f7728
Chargement en cours
Chargement en cours
Chargement en cours
Chargement en cours
+4 −4
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -134,7 +134,7 @@ class getID3_cached_mysql extends getID3


	// public: analyze file
	public function analyze($filename) {
	public function analyze($filename, $filesize=null, $original_filename='') {

		if (file_exists($filename)) {

@@ -157,7 +157,7 @@ class getID3_cached_mysql extends getID3
		}

		// Miss
		$analysis = parent::analyze($filename);
		$analysis = parent::analyze($filename, $filesize, $original_filename);

		// Save result
		if (file_exists($filename)) {
@@ -178,11 +178,11 @@ class getID3_cached_mysql extends getID3
	private function create_table($drop=false) {

		$SQLquery  = 'CREATE TABLE IF NOT EXISTS `'.mysql_real_escape_string($this->table).'` (';
		$SQLquery .=   '`filename` VARCHAR(255) NOT NULL DEFAULT \'\'';
		$SQLquery .=   '`filename` VARCHAR(500) NOT NULL DEFAULT \'\'';
		$SQLquery .= ', `filesize` INT(11) NOT NULL DEFAULT \'0\'';
		$SQLquery .= ', `filetime` INT(11) NOT NULL DEFAULT \'0\'';
		$SQLquery .= ', `analyzetime` INT(11) NOT NULL DEFAULT \'0\'';
		$SQLquery .= ', `value` TEXT NOT NULL';
		$SQLquery .= ', `value` LONGTEXT NOT NULL';
		$SQLquery .= ', PRIMARY KEY (`filename`, `filesize`, `filetime`)) ENGINE=MyISAM';
		$this->cursor = mysql_query($SQLquery, $this->connection);
		echo mysql_error($this->connection);
+18 −17
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -49,20 +49,20 @@
*
*   sqlite3             table='getid3_cache', hide=false        (PHP5)
*

***  database file will be stored in the same directory as this script,
***  webserver must have write access to that directory!
***  set $hide to TRUE to prefix db file with .ht to pervent access from web client
***  this is a default setting in the Apache configuration:

# The following lines prevent .htaccess and .htpasswd files from being viewed by Web clients.

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy all
</Files>

*
* ***  database file will be stored in the same directory as this script,
* ***  webserver must have write access to that directory!
* ***  set $hide to TRUE to prefix db file with .ht to pervent access from web client
* ***  this is a default setting in the Apache configuration:
*
* The following lines prevent .htaccess and .htpasswd files from being viewed by Web clients.
*
* <Files ~ "^\.ht">
*     Order allow,deny
*     Deny from all
*     Satisfy all
* </Files>
*
********************************************************************************
*
*   -------------------------------------------------------------------
@@ -159,7 +159,7 @@ class getID3_cached_sqlite3 extends getID3 {
	* @param type $filename
	* @return boolean
	*/
	public function analyze($filename) {
	public function analyze($filename, $filesize=null, $original_filename='') {
		if (!file_exists($filename)) {
			return false;
		}
@@ -182,7 +182,7 @@ class getID3_cached_sqlite3 extends getID3 {
			return unserialize(base64_decode($result));
		}
		// if it hasn't been analyzed before, then do it now
		$analysis = parent::analyze($filename);
		$analysis = parent::analyze($filename, $filesize=null, $original_filename='');
		// Save result
		$sql = $this->cache_file;
		$stmt = $db->prepare($sql);
@@ -253,7 +253,8 @@ class getID3_cached_sqlite3 extends getID3 {
				return "INSERT INTO $this->table (filename, dirname, filesize, filetime, analyzetime, val) VALUES (:filename, :dirname, :filesize, :filetime, :atime, :val)";
				break;
			case 'make_table':
				return "CREATE TABLE IF NOT EXISTS $this->table (filename VARCHAR(255) NOT NULL DEFAULT '', dirname VARCHAR(255) NOT NULL DEFAULT '', filesize INT(11) NOT NULL DEFAULT '0', filetime INT(11) NOT NULL DEFAULT '0', analyzetime INT(11) NOT NULL DEFAULT '0', val text not null, PRIMARY KEY (filename, filesize, filetime))";
				//return "CREATE TABLE IF NOT EXISTS $this->table (filename VARCHAR(255) NOT NULL DEFAULT '', dirname VARCHAR(255) NOT NULL DEFAULT '', filesize INT(11) NOT NULL DEFAULT '0', filetime INT(11) NOT NULL DEFAULT '0', analyzetime INT(11) NOT NULL DEFAULT '0', val text not null, PRIMARY KEY (filename, filesize, filetime))";
				return "CREATE TABLE IF NOT EXISTS $this->table (filename VARCHAR(255) DEFAULT '', dirname VARCHAR(255) DEFAULT '', filesize INT(11) DEFAULT '0', filetime INT(11) DEFAULT '0', analyzetime INT(11) DEFAULT '0', val text, PRIMARY KEY (filename, filesize, filetime))";
				break;
			case 'get_cached_dir':
				return "SELECT val FROM $this->table WHERE dirname = :dirname";
+27 −9
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -414,6 +414,20 @@ class getid3_lib
		return $newarray;
	}

	public static function flipped_array_merge_noclobber($array1, $array2) {
		if (!is_array($array1) || !is_array($array2)) {
			return false;
		}
		# naturally, this only works non-recursively
		$newarray = array_flip($array1);
		foreach (array_flip($array2) as $key => $val) {
			if (!isset($newarray[$key])) {
				$newarray[$key] = count($newarray);
			}
		}
		return array_flip($newarray);
	}


	public static function ksort_recursive(&$theArray) {
		ksort($theArray);
@@ -519,15 +533,14 @@ class getid3_lib
	}

	public static function XML2array($XMLstring) {
		if (function_exists('simplexml_load_string')) {
			if (function_exists('get_object_vars')) {
				if (function_exists('libxml_disable_entity_loader')) { // (PHP 5 >= 5.2.11)
		if (function_exists('simplexml_load_string') && function_exists('libxml_disable_entity_loader')) {
			// http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html
					libxml_disable_entity_loader(true);
				}
				$XMLobject = simplexml_load_string($XMLstring);
				return self::SimpleXMLelement2array($XMLobject);
			}
			// https://core.trac.wordpress.org/changeset/29378
			$loader = libxml_disable_entity_loader(true);
			$XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', LIBXML_NOENT);
			$return = self::SimpleXMLelement2array($XMLobject);
			libxml_disable_entity_loader($loader);
			return $return;
		}
		return false;
	}
@@ -1166,6 +1179,11 @@ class getid3_lib
				fwrite($tmp, $imgData);
				fclose($tmp);
				$GetDataImageSize = @getimagesize($tempfilename, $imageinfo);
				if (($GetDataImageSize === false) || !isset($GetDataImageSize[0]) || !isset($GetDataImageSize[1])) {
					return false;
				}
				$GetDataImageSize['height'] = $GetDataImageSize[0];
				$GetDataImageSize['width']  = $GetDataImageSize[1];
			}
			unlink($tempfilename);
		}
+31 −8
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -28,7 +28,7 @@ $temp_dir = ini_get('upload_tmp_dir');
if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) {
	$temp_dir = '';
}
if (!$temp_dir) {
if (!$temp_dir && function_exists('sys_get_temp_dir')) { // sys_get_temp_dir added in PHP v5.2.1
	// sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts
	$temp_dir = sys_get_temp_dir();
}
@@ -109,7 +109,7 @@ class getID3
	protected $startup_error   = '';
	protected $startup_warning = '';

	const VERSION           = '1.9.8-20140511';
	const VERSION           = '1.9.10-20150914';
	const FREAD_BUFFER_SIZE = 32768;

	const ATTACHMENTS_NONE   = false;
@@ -243,7 +243,7 @@ class getID3
	}


	public function openfile($filename) {
	public function openfile($filename, $filesize=null) {
		try {
			if (!empty($this->startup_error)) {
				throw new getid3_exception($this->startup_error);
@@ -256,7 +256,7 @@ class getID3
			$this->filename = $filename;
			$this->info = array();
			$this->info['GETID3_VERSION']   = $this->version();
			$this->info['php_memory_limit'] = $this->memory_limit;
			$this->info['php_memory_limit'] = (($this->memory_limit > 0) ? $this->memory_limit : false);

			// remote files not supported
			if (preg_match('/^(ht|f)tp:\/\//', $filename)) {
@@ -287,7 +287,7 @@ class getID3
				throw new getid3_exception('Could not open "'.$filename.'" ('.implode('; ', $errormessagelist).')');
			}

			$this->info['filesize'] = filesize($filename);
			$this->info['filesize'] = (!is_null($filesize) ? $filesize : filesize($filename));
			// set redundant parameters - might be needed in some include file
			// filenames / filepaths in getID3 are always expressed with forward slashes (unix-style) for both Windows and other to try and minimize confusion
			$filename = str_replace('\\', '/', $filename);
@@ -342,9 +342,9 @@ class getID3
	}

	// public: analyze file
	public function analyze($filename) {
	public function analyze($filename, $filesize=null, $original_filename='') {
		try {
			if (!$this->openfile($filename)) {
			if (!$this->openfile($filename, $filesize)) {
				return $this->info;
			}

@@ -389,7 +389,7 @@ class getID3
			$formattest = fread($this->fp, 32774);

			// determine format
			$determined_format = $this->GetFileFormat($formattest, $filename);
			$determined_format = $this->GetFileFormat($formattest, ($original_filename ? $original_filename : $filename));

			// unable to determine file format
			if (!$determined_format) {
@@ -1235,6 +1235,29 @@ class getID3
					}
				}

				// 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
				if ($comment_name == 'id3v1') {
					if ($encoding == 'ISO-8859-1') {
						if (function_exists('iconv')) {
							foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) {
								foreach ($valuearray as $key => $value) {
									if (preg_match('#^[\\x80-\\xFF]+$#', $value)) {
										foreach (array('windows-1251', 'KOI8-R') as $id3v1_bad_encoding) {
											if (@iconv($id3v1_bad_encoding, $id3v1_bad_encoding, $value) === $value) {
												$encoding = $id3v1_bad_encoding;
												break 3;
											}
										}
									}
								}
							}
						}
					}
				}
				// ID3v1 encoding detection hack end

				$this->CharConvert($this->info['tags'][$tag_name], $encoding);           // only copy gets converted!
			}

+2 −2
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -36,7 +36,7 @@ class getid3_gzip extends getid3_handler {
		//|ID1|ID2|CM |FLG|     MTIME     |XFL|OS |
		//+---+---+---+---+---+---+---+---+---+---+

		if ($info['filesize'] > $info['php_memory_limit']) {
		if ($info['php_memory_limit'] && ($info['filesize'] > $info['php_memory_limit'])) {
			$info['error'][] = 'File is too large ('.number_format($info['filesize']).' bytes) to read into memory (limit: '.number_format($info['php_memory_limit'] / 1048576).'MB)';
			return false;
		}
@@ -56,7 +56,7 @@ class getid3_gzip extends getid3_handler {
				$attr = unpack($unpack_header, substr($buf, 0, $start_length));
				if (!$this->get_os_type(ord($attr['os']))) {
					// Merge member with previous if wrong OS type
					$arr_members[$i - 1] .= $buf;
					$arr_members[($i - 1)] .= $buf;
					$arr_members[$i] = '';
					$is_wrong_members = true;
					continue;
Chargement en cours