//Autres auteurs : *@author Aucun *@copyright Tela-Botanica 2000-2004 *@version $Revision: 1.4 $ // +------------------------------------------------------------------------------------------------------+ */ // +------------------------------------------------------------------------------------------------------+ // | ENTETE du PROGRAMME | // +------------------------------------------------------------------------------------------------------+ 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'; $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 ($GLOBALS['projet_auth']->getAuth()) { include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ; $id_utilisateur = $GLOBALS['projet_auth']->getAuthData(PROJET_CHAMPS_ID); $participant = new participe($GLOBALS['projet_db']) ; if ($participant->isAdministrateur($id_utilisateur) || $participant->isCoordinateur($id_utilisateur, $document->_id_projet) || $participant->isContributeur($id_utilisateur, $document->_id_projet)) { $ok = true ; } else { $ok = false ; return '

'.$projet->getTitre($document->_id_projet).'

'. '

Vous devez participer à ce projet pour accéder à ce document

'; } } else { return '

'.$projet->getTitre($document->_id_projet).'

'. '

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 passe header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');// toujours modifie 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()); exit(); ?>