File indexing completed on 2025-03-09 05:22:14
0001 <?php 0002 ///////////////////////////////////////////////////////////////// 0003 /// getID3() by James Heinrich <info@getid3.org> // 0004 // available at http://getid3.sourceforge.net // 0005 // or http://www.getid3.org // 0006 // also https://github.com/JamesHeinrich/getID3 // 0007 ///////////////////////////////////////////////////////////////// 0008 // See readme.txt for more details // 0009 ///////////////////////////////////////////////////////////////// 0010 // // 0011 // module.archive.rar.php // 0012 // module for analyzing RAR files // 0013 // dependencies: NONE // 0014 // /// 0015 ///////////////////////////////////////////////////////////////// 0016 0017 0018 class getid3_rar extends getid3_handler 0019 { 0020 0021 public $option_use_rar_extension = false; 0022 0023 public function Analyze() { 0024 $info = &$this->getid3->info; 0025 0026 $info['fileformat'] = 'rar'; 0027 0028 if ($this->option_use_rar_extension === true) { 0029 if (function_exists('rar_open')) { 0030 if ($rp = rar_open($info['filenamepath'])) { 0031 $info['rar']['files'] = array(); 0032 $entries = rar_list($rp); 0033 foreach ($entries as $entry) { 0034 $info['rar']['files'] = getid3_lib::array_merge_clobber($info['rar']['files'], getid3_lib::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize())); 0035 } 0036 rar_close($rp); 0037 return true; 0038 } else { 0039 $info['error'][] = 'failed to rar_open('.$info['filename'].')'; 0040 } 0041 } else { 0042 $info['error'][] = 'RAR support does not appear to be available in this PHP installation'; 0043 } 0044 } else { 0045 $info['error'][] = 'PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)'; 0046 } 0047 return false; 0048 0049 } 0050 0051 }