1 | <?php |
---|
2 | |
---|
3 | /* |
---|
4 | * Abomailmans |
---|
5 | * MaZiaR - NetAktiv |
---|
6 | * tech@netaktiv.com |
---|
7 | * Printemps 2007 |
---|
8 | * Inspire de Spip-Listes |
---|
9 | */ |
---|
10 | |
---|
11 | if (!defined("_ECRIRE_INC_VERSION")) return; |
---|
12 | |
---|
13 | include_spip('inc/presentation'); |
---|
14 | include_spip('inc/distant'); |
---|
15 | include_spip('inc/affichage'); |
---|
16 | include_spip('inc/meta'); |
---|
17 | include_spip('inc/filtres'); |
---|
18 | include_spip('inc/lang'); |
---|
19 | include_spip ("inc/abomailmans"); |
---|
20 | |
---|
21 | function exec_abomailmans_affiche_template(){ |
---|
22 | |
---|
23 | $template = _request('template'); |
---|
24 | $sujet = _request('sujet'); |
---|
25 | $message = _request('message'); |
---|
26 | $Confirmer = _request('Confirmer'); |
---|
27 | $date = _request('date'); |
---|
28 | $id_rubrique = _request('id_rubrique'); |
---|
29 | $id_mot = _request('id_mot'); |
---|
30 | $charset = lire_meta('charset'); |
---|
31 | |
---|
32 | /* echo "<pre>"; |
---|
33 | print_r($GLOBALS); |
---|
34 | echo "</pre>";*/ |
---|
35 | include_spip('public/assembler'); |
---|
36 | $contexte_template = array('date' => trim ($date), |
---|
37 | 'id_rubrique' => $id_rubrique, |
---|
38 | 'id_mot' => $id_mot, |
---|
39 | 'template'=>$template, |
---|
40 | 'lang'=>$lang, |
---|
41 | 'sujet'=>$sujet, |
---|
42 | 'message'=>$message ); |
---|
43 | |
---|
44 | $texte_template = recuperer_fond('templates/'.$template, $contexte_template); |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; |
---|
49 | echo "<html lang='$lang' dir='ltr'>"; |
---|
50 | echo "<head><meta http_equiv='Content-Type' content='text/html; charset=".$charset."'>\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\n |
---|
51 | <script src=\"spip.php?page=jquery.js\" type=\"text/javascript\"></script>\n |
---|
52 | <script type=\"text/javascript\"> |
---|
53 | $('#Confimrer').click(function(){ |
---|
54 | $('#Confimrer').hide(); |
---|
55 | }); |
---|
56 | $('#confirmation').submit(function(){ |
---|
57 | var data = $('input,textarea,radio,select, checkbox', this).serialize(); |
---|
58 | $.ajax({ type: 'POST', |
---|
59 | url: '/ecrire/?exec=abomailmans_affiche_template', |
---|
60 | data: data, |
---|
61 | success: function(msg){ $('#envoyer').html(msg); } |
---|
62 | }); |
---|
63 | $('#apercu').hide(); |
---|
64 | return false; |
---|
65 | |
---|
66 | }); |
---|
67 | </script>\n |
---|
68 | |
---|
69 | </head><body>\n"; |
---|
70 | |
---|
71 | // si confirmation |
---|
72 | if ($Confirmer) { |
---|
73 | $email_liste = _request('email_liste'); |
---|
74 | $nomsite=lire_meta("nom_site"); |
---|
75 | $email_webmaster = lire_meta("email_webmaster"); |
---|
76 | |
---|
77 | if (abomailman_mail ($nomsite, $email_webmaster, "", $email_liste, $sujet, $texte_template, true, $charset)) { |
---|
78 | echo "E-mail envoyé à la liste de diffusion : ".$email_liste; |
---|
79 | } |
---|
80 | } |
---|
81 | else { |
---|
82 | |
---|
83 | echo "<form action=\"/ecrire/?exec=abomailmans_affiche_template\" method=\"post\" id=\"confirmation\">"; |
---|
84 | |
---|
85 | echo "<input type=\"hidden\" name=\"template\" value=\"".$template."\">"; |
---|
86 | echo "<input type=\"hidden\" name=\"sujet\" value=\"".$sujet."\">"; |
---|
87 | echo "<input type=\"hidden\" name=\"message\" value=\"".$message."\">"; |
---|
88 | echo "<input type=\"hidden\" name=\"date\" value=\"".$date."\">"; |
---|
89 | |
---|
90 | echo "<input type=\"hidden\" name=\"id_rubrique\" value=\"".$id_rubrique."\">"; |
---|
91 | echo "<input type=\"hidden\" name=\"id_mot\" value=\"".$id_mot."\">"; |
---|
92 | |
---|
93 | echo liens_absolus($texte_template).$message_erreur.""; |
---|
94 | echo "<br/><br/>"; |
---|
95 | |
---|
96 | debut_cadre_formulaire(); |
---|
97 | echo "Envoyer ce courrier à cette liste de diffusion :<br />"; |
---|
98 | $result = spip_query("SELECT email, titre FROM spip_abomailmans"); |
---|
99 | echo "<select name='email_liste' class='formo'>"; |
---|
100 | while ($row = spip_fetch_array($result)) { |
---|
101 | echo "<option value='".$row['email']."'>".$row['titre']." -> ".$row['email']."</option>\n"; |
---|
102 | } |
---|
103 | echo "</select>"; |
---|
104 | echo "<div id='cacher_confirmer'><br /><input name=\"Confirmer\" type=\"submit\" value=\""._T("abomailmans:envoi_confirmer")."\" id=\"Confimrer\"></div>"; |
---|
105 | echo "</form>"; |
---|
106 | fin_cadre_formulaire(); |
---|
107 | |
---|
108 | } |
---|
109 | |
---|
110 | echo "</body></html>"; |
---|
111 | unset ($_POST); |
---|
112 | |
---|
113 | } |
---|
114 | |
---|
115 | ?> |
---|