test pour cyrille
This commit is contained in:
parent
f2d5d05347
commit
d4405aa751
1 changed files with 35 additions and 3 deletions
|
@ -3,7 +3,39 @@ if (!defined('_ECRIRE_INC_VERSION')){
|
|||
return;
|
||||
}
|
||||
|
||||
function inc_charger_pdf_dist($fichier_pdf, $contexte = [], $args = []){
|
||||
$f = charger_fonction('generer_pdf','gamu');
|
||||
return $f($fichier_pdf, $contexte);
|
||||
function inc_charger_pdf_dist($fichier_pdf, $contexte = [], $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;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue