4 |
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 |
|
|
|
16 |
// suppression d'un mot ?
|
|
|
17 |
if ($conf_mot = intval($conf_mot)) {
|
|
|
18 |
$query = "SELECT * FROM spip_mots WHERE id_mot='$conf_mot'";
|
|
|
19 |
$result = spip_query($query);
|
|
|
20 |
if ($row = spip_fetch_array($result)) {
|
|
|
21 |
$id_mot = $row['id_mot'];
|
|
|
22 |
$titre_mot = typo($row['titre']);
|
|
|
23 |
$type_mot = typo($row['type']);
|
|
|
24 |
|
|
|
25 |
if ($connect_statut=="0minirezo") $aff_articles="prepa,prop,publie,refuse";
|
|
|
26 |
else $aff_articles="prop,publie";
|
|
|
27 |
|
|
|
28 |
list($nb_articles) = spip_fetch_array(spip_query(
|
|
|
29 |
"SELECT COUNT(*) FROM spip_mots_articles AS lien, spip_articles AS article
|
|
|
30 |
WHERE lien.id_mot=$conf_mot AND article.id_article=lien.id_article
|
|
|
31 |
AND FIND_IN_SET(article.statut,'$aff_articles')>0 AND article.statut!='refuse'"
|
|
|
32 |
));
|
|
|
33 |
list($nb_rubriques) = spip_fetch_array(spip_query(
|
|
|
34 |
"SELECT COUNT(*) FROM spip_mots_rubriques AS lien, spip_rubriques AS rubrique
|
|
|
35 |
WHERE lien.id_mot=$conf_mot AND rubrique.id_rubrique=lien.id_rubrique"
|
|
|
36 |
));
|
|
|
37 |
list($nb_breves) = spip_fetch_array(spip_query(
|
|
|
38 |
"SELECT COUNT(*) FROM spip_mots_breves AS lien, spip_breves AS breve
|
|
|
39 |
WHERE lien.id_mot=$conf_mot AND breve.id_breve=lien.id_breve
|
|
|
40 |
AND FIND_IN_SET(breve.statut,'$aff_articles')>0 AND breve.statut!='refuse'"));
|
|
|
41 |
list($nb_sites) = spip_fetch_array(spip_query(
|
|
|
42 |
"SELECT COUNT(*) FROM spip_mots_syndic AS lien, spip_syndic AS syndic
|
|
|
43 |
WHERE lien.id_mot=$conf_mot AND syndic.id_syndic=lien.id_syndic
|
|
|
44 |
AND FIND_IN_SET(syndic.statut,'$aff_articles')>0 AND syndic.statut!='refuse'"));
|
|
|
45 |
list($nb_forum) = spip_fetch_array(spip_query(
|
|
|
46 |
"SELECT COUNT(*) FROM spip_mots_forum AS lien, spip_forum AS forum
|
|
|
47 |
WHERE lien.id_mot=$conf_mot AND forum.id_forum=lien.id_forum
|
|
|
48 |
AND forum.statut='publie'"));
|
|
|
49 |
|
|
|
50 |
// si le mot n'est pas lie, on le supprime sans etats d'ames
|
|
|
51 |
if ($nb_articles + $nb_breves + $nb_sites + $nb_forum == 0) {
|
|
|
52 |
redirige_par_entete("mots_edit.php3?supp_mot=$id_mot&redirect_ok=oui&redirect=mots_tous.php3");
|
|
|
53 |
} // else traite plus loin (confirmation de suppression)
|
|
|
54 |
}
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
if ($connect_statut == '0minirezo') {
|
|
|
59 |
if ($modifier_groupe == "oui") {
|
|
|
60 |
$change_type = addslashes(corriger_caracteres($change_type));
|
|
|
61 |
$ancien_type = addslashes(corriger_caracteres($ancien_type));
|
|
|
62 |
$texte = addslashes(corriger_caracteres($texte));
|
|
|
63 |
$descriptif = addslashes(corriger_caracteres($descriptif));
|
|
|
64 |
|
|
|
65 |
if ($ancien_type) { // modif groupe
|
|
|
66 |
$query = "UPDATE spip_mots SET type='$change_type' WHERE id_groupe='$id_groupe'";
|
|
|
67 |
spip_query($query);
|
|
|
68 |
|
|
|
69 |
$query = "UPDATE spip_groupes_mots SET titre='$change_type', texte='$texte', descriptif='$descriptif', unseul='$unseul', obligatoire='$obligatoire',
|
|
|
70 |
articles='$articles', breves='$breves', rubriques='$rubriques', syndic='$syndic',
|
|
|
71 |
minirezo='$acces_minirezo', comite='$acces_comite', forum='$acces_forum'
|
|
|
72 |
WHERE id_groupe='$id_groupe'";
|
|
|
73 |
spip_query($query);
|
|
|
74 |
} else { // creation groupe
|
|
|
75 |
spip_query("INSERT INTO spip_groupes_mots (titre, unseul, obligatoire, articles, breves, rubriques, syndic, minirezo, comite, forum) VALUES ('$change_type', '$unseul', '$obligatoire', '$articles','$breves', '$rubriques', '$syndic', '$acces_minirezo', '$acces_comite', '$acces_forum')");
|
|
|
76 |
}
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
if ($supp_group){
|
|
|
80 |
$type=addslashes($supp_group);
|
|
|
81 |
$query="DELETE FROM spip_groupes_mots WHERE id_groupe='$supp_group'";
|
|
|
82 |
$result=spip_query($query);
|
|
|
83 |
}
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
debut_page(_T('titre_page_mots_tous'), "documents", "mots");
|
|
|
88 |
debut_gauche();
|
|
|
89 |
|
|
|
90 |
debut_droite();
|
|
|
91 |
|
|
|
92 |
gros_titre(_T('titre_mots_tous'));
|
|
|
93 |
echo typo(_T('info_creation_mots_cles')) . aide ("mots") . "<br><br>";
|
|
|
94 |
|
|
|
95 |
/////
|
|
|
96 |
|
|
|
97 |
if ($conf_mot>0) {
|
|
|
98 |
if ($nb_articles == 1) {
|
|
|
99 |
$texte_lie = _T('info_un_article')." ";
|
|
|
100 |
} else if ($nb_articles > 1) {
|
|
|
101 |
$texte_lie = _T('info_nombre_articles', array('nb_articles' => $nb_articles)) ." ";
|
|
|
102 |
}
|
|
|
103 |
if ($nb_breves == 1) {
|
|
|
104 |
$texte_lie .= _T('info_une_breve')." ";
|
|
|
105 |
} else if ($nb_breves > 1) {
|
|
|
106 |
$texte_lie .= _T('info_nombre_breves', array('nb_breves' => $nb_breves))." ";
|
|
|
107 |
}
|
|
|
108 |
if ($nb_sites == 1) {
|
|
|
109 |
$texte_lie .= _T('info_un_site')." ";
|
|
|
110 |
} else if ($nb_sites > 1) {
|
|
|
111 |
$texte_lie .= _T('info_nombre_sites', array('nb_sites' => $nb_sites))." ";
|
|
|
112 |
}
|
|
|
113 |
if ($nb_rubriques == 1) {
|
|
|
114 |
$texte_lie .= _T('info_une_rubrique')." ";
|
|
|
115 |
} else if ($nb_rubriques > 1) {
|
|
|
116 |
$texte_lie .= _T('info_nombre_rubriques', array('nb_rubriques' => $nb_rubriques))." ";
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
debut_boite_info();
|
|
|
120 |
echo "<div class='serif'>";
|
|
|
121 |
echo _T('info_delet_mots_cles', array('titre_mot' => $titre_mot, 'type_mot' => $type_mot, 'texte_lie' => $texte_lie));
|
|
|
122 |
|
|
|
123 |
echo "<UL>";
|
|
|
124 |
echo "<LI><B><A HREF='mots_edit.php3?supp_mot=$id_mot&redirect_ok=oui&redirect=mots_tous.php3'>"._T('item_oui')."</A>,</B> "._T('info_oui_suppression_mot_cle');
|
|
|
125 |
echo "<LI><B><A HREF='mots_tous.php3'>"._T('item_non')."</A>,</B> "._T('info_non_suppression_mot_cle');
|
|
|
126 |
echo "</UL>";
|
|
|
127 |
echo "</div>";
|
|
|
128 |
fin_boite_info();
|
|
|
129 |
echo "<P>";
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
//
|
|
|
134 |
// Calculer les nombres d'elements (articles, etc.) lies a chaque mot
|
|
|
135 |
//
|
|
|
136 |
|
|
|
137 |
if ($connect_statut=="0minirezo") $aff_articles = "'prepa','prop','publie'";
|
|
|
138 |
else $aff_articles = "'prop','publie'";
|
|
|
139 |
|
|
|
140 |
$result_articles = spip_query(
|
|
|
141 |
"SELECT COUNT(*) as cnt, lien.id_mot FROM spip_mots_articles AS lien, spip_articles AS article
|
|
|
142 |
WHERE article.id_article=lien.id_article AND article.statut IN ($aff_articles) GROUP BY lien.id_mot"
|
|
|
143 |
);
|
|
|
144 |
while ($row_articles = spip_fetch_array($result_articles)){
|
|
|
145 |
$id_mot = $row_articles['id_mot'];
|
|
|
146 |
$total_articles = $row_articles['cnt'];
|
|
|
147 |
$nb_articles[$id_mot] = $total_articles;
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
$result_rubriques = spip_query(
|
|
|
152 |
"SELECT COUNT(*) AS cnt, lien.id_mot FROM spip_mots_rubriques AS lien, spip_rubriques AS rubrique
|
|
|
153 |
WHERE rubrique.id_rubrique=lien.id_rubrique GROUP BY lien.id_mot"
|
|
|
154 |
);
|
|
|
155 |
while ($row_rubriques = spip_fetch_array($result_rubriques)){
|
|
|
156 |
$id_mot = $row_rubriques['id_mot'];
|
|
|
157 |
$total_rubriques = $row_rubriques['cnt'];
|
|
|
158 |
$nb_rubriques[$id_mot] = $total_rubriques;
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
$result_breves = spip_query(
|
|
|
162 |
"SELECT COUNT(*) AS cnt, lien.id_mot FROM spip_mots_breves AS lien, spip_breves AS breve
|
|
|
163 |
WHERE breve.id_breve=lien.id_breve AND breve.statut IN ($aff_articles) GROUP BY lien.id_mot"
|
|
|
164 |
);
|
|
|
165 |
while ($row_breves = spip_fetch_array($result_breves)){
|
|
|
166 |
$id_mot = $row_breves['id_mot'];
|
|
|
167 |
$total_breves = $row_breves['cnt'];
|
|
|
168 |
$nb_breves[$id_mot] = $total_breves;
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
$result_syndic = spip_query(
|
|
|
172 |
"SELECT COUNT(*) AS cnt, lien.id_mot FROM spip_mots_syndic AS lien, spip_syndic AS syndic
|
|
|
173 |
WHERE syndic.id_syndic=lien.id_syndic AND syndic.statut IN ($aff_articles) GROUP BY lien.id_mot"
|
|
|
174 |
);
|
|
|
175 |
while ($row_syndic = spip_fetch_array($result_syndic)){
|
|
|
176 |
$id_mot = $row_syndic['id_mot'];
|
|
|
177 |
$total_sites = $row_syndic['cnt'];
|
|
|
178 |
$nb_sites[$id_mot] = $total_sites;
|
|
|
179 |
}
|
|
|
180 |
|
|
|
181 |
|
|
|
182 |
//
|
|
|
183 |
// On boucle d'abord sur les groupes de mots
|
|
|
184 |
//
|
|
|
185 |
|
|
|
186 |
$query_groupes = "SELECT * FROM spip_groupes_mots ORDER BY titre";
|
|
|
187 |
$result_groupes = spip_query($query_groupes);
|
|
|
188 |
|
|
|
189 |
while ($row_groupes = spip_fetch_array($result_groupes)) {
|
|
|
190 |
$id_groupe = $row_groupes['id_groupe'];
|
|
|
191 |
$titre_groupe = typo($row_groupes['titre']);
|
|
|
192 |
$descriptif = $row_groupes['descriptif'];
|
|
|
193 |
$texte = $row_groupes['texte'];
|
|
|
194 |
$unseul = $row_groupes['unseul'];
|
|
|
195 |
$obligatoire = $row_groupes['obligatoire'];
|
|
|
196 |
$articles = $row_groupes['articles'];
|
|
|
197 |
$breves = $row_groupes['breves'];
|
|
|
198 |
$rubriques = $row_groupes['rubriques'];
|
|
|
199 |
$syndic = $row_groupes['syndic'];
|
|
|
200 |
$acces_minirezo = $row_groupes['minirezo'];
|
|
|
201 |
$acces_comite = $row_groupes['comite'];
|
|
|
202 |
$acces_forum = $row_groupes['forum'];
|
|
|
203 |
|
|
|
204 |
// Afficher le titre du groupe
|
|
|
205 |
debut_cadre_enfonce("groupe-mot-24.gif", false, '', $titre_groupe);
|
|
|
206 |
// Affichage des options du groupe (types d'elements, permissions...)
|
|
|
207 |
echo "<font face='Verdana,Arial,Sans,sans-serif' size=1>";
|
|
|
208 |
if ($articles == "oui") echo "> "._T('info_articles_2')." ";
|
|
|
209 |
if ($breves == "oui") echo "> "._T('info_breves_02')." ";
|
|
|
210 |
if ($rubriques == "oui") echo "> "._T('info_rubriques')." ";
|
|
|
211 |
if ($syndic == "oui") echo "> "._T('icone_sites_references')." ";
|
|
|
212 |
|
|
|
213 |
if ($unseul == "oui" OR $obligatoire == "oui") echo "<br>";
|
|
|
214 |
if ($unseul == "oui") echo "> "._T('info_un_mot')." ";
|
|
|
215 |
if ($obligatoire == "oui") echo "> "._T('info_groupe_important')." ";
|
|
|
216 |
|
|
|
217 |
echo "<br>";
|
|
|
218 |
if ($acces_minirezo == "oui") echo "> "._T('info_administrateurs')." ";
|
|
|
219 |
if ($acces_comite == "oui") echo "> "._T('info_redacteurs')." ";
|
|
|
220 |
if ($acces_forum == "oui") echo "> "._T('info_visiteurs_02')." ";
|
|
|
221 |
|
|
|
222 |
echo "</font>";
|
|
|
223 |
if ($descriptif) {
|
|
|
224 |
echo "<p><div align='left' border: 1px dashed #aaaaaa;'>";
|
|
|
225 |
echo "<font size=2 face='Verdana,Arial,Sans,sans-serif'>";
|
|
|
226 |
echo "<b>"._T('info_descriptif')."</b> ";
|
|
|
227 |
echo propre($descriptif);
|
|
|
228 |
echo " ";
|
|
|
229 |
echo "</font>";
|
|
|
230 |
echo "</div>";
|
|
|
231 |
}
|
|
|
232 |
|
|
|
233 |
if (strlen($texte)>0){
|
|
|
234 |
echo "<FONT FACE='Verdana,Arial,Sans,sans-serif'>";
|
|
|
235 |
echo "<P>".propre($texte);
|
|
|
236 |
echo "</FONT>";
|
|
|
237 |
}
|
|
|
238 |
|
|
|
239 |
//
|
|
|
240 |
// Afficher les mots-cles du groupe
|
|
|
241 |
//
|
|
|
242 |
$query = "SELECT * FROM spip_mots WHERE id_groupe = '$id_groupe' ORDER BY titre";
|
|
|
243 |
$tranches = afficher_tranches_requete($query, 3);
|
|
|
244 |
|
|
|
245 |
$table = '';
|
|
|
246 |
|
|
|
247 |
if (strlen($tranches)) {
|
|
|
248 |
echo "<div class='liste'>";
|
|
|
249 |
echo "<table border=0 cellspacing=0 cellpadding=3 width=\"100%\">";
|
|
|
250 |
|
|
|
251 |
echo $tranches;
|
|
|
252 |
|
|
|
253 |
$result = spip_query($query);
|
|
|
254 |
while ($row = spip_fetch_array($result)) {
|
|
|
255 |
|
|
|
256 |
$vals = '';
|
|
|
257 |
|
|
|
258 |
$id_mot = $row['id_mot'];
|
|
|
259 |
$titre_mot = $row['titre'];
|
|
|
260 |
|
|
|
261 |
if ($connect_statut == "0minirezo")
|
|
|
262 |
$aff_articles="prepa,prop,publie,refuse";
|
|
|
263 |
else
|
|
|
264 |
$aff_articles="prop,publie";
|
|
|
265 |
|
|
|
266 |
if ($id_mot!=$conf_mot) {
|
|
|
267 |
$couleur = $ifond ? "#FFFFFF" : $couleur_claire;
|
|
|
268 |
$ifond = $ifond ^ 1;
|
|
|
269 |
|
|
|
270 |
if ($connect_statut == "0minirezo" OR $nb_articles[$id_mot] > 0)
|
|
|
271 |
$s = "<a href='mots_edit.php3?id_mot=$id_mot&redirect=mots_tous.php3' class='liste-mot'>".typo($titre_mot)."</a>";
|
|
|
272 |
else
|
|
|
273 |
$s = typo($titre_mot);
|
|
|
274 |
|
|
|
275 |
$vals[] = $s;
|
|
|
276 |
|
|
|
277 |
$texte_lie = array();
|
|
|
278 |
|
|
|
279 |
if ($nb_articles[$id_mot] == 1)
|
|
|
280 |
$texte_lie[] = _T('info_1_article');
|
|
|
281 |
else if ($nb_articles[$id_mot] > 1)
|
|
|
282 |
$texte_lie[] = $nb_articles[$id_mot]." "._T('info_articles_02');
|
|
|
283 |
|
|
|
284 |
if ($nb_breves[$id_mot] == 1)
|
|
|
285 |
$texte_lie[] = _T('info_1_breve');
|
|
|
286 |
else if ($nb_breves[$id_mot] > 1)
|
|
|
287 |
$texte_lie[] = $nb_breves[$id_mot]." "._T('info_breves_03');
|
|
|
288 |
|
|
|
289 |
if ($nb_sites[$id_mot] == 1)
|
|
|
290 |
$texte_lie[] = _T('info_1_site');
|
|
|
291 |
else if ($nb_sites[$id_mot] > 1)
|
|
|
292 |
$texte_lie[] = $nb_sites[$id_mot]." "._T('info_sites');
|
|
|
293 |
|
|
|
294 |
if ($nb_rubriques[$id_mot] == 1)
|
|
|
295 |
$texte_lie[] = _T('info_une_rubrique_02');
|
|
|
296 |
else if ($nb_rubriques[$id_mot] > 1)
|
|
|
297 |
$texte_lie[] = $nb_rubriques[$id_mot]." "._T('info_rubriques_02');
|
|
|
298 |
|
|
|
299 |
$texte_lie = join($texte_lie,", ");
|
|
|
300 |
|
|
|
301 |
$vals[] = $texte_lie;
|
|
|
302 |
|
|
|
303 |
|
|
|
304 |
if ($connect_statut=="0minirezo") {
|
|
|
305 |
$vals[] = "<a href='mots_tous.php3?conf_mot=$id_mot'>"._T('info_supprimer_mot')." <img src='" . _DIR_IMG_PACK . "croix-rouge.gif' alt='X' width='7' height='7' border='0' align='middle'></a>";
|
|
|
306 |
}
|
|
|
307 |
|
|
|
308 |
$table[] = $vals;
|
|
|
309 |
|
|
|
310 |
|
|
|
311 |
}
|
|
|
312 |
|
|
|
313 |
}
|
|
|
314 |
if ($connect_statut=="0minirezo") {
|
|
|
315 |
$largeurs = array('', 100, 100);
|
|
|
316 |
$styles = array('arial11', 'arial1', 'arial1');
|
|
|
317 |
}
|
|
|
318 |
else {
|
|
|
319 |
$largeurs = array('', 100);
|
|
|
320 |
$styles = array('arial11', 'arial1');
|
|
|
321 |
}
|
|
|
322 |
afficher_liste($largeurs, $table, $styles);
|
|
|
323 |
|
|
|
324 |
echo "</table>";
|
|
|
325 |
// fin_cadre_relief();
|
|
|
326 |
echo "</div>";
|
|
|
327 |
$supprimer_groupe = false;
|
|
|
328 |
}
|
|
|
329 |
else
|
|
|
330 |
if ($connect_statut =="0minirezo")
|
|
|
331 |
$supprimer_groupe = true;
|
|
|
332 |
|
|
|
333 |
if ($connect_statut =="0minirezo" AND !$conf_mot){
|
|
|
334 |
echo "\n<table cellpadding=0 cellspacing=0 border=0 width=100%>";
|
|
|
335 |
echo "<tr>";
|
|
|
336 |
echo "<td>";
|
|
|
337 |
icone(_T('icone_modif_groupe_mots'), "mots_type.php3?id_groupe=$id_groupe", "groupe-mot-24.gif", "edit.gif");
|
|
|
338 |
echo "</td>";
|
|
|
339 |
if ($supprimer_groupe) {
|
|
|
340 |
echo "<td>";
|
|
|
341 |
icone(_T('icone_supprimer_groupe_mots'), "mots_tous.php3?supp_group=$id_groupe", "groupe-mot-24.gif", "supprimer.gif");
|
|
|
342 |
echo "</td>";
|
|
|
343 |
echo "<td> </td>"; // Histoire de forcer "supprimer" un peu plus vers la gauche
|
|
|
344 |
}
|
|
|
345 |
echo "<td>";
|
|
|
346 |
echo "<div align='$spip_lang_right'>";
|
|
|
347 |
icone(_T('icone_creation_mots_cles'), "mots_edit.php3?new=oui&redirect=mots_tous.php3&id_groupe=$id_groupe", "mot-cle-24.gif", "creer.gif");
|
|
|
348 |
echo "</div>";
|
|
|
349 |
echo "</td></tr></table>";
|
|
|
350 |
}
|
|
|
351 |
|
|
|
352 |
fin_cadre_enfonce();
|
|
|
353 |
}
|
|
|
354 |
|
|
|
355 |
if ($connect_statut =="0minirezo" AND !$conf_mot){
|
|
|
356 |
echo "<p> </p><div align='right'>";
|
|
|
357 |
icone(_T('icone_creation_groupe_mots'), "mots_type.php3?new=oui", "groupe-mot-24.gif", "creer.gif");
|
|
|
358 |
echo "</div>";
|
|
|
359 |
}
|
|
|
360 |
|
|
|
361 |
fin_page();
|
|
|
362 |
|
|
|
363 |
?>
|