12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- if (!defined('GETID3_INCLUDEPATH')) {
- exit;
- }
- class getid3_rar extends getid3_handler
- {
-
- public $use_php_rar_extension = true;
-
- public function Analyze() {
- $info = &$this->getid3->info;
- $info['fileformat'] = 'rar';
- if ($this->use_php_rar_extension === true) {
- if (function_exists('rar_open')) {
- if ($rp = rar_open($info['filenamepath'])) {
- $info['rar']['files'] = array();
- $entries = rar_list($rp);
- foreach ($entries as $entry) {
- $info['rar']['files'] = getid3_lib::array_merge_clobber($info['rar']['files'], getid3_lib::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize()));
- }
- rar_close($rp);
- return true;
- } else {
- $this->error('failed to rar_open('.$info['filename'].')');
- }
- } else {
- $this->error('RAR support does not appear to be available in this PHP installation');
- }
- } else {
- $this->error('PHP-RAR processing has been disabled (set $getid3_rar->use_php_rar_extension=true to enable)');
- }
- return false;
- }
- }
|