Compare commits

...
Sign in to create a new pull request.

2 commits

3 changed files with 28 additions and 17 deletions

View file

@ -128,16 +128,17 @@
<script src="[(#CHEMIN{js/jquery.caret.min.js}|timestamp)]" type="text/javascript"></script> <script src="[(#CHEMIN{js/jquery.caret.min.js}|timestamp)]" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
jQuery(function() { jQuery(function() {
gamumail(); gamumail();
//onAjaxLoad(gamumail); //onAjaxLoad(gamumail);
function gamumail(){ function gamumail(){
var navigateur = navigator.platform.toUpperCase().slice(0, 3);
if (navigateur !== "MAC") {
$(".tagEditor").tagEditor({ $(".tagEditor").tagEditor({
delimiter: ',; ' delimiter: ',; '
}); });
} }
}
}); });
</script> </script>

View file

@ -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) {

View file

@ -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;
} }