<?php /*-------------------------------------------------- | TAR/GZIP/ZIP ARCHIVE CLASSES | By Devin Doucette | Copyright (c) 2003 Devin Doucette | Email: darksnoopy@shaw.ca +-------------------------------------------------- | Email bugs/suggestions to darksnoopy@shaw.ca +-------------------------------------------------- | This script has been created and released under | the GNU GPL and is free to use and redistribute | only if this copyright statement is not removed +--------------------------------------------------*/ /*------------------------------------------------------------ | To create tar files: | $example = new tarfile($cwd,$flags); // args optional | -current working directory | -flags (array): | -overwrite - whether to overwrite existing files or return | an error message | -defaultperms - default file permissions (like chmod(), | must include 0 in front of value [eg. 0777, 0644]) | -recursesd[1,0] - whether or not to include subdirs | -storepath[1,0] - whether or not to store relative paths | -replacestats[array] - values to replace those from files | -mode - same as the result of a fileperms() call | -uid/gid - user/group id | -time - timestamp | -type - file type (5=dir,1=link,0=file) | -link - the file that is linked to | -path - only supported in USTAR, not recommended +------------------------------------------------------------*/ /*------------------------------------------------------------ | To create gzip files: | $example = new gzfile($cwd,$flags); // args optional | -current working directory | -flags (array): | -overwrite - whether to overwrite existing files or return | an error message | -defaultperms - default file permissions (like chmod(), | must include 0 in front of value [eg. 0777, 0644]) +------------------------------------------------------------*/ /*------------------------------------------------------------ | To create zip files: | $example = new zipfile($cwd,$flags); // args optional | -current working directory | -flags (array): | -overwrite - whether to overwrite existing files or return | an error message | -defaultperms - default file permissions (like chmod(), | must include 0 in front of value [eg. 0777, 0644]) | -time - timestamp to use to replace the mtime from files | -recursesd[1,0] - whether or not to include subdirs | -storepath[1,0] - whether or not to store relative paths | -level[0-9] - compression level (0 = none, 9 = max) | -comment - comment to add to the archive +------------------------------------------------------------*/ /*------------------------------------------------------------ | To add files: | $example->addfile($data,$filename,$flags); | -data - file contents | -filename - name of file to be put in archive | -flags (all flags are optional) | -flags (tar) [array]: -same flags as tarfile() | -flags (gzip) [string]: -comment to add to archive | -flags (zip) [array] -time - last modification time | | $example->addfiles($filelist); // tar and zip only | -filelist - array of file names relative to CWD | | $example->adddirectories($dirlist); // tar and zip only | -dirlist - array of directory names relative to CWD +------------------------------------------------------------*/ /*------------------------------------------------------------ | To output files: | $example->getdata(); | -returns file contents | | $example->filedownload($filename); | -filename - the name to give the file that is being sent | | $example->filewrite($filename,$perms); // perms optional | -filename - the name (including path) of the file to write | -perms - permissions to give the file after it is written +------------------------------------------------------------*/ /*------------------------------------------------------------ | To extract files (tar and gzip) | $example->extract($data); | -data - data to extract files from | -returns an array containing file attributes and contents | | $example->extractfile($filename); | -filename - the name (including path) of the file to use | -returns an array containing file attributes and contents | | Both functions will return a string containing any errors +------------------------------------------------------------*/ ?>
----------
Po co tyle kodu -- forum sie rozsypuje.
Daj linka do klasy, a jeszcze lepiej przeczytaj to co jest w komentarzach tej klasy.
--
dr_bonzo