utilisation de la constante _DEBUG_AUTORISER (tirée de dd) pour que le curl de la gesénération des pdf ne bloque pas

This commit is contained in:
clem 2020-12-02 01:47:31 +01:00
parent 41fb092c06
commit 141aa1ae4f
2 changed files with 22 additions and 12 deletions

View file

@ -92,6 +92,7 @@ function formulaires_gamumail_verifier_dist($slug, $auteur = 0, $Tclient = [], $
return $erreurs;
}
function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $Tpdf = [], $redirect = '', $options = []) :Array{
include_spip('inc/texte');
@ -112,17 +113,9 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T
$cc = explode(',', $cc);
$cci = explode(',', $cci);
// les documents joints
$pieces_jointes = [];
if ($f = charger_fonction('traiter_av_pdf', 'gamumail', true)) {
$options = $f($options, $auteur, $Tclient, $Tpdf);
}
if ($f = charger_fonction($slug . '_traiter_av_pdf', 'gamumail', true)) {
$options = $f($options, $auteur, $Tclient, $Tpdf);
}
// les documents joints
if (!empty($Tid_doc)) {
foreach ($Tid_doc as $id_document) {
$Tdocument = sql_fetsel('titre,fichier,extension','spip_documents','id_document='.intval($id_document));
@ -144,6 +137,13 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T
}
// les pdfs
if ($f = charger_fonction('traiter_av_pdf', 'gamumail', true)) {
$options = $f($options, $auteur, $Tclient, $Tpdf);
}
if ($f = charger_fonction($slug . '_traiter_av_pdf', 'gamumail', true)) {
$options = $f($options, $auteur, $Tclient, $Tpdf);
}
$Tpdf_dell = [];
if (!empty($Tpdfs_ok) and is_array($Tpdfs_ok)) {
if (array_key_exists('fichier', $Tpdf)) {
@ -177,14 +177,16 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T
if(find_in_path('gamumail/html_header.html')){
$html_header = recuperer_fond('gamumail/html_header', $options);
} elseif (find_in_path($slug . '_html_header.html')) {
}
elseif (find_in_path($slug . '_html_header.html')) {
$html_header = recuperer_fond('gamumail/'.$slug . '_html_header', $options);
}
$html_footer = '';
if(find_in_path('gamumail/html_footer.html')){
$html_footer = recuperer_fond('gamumail/html_footer', $options);
}elseif (find_in_path($slug . '_html_footer.html')) {
}
elseif (find_in_path($slug . '_html_footer.html')) {
$html_footer = recuperer_fond('gamumail/'.$slug . '_html_footer', $options);
}
@ -205,6 +207,7 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T
$corps = $f($corps, $options, $slug, $auteur, $Tclient, $Tpdf, $redirect);
}
// envoi du mail
$envoyer_mail = charger_fonction('envoyer_mail', 'inc/');
$ok = $envoyer_mail($pour, $sujet, $corps);
if (!$ok) {

View file

@ -19,11 +19,18 @@ function inc_charger_pdf_dist($fichier_pdf, $contexte = []){
}
}
$CurlConnect = curl_init();
// pour une connexion https locale (certificat auto-signé)
if (defined('_DEBUG_AUTORISER')) {
curl_setopt($CurlConnect, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($CurlConnect, CURLOPT_SSL_VERIFYPEER, false);
}
curl_setopt($CurlConnect, CURLOPT_URL, $url);
curl_setopt($CurlConnect, CURLOPT_RETURNTRANSFER, 1 );
//curl_setopt($CurlConnect, CURLOPT_POSTFIELDS, $request);
curl_setopt($CurlConnect, CURLOPT_USERPWD, $login.':'.$password);
$retour = curl_exec($CurlConnect);
curl_close($CurlConnect);
return $retour;
}