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