Subversion Repositories Sites.tela-botanica.org

Rev

Rev 609 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7 david 1
<?php
2
 
3
/***************************************************************************\
4
 *  SPIP, Systeme de publication pour l'internet                           *
5
 *                                                                         *
6
 *  Copyright (c) 2001-2005                                                *
7
 *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
8
 *                                                                         *
9
 *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
10
 *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11
\***************************************************************************/
12
 
13
 
14
include ("inc.php3");
15
include_ecrire ("inc_logos.php3");
16
include_ecrire ("inc_mots.php3");
17
include_ecrire ("inc_sites.php3");
18
include_ecrire ("inc_date.php3");
19
include_ecrire ("inc_abstract_sql.php3");
20
include_ecrire ("inc_config.php3");
21
 
22
$proposer_sites = lire_meta("proposer_sites");
23
 
24
function calculer_droits() {
25
	global $connect_statut, $statut, $id_rubrique, $id_rubrique_depart, $proposer_sites, $new;
26
	global $flag_editable, $flag_administrable;
27
 
28
	$flag_administrable = ($connect_statut == '0minirezo' AND acces_rubrique($id_rubrique));
29
	if ($id_rubrique_depart > 0)
30
		 $flag_administrable &= acces_rubrique($id_rubrique_depart);
31
	$flag_editable = ($flag_administrable OR ($proposer_sites > 0 AND ($statut == 'prop' OR $new == 'oui')));
32
}
33
 
34
 
35
//
36
// Creation d'un site
37
//
38
 
39
if ($new == 'oui') {
40
	calculer_droits();
41
 
42
	if ($flag_editable) {
43
		$id_rubrique = intval($id_rubrique);
44
 
45
		$mydate = date("YmdHis", time() - 12 * 3600);
46
		$query = "DELETE FROM spip_syndic WHERE (statut = 'refuse') && (maj < $mydate)";
47
		$result = spip_query($query);
48
 
49
		$moderation = (lire_meta("moderation_sites") == "oui")? 'oui' : 'non';
50
 
51
		$id_syndic = spip_abstract_insert("spip_syndic",
52
					 "(nom_site, id_rubrique, id_secteur, date, date_syndic, statut, syndication, moderation)",
53
					 "('"._T('avis_site_introuvable')."', $id_rubrique, $id_rubrique, NOW(), NOW(), 'refuse', 'non', '$moderation')");
54
	}
55
} else $id_syndic = intval($id_syndic);
56
 
