vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   [REQ] view zip file contents hack (https://vborg.vbsupport.ru/showthread.php?t=77368)

Joe Pimms 03-02-2005 09:41 PM

[REQ] view zip file contents hack
 
1 Attachment(s)
what i need is a viewer that will show all the contents in a .zip file,
so when a user clicks to see whats in the file ( .zip file ) it will list all the contents of it...

look at the pictures

here is a little info HERE or you can look at this script HERE this script let people view a zip file contents as a pop-up window.. This script is called PHPATM = PHP Advanced Transfer Manager witch is a download manager it would also be awsome if some one would intergrade this script into vbulletin ( 3.0.7 ) this hack would be displayed in the " postbit_attachment " template
and useing a collapse image.. so please help me on this as i do think this would be a great hack for those people that have sites with attachments on there sites

the pic's posted here were made as an example of what i would like to have

WhSox21 03-03-2005 05:04 AM

I might still have some code laying around here from MyImgs.com when I programed that feature for that site. Do you have the ziplib installed on your server? An alternative way to do what you want would be to unzip the file into a directory and read the files in that directory. I'll do my best to help but I'm pretty busy now with the HelpDesk and just life in general. Hopefully I'll get to this eventually.

Joe Pimms 03-03-2005 08:19 PM

hey host dose have ziplib and many others so it will work cause i used phpatm on my server to see if the zip viewer work and it did nicely

Joe Pimms 03-05-2005 03:33 PM

so can any one please help on this hack ?

Joe Pimms 03-07-2005 10:39 PM

can any one please please help me

why-not 03-08-2005 12:27 AM

Quote:

Originally Posted by Joe Pimms
can any one please please help me


PHP Code:

<?

// the location of the zip file and its name

/* windows use full path, ie: c:/www/docs/www/docs/test.zip */

$path_file = './http_docs/files/test.zip';

// type to return ( 0 = files array(), 1 = path and files array )

$type = 0;

// usage

$zip = zip_reader ( $path_file, $type );

// dump the results

print_r ( $zip );

function zip_reader ( $file )
{
    $ds = array ();
    $io = zip_open ( $file );

    if ( $io )
    {
        while ( $handle = zip_read ( $io ) )
        {
            $ft = is_zip_dir ( zip_entry_name ( $handle ) );

            if ( $ft[0] )
            {
                if ( $type )
                {
                    $ds[$ft[1]][] = array ( $ft[2], real_size ( zip_entry_filesize ( $handle ) ), real_size ( zip_entry_compressedsize( $handle ) ) );
                }
                else
                {
                    $ds[] = array ( $ft[2], real_size ( zip_entry_filesize ( $handle ) ), real_size ( zip_entry_compressedsize( $handle ) ) );
                }
            }
        }

        zip_close ( $io );
    }

    return ( $ds );
}

function is_zip_dir ( $in )
{
    $out = array ();
    $in = trim ( substr ( $in, strpos ( $in, chr ( 47 ) ) ) );
    $test = substr ( $in, strrpos ( $in, chr ( 47 ) ) + 1 );

    if ( ! empty ( $test ) )
    {
        $out[] = true;
        $out[] = substr ( $in, 0, strrpos ( $in, chr ( 47 ) ) + 1 );
        $out[] = $test;
    }
    else
    {
        $out[] = false;
        $out[] = $in;
        $out[] = '';
    }

    return ( $out );
}


function real_size ( $t )
{
    $out = 0;
    $math = pow ( 10, 2 );

       if ( $t < 1024 )
    {
        $out = $t . ' bytes';
    }
       else if ( $t < 1048576 )
    {
        $out = ( floor( ( $t / 1024 ) * $math ) / $math ) . ' KB';
    }
       else if ( $t < 1073741824 )
    {
        $out = ( floor( ( $t / 1048576 ) * $math ) / $math ) . ' MB';
    }

    return ( $out );
}

?>


C, ya...

Sonia

Joe Pimms 03-08-2005 02:30 AM

thanks for this but how do i use it there is no template edit like the pic i poted so how would this work ?i need it to be able to list a attachment id to open u have it saying to open test.zip

Arial 03-08-2005 08:57 AM

Sonia? Please check your PM
Thank you.

Joe Pimms 03-11-2005 05:17 AM

hey can you explain how this is to work for me please where i need it to be able to look more like or work more like the image i had made to show this hack ?


All times are GMT. The time now is 03:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01026 seconds
  • Memory Usage 1,743KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete