diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/e2gallerypro/e2upload/Backend/Assets/getid3/module.archive.szip.php	Mon Feb 22 08:02:39 2010 -0500
     1.3 @@ -0,0 +1,105 @@
     1.4 +<?php
     1.5 +// +----------------------------------------------------------------------+
     1.6 +// | PHP version 5                                                        |
     1.7 +// +----------------------------------------------------------------------+
     1.8 +// | Copyright (c) 2002-2006 James Heinrich, Allan Hansen                 |
     1.9 +// +----------------------------------------------------------------------+
    1.10 +// | This source file is subject to version 2 of the GPL license,         |
    1.11 +// | that is bundled with this package in the file license.txt and is     |
    1.12 +// | available through the world-wide-web at the following url:           |
    1.13 +// | http://www.gnu.org/copyleft/gpl.html                                 |
    1.14 +// +----------------------------------------------------------------------+
    1.15 +// | getID3() - http://getid3.sourceforge.net or http://www.getid3.org    |
    1.16 +// +----------------------------------------------------------------------+
    1.17 +// | Authors: James Heinrich <infoØgetid3*org>                            |
    1.18 +// |          Allan Hansen <ahØartemis*dk>                                |
    1.19 +// +----------------------------------------------------------------------+
    1.20 +// | module.archive.szip.php                                              |
    1.21 +// | module for analyzing SZIP compressed files                           |
    1.22 +// | dependencies: NONE                                                   |
    1.23 +// +----------------------------------------------------------------------+
    1.24 +//
    1.25 +// $Id: module.archive.szip.php,v 1.2 2006/11/02 10:48:00 ah Exp $
    1.26 +
    1.27 +        
    1.28 +        
    1.29 +class getid3_szip extends getid3_handler
    1.30 +{
    1.31 +
    1.32 +    public function Analyze() {
    1.33 +        
    1.34 +        $getid3 = $this->getid3;
    1.35 +
    1.36 +        fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
    1.37 +        $szip_rkau = fread($getid3->fp, 6);
    1.38 +        
    1.39 +        // Magic bytes:  'SZ'."\x0A\x04"
    1.40 +            
    1.41 +        $getid3->info['fileformat']            = 'szip';
    1.42 +
    1.43 +        $getid3->info['szip']['major_version'] = getid3_lib::BigEndian2Int(substr($szip_rkau, 4, 1));
    1.44 +        $getid3->info['szip']['minor_version'] = getid3_lib::BigEndian2Int(substr($szip_rkau, 5, 1));
    1.45 +
    1.46 +        while (!feof($getid3->fp)) {
    1.47 +            $next_block_id = fread($getid3->fp, 2);
    1.48 +            switch ($next_block_id) {
    1.49 +                case 'SZ':
    1.50 +                    // Note that szip files can be concatenated, this has the same effect as
    1.51 +                    // concatenating the files. this also means that global header blocks
    1.52 +                    // might be present between directory/data blocks.
    1.53 +                    fseek($getid3->fp, 4, SEEK_CUR);
    1.54 +                    break;
    1.55 +
    1.56 +                case 'BH':
    1.57 +                    $bh_header_bytes  = getid3_lib::BigEndian2Int(fread($getid3->fp, 3));
    1.58 +                    $bh_header_data   = fread($getid3->fp, $bh_header_bytes);
    1.59 +                    $bh_header_offset = 0;
    1.60 +                    while (strpos($bh_header_data, "\x00", $bh_header_offset) > 0) {
    1.61 +                        //filename as \0 terminated string  (empty string indicates end)
    1.62 +                        //owner as \0 terminated string (empty is same as last file)
    1.63 +                        //group as \0 terminated string (empty is same as last file)
    1.64 +                        //3 byte filelength in this block
    1.65 +                        //2 byte access flags
    1.66 +                        //4 byte creation time (like in unix)
    1.67 +                        //4 byte modification time (like in unix)
    1.68 +                        //4 byte access time (like in unix)
    1.69 +
    1.70 +                        $bh_data_array['filename'] = substr($bh_header_data, $bh_header_offset, strcspn($bh_header_data, "\x00"));
    1.71 +                        $bh_header_offset += (strlen($bh_data_array['filename']) + 1);
    1.72 +
    1.73 +                        $bh_data_array['owner'] = substr($bh_header_data, $bh_header_offset, strcspn($bh_header_data, "\x00"));
    1.74 +                        $bh_header_offset += (strlen($bh_data_array['owner']) + 1);
    1.75 +
    1.76 +                        $bh_data_array['group'] = substr($bh_header_data, $bh_header_offset, strcspn($bh_header_data, "\x00"));
    1.77 +                        $bh_header_offset += (strlen($bh_data_array['group']) + 1);
    1.78 +
    1.79 +                        $bh_data_array['filelength'] = getid3_lib::BigEndian2Int(substr($bh_header_data, $bh_header_offset, 3));
    1.80 +                        $bh_header_offset += 3;
    1.81 +
    1.82 +                        $bh_data_array['access_flags'] = getid3_lib::BigEndian2Int(substr($bh_header_data, $bh_header_offset, 2));
    1.83 +                        $bh_header_offset += 2;
    1.84 +
    1.85 +                        $bh_data_array['creation_time'] = getid3_lib::BigEndian2Int(substr($bh_header_data, $bh_header_offset, 4));
    1.86 +                        $bh_header_offset += 4;
    1.87 +
    1.88 +                        $bh_data_array['modification_time'] = getid3_lib::BigEndian2Int(substr($bh_header_data, $bh_header_offset, 4));
    1.89 +                        $bh_header_offset += 4;
    1.90 +
    1.91 +                        $bh_data_array['access_time'] = getid3_lib::BigEndian2Int(substr($bh_header_data, $bh_header_offset, 4));
    1.92 +                        $bh_header_offset += 4;
    1.93 +
    1.94 +                        $getid3->info['szip']['BH'][] = $bh_data_array;
    1.95 +                    }
    1.96 +                    break;
    1.97 +
    1.98 +                default:
    1.99 +                    break 2;
   1.100 +            }
   1.101 +        }
   1.102 +
   1.103 +        return true;
   1.104 +    }
   1.105 +
   1.106 +}
   1.107 +
   1.108 +?>
   1.109 \ No newline at end of file