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 2007-04-19 09:37:50 alexandre_tb Exp $ |
// CVS : $Id: telechargement.php,v 1.1.2.1 2007-05-11 13:58:45 alexandre_tb Exp $ |
/** |
* Application projet |
* |
31,7 → 31,7 |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.1 $ |
*@version $Revision: 1.1.2.1 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
40,6 → 40,52 |
// +------------------------------------------------------------------------------------------------------+ |
|
|
if ($this->_id_document == '') { |
return 'aucun fichier demandé'; |
} |
|
|
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) ; |
|
// 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()) { |
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ; |
$id_utilisateur = $this->_auth->getAuthData(PROJET_CHAMPS_ID); |
$participant = new participe($this->_db) ; |
if ($participant->isAdministrateur($id_utilisateur) || $participant->isCoordinateur($id_utilisateur) |
|| $participant->isContributeur($id_utilisateur)) { |
$ok = true ; |
} else { |
$ok = false ; |
return 'Vous devez participer à ce projet pour accéder à ce document'; |
} |
} |
} else { |
$ok = true ; |
} |
|
// Recherche de l extension |
$nom_de_fichier = pathinfo ($projet->getNomRepertoire().'/'.$document->getChemin()) ; |
$extension = $nom_de_fichier['extension']; |
|
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"); |
|
readfile (PROJET_CHEMIN_FICHIER.$document->getChemin()); |
|
exit(); |
|
|
?> |