source: extensions/charlies_content/getid3/getid3/module.archive.rar.php @ 3544

Last change on this file since 3544 was 3544, checked in by vdigital, 15 years ago

Change: getid3 upgraded to -> 1.7.9

  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1<?php
2/////////////////////////////////////////////////////////////////
3/// getID3() by James Heinrich <info@getid3.org>               //
4//  available at http://getid3.sourceforge.net                 //
5//            or http://www.getid3.org                         //
6/////////////////////////////////////////////////////////////////
7// See readme.txt for more details                             //
8/////////////////////////////////////////////////////////////////
9//                                                             //
10// module.archive.rar.php                                      //
11// module for analyzing RAR files                              //
12// dependencies: NONE                                          //
13//                                                            ///
14/////////////////////////////////////////////////////////////////
15
16
17class getid3_rar
18{
19
20        var $option_use_rar_extension = false;
21
22        function getid3_rar(&$fd, &$ThisFileInfo) {
23
24                $ThisFileInfo['fileformat'] = 'rar';
25
26                if ($this->option_use_rar_extension === true) {
27                        if (function_exists('rar_open')) {
28                                if ($rp = rar_open($ThisFileInfo['filename'])) {
29                                        $ThisFileInfo['rar']['files'] = array();
30                                        $entries = rar_list($rp);
31                                        foreach ($entries as $entry) {
32                                                $ThisFileInfo['rar']['files'] = getid3_lib::array_merge_clobber($ThisFileInfo['rar']['files'], getid3_lib::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize()));
33                                        }
34                                        rar_close($rp);
35                                        return true;
36                                } else {
37                                        $ThisFileInfo['error'][] = 'failed to rar_open('.$ThisFileInfo['filename'].')';
38                                }
39                        } else {
40                                $ThisFileInfo['error'][] = 'RAR support does not appear to be available in this PHP installation';
41                        }
42                } else {
43                        $ThisFileInfo['error'][] = 'PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)';
44                }
45                return false;
46
47        }
48
49}
50
51
52?>
Note: See TracBrowser for help on using the repository browser.