Subversion Repositories Applications.projet

Compare Revisions

Ignore whitespace Rev 245 → Rev 246

/branches/livraison_narmer/services/telechargement.php
19,7 → 19,7
// | 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: telechargement.php,v 1.1.2.1 2007-05-11 13:58:45 alexandre_tb Exp $
// CVS : $Id: telechargement.php,v 1.1.2.2 2007-06-04 15:42:49 alexandre_tb Exp $
/**
* Application projet
*
31,7 → 31,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1.2.1 $
*@version $Revision: 1.1.2.2 $
// +------------------------------------------------------------------------------------------------------+
*/
 
40,26 → 40,33
// +------------------------------------------------------------------------------------------------------+
 
 
if ($this->_id_document == '') {
return 'aucun fichier demandé';
if (is_object ($this) && $this->_id_document == '') {
return 'aucun fichier demandé';
} else {
if (!is_object($this) && isset ($_GET['id_document'])) {
$id_document = $_GET['id_document'];
}
}
 
if (is_object ($this)) {
$id_document = $this->_id_document;
}
 
include_once PROJET_CHEMIN_CLASSES.'projet.class.php';
include_once PROJET_CHEMIN_CLASSES.'document.class.php';
 
$projet = new projet ($this->_id_projet);
$document = new document ($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
 
$document = new document ($id_document, $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
$projet = new projet ($document->_id_projet);
// Soit le document est public et on le renvoie, soit il est prive
// et on teste les droits
 
if ($document->getVisibilite() == 'prive') {
// On teste le login
if ($this->_auth->getAuth()) {
if ($GLOBALS['projet_auth']->getAuth()) {
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
$id_utilisateur = $this->_auth->getAuthData(PROJET_CHAMPS_ID);
$participant = new participe($this->_db) ;
$id_utilisateur = $GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID);
$participant = new participe($GLOBALS['projet_db']) ;
if ($participant->isAdministrateur($id_utilisateur) || $participant->isCoordinateur($id_utilisateur)
|| $participant->isContributeur($id_utilisateur)) {
$ok = true ;
78,10 → 85,12
 
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: '.$document->getTypeMime()."\r\n") ;
header('Content-Length: '.$document->getTaille().";\r\n");
header ('Content-Disposition: attachment; filename="'.$document->getNomLong().'.'.$extension.'"'."\r\n");
header('Cache-Control: Public, must-revalidate');// HTTP/1.1
header('Pragma: hack');
header ('Content-Type: '.$document->getTypeMime()) ;
header('Content-Length: '.(string) $document->getTaille());
header ('Content-Disposition: attachment; filename="'.$document->getNomLong().'.'.$extension.'"');
header("Content-Transfer-Encoding: binary\n");
 
readfile (PROJET_CHEMIN_FICHIER.$document->getChemin());