Feat : passage de la récupération des PDFs à envoyer à la fonction dédiée de Gamufonctions
This commit is contained in:
parent
9797f06364
commit
f5c6c696a2
1 changed files with 3 additions and 33 deletions
|
@ -4,38 +4,8 @@ if (!defined('_ECRIRE_INC_VERSION')){
|
||||||
}
|
}
|
||||||
|
|
||||||
function inc_charger_pdf_dist($fichier_pdf, $context = [], $post = false){
|
function inc_charger_pdf_dist($fichier_pdf, $context = [], $post = false){
|
||||||
// $f = charger_fonction('generer_pdf','gamu');
|
|
||||||
// return $f($fichier_pdf, $contexte);
|
|
||||||
/*
|
|
||||||
* on remplace l'autentification par login / mdf
|
|
||||||
* via un alea, qui est le timestamp
|
|
||||||
* il doit etre inférieur à 2sec à la génération du pdf
|
|
||||||
*/
|
|
||||||
if ($post) {
|
|
||||||
$data = $context ?? [];
|
|
||||||
$context = [];
|
|
||||||
}
|
|
||||||
$context['spipdf'] = $fichier_pdf;
|
|
||||||
$context['alea'] = time();
|
|
||||||
$url = generer_url_public('spipdf', $context , true, false);
|
|
||||||
|
|
||||||
$CurlConnect = curl_init();
|
|
||||||
if (defined('_DEBUG_AUTORISER')) {
|
|
||||||
curl_setopt($CurlConnect, CURLOPT_SSL_VERIFYHOST, false);
|
|
||||||
curl_setopt($CurlConnect, CURLOPT_SSL_VERIFYPEER, false);
|
|
||||||
}
|
|
||||||
curl_setopt($CurlConnect, CURLOPT_URL, $url);
|
|
||||||
if ($post) {
|
|
||||||
curl_setopt($CurlConnect, CURLOPT_POST, true);
|
|
||||||
curl_setopt($CurlConnect, CURLOPT_POSTFIELDS, http_build_query($data));
|
|
||||||
}
|
|
||||||
curl_setopt($CurlConnect, CURLOPT_RETURNTRANSFER, 1 );
|
|
||||||
curl_setopt($CurlConnect, CURLOPT_SSL_VERIFYPEER, 0);
|
|
||||||
if( ! $retour = curl_exec($CurlConnect)) {
|
|
||||||
trigger_error(curl_error($CurlConnect));
|
|
||||||
}
|
|
||||||
|
|
||||||
curl_close($CurlConnect);
|
|
||||||
return $retour;
|
|
||||||
|
|
||||||
|
// appel de la fonction de génération des PDFs de Gamufonctions
|
||||||
|
$f = charger_fonction('generer_pdf','gamu');
|
||||||
|
return $f($fichier_pdf, $context, $post);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue