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 |
include_ecrire ("inc_logos.php3");
|
|
|
16 |
include_ecrire ("inc_sites.php3");
|
|
|
17 |
include_ecrire ("inc_abstract_sql.php3");
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
//
|
|
|
21 |
// modifications mot
|
|
|
22 |
//
|
|
|
23 |
if ($connect_statut == '0minirezo') {
|
|
|
24 |
if ($supp_mot) {
|
|
|
25 |
$query = "DELETE FROM spip_mots WHERE id_mot=$supp_mot";
|
|
|
26 |
$result = spip_query($query);
|
|
|
27 |
$query = "DELETE FROM spip_mots_articles WHERE id_mot=$supp_mot";
|
|
|
28 |
$result = spip_query($query);
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
if ($titre_mot) {
|
|
|
32 |
if ($new == 'oui' && $id_groupe) {
|
|
|
33 |
$id_mot = spip_abstract_insert("spip_mots", '(id_groupe)', "($id_groupe)");
|
|
|
34 |
|
|
|
35 |
// ajouter le mot a l'article
|
|
|
36 |
if (settype($ajouter_id_article, 'integer') AND ($ajouter_id_article>0))
|
|
|
37 |
spip_query("INSERT INTO spip_mots_$table (id_mot, $id_table) VALUES ($id_mot, $ajouter_id_article)");
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
$titre_mot = addslashes($titre_mot);
|
|
|
41 |
$texte = addslashes($texte);
|
|
|
42 |
$descriptif = addslashes($descriptif);
|
|
|
43 |
$type = addslashes(corriger_caracteres($type));
|
|
|
44 |
$result = spip_query("SELECT titre FROM spip_groupes_mots WHERE id_groupe='$id_groupe'");
|
|
|
45 |
if ($row = spip_fetch_array($result))
|
|
|
46 |
$type = addslashes(corriger_caracteres($row['titre']));
|
|
|
47 |
|
|
|
48 |
// recoller les champs du extra
|
|
|
49 |
if ($champs_extra) {
|
|
|
50 |
include_ecrire("inc_extra.php3");
|
|
|
51 |
$add_extra = ", extra = '".addslashes(extra_recup_saisie("mots"))."'";
|
|
|
52 |
} else
|
|
|
53 |
$add_extra = '';
|
|
|
54 |
|
|
|
55 |
$query = "UPDATE spip_mots SET titre='$titre_mot', texte='$texte', descriptif='$descriptif', type='$type', id_groupe=$id_groupe $add_extra WHERE id_mot=$id_mot";
|
|
|
56 |
$result = spip_query($query);
|
|
|
57 |
|
|
|
58 |
if (lire_meta('activer_moteur') == 'oui') {
|
|
|
59 |
include_ecrire ("inc_index.php3");
|
|
|
60 |
marquer_indexer('mot', $id_mot);
|
|
|
61 |
}
|
|
|
62 |
}
|
|
|
63 |
else if ($new == 'oui') {
|
|
|
64 |
if (!$titre_mot = $titre) {
|
|
|
65 |
$titre_mot = filtrer_entites(_T('texte_nouveau_mot'));
|
|
|
66 |
$onfocus = " onfocus=\"if(!antifocus){this.value='';antifocus=true;}\"";
|
|
|
67 |
}
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
//
|
|
|
72 |
// redirection ou affichage
|
|
|
73 |
//
|
|
|
74 |
if ($redirect_ok == 'oui' && $redirect) {
|
|
|
75 |
redirige_par_entete(rawurldecode($redirect));
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
//
|
|
|
79 |
// Recupere les donnees
|
|
|
80 |
//
|
|
|
81 |
$query = "SELECT * FROM spip_mots WHERE id_mot='$id_mot'";
|
|
|
82 |
$result = spip_query($query);
|
|
|
83 |
|
|
|
84 |
if ($row = spip_fetch_array($result)) {
|
|
|
85 |
$id_mot = $row['id_mot'];
|
|
|
86 |
$titre_mot = $row['titre'];
|
|
|
87 |
$descriptif = $row['descriptif'];
|
|
|
88 |
$texte = $row['texte'];
|
|
|
89 |
$type = $row['type'];
|
|
|
90 |
$extra = $row['extra'];
|
|
|
91 |
$id_groupe = $row['id_groupe'];
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
debut_page("« $titre_mot »", "documents", "mots");
|
|
|
95 |
debut_gauche();
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
//////////////////////////////////////////////////////
|
|
|
99 |
// Boite "voir en ligne"
|
|
|
100 |
//
|
|
|
101 |
|
|
|
102 |
if ($id_mot) {
|
|
|
103 |
debut_boite_info();
|
|
|
104 |
echo "<CENTER>";
|
|
|
105 |
echo "<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=1><B>"._T('titre_gauche_mots_edit')."</B></FONT>";
|
|
|
106 |
echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=6><B>$id_mot</B></FONT>";
|
|
|
107 |
echo "</CENTER>";
|
|
|
108 |
|
|
|
109 |
voir_en_ligne ('mot', $id_mot);
|
|
|
110 |
|
|
|
111 |
fin_boite_info();
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
echo "<p><center>";
|
|
|
115 |
if ($new == 'oui') {
|
|
|
116 |
$adresse_retour = "mots_edit.php3?redirect=$redirect&redirect_ok=oui&supp_mot=$id_mot";
|
|
|
117 |
}else {
|
|
|
118 |
$adresse_retour = "mots_edit.php3?redirect=$redirect&redirect_ok=oui";
|
|
|
119 |
}
|
|
|
120 |
echo "</center>";
|
|
|
121 |
|
|
|
122 |
//////////////////////////////////////////////////////
|
|
|
123 |
// Logos du mot-clef
|
|
|
124 |
//
|
|
|
125 |
|
|
|
126 |
if ($id_mot > 0 AND $connect_statut == '0minirezo')
|
|
|
127 |
afficher_boite_logo('mot', 'id_mot', $id_mot,
|
|
|
128 |
_T('logo_mot_cle').aide("breveslogo"), _T('logo_survol'));
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
//
|
|
|
132 |
// Afficher les boutons de creation d'article et de breve
|
|
|
133 |
//
|
|
|
134 |
debut_raccourcis();
|
|
|
135 |
|
|
|
136 |
icone_horizontale(_T('icone_voir_tous_mots_cles'), "mots_tous.php3", "mot-cle-24.gif", "rien.gif");
|
|
|
137 |
|
|
|
138 |
if ($connect_statut == '0minirezo')
|
|
|
139 |
icone_horizontale(_T('icone_creation_mots_cles'), "mots_edit.php3?new=oui&redirect=mots_tous.php3&id_groupe=$id_groupe", "mot-cle-24.gif", "creer.gif");
|
|
|
140 |
|
|
|
141 |
fin_raccourcis();
|
|
|
142 |
|
|
|
143 |
|
|
|
144 |
debut_droite();
|
|
|
145 |
|
|
|
146 |
debut_cadre_relief("mot-cle-24.gif");
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
echo "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>";
|
|
|
150 |
echo "<tr width='100%'>";
|
|
|
151 |
echo "<td width='100%' valign='top'>";
|
|
|
152 |
gros_titre($titre_mot);
|
|
|
153 |
|
|
|
154 |
|
|
|
155 |
if ($descriptif) {
|
|
|
156 |
echo "<p><div align='left' border: 1px dashed #aaaaaa;'>";
|
|
|
157 |
echo "<font size=2 face='Verdana,Arial,Sans,sans-serif'>";
|
|
|
158 |
echo "<b>"._T('info_descriptif')."</b> ";
|
|
|
159 |
echo propre($descriptif);
|
|
|
160 |
echo " ";
|
|
|
161 |
echo "</font>";
|
|
|
162 |
echo "</div>";
|
|
|
163 |
}
|
|
|
164 |
echo "</td>";
|
|
|
165 |
echo "</tr></table>\n";
|
|
|
166 |
|
|
|
167 |
|
|
|
168 |
if (strlen($texte)>0){
|
|
|
169 |
echo "<FONT FACE='Verdana,Arial,Sans,sans-serif'>";
|
|
|
170 |
echo "<P>".propre($texte);
|
|
|
171 |
echo "</FONT>";
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
|
176 |
if ($id_mot) {
|
|
|
177 |
echo "<P>";
|
|
|
178 |
|
|
|
179 |
if ($connect_statut == "0minirezo")
|
|
|
180 |
$aff_articles = "'prepa','prop','publie','refuse'";
|
|
|
181 |
else
|
|
|
182 |
$aff_articles = "'prop','publie'";
|
|
|
183 |
|
|
|
184 |
afficher_rubriques(_T('info_rubriques_liees_mot'),
|
|
|
185 |
"SELECT rubrique.* FROM spip_rubriques AS rubrique, spip_mots_rubriques AS lien WHERE lien.id_mot='$id_mot'
|
|
|
186 |
AND lien.id_rubrique=rubrique.id_rubrique ORDER BY rubrique.titre");
|
|
|
187 |
|
|
|
188 |
afficher_articles(_T('info_articles_lies_mot'),
|
|
|
189 |
", spip_mots_articles AS lien WHERE lien.id_mot='$id_mot'
|
|
|
190 |
AND lien.id_article=articles.id_article AND articles.statut IN ($aff_articles) ORDER BY articles.date DESC", true);
|
|
|
191 |
|
|
|
192 |
afficher_breves(_T('info_breves_liees_mot'),
|
|
|
193 |
"SELECT breves.* FROM spip_breves AS breves, spip_mots_breves AS lien WHERE lien.id_mot='$id_mot'
|
|
|
194 |
AND lien.id_breve=breves.id_breve ORDER BY breves.date_heure DESC");
|
|
|
195 |
|
|
|
196 |
afficher_sites(_T('info_sites_lies_mot'),
|
|
|
197 |
"SELECT syndic.* FROM spip_syndic AS syndic, spip_mots_syndic AS lien WHERE lien.id_mot='$id_mot'
|
|
|
198 |
AND lien.id_syndic=syndic.id_syndic ORDER BY syndic.nom_site DESC");
|
|
|
199 |
}
|
|
|
200 |
|
|
|
201 |
fin_cadre_relief();
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
if ($connect_statut =="0minirezo"){
|
|
|
206 |
echo "<P>";
|
|
|
207 |
debut_cadre_formulaire();
|
|
|
208 |
|
|
|
209 |
echo "<FORM ACTION='mots_edit.php3' METHOD='post'>";
|
|
|
210 |
echo "<div class='serif'>";
|
|
|
211 |
|
|
|
212 |
if ($id_mot)
|
|
|
213 |
echo "<INPUT TYPE='Hidden' NAME='id_mot' VALUE='$id_mot'>\n";
|
|
|
214 |
else if ($new=='oui')
|
|
|
215 |
echo "<INPUT TYPE='Hidden' NAME='new' VALUE='oui' />\n";
|
|
|
216 |
echo "<INPUT TYPE='Hidden' NAME='redirect' VALUE=\"$redirect\" />\n";
|
|
|
217 |
echo "<INPUT TYPE='Hidden' NAME='redirect_ok' VALUE='oui' />\n";
|
|
|
218 |
echo "<INPUT TYPE='Hidden' NAME='table' VALUE='$table' />\n";
|
|
|
219 |
echo "<INPUT TYPE='Hidden' NAME='id_table' VALUE='$id_table' />\n";
|
|
|
220 |
echo "<INPUT TYPE='Hidden' NAME='ajouter_id_article' VALUE=\"$ajouter_id_article\" />\n";
|
|
|
221 |
|
|
|
222 |
$titre_mot = entites_html($titre_mot);
|
|
|
223 |
$descriptif = entites_html($descriptif);
|
|
|
224 |
$texte = entites_html($texte);
|
|
|
225 |
|
|
|
226 |
echo "<B>"._T('info_titre_mot_cle')."</B> "._T('info_obligatoire_02');
|
|
|
227 |
echo aide ("mots");
|
|
|
228 |
|
|
|
229 |
echo "<BR><INPUT TYPE='text' NAME='titre_mot' CLASS='formo' VALUE=\"$titre_mot\" SIZE='40' $onfocus />";
|
|
|
230 |
|
|
|
231 |
// dans le groupe...
|
|
|
232 |
$query_groupes = "SELECT * FROM spip_groupes_mots ORDER BY titre";
|
|
|
233 |
$result = spip_query($query_groupes);
|
|
|
234 |
if (spip_num_rows($result)>1) {
|
|
|
235 |
debut_cadre_relief("groupe-mot-24.gif");
|
|
|
236 |
echo _T('info_dans_groupe')."</label>\n";
|
|
|
237 |
echo aide ("motsgroupes");
|
|
|
238 |
echo " <SELECT NAME='id_groupe' class='fondl'>\n";
|
|
|
239 |
while ($row_groupes = spip_fetch_array($result)){
|
|
|
240 |
$groupe = $row_groupes['id_groupe'];
|
|
|
241 |
$titre_groupe = texte_backend(supprimer_tags(typo($row_groupes['titre'])));
|
|
|
242 |
echo "<OPTION".mySel($groupe, $id_groupe).">$titre_groupe</OPTION>\n";
|
|
|
243 |
}
|
|
|
244 |
echo "</SELECT>";
|
|
|
245 |
fin_cadre_relief();
|
|
|
246 |
} else {
|
|
|
247 |
$row_groupes = spip_fetch_array($result);
|
|
|
248 |
if (!$row_groupes) {
|
|
|
249 |
// il faut creer un groupe de mots (cas d'un mot cree depuis articles.php3)
|
|
|
250 |
$row_groupes['id_groupe'] = spip_abstract_insert("spip_groupes_mots",
|
|
|
251 |
"(titre, unseul, obligatoire, articles, breves, rubriques, syndic, minirezo, comite, forum)",
|
|
|
252 |
"('" .
|
|
|
253 |
addslashes(_T('info_mot_sans_groupe'))."', 'non', 'non', 'oui', 'oui', 'non', 'oui', 'oui', 'non', 'non'");
|
|
|
254 |
|
|
|
255 |
}
|
|
|
256 |
echo "<input type='hidden' name='id_groupe' value='".$row_groupes['id_groupe']."'>";
|
|
|
257 |
}
|
|
|
258 |
|
|
|
259 |
if ($options == 'avancees' OR $descriptif) {
|
|
|
260 |
echo "<B>"._T('texte_descriptif_rapide')."</B><BR>";
|
|
|
261 |
echo "<TEXTAREA NAME='descriptif' CLASS='forml' ROWS='4' COLS='40' wrap=soft>";
|
|
|
262 |
echo $descriptif;
|
|
|
263 |
echo "</TEXTAREA><P>\n";
|
|
|
264 |
}
|
|
|
265 |
else
|
|
|
266 |
echo "<INPUT TYPE='hidden' NAME='descriptif' VALUE=\"$descriptif\">";
|
|
|
267 |
|
|
|
268 |
if ($options == 'avancees' OR $texte) {
|
|
|
269 |
echo "<B>"._T('info_texte_explicatif')."</B><BR>";
|
|
|
270 |
echo "<TEXTAREA NAME='texte' ROWS='8' CLASS='forml' COLS='40' wrap=soft>";
|
|
|
271 |
echo $texte;
|
|
|
272 |
echo "</TEXTAREA><P>\n";
|
|
|
273 |
}
|
|
|
274 |
else
|
|
|
275 |
echo "<INPUT TYPE='hidden' NAME='texte' VALUE=\"$texte\">";
|
|
|
276 |
|
|
|
277 |
if ($champs_extra) {
|
|
|
278 |
include_ecrire("inc_extra.php3");
|
|
|
279 |
extra_saisie($extra, 'mots', $id_groupe);
|
|
|
280 |
}
|
|
|
281 |
|
|
|
282 |
echo "<DIV align='right'><INPUT TYPE='submit' NAME='Valider' VALUE='"._T('bouton_enregistrer')."' CLASS='fondo'></div>";
|
|
|
283 |
|
|
|
284 |
echo "</div>";
|
|
|
285 |
echo "</FORM>";
|
|
|
286 |
|
|
|
287 |
fin_cadre_formulaire();
|
|
|
288 |
}
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
fin_page();
|
|
|
292 |
|
|
|
293 |
?>
|