view e2gallerypro/e2upload/Backend/Assets/getid3/module.archive.szip.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 source
1 <?php
2 // +----------------------------------------------------------------------+
3 // | PHP version 5 |
4 // +----------------------------------------------------------------------+
5 // | Copyright (c) 2002-2006 James Heinrich, Allan Hansen |
6 // +----------------------------------------------------------------------+
7 // | This source file is subject to version 2 of the GPL license, |
8 // | that is bundled with this package in the file license.txt and is |
9 // | available through the world-wide-web at the following url: |
10 // | http://www.gnu.org/copyleft/gpl.html |
11 // +----------------------------------------------------------------------+
12 // | getID3() - http://getid3.sourceforge.net or http://www.getid3.org |
13 // +----------------------------------------------------------------------+
14 // | Authors: James Heinrich <infoØgetid3*org> |
15 // | Allan Hansen <ahØartemis*dk> |
16 // +----------------------------------------------------------------------+
17 // | module.archive.szip.php |
18 // | module for analyzing SZIP compressed files |
19 // | dependencies: NONE |
20 // +----------------------------------------------------------------------+
21 //
22 // $Id: module.archive.szip.php,v 1.2 2006/11/02 10:48:00 ah Exp $
26 class getid3_szip extends getid3_handler
27 {
29 public function Analyze() {
31 $getid3 = $this->getid3;
33 fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
34 $szip_rkau = fread($getid3->fp, 6);
36 // Magic bytes: 'SZ'."\x0A\x04"
38 $getid3->info['fileformat'] = 'szip';
40 $getid3->info['szip']['major_version'] = getid3_lib::BigEndian2Int(substr($szip_rkau, 4, 1));
41 $getid3->info['szip']['minor_version'] = getid3_lib::BigEndian2Int(substr($szip_rkau, 5, 1));
43 while (!feof($getid3->fp)) {
44 $next_block_id = fread($getid3->fp, 2);
45 switch ($next_block_id) {
46 case 'SZ':
47 // Note that szip files can be concatenated, this has the same effect as
48 // concatenating the files. this also means that global header blocks
49 // might be present between directory/data blocks.
50 fseek($getid3->fp, 4, SEEK_CUR);
51 break;
53 case 'BH':
54 $bh_header_bytes = getid3_lib::BigEndian2Int(fread($getid3->fp, 3));
55 $bh_header_data = fread($getid3->fp, $bh_header_bytes);
56 $bh_header_offset = 0;
57 while (strpos($bh_header_data, "\x00", $bh_header_offset) > 0) {
58 //filename as \0 terminated string (empty string indicates end)
59 //owner as \0 terminated string (empty is same as last file)
60 //group as \0 terminated string (empty is same as last file)
61 //3 byte filelength in this block
62 //2 byte access flags
63 //4 byte creation time (like in unix)
64 //4 byte modification time (like in unix)
65 //4 byte access time (like in unix)
67 $bh_data_array['filename'] = substr($bh_header_data, $bh_header_offset, strcspn($bh_header_data, "\x00"));
68 $bh_header_offset += (strlen($bh_data_array['filename']) + 1);
70 $bh_data_array['owner'] = substr($bh_header_data, $bh_header_offset, strcspn($bh_header_data, "\x00"));
71 $bh_header_offset += (strlen($bh_data_array['owner']) + 1);
73 $bh_data_array['group'] = substr($bh_header_data, $bh_header_offset, strcspn($bh_header_data, "\x00"));
74 $bh_header_offset += (strlen($bh_data_array['group']) + 1);
76 $bh_data_array['filelength'] = getid3_lib::BigEndian2Int(substr($bh_header_data, $bh_header_offset, 3));
77 $bh_header_offset += 3;
79 $bh_data_array['access_flags'] = getid3_lib::BigEndian2Int(substr($bh_header_data, $bh_header_offset, 2));
80 $bh_header_offset += 2;
82 $bh_data_array['creation_time'] = getid3_lib::BigEndian2Int(substr($bh_header_data, $bh_header_offset, 4));
83 $bh_header_offset += 4;
85 $bh_data_array['modification_time'] = getid3_lib::BigEndian2Int(substr($bh_header_data, $bh_header_offset, 4));
86 $bh_header_offset += 4;
88 $bh_data_array['access_time'] = getid3_lib::BigEndian2Int(substr($bh_header_data, $bh_header_offset, 4));
89 $bh_header_offset += 4;
91 $getid3->info['szip']['BH'][] = $bh_data_array;
92 }
93 break;
95 default:
96 break 2;
97 }
98 }
100 return true;
101 }
103 }
105 ?>