Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/clients/a38b86744e455b1f2e763fe46170a4c9/web/jebulle.net/sources/classes/geshi.php on line 2013
.: Codulle : Source de panierdefichiers0.1.class.php :.

Codulle - L'explorateur de code sources

Accueil>> Rootulle

Informations fichier

Nom du fichier : panierdefichiers0.1.class.php
Taille du fichier : 6 Ko (248 lignes)
Language : PHP

  1. <?php
  2.  
  3. ///////////////////////////////
  4. // INFORMATIONS
  5. ///////////////////////////////
  6. //
  7. // Encodage du fichier : UTF-8
  8. // Utilisation des tabulations : Oui
  9. // 1 Tabulation = 4 caractères
  10. //
  11. ///////////////////////////////
  12. // LICENCE
  13. ///////////////////////////////
  14. //
  15. // © DUCARRE Cedric, Bubulles Creations, (09/05/2005)
  16. //
  17. // webmaster@jebulle.net
  18. // http://jebulle.net
  19. //
  20. // Ce logiciel est un programme servant à gérer un panier de fichiers pour
  21. // sites internet.
  22. //
  23. // Ce logiciel est régi par la licence CeCILL soumise au droit français et
  24. // respectant les principes de diffusion des logiciels libres. Vous pouvez
  25. // utiliser, modifier et/ou redistribuer ce programme sous les conditions
  26. // de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
  27. // sur le site "http://www.cecill.info".
  28. //
  29. // En contrepartie de l'accessibilité au code source et des droits de copie,
  30. // de modification et de redistribution accordés par cette licence, il n'est
  31. // offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
  32. // seule une responsabilité restreinte pèse sur l'auteur du programme, le
  33. // titulaire des droits patrimoniaux et les concédants successifs.
  34. //
  35. // A cet égard l'attention de l'utilisateur est attirée sur les risques
  36. // associés au chargement, à l'utilisation, à la modification et/ou au
  37. // développement et à la reproduction du logiciel par l'utilisateur étant
  38. // donné sa spécificité de logiciel libre, qui peut le rendre complexe à
  39. // manipuler et qui le réserve donc à des développeurs et des professionnels
  40. // avertis possédant des connaissances informatiques approfondies. Les
  41. // utilisateurs sont donc invités à charger et tester l'adéquation du
  42. // logiciel à leurs besoins dans des conditions permettant d'assurer la
  43. // sécurité de leurs systèmes et ou de leurs données et, plus généralement,
  44. // à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
  45. //
  46. // Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
  47. // pris connaissance de la licence CeCILL, et que vous en avez accepté les
  48. // termes.
  49. //
  50. ///////////////////////////////
  51.  
  52. /**
  53. * Classe de gestion de panier de fichiers.
  54. *
  55. * Permet d'ajouter des fichiers à un panier virtuel et de créer une archive
  56. * télechargeable de ces fichiers.
  57. *
  58. * @author SamRay1024
  59. * @copyright Bubulles Creation - http://jebulle.net
  60. * @since 09/05/2005
  61. * @version 0.1
  62. *
  63. */
  64.  
  65. // nom de la variable du panier dans la session
  66. define( 'NOM_PANIER_SESSION', 'EX_PANIER_FICHIERS' );
  67.  
  68. // chemin d'accès à la librairie de compression
  69. define( 'COMPRESS_LIB', 'pclzip.lib.php' );
  70.  
  71. class PanierDeFichiers {
  72. /**
  73. * Constructeur de la classe.
  74. *
  75. * @param [VOID]
  76. * @return [VOID]
  77. */
  78. function __construct()
  79. {
  80. // verification que le module de compression est actif sur le serveur
  81. if( !extension_loaded( 'zlib' ) )
  82. die( '<strong>[ Erreur fatale ]</strong> L\'extension \'zlib\' n\'est pas charg&eacute;e. Impossible d\'utiliser le panier sans elle.');
  83. // s'il n'y a pas de session démarrée, il faut la créer
  84. if( session_id() === '' )
  85. // creation du panier s'il n'existe pas déjà
  86. if( !isset( $_SESSION[NOM_PANIER_SESSION] ) )
  87. $_SESSION[NOM_PANIER_SESSION] = array();
  88. }
  89. /**
  90. * Ajoute un fichier au panier que s'il n'y est pas déjà.
  91. * La recherche si le fichier se trouve déjà dans le panier s'effectue
  92. * avec le chemin complet du fichier (autorise alors deux noms de fichiers
  93. * identiques mais dans des dossiers différents).
  94. *
  95. * @param [STRING] $sCheminFichier Chemin du fichier.
  96. * @return [BOOLEAN] TRUE si le fichier a été ajouté, FALSE sinon.
  97. */
  98. function Ajouter( $sCheminFichier )
  99. {
  100. // ajout du fichier s'il n'y est pas déjà
  101. if( array_search( $sCheminFichier, $_SESSION[NOM_PANIER_SESSION] ) === false )
  102. {
  103. $_SESSION[NOM_PANIER_SESSION][] = $sCheminFichier;
  104. return true;
  105. }
  106. return false;
  107. }
  108. /**
  109. * Supprime le fichier spécifié du panier.
  110. *
  111. * @param [STRING] $sCheminFichier Chemin du fichier à supprimer. (Idem méthode d'ajout)
  112. * @return [BOOLEAN] TRUE si le fichier a été supprimé, FALSE sinon.
  113. */
  114. function Supprimer( $sCheminFichier )
  115. {
  116. // si l'image se trouve bien dans le panier on la supprime
  117. if( ( $iPosition = array_search( $sCheminFichier, $_SESSION[NOM_PANIER_SESSION] ) ) !== false )
  118. {
  119. unset( $_SESSION[NOM_PANIER_SESSION][$iPosition] );
  120. return true;
  121. }
  122. return false;
  123. }
  124. /**
  125. * Vide le panier.
  126. *
  127. * @param [VOID]
  128. * @return [VOID]
  129. */
  130. function ViderPanier()
  131. {
  132. $_SESSION[NOM_PANIER_SESSION] = array();
  133. }
  134. /**
  135. * Création de l'archive qui contient les fichiers du panier.
  136. * Par défaut, l'archive est écrite sur le disque puis chargée en mémoire et enfin supprimée.
  137. * L'archive chargée en mémoire est alors envoyée au navigateur client pour le télechargement.
  138. *
  139. * @param [STRING] $sNomFichier Nom à donner à l'archive.
  140. * @param [BOOLEAN] $bEcrireSeulement Si TRUE, l'archive n'est pas effacée du disque et n'est pas envoyée au navigateur.
  141. * @return [VOID]
  142. */
  143. function CreerArchive( $sNomFichier, $bEcrireSeulement = false )
  144. {
  145.  
  146. $sFichierZip = $sNomFichier.'.zip';
  147. // inclusion de la librairie de compression zip
  148. require_once( COMPRESS_LIB );
  149. // creation de l'objet du fichier zip
  150. $oZip = new PclZip( $sFichierZip );
  151. // ajout des fichiers au zip et ecriture sur le disque
  152. if( $oZip->create( $_SESSION[NOM_PANIER_SESSION] ) == 0 )
  153. die( "Erreur : ".$oZip->errorInfo(true) );
  154. // destruction objet zip
  155. unset( $oZip );
  156. if( $bEcrireSeulement === false )
  157. {
  158. // lecture binaire de l'archive
  159. $fpHandle = fopen( $sFichierZip, 'rb' );
  160. $sArchive = fread( $fpHandle, filesize( $sFichierZip ) );
  161. fclose( $fpHandle );
  162. // suppression de l'archive
  163. unlink( $sFichierZip );
  164. // chargement des entetes HTTP pour l'envoi de l'archive
  165. header("Content-type: application/octet-stream");
  166. header("Content-disposition: attachment; filename=$sNomFichier.zip");
  167. // envoi au navigateur
  168. echo $sArchive;
  169. }
  170. }
  171. /**
  172. * Compte le nombre de fichiers dans le panier.
  173. *
  174. * @param [VOID]
  175. * @return [INTEGER] Retourne le nombre de fichiers dans le panier.
  176. */
  177. function CompterFichiers()
  178. {
  179. return sizeof( $_SESSION[NOM_PANIER_SESSION] );
  180. }
  181. /**
  182. * Vérifie l'existence d'un fichier dans le panier.
  183. *
  184. * @param [STRING] $sCheminFichier Chemin du fichier à vérifier.
  185. * @return [BOOLEAN] TRUE si le fichier est dans le panier, FALSE sinon.
  186. */
  187. function EstDansLePanier( $sCheminFichier )
  188. {
  189. if( array_search( $sCheminFichier, $_SESSION[NOM_PANIER_SESSION] ) !== false )
  190. return true;
  191. else
  192. return false;
  193. }
  194. /**
  195. * Affiche le contenu du panier.
  196. * Fonction utile uniquement pour du déboguage.
  197. *
  198. * @param [VOID]
  199. * @return [VOID]
  200. */
  201. function EtatPanier()
  202. {
  203. echo '<pre>';
  204. print_r( $_SESSION[NOM_PANIER_SESSION] );
  205. echo '</pre>';
  206. }
  207. }
  208.  
  209. ?>

Liste des projets

Téléchargez Codulle

Publié par Codulle - v0.1.1 - © Bubulles Creations