2009-08-06 08:44:35 +00:00
|
|
|
|
<?php
|
|
|
|
|
isset($_REQUEST['idObject'])? $idObject = $_REQUEST['idObject'] : $idObject = '';
|
|
|
|
|
if($idObject == ''){
|
|
|
|
|
print 'Param<61>tres incorrects';
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getMarques($idObject, $directory){
|
|
|
|
|
require_once 'common/curl.php';
|
|
|
|
|
$url = 'http://bases-marques.inpi.fr/Typo3_INPI_Marques/getPdf?idObjet='.$idObject.'_FMARK-1,FMARK-2';
|
|
|
|
|
$page = getUrl($url, '', '', '', false, '', '', 7);
|
|
|
|
|
$body = $page['body'];
|
|
|
|
|
//On test si il y a eu une erreur
|
|
|
|
|
if($page['code']==200){
|
|
|
|
|
$fp=@fopen($directory.'/'.$idObject.'.pdf', 'w');
|
|
|
|
|
@fwrite($fp, $body);
|
|
|
|
|
@fclose($fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Chemin de stockage de fichier
|
|
|
|
|
$directory = 'marques';
|
|
|
|
|
if(!is_dir(PATH_DATA.'/'.$directory)) mkdir(PATH_DATA.'/'.$directory);
|
|
|
|
|
$file = $idObject.'.pdf';
|
|
|
|
|
|
|
|
|
|
//Le fichier n'existe pas alors on le t<>l<EFBFBD>charge
|
|
|
|
|
if(!file_exists(PATH_DATA.'/'.$directory.'/'.$file)
|
2009-08-06 13:07:11 +00:00
|
|
|
|
|| filesize(PATH_DATA.'/'.$directory.'/'.$file)==0
|
|
|
|
|
|| date('Ymd', filemtime(PATH_DATA.'/'.$directory.'/'.$file))!=date('Ymd') )
|
2009-08-06 08:44:35 +00:00
|
|
|
|
getMarques($idObject, PATH_DATA.'/'.$directory);
|
|
|
|
|
|
|
|
|
|
//On affiche le fichier en v<>rifiant qu'il existe
|
|
|
|
|
if(file_exists(PATH_DATA.'/'.$directory.'/'.$file) && filesize(PATH_DATA.'/'.$directory.'/'.$file)>0)
|
|
|
|
|
{
|
|
|
|
|
//On affiche le fichier
|
2009-08-06 13:07:11 +00:00
|
|
|
|
header("Pragma: public");
|
|
|
|
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
|
|
|
|
//header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
|
|
|
|
header("Cache-Control: must-revalidate");
|
|
|
|
|
header("Content-type: application/pdf");
|
2009-08-06 08:44:35 +00:00
|
|
|
|
header("Content-Disposition: inline; filename=\"$file\"");
|
|
|
|
|
print file_get_contents(PATH_DATA.'/'.$directory.'/'.$file);
|
|
|
|
|
}else{
|
2009-08-06 13:00:26 +00:00
|
|
|
|
print 'Document introuvable.';
|
2009-08-06 08:44:35 +00:00
|
|
|
|
}
|