Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: fichier_attache.php,v 1.1 2006-04-19 13:51:57 alexandre_tb Exp $
/**
* Application projet
*
* Fichier pour afficher les pièces jointes
*
*@package projet
//Auteur original :
*@author Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// A faire
include_once 'configuration/projet.config.inc.php' ;
include_once ('classes/ezmlmAccessObject.class.php') ;
include_once 'Mail/mimeDecode.php' ;
$num_rep = array_shift ($actionargs) ;
$num_message = array_shift($actionargs) ;
$xml_parser = &new ezmlmAccessObject('message', PROJET_DOMAINE_LISTE,
$nom_liste, $GLOBALS['lang']) ;
$xml_parser->setIdMessage($num_rep, $num_message) ;
$xml_parser->load();
ob_start ();
$xml_parser->parse() ;
$mail = ob_get_contents() ;
ob_end_clean();
/*
$mail = file_get_contents (PROJET_CHEMIN_LISTES.PROJET_DOMAINE_LISTE.'/'.$nom_liste.'/'.'archive/'.$num_rep.'/'.$num_message) ;
*/
$decodeur = new Mail_mimeDecode($mail) ;
$mailDecode = $decodeur->decode(array ('decode_bodies' => 'true', 'include_bodies' => 'true')) ;
//var_dump ($mailDecode) ;
function getParts(&$part, $num_part) {
$part = $part->parts[$num_part] ;
return $part ;
}
for ($i = 0; $i < count ($actionargs); $i++) {
$part = getParts($mailDecode, $actionargs[$i]) ;
}
$content_type = $part->ctype_primary.'/'.$part->ctype_secondary ;
// Certain fichiers attaché n'ont pas de ctype_primary et ctype_secondary
if ($content_type == '/') {
$content_type = $part->content_type;
}
$nom_du_fichier = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : $part->ctype_parameters['name'] ;
//echo $content_type ;
header('Expires: Wen, 01 Dec 1999 01:00:00 GMT');// Date du passé
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');// toujours modifié
header('Cache-Control: Public');// HTTP/1.1
header ('Content-Type: '.$content_type."\r\n") ;
header("Content-Length: ".strlen($part->body).";\r\n");
header ('Content-Disposition: attachment; filename="'.$nom_du_fichier.'"'."\r\n");
header('Content-Transfer-Encoding: '.$part->content-transfer-encoding);
echo $part->body ;
exit(0) ;
?>