4 |
david |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
//
|
|
|
4 |
// Ce fichier ne sera execute qu'une fois
|
|
|
5 |
if (defined("_INC_FORMULAIRES")) return;
|
|
|
6 |
define("_INC_FORMULAIRES", "1");
|
|
|
7 |
|
|
|
8 |
include_ecrire('inc_filtres.php3');
|
|
|
9 |
include_ecrire('inc_lang.php3'); // pour lang_select
|
|
|
10 |
|
|
|
11 |
function test_pass() {
|
|
|
12 |
include_ecrire("inc_acces.php3");
|
|
|
13 |
for (;;) {
|
|
|
14 |
$passw = creer_pass_aleatoire();
|
|
|
15 |
$query = "SELECT statut FROM spip_signatures WHERE statut='$passw'";
|
|
|
16 |
$result = spip_query($query);
|
|
|
17 |
if (!spip_num_rows($result)) break;
|
|
|
18 |
}
|
|
|
19 |
return $passw;
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
function test_login($mail) {
|
|
|
23 |
if (strpos($mail, "@") > 0) $login_base = substr($mail, 0, strpos($mail, "@"));
|
|
|
24 |
else $login_base = $mail;
|
|
|
25 |
|
|
|
26 |
$login_base = strtolower($login_base);
|
|
|
27 |
$login_base = ereg_replace("[^a-zA-Z0-9]", "", $login_base);
|
|
|
28 |
if (!$login_base) $login_base = "user";
|
|
|
29 |
|
|
|
30 |
for ($i = 0; ; $i++) {
|
|
|
31 |
if ($i) $login = $login_base.$i;
|
|
|
32 |
else $login = $login_base;
|
|
|
33 |
$query = "SELECT id_auteur FROM spip_auteurs WHERE login='$login'";
|
|
|
34 |
$result = spip_query($query);
|
|
|
35 |
if (!spip_num_rows($result)) break;
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
return $login;
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
function erreur($zetexte){
|
|
|
42 |
global $spip_lang_rtl;
|
|
|
43 |
return "<br /><img src='puce$spip_lang_rtl.gif' border='0' alt='-' /> $zetexte";
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
//
|
|
|
47 |
// Retour a l'ecran du lien de confirmation d'une signature de petition
|
|
|
48 |
//
|
|
|
49 |
|
|
|
50 |
function reponse_confirmation($id_article) {
|
|
|
51 |
global $val_confirm;
|
|
|
52 |
|
|
|
53 |
include_ecrire("inc_connect.php3");
|
|
|
54 |
|
|
|
55 |
if ($GLOBALS['db_ok']) {
|
|
|
56 |
include_ecrire("inc_texte.php3");
|
|
|
57 |
include_ecrire("inc_filtres.php3");
|
|
|
58 |
|
|
|
59 |
// Eviter les doublons
|
|
|
60 |
$lock = "petition $id_article $val_confirm";
|
|
|
61 |
if (!spip_get_lock($lock, 5)) {
|
|
|
62 |
$texte = _T('form_pet_probleme_technique');
|
|
|
63 |
}
|
|
|
64 |
else {
|
|
|
65 |
$query_sign = "SELECT * FROM spip_signatures WHERE statut='".addslashes($val_confirm)."'";
|
|
|
66 |
$result_sign = spip_query($query_sign);
|
|
|
67 |
if (spip_num_rows($result_sign) > 0) {
|
|
|
68 |
while($row = spip_fetch_array($result_sign)) {
|
|
|
69 |
$id_signature = $row['id_signature'];
|
|
|
70 |
$id_article = $row['id_article'];
|
|
|
71 |
$date_time = $row['date_time'];
|
|
|
72 |
$nom_email = $row['nom_email'];
|
|
|
73 |
$adresse_email = $row['ad_email'];
|
|
|
74 |
$nom_site = $row['nom_site'];
|
|
|
75 |
$url_site = $row['url_site'];
|
|
|
76 |
$message = $row['message'];
|
|
|
77 |
$statut = $row['statut'];
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
$query_petition = "SELECT * FROM spip_petitions WHERE id_article=$id_article";
|
|
|
81 |
$result_petition = spip_query($query_petition);
|
|
|
82 |
|
|
|
83 |
while ($row = spip_fetch_array($result_petition)) {
|
|
|
84 |
$id_article = $row['id_article'];
|
|
|
85 |
$email_unique = $row['email_unique'];
|
|
|
86 |
$site_obli = $row['site_obli'];
|
|
|
87 |
$site_unique = $row['site_unique'];
|
|
|
88 |
$message_petition = $row['message'];
|
|
|
89 |
$texte_petition = $row['texte'];
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
if ($email_unique == "oui") {
|
|
|
93 |
$email = addslashes($adresse_email);
|
|
|
94 |
$query = "SELECT * FROM spip_signatures WHERE id_article=$id_article AND ad_email='$email' AND statut='publie'";
|
|
|
95 |
$result = spip_query($query);
|
|
|
96 |
if (spip_num_rows($result) > 0) {
|
|
|
97 |
$texte .= erreur(_T('form_pet_deja_signe'));
|
|
|
98 |
$refus = "oui";
|
|
|
99 |
}
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
if ($site_unique == "oui") {
|
|
|
103 |
$site = addslashes($url_site);
|
|
|
104 |
$query = "SELECT * FROM spip_signatures WHERE id_article=$id_article AND url_site='$site' AND statut='publie'";
|
|
|
105 |
$result = spip_query($query);
|
|
|
106 |
if (spip_num_rows($result) > 0) {
|
|
|
107 |
$texte .= erreur(_T('form_pet_deja_enregistre'));
|
|
|
108 |
$refus = "oui";
|
|
|
109 |
}
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
if ($refus == "oui") {
|
|
|
113 |
$texte .= erreur(_T('form_deja_inscrit'));
|
|
|
114 |
}
|
|
|
115 |
else {
|
|
|
116 |
$query = "UPDATE spip_signatures SET statut=\"publie\" WHERE id_signature='$id_signature'";
|
|
|
117 |
$result = spip_query($query);
|
|
|
118 |
|
|
|
119 |
$texte .= erreur(_T('form_pet_signature_validee'));
|
|
|
120 |
}
|
|
|
121 |
}
|
|
|
122 |
else {
|
|
|
123 |
$texte .= erreur(_T('form_pet_aucune_signature'));
|
|
|
124 |
}
|
|
|
125 |
spip_release_lock($lock);
|
|
|
126 |
}
|
|
|
127 |
}
|
|
|
128 |
else {
|
|
|
129 |
$texte = _T('form_pet_probleme_technique');
|
|
|
130 |
}
|
|
|
131 |
echo "<div class='reponse_formulaire'>$texte</div>";
|
|
|
132 |
}
|
|
|
133 |
|
|
|
134 |
//
|
|
|
135 |
// Retour a l'ecran de la signature d'une petition
|
|
|
136 |
//
|
|
|
137 |
|
|
|
138 |
function reponse_signature($id_article) {
|
|
|
139 |
global $nom_email, $adresse_email, $message, $nom_site, $url_site, $url_page;
|
|
|
140 |
|
|
|
141 |
include_ecrire("inc_connect.php3");
|
|
|
142 |
|
|
|
143 |
if ($GLOBALS['db_ok']) {
|
|
|
144 |
include_ecrire("inc_texte.php3");
|
|
|
145 |
include_ecrire("inc_filtres.php3");
|
|
|
146 |
include_ecrire("inc_mail.php3");
|
|
|
147 |
|
|
|
148 |
// Eviter les doublons
|
|
|
149 |
$lock = "petition $id_article $adresse_email";
|
|
|
150 |
if (!spip_get_lock($lock, 5)) {
|
|
|
151 |
$reponse_signature = _T('form_pet_probleme_technique');
|
|
|
152 |
}
|
|
|
153 |
else {
|
|
|
154 |
$query_petition = "SELECT * FROM spip_petitions WHERE id_article=$id_article";
|
|
|
155 |
$result_petition = spip_query($query_petition);
|
|
|
156 |
|
|
|
157 |
while ($row = spip_fetch_array($result_petition)) {
|
|
|
158 |
$id_article = $row['id_article'];
|
|
|
159 |
$email_unique = $row['email_unique'];
|
|
|
160 |
$site_obli = $row['site_obli'];
|
|
|
161 |
$site_unique = $row['site_unique'];
|
|
|
162 |
$message_petition = $row['message'];
|
|
|
163 |
$texte_petition = $row['texte'];
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
if (strlen($nom_email) < 2) {
|
|
|
167 |
$reponse_signature .= erreur(_T('form_indiquer_nom'));
|
|
|
168 |
$refus = "oui";
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
if ($adresse_email == _T('info_mail_fournisseur')) {
|
|
|
172 |
$reponse_signature .= erreur(_T('form_indiquer_email'));
|
|
|
173 |
$refus = "oui";
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
if ($email_unique == "oui") {
|
|
|
177 |
$email = addslashes($adresse_email);
|
|
|
178 |
$query = "SELECT * FROM spip_signatures WHERE id_article=$id_article AND ad_email='$email' AND statut='publie'";
|
|
|
179 |
$result = spip_query($query);
|
|
|
180 |
if (spip_num_rows($result) > 0) {
|
|
|
181 |
$reponse_signature .= erreur(_T('form_pet_deja_signe'));
|
|
|
182 |
$refus = "oui";
|
|
|
183 |
}
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
if (!email_valide($adresse_email)) {
|
|
|
187 |
$reponse_signature .= erreur(_T('form_email_non_valide'));
|
|
|
188 |
$refus = "oui";
|
|
|
189 |
}
|
|
|
190 |
|
|
|
191 |
if ($site_obli == "oui") {
|
|
|
192 |
if (!$nom_site) {
|
|
|
193 |
$reponse_signature .= erreur(_T('form_indiquer_nom_site'));
|
|
|
194 |
$refus = "oui";
|
|
|
195 |
}
|
|
|
196 |
include_local ("ecrire/inc_sites.php3");
|
|
|
197 |
|
|
|
198 |
if (!recuperer_page($url_site)) {
|
|
|
199 |
$reponse_signature .= erreur(_T('form_pet_url_invalide'));
|
|
|
200 |
$refus = "oui";
|
|
|
201 |
}
|
|
|
202 |
}
|
|
|
203 |
if ($site_unique == "oui") {
|
|
|
204 |
$site = addslashes($url_site);
|
|
|
205 |
$query = "SELECT * FROM spip_signatures WHERE id_article=$id_article AND url_site='$site' AND (statut='publie' OR statut='poubelle')";
|
|
|
206 |
$result = spip_query($query);
|
|
|
207 |
if (spip_num_rows($result) > 0) {
|
|
|
208 |
$reponse_signature .= erreur(_T('form_pet_site_deja_enregistre'));
|
|
|
209 |
$refus = "oui";
|
|
|
210 |
}
|
|
|
211 |
}
|
|
|
212 |
|
|
|
213 |
$passw = test_pass();
|
|
|
214 |
|
|
|
215 |
if ($refus == "oui") {
|
|
|
216 |
$reponse_signature.= "<P><FONT COLOR='red'><B>"._T('form_pet_signature_pasprise')."</B></FONT><P>";
|
|
|
217 |
}
|
|
|
218 |
else {
|
|
|
219 |
$query_site = "SELECT titre FROM spip_articles WHERE id_article=$id_article";
|
|
|
220 |
$result_site = spip_query($query_site);
|
|
|
221 |
while ($row = spip_fetch_array($result_site)) {
|
|
|
222 |
$titre = $row['titre'];
|
|
|
223 |
}
|
|
|
224 |
|
|
|
225 |
$link = new Link($url_page);
|
|
|
226 |
$link->addVar('val_confirm', $passw);
|
|
|
227 |
$url = $link->getUrl("sp$id_article");
|
|
|
228 |
|
|
|
229 |
$messagex = _T('form_pet_mail_confirmation', array('titre' => $titre, 'nom_email' => $nom_email, 'nom_site' => $nom_site, 'url_site' => $url_site, 'url' => $url));
|
|
|
230 |
|
|
|
231 |
if (envoyer_mail($adresse_email, _T('form_pet_confirmation')." ".$titre, $messagex)) {
|
|
|
232 |
$reponse_signature .= "<P><B>"._T('form_pet_envoi_mail_confirmation')."</B>";
|
|
|
233 |
|
|
|
234 |
$nom_email = addslashes($nom_email);
|
|
|
235 |
$adresse_email = addslashes($adresse_email);
|
|
|
236 |
$nom_site = addslashes($nom_site);
|
|
|
237 |
$url_site = addslashes($url_site);
|
|
|
238 |
$message = addslashes($message);
|
|
|
239 |
|
|
|
240 |
$query = "INSERT INTO spip_signatures (id_article, date_time, nom_email, ad_email, nom_site, url_site, message, statut) ".
|
|
|
241 |
"VALUES ('$id_article', NOW(), '$nom_email', '$adresse_email', '$nom_site', '$url_site', '$message', '$passw')";
|
|
|
242 |
$result = spip_query($query);
|
|
|
243 |
}
|
|
|
244 |
else {
|
|
|
245 |
$reponse_signature = _T('form_pet_probleme_technique');
|
|
|
246 |
}
|
|
|
247 |
}
|
|
|
248 |
spip_release_lock($lock);
|
|
|
249 |
}
|
|
|
250 |
}
|
|
|
251 |
else {
|
|
|
252 |
$reponse_signature = _T('form_pet_probleme_technique');
|
|
|
253 |
}
|
|
|
254 |
echo "<div class='reponse_formulaire'>$reponse_signature</div>";
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
//
|
|
|
258 |
// Formulaire de signature d'une petition
|
|
|
259 |
//
|
|
|
260 |
|
|
|
261 |
function formulaire_signature($id_article) {
|
|
|
262 |
include_ecrire("inc_texte.php3");
|
|
|
263 |
|
|
|
264 |
$query_petition = "SELECT * FROM spip_petitions WHERE id_article=$id_article";
|
|
|
265 |
$result_petition = spip_query($query_petition);
|
|
|
266 |
|
|
|
267 |
if ($row_petition = spip_fetch_array($result_petition)) {
|
|
|
268 |
$id_article = $row_petition['id_article'];
|
|
|
269 |
$email_unique = $row_petition['email_unique'];
|
|
|
270 |
$site_obli = $row_petition['site_obli'];
|
|
|
271 |
$site_unique = $row_petition['site_unique'];
|
|
|
272 |
$message_petition = $row_petition['message'];
|
|
|
273 |
$texte_petition = $row_petition['texte'];
|
|
|
274 |
|
|
|
275 |
$link = new Link;
|
|
|
276 |
$url = lire_meta("adresse_site").'/'.$link->getUrl();
|
|
|
277 |
$link = new Link;
|
|
|
278 |
$link->addVar('url_page', $url);
|
|
|
279 |
$retour .= $link->getForm('post', "sp$id_article");
|
|
|
280 |
|
|
|
281 |
$retour .= propre($texte_petition);
|
|
|
282 |
|
|
|
283 |
$retour .= "<div><fieldset><p><b>"._T('form_pet_votre_nom')."</b><br />";
|
|
|
284 |
$retour .= "<input type=\"text\" class=\"forml\" name=\"nom_email\" value=\"\" size=\"20\" /></p>";
|
|
|
285 |
|
|
|
286 |
$retour .= "<p><b>"._T('form_pet_votre_email')."</b><br />";
|
|
|
287 |
$retour .= "<input type=\"text\" class=\"forml\" name=\"adresse_email\" value=\"\" size=\"20\" /></p></fieldset>";
|
|
|
288 |
|
|
|
289 |
$retour .= "<br /><fieldset><p>";
|
|
|
290 |
if ($site_obli != "oui") {
|
|
|
291 |
$retour .= _T('form_pet_votre_site')."<br />";
|
|
|
292 |
}
|
|
|
293 |
$retour .= "<b>"._T('form_pet_nom_site2')."</b><br />";
|
|
|
294 |
$retour .= "<input type=\"text\" class=\"forml\" name=\"nom_site\" value=\"\" size=\"20\" /></p>";
|
|
|
295 |
|
|
|
296 |
$retour .= "<p><b>"._T('form_pet_adresse_site')."</b><br />";
|
|
|
297 |
$retour .= "<input type=\"text\" class=\"forml\" name=\"url_site\" value=\"http://\" size=\"20\" /></p></fieldset>";
|
|
|
298 |
|
|
|
299 |
if ($message_petition == "oui") {
|
|
|
300 |
$retour .= "<br /><fieldset>";
|
|
|
301 |
|
|
|
302 |
$retour .= "<b>"._T('form_pet_message_commentaire')."</b><br />";
|
|
|
303 |
$retour .= "<textarea name=\"message\" rows=\"3\" class=\"forml\" cols=\"20\" wrap='soft'>";
|
|
|
304 |
$retour .= "</textarea></fieldset>\n";
|
|
|
305 |
}
|
|
|
306 |
else {
|
|
|
307 |
$retour .= "<input type=\"hidden\" name=\"message\" value=\"\" />";
|
|
|
308 |
}
|
|
|
309 |
$retour .= "</div>";
|
|
|
310 |
|
|
|
311 |
$retour .= "<br /><div align=\"right\"><input type=\"submit\" name=\"Valider\" class=\"spip_bouton\" value=\""._T('bouton_valider')."\" />";
|
|
|
312 |
$retour .= "</div></form>\n";
|
|
|
313 |
}
|
|
|
314 |
return $retour;
|
|
|
315 |
}
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
// inscrire les visiteurs dans l'espace public (statut 6forum) ou prive (statut nouveau->1comite)
|
|
|
319 |
function formulaire_inscription($type) {
|
|
|
320 |
$request_uri = $GLOBALS["REQUEST_URI"];
|
|
|
321 |
global $mail_inscription;
|
|
|
322 |
global $nom_inscription;
|
|
|
323 |
|
|
|
324 |
if ($type == 'redac') {
|
|
|
325 |
if (lire_meta("accepter_inscriptions") != "oui") return;
|
|
|
326 |
$statut = "nouveau";
|
|
|
327 |
}
|
|
|
328 |
else if ($type == 'forum') {
|
|
|
329 |
$statut = "6forum";
|
|
|
330 |
}
|
|
|
331 |
else {
|
|
|
332 |
return; // tentative de hack...?
|
|
|
333 |
}
|
|
|
334 |
|
|
|
335 |
if ($mail_inscription && $nom_inscription) {
|
|
|
336 |
$query = "SELECT * FROM spip_auteurs WHERE email='".addslashes($mail_inscription)."'";
|
|
|
337 |
$result = spip_query($query);
|
|
|
338 |
|
|
|
339 |
echo "<div class='reponse_formulaire'>";
|
|
|
340 |
|
|
|
341 |
// l'abonne existe deja.
|
|
|
342 |
if ($row = spip_fetch_array($result)) {
|
|
|
343 |
$id_auteur = $row['id_auteur'];
|
|
|
344 |
$statut = $row['statut'];
|
|
|
345 |
|
|
|
346 |
unset ($continue);
|
|
|
347 |
if ($statut == '5poubelle')
|
|
|
348 |
echo "<b>"._T('form_forum_access_refuse')."</b>";
|
|
|
349 |
else if ($statut == 'nouveau') {
|
|
|
350 |
spip_query ("DELETE FROM spip_auteurs WHERE id_auteur=$id_auteur");
|
|
|
351 |
$continue = true;
|
|
|
352 |
} else
|
|
|
353 |
echo "<b>"._T('form_forum_email_deja_enregistre')."</b>";
|
|
|
354 |
} else
|
|
|
355 |
$continue = true;
|
|
|
356 |
|
|
|
357 |
// envoyer identifiants par mail
|
|
|
358 |
if ($continue) {
|
|
|
359 |
include_ecrire("inc_acces.php3");
|
|
|
360 |
$pass = creer_pass_aleatoire(8, $mail_inscription);
|
|
|
361 |
$login = test_login($mail_inscription);
|
|
|
362 |
$mdpass = md5($pass);
|
|
|
363 |
$htpass = generer_htpass($pass);
|
|
|
364 |
$query = "INSERT INTO spip_auteurs (nom, email, login, pass, statut, htpass) ".
|
|
|
365 |
"VALUES ('".addslashes($nom_inscription)."', '".addslashes($mail_inscription)."', '$login', '$mdpass', '$statut', '$htpass')";
|
|
|
366 |
$result = spip_query($query);
|
|
|
367 |
ecrire_acces();
|
|
|
368 |
|
|
|
369 |
$nom_site_spip = lire_meta("nom_site");
|
|
|
370 |
$adresse_site = lire_meta("adresse_site");
|
|
|
371 |
|
|
|
372 |
$message = _T('form_forum_message_auto')."\n\n"._T('form_forum_bonjour')."\n\n";
|
|
|
373 |
if ($type == 'forum') {
|
|
|
374 |
$message .= _T('form_forum_voici1', array('nom_site_spip' => $nom_site_spip, 'adresse_site' => $adresse_site)) . "\n\n";
|
|
|
375 |
}
|
|
|
376 |
else {
|
|
|
377 |
$message .= _T('form_forum_voici2', array('nom_site_spip' => $nom_site_spip, 'adresse_site' => $adresse_site)) . "\n\n";
|
|
|
378 |
}
|
|
|
379 |
$message .= "- "._T('form_forum_login')." $login\n";
|
|
|
380 |
$message .= "- "._T('form_forum_pass')." $pass\n\n";
|
|
|
381 |
|
|
|
382 |
if (envoyer_mail($mail_inscription, "[$nom_site_spip] "._T('form_forum_identifiants'), $message)) {
|
|
|
383 |
echo _T('form_forum_identifiant_mail');
|
|
|
384 |
}
|
|
|
385 |
else {
|
|
|
386 |
echo _T('form_forum_probleme_mail');
|
|
|
387 |
}
|
|
|
388 |
}
|
|
|
389 |
echo "</div>";
|
|
|
390 |
}
|
|
|
391 |
else {
|
|
|
392 |
echo _T('form_forum_indiquer_nom_email');
|
|
|
393 |
$link = $GLOBALS['clean_link'];
|
|
|
394 |
echo $link->getForm('GET');
|
|
|
395 |
echo "<P><B>"._T('form_pet_votre_nom')."</B><BR>";
|
|
|
396 |
echo "<INPUT TYPE=\"text\" CLASS=\"forml\" NAME=\"nom_inscription\" VALUE=\"\" SIZE=\"30\">";
|
|
|
397 |
echo "<P><B>"._T('form_pet_votre_email')."</B><BR>";
|
|
|
398 |
echo "<INPUT TYPE=\"text\" CLASS=\"forml\" NAME=\"mail_inscription\" VALUE=\"\" SIZE=\"30\">";
|
|
|
399 |
echo "<DIV ALIGN=\"right\"><INPUT TYPE=\"submit\" NAME=\"Valider\" CLASS=\"spip_bouton\" VALUE=\""._T('bouton_valider')."\">";
|
|
|
400 |
echo "</DIV></FORM>";
|
|
|
401 |
}
|
|
|
402 |
}
|
|
|
403 |
|
|
|
404 |
|
|
|
405 |
function formulaire_site($la_rubrique) {
|
|
|
406 |
$request_uri = $GLOBALS["REQUEST_URI"];
|
|
|
407 |
global $nom_site;
|
|
|
408 |
global $url_site;
|
|
|
409 |
global $description_site;
|
|
|
410 |
|
|
|
411 |
if ($nom_site) {
|
|
|
412 |
// Tester le nom du site
|
|
|
413 |
if (strlen ($nom_site) < 2){
|
|
|
414 |
$reponse_signature .= erreur(_T('form_prop_indiquer_nom_site'));
|
|
|
415 |
$refus = "oui";
|
|
|
416 |
}
|
|
|
417 |
|
|
|
418 |
// Tester l'URL du site
|
|
|
419 |
include_ecrire("inc_sites.php3");
|
|
|
420 |
if (!recuperer_page($url_site)) {
|
|
|
421 |
$reponse_signature .= erreur(_T('form_pet_url_invalide'));
|
|
|
422 |
$refus = "oui";
|
|
|
423 |
}
|
|
|
424 |
|
|
|
425 |
// Integrer a la base de donnees
|
|
|
426 |
echo "<div class='reponse_formulaire'>";
|
|
|
427 |
|
|
|
428 |
if ($refus !="oui"){
|
|
|
429 |
$nom_site = addslashes($nom_site);
|
|
|
430 |
$url_site = addslashes($url_site);
|
|
|
431 |
$description_site = addslashes($description_site);
|
|
|
432 |
|
|
|
433 |
$query = "INSERT INTO spip_syndic (nom_site, url_site, id_rubrique, descriptif, date, date_syndic, statut, syndication) ".
|
|
|
434 |
"VALUES ('$nom_site', '$url_site', $la_rubrique, '$description_site', NOW(), NOW(), 'prop', 'non')";
|
|
|
435 |
$result = spip_query($query);
|
|
|
436 |
echo _T('form_prop_enregistre');
|
|
|
437 |
}
|
|
|
438 |
else {
|
|
|
439 |
echo $reponse_signature;
|
|
|
440 |
echo "<p> "._T('form_prop_non_enregistre');
|
|
|
441 |
}
|
|
|
442 |
|
|
|
443 |
echo "</div>";
|
|
|
444 |
}
|
|
|
445 |
else {
|
|
|
446 |
$link = $GLOBALS['clean_link'];
|
|
|
447 |
echo $link->getForm('POST');
|
|
|
448 |
echo "<P><div class='spip_encadrer'><B>"._T('form_prop_nom_site')."</B><BR>";
|
|
|
449 |
echo "<INPUT TYPE=\"text\" CLASS=\"forml\" NAME=\"nom_site\" VALUE=\"\" SIZE=\"30\">";
|
|
|
450 |
echo "<P><B>"._T('form_prop_url_site')."</B><BR>";
|
|
|
451 |
echo "<INPUT TYPE=\"text\" CLASS=\"forml\" NAME=\"url_site\" VALUE=\"\" SIZE=\"30\"></div>";
|
|
|
452 |
echo "<P><B>"._T('form_prop_description')."</B><BR>";
|
|
|
453 |
echo "<TEXTAREA NAME='description_site' ROWS='5' CLASS='forml' COLS='40' wrap=soft></textarea>";
|
|
|
454 |
echo "<DIV ALIGN=\"right\"><INPUT TYPE=\"submit\" NAME=\"Valider\" CLASS=\"spip_bouton\" VALUE=\""._T('bouton_valider')."\">";
|
|
|
455 |
echo "</DIV></FORM>";
|
|
|
456 |
}
|
|
|
457 |
}
|
|
|
458 |
|
|
|
459 |
function formulaire_ecrire_auteur($id_auteur, $email_auteur) {
|
|
|
460 |
global $flag_wordwrap;
|
|
|
461 |
|
|
|
462 |
include_ecrire("inc_texte.php3");
|
|
|
463 |
include_ecrire("inc_filtres.php3");
|
|
|
464 |
include_ecrire("inc_mail.php3");
|
|
|
465 |
|
|
|
466 |
$affiche_formulaire = true;
|
|
|
467 |
if ($GLOBALS['texte_message_auteur'.$id_auteur]) {
|
|
|
468 |
if ($GLOBALS['sujet_message_auteur'.$id_auteur] == "")
|
|
|
469 |
$erreur .= erreur(_T('form_prop_indiquer_sujet'));
|
|
|
470 |
else if (! email_valide($GLOBALS['email_message_auteur'.$id_auteur]) )
|
|
|
471 |
$erreur .= erreur(_T('form_prop_indiquer_email'));
|
|
|
472 |
else if ($GLOBALS['valide_message_auteur'.$id_auteur]) { // verifier hash ?
|
|
|
473 |
$GLOBALS['texte_message_auteur'.$id_auteur] .= "\n\n-- Envoi via le site ".lire_meta('nom_site')." (".lire_meta('adresse_site')."/) --\n";
|
|
|
474 |
envoyer_mail($email_auteur,
|
|
|
475 |
$GLOBALS['sujet_message_auteur'.$id_auteur],
|
|
|
476 |
$GLOBALS['texte_message_auteur'.$id_auteur], $GLOBALS['email_message_auteur'.$id_auteur],
|
|
|
477 |
"X-Originating-IP: ".$GLOBALS['REMOTE_ADDR']);
|
|
|
478 |
$erreur .= erreur(_T('form_prop_message_envoye'));
|
|
|
479 |
$affiche_formulaire = false;
|
|
|
480 |
} else { //preview
|
|
|
481 |
echo "<br /><div class='spip_encadrer'>"._T('form_prop_sujet')." <b>".$GLOBALS['sujet_message_auteur'.$id_auteur]."</b></div>";
|
|
|
482 |
if ($flag_wordwrap)
|
|
|
483 |
$GLOBALS['texte_message_auteur'.$id_auteur] = wordwrap($GLOBALS['texte_message_auteur'.$id_auteur]);
|
|
|
484 |
echo "<pre>".entites_html($GLOBALS['texte_message_auteur'.$id_auteur])."</pre>";
|
|
|
485 |
$affiche_formulaire = false;
|
|
|
486 |
$link = $GLOBALS['clean_link'];
|
|
|
487 |
$link->addVar('email_message_auteur'.$id_auteur, $GLOBALS['email_message_auteur'.$id_auteur]);
|
|
|
488 |
$link->addVar('sujet_message_auteur'.$id_auteur, $GLOBALS['sujet_message_auteur'.$id_auteur]);
|
|
|
489 |
$link->addVar('texte_message_auteur'.$id_auteur, $GLOBALS['texte_message_auteur'.$id_auteur]);
|
|
|
490 |
$link->addVar('valide_message_auteur'.$id_auteur, 'oui');
|
|
|
491 |
echo $link->getForm('post');
|
|
|
492 |
echo "<div align=\"right\"><input type=\"submit\" name=\"Confirmer\" class=\"spip_bouton\" value=\""._T('form_prop_confirmer_envoi')."\" />";
|
|
|
493 |
echo "</div></form>";
|
|
|
494 |
}
|
|
|
495 |
}
|
|
|
496 |
|
|
|
497 |
if ($erreur)
|
|
|
498 |
echo "<div class='spip_encadrer'><b>$erreur<br /> </b></div>\n";
|
|
|
499 |
|
|
|
500 |
if ($affiche_formulaire) {
|
|
|
501 |
$retour = $GLOBALS['REQUEST_URI'];
|
|
|
502 |
$link = $GLOBALS['clean_link'];
|
|
|
503 |
echo $link->getForm('post');
|
|
|
504 |
echo "<div class='spip_encadrer'><b>"._T('form_pet_votre_email')."</b><br />";
|
|
|
505 |
echo "<input type=\"text\" class=\"forml\" name=\"email_message_auteur$id_auteur\" value=\"".entites_html($GLOBALS['email_message_auteur'.$id_auteur])."\" SIZE=\"30\" />\n";
|
|
|
506 |
echo "<p><b>"._T('form_prop_sujet')."</b><br />";
|
|
|
507 |
echo "<input type=\"text\" class=\"forml\" name=\"sujet_message_auteur$id_auteur\" value=\"".entites_html($GLOBALS['sujet_message_auteur'.$id_auteur])."\" SIZE=\"30\" /></p>\n";
|
|
|
508 |
echo "<p><textarea name='texte_message_auteur$id_auteur' rows='10' class='forml' cols='40' wrap=soft>".entites_html($GLOBALS['texte_message_auteur'.$id_auteur])."</textarea></p>\n";
|
|
|
509 |
echo "<div align=\"right\"><input type=\"submit\" name=\"Valider\" class=\"spip_bouton\" value=\""._T('form_prop_envoyer')."\" /></div>";
|
|
|
510 |
echo "</div></form>";
|
|
|
511 |
}
|
|
|
512 |
}
|
|
|
513 |
|
|
|
514 |
?>
|