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:
parent
41fb092c06
commit
141aa1ae4f
2 changed files with 22 additions and 12 deletions
|
@ -92,6 +92,7 @@ function formulaires_gamumail_verifier_dist($slug, $auteur = 0, $Tclient = [], $
|
||||||
return $erreurs;
|
return $erreurs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $Tpdf = [], $redirect = '', $options = []) :Array{
|
function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $Tpdf = [], $redirect = '', $options = []) :Array{
|
||||||
|
|
||||||
include_spip('inc/texte');
|
include_spip('inc/texte');
|
||||||
|
@ -112,17 +113,9 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T
|
||||||
$cc = explode(',', $cc);
|
$cc = explode(',', $cc);
|
||||||
$cci = explode(',', $cci);
|
$cci = explode(',', $cci);
|
||||||
|
|
||||||
|
// les documents joints
|
||||||
$pieces_jointes = [];
|
$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)) {
|
if (!empty($Tid_doc)) {
|
||||||
foreach ($Tid_doc as $id_document) {
|
foreach ($Tid_doc as $id_document) {
|
||||||
$Tdocument = sql_fetsel('titre,fichier,extension','spip_documents','id_document='.intval($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
|
// 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 = [];
|
$Tpdf_dell = [];
|
||||||
if (!empty($Tpdfs_ok) and is_array($Tpdfs_ok)) {
|
if (!empty($Tpdfs_ok) and is_array($Tpdfs_ok)) {
|
||||||
if (array_key_exists('fichier', $Tpdf)) {
|
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')){
|
if(find_in_path('gamumail/html_header.html')){
|
||||||
$html_header = recuperer_fond('gamumail/html_header', $options);
|
$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_header = recuperer_fond('gamumail/'.$slug . '_html_header', $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
$html_footer = '';
|
$html_footer = '';
|
||||||
if(find_in_path('gamumail/html_footer.html')){
|
if(find_in_path('gamumail/html_footer.html')){
|
||||||
$html_footer = recuperer_fond('gamumail/html_footer', $options);
|
$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);
|
$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);
|
$corps = $f($corps, $options, $slug, $auteur, $Tclient, $Tpdf, $redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// envoi du mail
|
||||||
$envoyer_mail = charger_fonction('envoyer_mail', 'inc/');
|
$envoyer_mail = charger_fonction('envoyer_mail', 'inc/');
|
||||||
$ok = $envoyer_mail($pour, $sujet, $corps);
|
$ok = $envoyer_mail($pour, $sujet, $corps);
|
||||||
if (!$ok) {
|
if (!$ok) {
|
||||||
|
|
|
@ -19,11 +19,18 @@ function inc_charger_pdf_dist($fichier_pdf, $contexte = []){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$CurlConnect = curl_init();
|
$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_URL, $url);
|
||||||
curl_setopt($CurlConnect, CURLOPT_RETURNTRANSFER, 1 );
|
curl_setopt($CurlConnect, CURLOPT_RETURNTRANSFER, 1 );
|
||||||
//curl_setopt($CurlConnect, CURLOPT_POSTFIELDS, $request);
|
//curl_setopt($CurlConnect, CURLOPT_POSTFIELDS, $request);
|
||||||
curl_setopt($CurlConnect, CURLOPT_USERPWD, $login.':'.$password);
|
curl_setopt($CurlConnect, CURLOPT_USERPWD, $login.':'.$password);
|
||||||
$retour = curl_exec($CurlConnect);
|
$retour = curl_exec($CurlConnect);
|
||||||
curl_close($CurlConnect);
|
curl_close($CurlConnect);
|
||||||
|
|
||||||
return $retour;
|
return $retour;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue