Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> klasa ZIP TAR/GZIP/ZIP ARCHIVE CLASSES
ozzy88
post 26.03.2006, 23:03:11
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 26.03.2006

Ostrzeżenie: (0%)
-----


Witam, dopadłem na necie klase do pakowania i wypakowywania plików ZIP ale niewiem jak ją obsługiwać... może ktoś coś podpowiedzieć??

  1. <?php
  2. /*--------------------------------------------------
  3.  | TAR/GZIP/ZIP ARCHIVE CLASSES
  4.  | By Devin Doucette
  5.  | Copyright (c) 2003 Devin Doucette
  6.  | Email: darksnoopy@shaw.ca
  7.  +--------------------------------------------------
  8.  | Email bugs/suggestions to darksnoopy@shaw.ca
  9.  +--------------------------------------------------
  10.  | This script has been created and released under
  11.  | the GNU GPL and is free to use and redistribute
  12.  | only if this copyright statement is not removed
  13.  +--------------------------------------------------*/
  14.  
  15. /*------------------------------------------------------------
  16.  | To create tar files:
  17.  | $example = new tarfile($cwd,$flags); // args optional
  18.  | -current working directory
  19.  | -flags (array):
  20.  | -overwrite - whether to overwrite existing files or return
  21.  | an error message
  22.  | -defaultperms - default file permissions (like chmod(),
  23.  | must include 0 in front of value [eg. 0777, 0644])
  24.  | -recursesd[1,0] - whether or not to include subdirs
  25.  | -storepath[1,0] - whether or not to store relative paths
  26.  | -replacestats[array] - values to replace those from files
  27.  |  -mode - same as the result of a fileperms() call
  28.  |  -uid/gid - user/group id
  29.  |  -time - timestamp
  30.  |  -type - file type (5=dir,1=link,0=file)
  31.  |  -link - the file that is linked to
  32.  |  -path - only supported in USTAR, not recommended
  33.  +------------------------------------------------------------*/
  34.  
  35. /*------------------------------------------------------------
  36.  | To create gzip files:
  37.  | $example = new gzfile($cwd,$flags); // args optional
  38.  | -current working directory
  39.  | -flags (array):
  40.  | -overwrite - whether to overwrite existing files or return
  41.  | an error message
  42.  | -defaultperms - default file permissions (like chmod(),
  43.  | must include 0 in front of value [eg. 0777, 0644])
  44.  +------------------------------------------------------------*/
  45.  
  46. /*------------------------------------------------------------
  47.  | To create zip files:
  48.  | $example = new zipfile($cwd,$flags); // args optional
  49.  | -current working directory
  50.  | -flags (array):
  51.  | -overwrite - whether to overwrite existing files or return
  52.  | an error message
  53.  | -defaultperms - default file permissions (like chmod(),
  54.  | must include 0 in front of value [eg. 0777, 0644])
  55.  | -time - timestamp to use to replace the mtime from files
  56.  | -recursesd[1,0] - whether or not to include subdirs
  57.  | -storepath[1,0] - whether or not to store relative paths
  58.  | -level[0-9] - compression level (0 = none, 9 = max)
  59.  | -comment - comment to add to the archive
  60.  +------------------------------------------------------------*/
  61.  
  62. /*------------------------------------------------------------
  63.  | To add files:
  64.  | $example->addfile($data,$filename,$flags);
  65.  | -data - file contents
  66.  | -filename - name of file to be put in archive
  67.  | -flags (all flags are optional)
  68.  | -flags (tar) [array]: -same flags as tarfile()
  69.  | -flags (gzip) [string]: -comment to add to archive
  70.  | -flags (zip) [array] -time - last modification time
  71.  |
  72.  | $example->addfiles($filelist); // tar and zip only
  73.  | -filelist - array of file names relative to CWD
  74.  |
  75.  | $example->adddirectories($dirlist); // tar and zip only
  76.  | -dirlist - array of directory names relative to CWD
  77.  +------------------------------------------------------------*/
  78.  
  79. /*------------------------------------------------------------
  80.  | To output files:
  81.  | $example->getdata();
  82.  | -returns file contents
  83.  |
  84.  | $example->filedownload($filename);
  85.  | -filename - the name to give the file that is being sent
  86.  |
  87.  | $example->filewrite($filename,$perms); // perms optional
  88.  | -filename - the name (including path) of the file to write
  89.  | -perms - permissions to give the file after it is written
  90.  +------------------------------------------------------------*/
  91.  
  92. /*------------------------------------------------------------
  93.  | To extract files (tar and gzip)
  94.  | $example->extract($data);
  95.  | -data - data to extract files from
  96.  | -returns an array containing file attributes and contents
  97.  |
  98.  | $example->extractfile($filename);
  99.  | -filename - the name (including path) of the file to use
  100.  | -returns an array containing file attributes and contents
  101.  |
  102.  | Both functions will return a string containing any errors
  103.  +------------------------------------------------------------*/
  104. ?>


----------
Po co tyle kodu -- forum sie rozsypuje.
Daj linka do klasy, a jeszcze lepiej przeczytaj to co jest w komentarzach tej klasy.
--
dr_bonzo
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 24.07.2025 - 15:34