57
$result = spip_query("SELECT statut, id_rubrique FROM spip_syndic
58
	WHERE id_syndic=$id_syndic");
59
 
60
if ($row = spip_fetch_array($result)) {
61
	$statut = $row["statut"];
62
	$id_rubrique_depart = $row["id_rubrique"];
63
	if (!$id_rubrique) $id_rubrique = $id_rubrique_depart;
64
}
65
if ($new == 'oui') $statut = 'prop';
66
 
67
calculer_droits();
68
 
69
 
70
//
71
// Analyse automatique d'une URL
72
//
73
 
74
if ($analyser_site == 'oui' AND $flag_editable) {
75
 
76
	$v = analyser_site($url);
77
 
78
	if ($v) {
79
		$nom_site = addslashes($v['nom_site']);
80
		$url_site = addslashes($v['url_site']);
81
		if (!$nom_site) $nom_site = $url_site;
82
		$url_syndic = addslashes($v['url_syndic']);
83
		$descriptif = addslashes($v['descriptif']);
84
		$syndication = $v[syndic] ? 'oui' : 'non';
85
		$result = spip_query("UPDATE spip_syndic ".
86
			"SET nom_site='$nom_site', url_site='$url_site',
87
			url_syndic='$url_syndic', descriptif='$descriptif',
88
			syndication='$syndication', statut='$statut'
89
			WHERE id_syndic=$id_syndic");
90
		if ($syndication == 'oui') syndic_a_jour($id_syndic);
91
		$link = new Link('sites.php3');
92
		$link->addVar('id_syndic');
93
		$link->addVar('redirect');
94
		$redirect = $link->getUrl();
95
		$redirect_ok = 'oui';
96
	}
97
}
98
 
99
 
100
//
101
// Ajout et suppression syndication
102
//
103
 
104
if ($nouveau_statut AND $flag_administrable) {
105
	$statut = $nouveau_statut;
106
	$result = spip_query("UPDATE spip_syndic SET statut='$statut'
107
	WHERE id_syndic=$id_syndic");
108
	if ($statut == 'publie')
109
		spip_query("UPDATE spip_syndic SET date=NOW() WHERE
110
		id_syndic=$id_syndic");
111
 
112
	calculer_rubriques();
113
	if ($statut == 'publie') {
114
		if (lire_meta('activer_moteur') == 'oui') {
115
			include_ecrire ("inc_index.php3");
116
			marquer_indexer('syndic', $id_syndic);
117
		}
118
	}
119
}
120
 
121
if ($nom_site AND $modifier_site == 'oui' AND $flag_editable) {
122
	$nom_site = addslashes($nom_site);
123
	$url_site = addslashes($url_site);
124
	$descriptif = addslashes($descriptif);
125
	if (strlen($url_syndic) < 8) $syndication = "non";
126
	$url_syndic = addslashes($url_syndic);
127
 
128
	// recoller les champs du extra
129
	if ($champs_extra) {
130
		include_ecrire("inc_extra.php3");
131
		$add_extra = ", extra = '".addslashes(extra_recup_saisie("sites", $id_secteur))."'";
132
	} else
133
		$add_extra = '';
134
 
135
 
136
 
137
	spip_query("UPDATE spip_syndic SET id_rubrique='$id_rubrique',
138
	nom_site='$nom_site', url_site='$url_site', url_syndic='$url_syndic',
139
	descriptif='$descriptif', syndication='$syndication', statut='$statut'
140
	$add_extra WHERE id_syndic=$id_syndic");
141
 
142
	if ($syndication_old != $syndication OR $url_syndic != $old_syndic)
143
		$reload = "oui";
144
 
145
	if ($syndication_old != $syndication AND $syndication == "non")
146
		spip_query("DELETE FROM spip_syndic_articles
147
		WHERE id_syndic=$id_syndic");
148
 
149
	calculer_rubriques();
150
 
151
	// invalider et reindexer
152
	if ($statut == 'publie') {
153
		if ($invalider_caches) {
154
			include_ecrire ("inc_invalideur.php3");
155
			suivre_invalideur("id='id_syndic/$id_syndic'");
156
		}
157
		if (lire_meta('activer_moteur') == 'oui') {
158
			include_ecrire ("inc_index.php3");
159
			marquer_indexer('syndic', $id_syndic);
160
		}
161
	}
162
	$link = new Link('sites.php3');
163
	$link->addVar('id_syndic');
164
	$link->addVar('redirect');
165
	$link->addVar('reload', $reload);
166
	$redirect = $link->getUrl();
167
	$redirect_ok = 'oui';
168
}
169
 
170
 
171
if ($jour AND $flag_administrable) {
172
	if ($annee == "0000") $mois = "00";
173
	if ($mois == "00") $jour = "00";
174
	spip_query("UPDATE spip_syndic SET date='$annee-$mois-$jour'
175
	WHERE id_syndic=$id_syndic");
176
	calculer_rubriques();
177
}
178
 
179
 
180
 
181
if ($redirect AND $redirect_ok == 'oui') {
182
	redirige_par_entete($redirect);
183
}
184
 
185
 
186
//
187
// reload
188
//
189
if ($reload) {
190
	$result = spip_query ("SELECT * FROM spip_syndic WHERE id_syndic=$id_syndic
191
	AND syndication IN ('oui', 'sus', 'off')");
192
	if ($result AND spip_num_rows($result)>0)
193
		$erreur_syndic = syndic_a_jour ($id_syndic);
194
}
195
 
196
 
197
//
198
// Afficher la page
199
//
200
 
201
calculer_droits();
202
 
203
$result = spip_query("SELECT * FROM spip_syndic WHERE id_syndic=$id_syndic");
204
 
205
if ($row = spip_fetch_array($result)) {
206
	$id_syndic = $row["id_syndic"];
207
	$id_rubrique = $row["id_rubrique"];
208
	$nom_site = $row["nom_site"];
209
	$url_site = $row["url_site"];
210
	$url_syndic = $row["url_syndic"];
211
	$descriptif = $row["descriptif"];
212
	$syndication = $row["syndication"];
213
	$statut = $row["statut"];
214
	$date_heure = $row["date"];
215
	$date_syndic = $row['date_syndic'];
216
	$mod = $row['moderation'];
217
 
218
	$extra=$row["extra"];
219
 
220
	}
221
 
222
if ($nom_site)
223
	$titre_page = "&laquo; $nom_site &raquo;";
224
else
225
	$titre_page = _T('info_site');
226
 
227
 
228
 
229
debut_page("$titre_page","documents","sites");
230
 
231
 
232
//////// parents
233
 
234
 
235
debut_grand_cadre();
236
 
237
afficher_hierarchie($id_rubrique);
238
 
239
fin_grand_cadre();
240
 
241
 
242
 
243
debut_gauche();
244
 
245
debut_boite_info();
246
	echo "<center>";
247
	echo "<font face='Verdana,Arial,Sans,sans-serif' size=1><b>"._T('titre_site_numero')."</b></font>";
248
	echo "<br><font face='Verdana,Arial,Sans,sans-serif' size=6><b>$id_syndic</b></font>\n";
249
 
250
	voir_en_ligne ('site', $id_syndic, $statut);
251
 
252
 
253
	echo "</center>";
254
fin_boite_info();
255
 
256
 
257
echo "<p><center>";
258
	icone (_T('icone_voir_sites_references'), "sites_tous.php3", "site-24.gif","rien.gif");
259
echo "</center>";
260
 
261
if ($id_syndic AND $flag_administrable)
262
	afficher_boite_logo('site', 'id_syndic', $id_syndic, _T('logo_site')." ".aide ("rublogo"), _T('logo_survol'), 'site');
263
 
264
 
265
debut_droite();
266
 
267
 
268
 
269
debut_cadre_relief("site-24.gif");
270
echo "<center>";
271
 
272
if ($syndication == 'off' OR $syndication == 'sus') {
273
	$logo_statut = "puce-orange-anim.gif";
274
}
275
else if ($statut == 'publie') {
276
	$logo_statut = "puce-verte.gif";
277
}
278
else if ($statut == 'prop') {
279
	$logo_statut = "puce-blanche.gif";
280
}
281
else if ($statut == 'refuse') {
282
	$logo_statut = "puce-rouge.gif";
283
}
284
 
285
echo "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>";
286
echo "<tr width='100%'><td width='100%' valign='top'>";
287
	gros_titre($nom_site, $logo_statut);
288
 
289
$url_affichee = $url_site;
290
 
291
if (strlen($url_affichee) > 40) $url_affichee = substr($url_affichee, 0, 30)."...";
292
echo "<a href='$url_site'><b>$url_affichee</b></a>";
293
 
294
if (strlen($descriptif) > 1) {
295
	echo "<p><div align='left' style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #e4e4e4;'>";
296
	echo "<font size=2 face='Verdana,Arial,Sans,sans-serif'>";
297
	echo "<b>"._T('info_descriptif')."</b> ";
298
	echo propre($descriptif);
299
	echo "&nbsp; ";
300
	echo "</font>";
301
	echo "</div>";
302
}
303
echo "</td>";
304
 
305
if ($flag_editable) {
306
	$link = new Link('sites_edit.php3');
307
	$link->addVar('id_syndic');
308
	$link->addVar('target', $clean_link->getUrl());
309
	echo "<td>". http_img_pack('rien.gif', " ", "width='5'") . "</td>\n";
310
	echo "<td  align='right'>";
311
	icone(_T('icone_modifier_site'), $link->getUrl(), "site-24.gif", "edit.gif");
312
	echo "</td>";
313
}
314
echo "</tr></table>\n";
315
 
316
 
317
 
318
if ($flag_editable AND ($options == 'avancees' OR $statut == 'publie')) {
319
	if ($statut == 'publie') {
320
		echo "<p>";
321
 
322
		if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})", $date_heure, $regs)) {
323
		        $mois = $regs[2];
324
		        $jour = $regs[3];
325
		        $annee = $regs[1];
326
		}
327
 
328
 
329
		debut_cadre_enfonce();
330
		echo afficher_formulaire_date("sites.php3?id_syndic=$id_syndic&options=$options", _T('info_date_referencement'), $jour, $mois, $annee);
331
		fin_cadre_enfonce();
332
	}
333
	else {
334
		echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('info_site_propose')." <B>".affdate($date_heure)."&nbsp;</B></FONT><P>";
335
	}
336
}
337
 
338
if ($flag_editable AND $options == 'avancees') {
339
	formulaire_mots('syndic', $id_syndic, $nouv_mot, $supp_mot, $cherche_mot, $flag_editable);
340
}
341
 
342
if ($flag_administrable) {
343
	$link = $GLOBALS['clean_link'];
344
	$link->delVar('new');
345
	echo $link->getForm('GET');
346
	debut_cadre_relief("racine-site-24.gif");
347
	echo "\n<center>";
348
 
349
	echo "<b>"._T('info_statut_site_1')."</b> &nbsp;&nbsp; \n";
350
 
351
	echo "<select name='nouveau_statut' size=1 class='fondl'>\n";
352
 
353
	echo my_sel("publie",_T('info_statut_site_2'),$statut);
354
	echo my_sel("prop",_T('info_statut_site_3'),$statut);
355
	echo my_sel("refuse",_T('info_statut_site_4'),$statut);
356
 
357
	echo "</select>\n";
358
 
359
	echo " &nbsp;&nbsp;&nbsp; <input type='submit' name='Valider' value='"._T('bouton_valider')."' class='fondo'>\n</center>\n";
360
	fin_cadre_relief();
361
	echo "</form>\n";
362
}
363
 
364
if ($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") {
365
	echo "<p><font size=3 face='Verdana,Arial,Sans,sans-serif'><b>"._T('info_site_syndique')."</b></font>";
366
 
367
	if ($erreur_syndic)
368
		echo "<p><font color=red><b>$erreur_syndic</b></font>";
369
 
370
	if ($syndication == "off" OR $syndication=="sus") {
371
		debut_boite_info();
372
		echo _T('avis_site_syndique_probleme', array('url_syndic' => $url_syndic));
373
		echo "<center><b>";
374
		echo "<a href='sites.php3?id_syndic=$id_syndic&reload=oui'>";
375
		echo _T('lien_nouvelle_recuperation')."</a></b></center>\n";
376
		fin_boite_info();
377
	}
378
	afficher_syndic_articles(_T('titre_articles_syndiques'),
379
		"SELECT * FROM spip_syndic_articles WHERE id_syndic=$id_syndic
380
		ORDER BY date DESC");
381
 
382
 
383
	echo "<font face='verdana,arial,helvetica' size=2>";
384
	// afficher la date de dernier acces a la syndication
385
	if ($date_syndic)
386
		echo "<p><div align='left'>"._T('info_derniere_syndication').' '.affdate_heure($date_syndic)
387
		.".</div>\n";
388
 
389
		echo "<div align='right'>\n"
390
		. "<form method='post' action='sites.php3?id_syndic=$id_syndic'>"
391
		. "<input type='submit' name='reload' value=\""
392
		. attribut_html(_T('lien_mise_a_jour_syndication'))
393
		. "\" class='fondo' style='font-size:9px;' /></form></div>\n";
394
 
395
	// Options
396
	if ($flag_administrable && $options=='avancees') {
397
 
398
		debut_cadre_relief();
399
		echo "<u>"._T('syndic_options')."</u>"
400
			. aide('artsyn')."\n"
401
			. "<form method='POST' action='sites.php3?id_syndic=$id_syndic' class='verdana2'>\n";
402
 
403
		// modifier la moderation
404
		if ($moderation == 'oui' OR $moderation == 'non')
405
			spip_query("UPDATE spip_syndic SET moderation='$moderation'
406
			WHERE id_syndic=$id_syndic");
407
		else
408
			$moderation = $mod;
409
		if ($moderation != 'oui') $moderation='non';
410
 
411
		echo "<p><div align='$spip_lang_left'>"
412
			. _T('syndic_choix_moderation') . "<br />\n";
413
		afficher_choix('moderation', $moderation,
414
			array(
415
			'non' => _T('info_publier')
416
				.' ('._T('bouton_radio_modere_posteriori').')',
417
			'oui' => _T('info_bloquer')
418
				.' ('._T('bouton_radio_modere_priori').')'
419
			));
420
 
421
		// Oublier les vieux liens ?
422
		# appliquer les choix
423
		if ($miroir == 'oui' OR $miroir == 'non')
424
			spip_query("UPDATE spip_syndic SET miroir='$miroir'
425
			WHERE id_syndic=$id_syndic");
426
		if ($oubli == 'oui' OR $oubli == 'non')
427
			spip_query("UPDATE spip_syndic SET oubli='$oubli'
428
			WHERE id_syndic=$id_syndic");
429
 
430
		echo "<p><div align='left'>"._T('syndic_choix_oublier');
431
 
432
		echo "<ul>\n";
433
 
434
		# miroir
435
		if (!$miroir AND !$miroir = $row['miroir']) $miroir = 'non';
436
		echo "<li>"._T('syndic_option_miroir').' ';
437
		afficher_choix('miroir', $miroir,
438
			array('oui' => _T('item_oui'), 'non' => _T('item_non')),
439
			" &nbsp; ");
440
		echo "</li>\n";
441
 
442
		# oubli
443
		if (!$oubli AND !$oubli = $row['oubli']) $oubli = 'non';
444
		echo "<li>"._T('syndic_option_oubli', array('mois' => 2)).' ';
445
		afficher_choix('oubli', $oubli,
446
			array('oui' => _T('item_oui'), 'non' => _T('item_non')),
447
			" &nbsp; ");
448
		echo "</li>\n";
449
 
450
		echo "</ul>\n";
451
 
452
		// Bouton "Valider"
453
		echo "<div style='text-align:$spip_lang_right'><INPUT TYPE='submit' NAME='Valider' VALUE='"._T('bouton_valider')."' CLASS='fondo'></div>";
454
 
455
 
456
		fin_cadre_relief();
457
	}
458
	echo "</font>";
459
}
460
// Cas d'un site ayant un feedfinder detecte
461
else if (preg_match(',^select: (.*),', $url_syndic, $regs)) {
462
	echo "<br /><br />\n";
463
	echo "<form method='post' action='sites.php3?id_syndic=$id_syndic'>";
464
	foreach (
465
		array('id_rubrique', 'nom_site', 'url_site', 'descriptif', 'statut')
466
	as $var) {
467
		echo "<input type='hidden' name='$var' value=\"".entites_html($$var)."\" />";
468
	}
469
	echo debut_cadre_relief();
470
	echo "<div align='$spip_lang_left'>\n";
471
	echo "<INPUT TYPE='radio' NAME='syndication' VALUE='non' id='syndication_non' CHECKED>";
472
	echo " <b><label for='syndication_non'>"._T('bouton_radio_non_syndication')."</label></b><p>";
473
	echo "<INPUT TYPE='radio' NAME='syndication' VALUE='oui' id='syndication_oui'>";
474
	echo " <b><label for='syndication_oui'>"._T('bouton_radio_syndication')."</label></b> &nbsp;";
475
 
476
	$feeds = explode(' ',$regs[1]);
477
	echo "<select name='url_syndic'>\n";
478
	foreach ($feeds as $feed) {
479
		echo '<option value="'.entites_html($feed).'">'.$feed."</option>\n";
480
	}
481
	echo "</select>\n";
482
	echo aide("rubsyn");
483
	echo '<input type="hidden" name="modifier_site" value="oui" />';
484
	echo '<input type="hidden" name="reload" value="oui" />';
485
	echo "<div align='$spip_lang_right'><input type='submit' name='Valider' value='"._T('bouton_valider')."' class='fondo'></div>\n";
486
	echo fin_cadre_relief();
487
	echo "</div></form>\n";
488
}
489
 
490
 
491
if ($champs_extra AND $extra) {
492
		include_ecrire("inc_extra.php3");
493
		extra_affichage($extra, "sites");
494
	}
495
 
496
fin_cadre_relief();
497
 
498
 
499
 
500
//////////////////////////////////////////////////////
501
// Forums
502
//
503
 
504
echo "<br><br>\n";
505
 
506
$forum_retour = "sites.php3?id_syndic=$id_syndic";
507
 
508
$link = new Link('forum_envoi.php3');
509
$link->addVar('statut', 'prive');
510
$link->addVar('adresse_retour', $forum_retour);
511
$link->addVar('id_syndic');
512
$link->addVar('titre_message', $nom_site);
513
 
514
 
515
echo "<div align='center'>";
516
icone (_T('icone_poster_message'), $link->getUrl(), "forum-interne-24.gif", "creer.gif");
517
echo "</div>";
518
 
519
echo "<p align='left'>\n";
520
 
521
$result_forum = spip_query("SELECT * FROM spip_forum WHERE statut='prive'
522
AND id_syndic=$id_syndic AND id_parent=0 ORDER BY date_heure DESC LIMIT 0,20");
523
afficher_forum($result_forum, $forum_retour);
524
 
525
 
526
fin_page();
527
 
528
?>