Skip to content

Commit

Permalink
#438 basic GPX format detection
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHeinrich committed Feb 19, 2024
1 parent fff2dc3 commit a94fb70
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
12 changes: 11 additions & 1 deletion getid3/getid3.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class getID3
*/
protected $startup_warning = '';

const VERSION = '1.9.23-202312292105';
const VERSION = '1.9.23-202402191012';
const FREAD_BUFFER_SIZE = 32768;

const ATTACHMENTS_NONE = false;
Expand Down Expand Up @@ -1477,6 +1477,16 @@ public function GetFileFormatArray() {

// Misc other formats

// GPX - data - GPS Exchange Format
'gpx' => array (
'pattern' => '^<\\?xml [^>]+>[\s]*<gpx ',
'group' => 'misc',
'module' => 'gpx',
'mime_type' => 'application/gpx+xml',
'fail_id3' => 'ERROR',
'fail_ape' => 'ERROR',
),

// PAR2 - data - Parity Volume Set Specification 2.0
'par2' => array (
'pattern' => '^PAR2\\x00PKT',
Expand Down
36 changes: 36 additions & 0 deletions getid3/module.misc.gpx.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/////////////////////////////////////////////////////////////////
/// getID3() by James Heinrich <[email protected]> //
// available at https://github.com/JamesHeinrich/getID3 //
// or https://www.getid3.org //
// or http://getid3.sourceforge.net //
// see readme.txt for more details //
/////////////////////////////////////////////////////////////////
// //
// module.misc.gpx.php //
// module for analyzing gpx files //
// dependencies: NONE //
// ///
/////////////////////////////////////////////////////////////////

if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers
exit;
}

class getid3_gpx extends getid3_handler
{
/**
* @return bool
*/
public function Analyze() {
$info = &$this->getid3->info;

$info['fileformat'] = 'gpx';

$this->error('gpx parsing not enabled in this version of getID3()');
return false;

}

}

0 comments on commit a94fb70

Please sign in to comment.