public static function zip_parse_file_header($data, $centralend, &$pos) {
        $file = unpack('Vsig/vversion/vversion_req/vgeneral/vmethod/Vmodified/Vcrc/Vsize_compressed/Vsize/vname_length/vextra_length/vcomment_length/vdisk/vattr/Vattrext/Vlocal_offset', substr($data, $pos, 46));
        $file['central_offset'] = $centralend['offset'] + $pos;
        $pos = $pos + 46;
        if ($file['sig'] !== 0x02014b50) {
            // Borked ZIP structure!
            return false;
        }
        $file['name'] = substr($data, $pos, $file['name_length']);
        $pos = $pos + $file['name_length'];
        $file['extra'] = array();
        $file['extra_data'] = '';
        if ($file['extra_length']) {
            $extradata = substr($data, $pos, $file['extra_length']);
            $file['extra_data'] = $extradata;
            while (strlen($extradata) > 4) {
                $extra = unpack('vid/vsize', substr($extradata, 0, 4));
                $extra['data'] = substr($extradata, 4, $extra['size']);
                $extradata = substr($extradata, 4+$extra['size']);
                $file['extra'][] = $extra;
            }
            $pos = $pos + $file['extra_length'];
        }
        if ($file['comment_length']) {
            $pos = $pos + $file['comment_length'];
            $file['comment'] = substr($data, $pos, $file['comment_length']);
        } else {
            $file['comment'] = '';
        }
        return $file;
    }
public static function zip_parse_file_header($data, $centralend, &$pos) {
        $file = unpack('Vsig/vversion/vversion_req/vgeneral/vmethod/Vmodified/Vcrc/Vsize_compressed/Vsize/vname_length/vextra_length/vcomment_length/vdisk/vattr/Vattrext/Vlocal_offset', substr($data, $pos, 46));
        $file['central_offset'] = $centralend['offset'] + $pos;
        $pos = $pos + 46;
        if ($file['sig'] !== 0x02014b50) {
            // Borked ZIP structure!
            return false;
        }
        $file['name'] = substr($data, $pos, $file['name_length']);
        $pos = $pos + $file['name_length'];
        $file['extra'] = array();
        $file['extra_data'] = '';
        if ($file['extra_length']) {
            $extradata = substr($data, $pos, $file['extra_length']);
            $file['extra_data'] = $extradata;
            while (strlen($extradata) > 4) {
                $extra = unpack('vid/vsize', substr($extradata, 0, 4));
                $extra['data'] = substr($extradata, 4, $extra['size']);
                $extradata = substr($extradata, 4+$extra['size']);
                $file['extra'][] = $extra;
            }
            $pos = $pos + $file['extra_length'];
        }
        if ($file['comment_length']) {
            $pos = $pos + $file['comment_length'];
            $file['comment'] = substr($data, $pos, $file['comment_length']);
        } else {
            $file['comment'] = '';
        }
        return $file;
    }
public static function zip_parse_file_header ( $ data , $ centralend , & $ pos ) { $ file = unpack ( 'Vsig/vversion/vversion_req/vgeneral/vmethod/Vmodified/Vcrc/Vsize_compressed/Vsize/vname_length/vextra_length/vcomment_length/vdisk/vattr/Vattrext/Vlocal_offset' , substr ( $ data , $ pos , 46 ) ) ; $ file [ 'central_offset' ] = $ centralend [ 'offset' ] + $ pos ; $ pos = $ pos + 46 ; if ( $ file [ 'sig' ] !== 0x02014b50 ) { // Borked ZIP structure! return false ; } $ file [ 'name' ] = substr ( $ data , $ pos , $ file [ 'name_length' ] ) ; $ pos = $ pos + $ file [ 'name_length' ] ; $ file [ 'extra' ] = array ( ) ; $ file [ 'extra_data' ] = '' ; if ( $ file [ 'extra_length' ] ) { $ extradata = substr ( $ data , $ pos , $ file [ 'extra_length' ] ) ; $ file [ 'extra_data' ] = $ extradata ; while ( strlen ( $ extradata ) > 4 ) { $ extra = unpack ( 'vid/vsize' , substr ( $ extradata , 0 , 4 ) ) ; $ extra [ 'data' ] = substr ( $ extradata , 4 , $ extra [ 'size' ] ) ; $ extradata = substr ( $ extradata , 4 + $ extra [ 'size' ] ) ; $ file [ 'extra' ] [ ] = $ extra ; } $ pos = $ pos + $ file [ 'extra_length' ] ; } if ( $ file [ 'comment_length' ] ) { $ pos = $ pos + $ file [ 'comment_length' ] ; $ file [ 'comment' ] = substr ( $ data , $ pos , $ file [ 'comment_length' ] ) ; } else { $ file [ 'comment' ] = '' ; } return $ file ; }
Parse file header.
@internal
@param string $data
@param array $centralend
@param int $pos (modified)
@return array|bool file info
Parse file header .