diff e2gallerypro/e2upload/Backend/Assets/getid3/module.misc.iso.php @ 3:3f6b44aa6b35 judyates

[svn r4] added ability to buy stuff, from a Prints page, but it doesn't work well with the css, and it also has not been fitted into the perl make system.
author rlm
date Mon, 22 Feb 2010 08:02:39 -0500
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/e2gallerypro/e2upload/Backend/Assets/getid3/module.misc.iso.php	Mon Feb 22 08:02:39 2010 -0500
     1.3 @@ -0,0 +1,450 @@
     1.4 +<?php
     1.5 +// +----------------------------------------------------------------------+
     1.6 +// | PHP version 5                                                        |
     1.7 +// +----------------------------------------------------------------------+
     1.8 +// | Copyright (c) 2002-2006 James Heinrich, Allan Hansen                 |
     1.9 +// +----------------------------------------------------------------------+
    1.10 +// | This source file is subject to version 2 of the GPL license,         |
    1.11 +// | that is bundled with this package in the file license.txt and is     |
    1.12 +// | available through the world-wide-web at the following url:           |
    1.13 +// | http://www.gnu.org/copyleft/gpl.html                                 |
    1.14 +// +----------------------------------------------------------------------+
    1.15 +// | getID3() - http://getid3.sourceforge.net or http://www.getid3.org    |
    1.16 +// +----------------------------------------------------------------------+
    1.17 +// | Authors: James Heinrich <infoØgetid3*org>                            |
    1.18 +// |          Allan Hansen <ahØartemis*dk>                                |
    1.19 +// +----------------------------------------------------------------------+
    1.20 +// | module.misc.iso.php                                                  |
    1.21 +// | Module for analyzing ISO files                                       |
    1.22 +// | dependencies: NONE                                                   |
    1.23 +// +----------------------------------------------------------------------+
    1.24 +//
    1.25 +// $Id: module.misc.iso.php,v 1.3 2006/11/02 10:48:02 ah Exp $
    1.26 +
    1.27 +
    1.28 +
    1.29 +class getid3_iso extends getid3_handler
    1.30 +{
    1.31 +
    1.32 +    public function Analyze() {
    1.33 +        
    1.34 +        $getid3 = $this->getid3;
    1.35 +        
    1.36 +        $getid3->info['fileformat'] = 'iso';
    1.37 +
    1.38 +        for ($i = 16; $i <= 19; $i++) {
    1.39 +            fseek($getid3->fp, 2048 * $i, SEEK_SET);
    1.40 +            $iso_header = fread($getid3->fp, 2048);
    1.41 +            if (substr($iso_header, 1, 5) == 'CD001') {
    1.42 +                switch (ord($iso_header{0})) {
    1.43 +                    case 1:
    1.44 +                        $getid3->info['iso']['primary_volume_descriptor']['offset'] = 2048 * $i;
    1.45 +                        $this->ParsePrimaryVolumeDescriptor($iso_header);
    1.46 +                        break;
    1.47 +
    1.48 +                    case 2:
    1.49 +                        $getid3->info['iso']['supplementary_volume_descriptor']['offset'] = 2048 * $i;
    1.50 +                        $this->ParseSupplementaryVolumeDescriptor($iso_header);
    1.51 +                        break;
    1.52 +
    1.53 +                    default:
    1.54 +                        // skip
    1.55 +                        break;
    1.56 +                }
    1.57 +            }
    1.58 +        }
    1.59 +
    1.60 +        $this->ParsePathTable();
    1.61 +
    1.62 +        $getid3->info['iso']['files'] = array ();
    1.63 +        foreach ($getid3->info['iso']['path_table']['directories'] as $directory_num => $directory_data) {
    1.64 +            $getid3->info['iso']['directories'][$directory_num] = $this->ParseDirectoryRecord($directory_data);
    1.65 +        }
    1.66 +
    1.67 +        return true;
    1.68 +    }
    1.69 +
    1.70 +
    1.71 +
    1.72 +    private function ParsePrimaryVolumeDescriptor(&$iso_header) {
    1.73 +        
    1.74 +        $getid3 = $this->getid3;
    1.75 +        
    1.76 +        // ISO integer values are stored *BOTH* Little-Endian AND Big-Endian format!!
    1.77 +        // ie 12345 == 0x3039  is stored as $39 $30 $30 $39 in a 4-byte field
    1.78 +
    1.79 +        $getid3->info['iso']['primary_volume_descriptor']['raw'] = array ();
    1.80 +        $info_iso_primaryVD     = &$getid3->info['iso']['primary_volume_descriptor'];
    1.81 +        $info_iso_primaryVD_raw = &$info_iso_primaryVD['raw'];
    1.82 +
    1.83 +        $info_iso_primaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($iso_header,    0, 1));
    1.84 +        $info_iso_primaryVD_raw['standard_identifier']    = substr($iso_header,    1, 5);
    1.85 +        if ($info_iso_primaryVD_raw['standard_identifier'] != 'CD001') {
    1.86 +            throw new getid3_exception('Expected "CD001" at offset ('.($info_iso_primaryVD['offset'] + 1).'), found "'.$info_iso_primaryVD_raw['standard_identifier'].'" instead');
    1.87 +        }
    1.88 +        
    1.89 +        getid3_lib::ReadSequence('LittleEndian2Int', $info_iso_primaryVD_raw, $iso_header, 6, 
    1.90 +            array (
    1.91 +                'volume_descriptor_version'     => 1,
    1.92 +                'IGNORE-unused_1'               => 1,
    1.93 +                'system_identifier'             => -32,     // string
    1.94 +                'volume_identifier'             => -32,     // string
    1.95 +                'IGNORE-unused_2'               => 8,
    1.96 +                'volume_space_size'             => 4,
    1.97 +                'IGNORE-1'                      => 4,
    1.98 +                'IGNORE-unused_3'               => 32,
    1.99 +                'volume_set_size'               => 2,
   1.100 +                'IGNORE-2'                      => 2,
   1.101 +                'volume_sequence_number'        => 2,
   1.102 +                'IGNORE-3'                      => 2,
   1.103 +                'logical_block_size'            => 2,
   1.104 +                'IGNORE-4'                      => 2,
   1.105 +                'path_table_size'               => 4,
   1.106 +                'IGNORE-5'                      => 4,
   1.107 +                'path_table_l_location'         => 2,
   1.108 +                'IGNORE-6'                      => 2,
   1.109 +                'path_table_l_opt_location'     => 2,
   1.110 +                'IGNORE-7'                      => 2,
   1.111 +                'path_table_m_location'         => 2,
   1.112 +                'IGNORE-8'                      => 2,
   1.113 +                'path_table_m_opt_location'     => 2,
   1.114 +                'IGNORE-9'                      => 2,
   1.115 +                'root_directory_record'         => -34,     // string
   1.116 +                'volume_set_identifier'         => -128,    // string
   1.117 +                'publisher_identifier'          => -128,    // string
   1.118 +                'data_preparer_identifier'      => -128,    // string
   1.119 +                'application_identifier'        => -128,    // string
   1.120 +                'copyright_file_identifier'     => -37,     // string
   1.121 +                'abstract_file_identifier'      => -37,     // string
   1.122 +                'bibliographic_file_identifier' => -37,     // string
   1.123 +                'volume_creation_date_time'     => -17,     // string
   1.124 +                'volume_modification_date_time' => -17,     // string
   1.125 +                'volume_expiration_date_time'   => -17,     // string
   1.126 +                'volume_effective_date_time'    => -17,     // string
   1.127 +                'file_structure_version'        => 1,
   1.128 +                'IGNORE-unused_4'               => 1,
   1.129 +                'application_data'              => -512     // string
   1.130 +            )
   1.131 +        );
   1.132 +
   1.133 +        $info_iso_primaryVD['system_identifier']             = trim($info_iso_primaryVD_raw['system_identifier']);
   1.134 +        $info_iso_primaryVD['volume_identifier']             = trim($info_iso_primaryVD_raw['volume_identifier']);
   1.135 +        $info_iso_primaryVD['volume_set_identifier']         = trim($info_iso_primaryVD_raw['volume_set_identifier']);
   1.136 +        $info_iso_primaryVD['publisher_identifier']          = trim($info_iso_primaryVD_raw['publisher_identifier']);
   1.137 +        $info_iso_primaryVD['data_preparer_identifier']      = trim($info_iso_primaryVD_raw['data_preparer_identifier']);
   1.138 +        $info_iso_primaryVD['application_identifier']        = trim($info_iso_primaryVD_raw['application_identifier']);
   1.139 +        $info_iso_primaryVD['copyright_file_identifier']     = trim($info_iso_primaryVD_raw['copyright_file_identifier']);
   1.140 +        $info_iso_primaryVD['abstract_file_identifier']      = trim($info_iso_primaryVD_raw['abstract_file_identifier']);
   1.141 +        $info_iso_primaryVD['bibliographic_file_identifier'] = trim($info_iso_primaryVD_raw['bibliographic_file_identifier']);
   1.142 +        
   1.143 +        $info_iso_primaryVD['volume_creation_date_time']     = getid3_iso::ISOtimeText2UNIXtime($info_iso_primaryVD_raw['volume_creation_date_time']);
   1.144 +        $info_iso_primaryVD['volume_modification_date_time'] = getid3_iso::ISOtimeText2UNIXtime($info_iso_primaryVD_raw['volume_modification_date_time']);
   1.145 +        $info_iso_primaryVD['volume_expiration_date_time']   = getid3_iso::ISOtimeText2UNIXtime($info_iso_primaryVD_raw['volume_expiration_date_time']);
   1.146 +        $info_iso_primaryVD['volume_effective_date_time']    = getid3_iso::ISOtimeText2UNIXtime($info_iso_primaryVD_raw['volume_effective_date_time']);
   1.147 +
   1.148 +        if (($info_iso_primaryVD_raw['volume_space_size'] * 2048) > $getid3->info['filesize']) {
   1.149 +            throw new getid3_exception('Volume Space Size ('.($info_iso_primaryVD_raw['volume_space_size'] * 2048).' bytes) is larger than the file size ('.$getid3->info['filesize'].' bytes) (truncated file?)');
   1.150 +        }
   1.151 +
   1.152 +        return true;
   1.153 +    }
   1.154 +
   1.155 +
   1.156 +
   1.157 +    private function ParseSupplementaryVolumeDescriptor(&$iso_header) {
   1.158 +        
   1.159 +        $getid3 = $this->getid3;
   1.160 +        
   1.161 +        // ISO integer values are stored Both-Endian format!!
   1.162 +        // ie 12345 == 0x3039  is stored as $39 $30 $30 $39 in a 4-byte field
   1.163 +
   1.164 +        $getid3->info['iso']['supplementary_volume_descriptor']['raw'] = array ();
   1.165 +        $info_iso_supplementaryVD     = &$getid3->info['iso']['supplementary_volume_descriptor'];
   1.166 +        $info_iso_supplementaryVD_raw = &$info_iso_supplementaryVD['raw'];
   1.167 +
   1.168 +        $info_iso_supplementaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($iso_header, 0, 1));
   1.169 +        $info_iso_supplementaryVD_raw['standard_identifier']    = substr($iso_header, 1, 5);
   1.170 +        if ($info_iso_supplementaryVD_raw['standard_identifier'] != 'CD001') {
   1.171 +            throw new getid3_exception('Expected "CD001" at offset ('.($info_iso_supplementaryVD['offset'] + 1).'), found "'.$info_iso_supplementaryVD_raw['standard_identifier'].'" instead');
   1.172 +        }
   1.173 +
   1.174 +        getid3_lib::ReadSequence('LittleEndian2Int', $info_iso_supplementaryVD_raw, $iso_header, 6, 
   1.175 +            array (
   1.176 +                'volume_descriptor_version'     => 1,
   1.177 +                'IGNORE-unused_1'               => -1,
   1.178 +                'system_identifier'             => -32,
   1.179 +                'volume_identifier'             => -32,
   1.180 +                'IGNORE-unused_2'               => -8,
   1.181 +                'volume_space_size'             => 4,
   1.182 +                'IGNORE-1'                      => 4,
   1.183 +                'IGNORE-unused_3'               => -32,
   1.184 +                'volume_set_size'               => 2,
   1.185 +                'IGNORE-2'                      => 2,
   1.186 +                'volume_sequence_number'        => 2,
   1.187 +                'IGNORE-3'                      => 2,
   1.188 +                'logical_block_size'            => 2,
   1.189 +                'IGNORE-4'                      => 2,
   1.190 +                'path_table_size'               => 4,
   1.191 +                'IGNORE-5'                      => 4,
   1.192 +                'path_table_l_location'         => 2,
   1.193 +                'IGNORE-6'                      => 2,
   1.194 +                'path_table_l_opt_location'     => 2,
   1.195 +                'IGNORE-7'                      => 2,
   1.196 +                'path_table_m_location'         => 2,
   1.197 +                'IGNORE-8'                      => 2,
   1.198 +                'path_table_m_opt_location'     => 2,
   1.199 +                'IGNORE-9'                      => 2,
   1.200 +                'root_directory_record'         => -34,
   1.201 +                'volume_set_identifier'         => -128,
   1.202 +                'publisher_identifier'          => -128,
   1.203 +                'data_preparer_identifier'      => -128,
   1.204 +                'application_identifier'        => -128,
   1.205 +                'copyright_file_identifier'     => -37,
   1.206 +                'abstract_file_identifier'      => -37,
   1.207 +                'bibliographic_file_identifier' => -37,
   1.208 +                'volume_creation_date_time'     => -17,
   1.209 +                'volume_modification_date_time' => -17,
   1.210 +                'volume_expiration_date_time'   => -17,
   1.211 +                'volume_effective_date_time'    => -17,
   1.212 +                'file_structure_version'        => 1,
   1.213 +                'IGNORE-unused_4'               => 1,
   1.214 +                'application_data'              => -512
   1.215 +            )
   1.216 +        );
   1.217 +
   1.218 +        $info_iso_supplementaryVD['system_identifier']              = trim($info_iso_supplementaryVD_raw['system_identifier']);
   1.219 +        $info_iso_supplementaryVD['volume_identifier']              = trim($info_iso_supplementaryVD_raw['volume_identifier']);
   1.220 +        $info_iso_supplementaryVD['volume_set_identifier']          = trim($info_iso_supplementaryVD_raw['volume_set_identifier']);
   1.221 +        $info_iso_supplementaryVD['publisher_identifier']           = trim($info_iso_supplementaryVD_raw['publisher_identifier']);
   1.222 +        $info_iso_supplementaryVD['data_preparer_identifier']       = trim($info_iso_supplementaryVD_raw['data_preparer_identifier']);
   1.223 +        $info_iso_supplementaryVD['application_identifier']         = trim($info_iso_supplementaryVD_raw['application_identifier']);
   1.224 +        $info_iso_supplementaryVD['copyright_file_identifier']      = trim($info_iso_supplementaryVD_raw['copyright_file_identifier']);
   1.225 +        $info_iso_supplementaryVD['abstract_file_identifier']       = trim($info_iso_supplementaryVD_raw['abstract_file_identifier']);
   1.226 +        $info_iso_supplementaryVD['bibliographic_file_identifier']  = trim($info_iso_supplementaryVD_raw['bibliographic_file_identifier']);
   1.227 +        
   1.228 +        $info_iso_supplementaryVD['volume_creation_date_time']      = getid3_iso::ISOtimeText2UNIXtime($info_iso_supplementaryVD_raw['volume_creation_date_time']);
   1.229 +        $info_iso_supplementaryVD['volume_modification_date_time']  = getid3_iso::ISOtimeText2UNIXtime($info_iso_supplementaryVD_raw['volume_modification_date_time']);
   1.230 +        $info_iso_supplementaryVD['volume_expiration_date_time']    = getid3_iso::ISOtimeText2UNIXtime($info_iso_supplementaryVD_raw['volume_expiration_date_time']);
   1.231 +        $info_iso_supplementaryVD['volume_effective_date_time']     = getid3_iso::ISOtimeText2UNIXtime($info_iso_supplementaryVD_raw['volume_effective_date_time']);
   1.232 +
   1.233 +        if (($info_iso_supplementaryVD_raw['volume_space_size'] * $info_iso_supplementaryVD_raw['logical_block_size']) > $getid3->info['filesize']) {
   1.234 +            throw new getid3_exception('Volume Space Size ('.($info_iso_supplementaryVD_raw['volume_space_size'] * $info_iso_supplementaryVD_raw['logical_block_size']).' bytes) is larger than the file size ('.$getid3->info['filesize'].' bytes) (truncated file?)');
   1.235 +        }
   1.236 +
   1.237 +        return true;
   1.238 +    }
   1.239 +
   1.240 +
   1.241 +
   1.242 +    private function ParsePathTable() {
   1.243 +        
   1.244 +        $getid3 = $this->getid3;
   1.245 +        
   1.246 +        if (!isset($getid3->info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location']) && !isset($getid3->info['iso']['primary_volume_descriptor']['raw']['path_table_l_location'])) {
   1.247 +            return false;
   1.248 +        }
   1.249 +        if (isset($getid3->info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location'])) {
   1.250 +            $path_table_location = $getid3->info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location'];
   1.251 +            $path_table_size     = $getid3->info['iso']['supplementary_volume_descriptor']['raw']['path_table_size'];
   1.252 +            $text_encoding       = 'UTF-16BE'; // Big-Endian Unicode
   1.253 +        } 
   1.254 +        else {
   1.255 +            $path_table_location = $getid3->info['iso']['primary_volume_descriptor']['raw']['path_table_l_location'];
   1.256 +            $path_table_size     = $getid3->info['iso']['primary_volume_descriptor']['raw']['path_table_size'];
   1.257 +            $text_encoding       = 'ISO-8859-1'; // Latin-1
   1.258 +        }
   1.259 +
   1.260 +        if (($path_table_location * 2048) > $getid3->info['filesize']) {
   1.261 +            throw new getid3_exception('Path Table Location specifies an offset ('.($path_table_location * 2048).') beyond the end-of-file ('.$getid3->info['filesize'].')');
   1.262 +        }
   1.263 +
   1.264 +        $getid3->info['iso']['path_table']['offset'] = $path_table_location * 2048;
   1.265 +        fseek($getid3->fp, $getid3->info['iso']['path_table']['offset'], SEEK_SET);
   1.266 +        $getid3->info['iso']['path_table']['raw'] = fread($getid3->fp, $path_table_size);
   1.267 +
   1.268 +        $offset = 0;
   1.269 +        $pathcounter = 1;
   1.270 +        while ($offset < $path_table_size) {
   1.271 +            
   1.272 +            $getid3->info['iso']['path_table']['directories'][$pathcounter] = array ();
   1.273 +            $info_iso_pathtable_directories_current = &$getid3->info['iso']['path_table']['directories'][$pathcounter];
   1.274 +
   1.275 +            getid3_lib::ReadSequence('LittleEndian2Int', $info_iso_pathtable_directories_current, $getid3->info['iso']['path_table']['raw'], $offset, 
   1.276 +                array (
   1.277 +                       'length'           => 1,
   1.278 +                    'extended_length'  => 1,
   1.279 +                    'location_logical' => 4,
   1.280 +                    'parent_directory' => 2,
   1.281 +                )
   1.282 +            );
   1.283 +            
   1.284 +            $info_iso_pathtable_directories_current['name'] = substr($getid3->info['iso']['path_table']['raw'], $offset+8, $info_iso_pathtable_directories_current['length']);
   1.285 +            
   1.286 +            $offset += 8 + $info_iso_pathtable_directories_current['length'] + ($info_iso_pathtable_directories_current['length'] % 2);
   1.287 +
   1.288 +            $info_iso_pathtable_directories_current['name_ascii'] = $getid3->iconv($text_encoding, $getid3->encoding, $info_iso_pathtable_directories_current['name'], true);
   1.289 +
   1.290 +            $info_iso_pathtable_directories_current['location_bytes'] = $info_iso_pathtable_directories_current['location_logical'] * 2048;
   1.291 +            if ($pathcounter == 1) {
   1.292 +                $info_iso_pathtable_directories_current['full_path'] = '/';
   1.293 +            }
   1.294 +            else {
   1.295 +                $info_iso_pathtable_directories_current['full_path'] = $getid3->info['iso']['path_table']['directories'][$info_iso_pathtable_directories_current['parent_directory']]['full_path'].$info_iso_pathtable_directories_current['name_ascii'].'/';
   1.296 +            }
   1.297 +            $full_path_array[] = $info_iso_pathtable_directories_current['full_path'];
   1.298 +
   1.299 +            $pathcounter++;
   1.300 +        }
   1.301 +
   1.302 +        return true;
   1.303 +    }
   1.304 +
   1.305 +
   1.306 +
   1.307 +    private function ParseDirectoryRecord($directory_data) {
   1.308 +        
   1.309 +        $getid3 = $this->getid3;
   1.310 +        
   1.311 +        $text_encoding = isset($getid3->info['iso']['supplementary_volume_descriptor']) ? 'UTF-16BE' : 'ISO-8859-1'; 
   1.312 +
   1.313 +        fseek($getid3->fp, $directory_data['location_bytes'], SEEK_SET);
   1.314 +        $directory_record_data = fread($getid3->fp, 1);
   1.315 +        
   1.316 +        while (ord($directory_record_data{0}) > 33) {
   1.317 +
   1.318 +            $directory_record_data .= fread($getid3->fp, ord($directory_record_data{0}) - 1);
   1.319 +            
   1.320 +            $this_directory_record = array ();
   1.321 +            $this_directory_record['raw'] = array ();
   1.322 +            $this_directory_record_raw = &$this_directory_record['raw'];
   1.323 +            
   1.324 +            getid3_lib::ReadSequence('LittleEndian2Int', $this_directory_record_raw, $directory_record_data, 0, 
   1.325 +                array (
   1.326 +                    'length'                    => 1,
   1.327 +                    'extended_attribute_length' => 1,
   1.328 +                    'offset_logical'            => 4,
   1.329 +                    'IGNORE-1'                  => 4,
   1.330 +                    'filesize'                  => 4,
   1.331 +                    'IGNORE-2'                  => 4,
   1.332 +                    'recording_date_time'       => -7,
   1.333 +                    'file_flags'                => 1,
   1.334 +                    'file_unit_size'            => 1,
   1.335 +                    'interleave_gap_size'       => 1,
   1.336 +                    'volume_sequence_number'    => 2,
   1.337 +                    'IGNORE-3'                  => 2,
   1.338 +                    'file_identifier_length'    => 1,
   1.339 +                )
   1.340 +            );
   1.341 +
   1.342 +            $this_directory_record_raw['file_identifier'] = substr($directory_record_data, 33, $this_directory_record_raw['file_identifier_length']);
   1.343 +            
   1.344 +            $this_directory_record['file_identifier_ascii']     = $getid3->iconv($text_encoding, $getid3->encoding, $this_directory_record_raw['file_identifier'], true);
   1.345 +            $this_directory_record['filesize']                  = $this_directory_record_raw['filesize'];
   1.346 +            $this_directory_record['offset_bytes']              = $this_directory_record_raw['offset_logical'] * 2048;
   1.347 +            $this_directory_record['file_flags']['hidden']      = (bool)($this_directory_record_raw['file_flags'] & 0x01);
   1.348 +            $this_directory_record['file_flags']['directory']   = (bool)($this_directory_record_raw['file_flags'] & 0x02);
   1.349 +            $this_directory_record['file_flags']['associated']  = (bool)($this_directory_record_raw['file_flags'] & 0x04);
   1.350 +            $this_directory_record['file_flags']['extended']    = (bool)($this_directory_record_raw['file_flags'] & 0x08);
   1.351 +            $this_directory_record['file_flags']['permissions'] = (bool)($this_directory_record_raw['file_flags'] & 0x10);
   1.352 +            $this_directory_record['file_flags']['multiple']    = (bool)($this_directory_record_raw['file_flags'] & 0x80);
   1.353 +            $this_directory_record['recording_timestamp']       = getid3_iso::ISOtime2UNIXtime($this_directory_record_raw['recording_date_time']);
   1.354 +
   1.355 +            if ($this_directory_record['file_flags']['directory']) {
   1.356 +                $this_directory_record['filename'] = $directory_data['full_path'];
   1.357 +            }
   1.358 +            else {
   1.359 +                $this_directory_record['filename'] = $directory_data['full_path'].getid3_iso::ISOstripFilenameVersion($this_directory_record['file_identifier_ascii']);
   1.360 +                $getid3->info['iso']['files'] = getid3_iso::array_merge_clobber($getid3->info['iso']['files'], getid3_iso::CreateDeepArray($this_directory_record['filename'], '/', $this_directory_record['filesize']));
   1.361 +            }
   1.362 +            
   1.363 +            $directory_record[]    = $this_directory_record;
   1.364 +            $directory_record_data = fread($getid3->fp, 1);
   1.365 +        }
   1.366 +        
   1.367 +        return $directory_record;
   1.368 +    }
   1.369 +
   1.370 +
   1.371 +
   1.372 +    public static function ISOstripFilenameVersion($iso_filename) {
   1.373 +
   1.374 +        // convert 'filename.ext;1' to 'filename.ext'
   1.375 +        if (!strstr($iso_filename, ';')) {
   1.376 +            return $iso_filename;
   1.377 +        }
   1.378 +        return substr($iso_filename, 0, strpos($iso_filename, ';'));
   1.379 +    }
   1.380 +
   1.381 +
   1.382 +
   1.383 +    public static function ISOtimeText2UNIXtime($iso_time) {
   1.384 +
   1.385 +        if (!(int)substr($iso_time, 0, 4)) {
   1.386 +            return false;
   1.387 +        }
   1.388 +        
   1.389 +        return gmmktime((int)substr($iso_time, 8, 2), (int)substr($iso_time, 10, 2), (int)substr($iso_time, 12, 2), (int)substr($iso_time, 4, 2), (int)substr($iso_time, 6, 2), (int)substr($iso_time, 0, 4));
   1.390 +    }
   1.391 +    
   1.392 +    
   1.393 +
   1.394 +    public static function ISOtime2UNIXtime($iso_time) {
   1.395 +    
   1.396 +        // Represented by seven bytes:
   1.397 +        // 1: Number of years since 1900
   1.398 +        // 2: Month of the year from 1 to 12
   1.399 +        // 3: Day of the Month from 1 to 31
   1.400 +        // 4: Hour of the day from 0 to 23
   1.401 +        // 5: Minute of the hour from 0 to 59
   1.402 +        // 6: second of the minute from 0 to 59
   1.403 +        // 7: Offset from Greenwich Mean Time in number of 15 minute intervals from -48 (West) to +52 (East)
   1.404 +
   1.405 +        return gmmktime(ord($iso_time[3]), ord($iso_time[4]), ord($iso_time[5]), ord($iso_time[1]), ord($iso_time[2]), ord($iso_time[0]) + 1900);
   1.406 +    }
   1.407 +
   1.408 +
   1.409 +
   1.410 +    public static function array_merge_clobber($array1, $array2) {
   1.411 +
   1.412 +        // written by kcØhireability*com
   1.413 +        // taken from http://www.php.net/manual/en/function.array-merge-recursive.php
   1.414 +        
   1.415 +        if (!is_array($array1) || !is_array($array2)) {
   1.416 +            return false;
   1.417 +        }
   1.418 +        
   1.419 +        $newarray = $array1;
   1.420 +        foreach ($array2 as $key => $val) {
   1.421 +            if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) {
   1.422 +                $newarray[$key] = getid3_iso::array_merge_clobber($newarray[$key], $val);
   1.423 +            } else {
   1.424 +                $newarray[$key] = $val;
   1.425 +            }
   1.426 +        }
   1.427 +        return $newarray;
   1.428 +    }
   1.429 +    
   1.430 +    
   1.431 +    
   1.432 +    public static function CreateDeepArray($array_path, $separator, $value) {
   1.433 +
   1.434 +        // assigns $value to a nested array path:
   1.435 +        //   $foo = getid3_lib::CreateDeepArray('/path/to/my', '/', 'file.txt')
   1.436 +        // is the same as:
   1.437 +        //   $foo = array ('path'=>array('to'=>'array('my'=>array('file.txt'))));
   1.438 +        // or
   1.439 +        //   $foo['path']['to']['my'] = 'file.txt';
   1.440 +        
   1.441 +        while ($array_path{0} == $separator) {
   1.442 +            $array_path = substr($array_path, 1);
   1.443 +        }
   1.444 +        if (($pos = strpos($array_path, $separator)) !== false) {
   1.445 +            return array (substr($array_path, 0, $pos) => getid3_iso::CreateDeepArray(substr($array_path, $pos + 1), $separator, $value));
   1.446 +        }
   1.447 +        
   1.448 +        return array ($array_path => $value);
   1.449 +    }
   1.450 +
   1.451 +}
   1.452 +
   1.453 +?>
   1.454 \ No newline at end of file