1 | <?php |
---|
2 | |
---|
3 | /***************************************************************************\ |
---|
4 | * SPIP, Systeme de publication pour l'internet * |
---|
5 | * * |
---|
6 | * Copyright (c) 2001-2006 * |
---|
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 | if (!defined("_ECRIRE_INC_VERSION")) return; |
---|
14 | |
---|
15 | include_spip('inc/presentation'); |
---|
16 | include_spip('inc/actions'); |
---|
17 | include_spip('base/abstract_sql'); |
---|
18 | include_spip('inc/agenda_gestion'); |
---|
19 | include_spip('inc/pim_agenda_gestion'); |
---|
20 | |
---|
21 | // http://doc.spip.org/@exec_mots_tous_dist |
---|
22 | function exec_mots_tous_dist() |
---|
23 | { |
---|
24 | global $acces_comite, $acces_forum, $acces_minirezo, $new, $articles, $breves, $change_type, $conf_mot, $connect_statut, $connect_toutes_rubriques, $descriptif, $id_groupe, $modifier_groupe, $obligatoire, $rubriques, $spip_lang, $spip_lang_right, $supp_group, $syndic, $texte, $unseul; |
---|
25 | global $evenements, $pim_agenda; |
---|
26 | global $tables_principales; |
---|
27 | |
---|
28 | $id_groupe = intval($id_groupe); |
---|
29 | |
---|
30 | if ($conf_mot = intval($conf_mot)) { |
---|
31 | $result = spip_query("SELECT * FROM spip_mots WHERE id_mot=$conf_mot"); |
---|
32 | if ($row = spip_fetch_array($result)) { |
---|
33 | $id_mot = $row['id_mot']; |
---|
34 | $titre_mot = typo($row['titre']); |
---|
35 | $type_mot = typo($row['type']); |
---|
36 | |
---|
37 | if ($connect_statut=="0minirezo") $aff_articles="'prepa','prop','publie','refuse'"; |
---|
38 | else $aff_articles="'prop','publie'"; |
---|
39 | |
---|
40 | $nb_articles = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_articles AS lien, spip_articles AS article WHERE lien.id_mot=$conf_mot AND article.id_article=lien.id_article AND (article.statut IN ($aff_articles))>0 AND article.statut!='refuse'")); |
---|
41 | $nb_articles = $nb_articles['n']; |
---|
42 | |
---|
43 | $nb_rubriques = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_rubriques AS lien, spip_rubriques AS rubrique WHERE lien.id_mot=$conf_mot AND rubrique.id_rubrique=lien.id_rubrique")); |
---|
44 | $nb_rubriques = $nb_rubriques['n']; |
---|
45 | |
---|
46 | $nb_breves = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_breves AS lien, spip_breves AS breve WHERE lien.id_mot=$conf_mot AND breve.id_breve=lien.id_breve AND (breve.statut IN ($aff_articles))>0 AND breve.statut!='refuse'")); |
---|
47 | $nb_breves = $nb_breves['n']; |
---|
48 | |
---|
49 | $nb_sites = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_syndic AS lien, spip_syndic AS syndic WHERE lien.id_mot=$conf_mot AND syndic.id_syndic=lien.id_syndic AND (syndic.statut IN ($aff_articles))>0 AND syndic.statut!='refuse'")); |
---|
50 | $nb_sites = $nb_sites['n']; |
---|
51 | |
---|
52 | $nb_forum = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_forum AS lien, spip_forum AS forum WHERE lien.id_mot=$conf_mot AND forum.id_forum=lien.id_forum AND forum.statut='publie'")); |
---|
53 | $nb_forum = $nb_forum['n']; |
---|
54 | |
---|
55 | $nb_evenements = 0; |
---|
56 | if (isset($tables_principales['spip_evenements'])){ |
---|
57 | $nb_evenements = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_evenements AS lien, spip_evenements AS evenement WHERE lien.id_mot=$conf_mot AND evenement.id_evenement=lien.id_evenement")); |
---|
58 | $nb_evenements = $nb_evenements['n']; |
---|
59 | } |
---|
60 | |
---|
61 | $nb_agenda = 0; |
---|
62 | if (isset($tables_principales['spip_pim_agenda'])){ |
---|
63 | $nb_agenda = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_pim_agenda AS lien, spip_pim_agenda AS agenda WHERE lien.id_mot=$conf_mot AND agenda.id_agenda=lien.id_agenda")); |
---|
64 | $nb_agenda = $nb_agenda['n']; |
---|
65 | } |
---|
66 | |
---|
67 | // si le mot n'est pas lie, on demande sa suppression |
---|
68 | if ($nb_articles + $nb_breves + $nb_sites + $nb_forum + $nb_evenements + $nb_agenda == 0) { |
---|
69 | redirige_par_entete(generer_url_ecrire("mots_edit","supp_mot=$id_mot&redirect_ok=oui&redirect=" . rawurlencode(generer_url_ecrire('mots_tous')), true)); |
---|
70 | } // else traite plus loin (confirmation de suppression) |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | if ($connect_statut == '0minirezo' AND $connect_toutes_rubriques) { |
---|
75 | if (function_exists('Agenda_install')) Agenda_install(); |
---|
76 | if (function_exists('PIMAgenda_install')) PIMAgenda_install(); |
---|
77 | |
---|
78 | if ($modifier_groupe == "oui") { |
---|
79 | $change_type = (corriger_caracteres($change_type)); |
---|
80 | $texte = (corriger_caracteres($texte)); |
---|
81 | $descriptif = (corriger_caracteres($descriptif)); |
---|
82 | |
---|
83 | if (!$new) { // modif groupe |
---|
84 | spip_query("UPDATE spip_mots SET type=" . spip_abstract_quote($change_type) . " WHERE id_groupe=$id_groupe"); |
---|
85 | |
---|
86 | |
---|
87 | spip_query("UPDATE spip_groupes_mots SET titre=" . spip_abstract_quote($change_type) . ", texte=" . spip_abstract_quote($texte) . ", descriptif=" . spip_abstract_quote($descriptif) . ", unseul=" . spip_abstract_quote($unseul) . ", obligatoire=" . spip_abstract_quote($obligatoire) . ", articles=" . spip_abstract_quote($articles) . ", breves=" . spip_abstract_quote($breves) . ", rubriques=" . spip_abstract_quote($rubriques) . ", syndic=" . spip_abstract_quote($syndic) . ", minirezo=" . spip_abstract_quote($acces_minirezo) . ", comite=" . spip_abstract_quote($acces_comite) . ", forum=" . spip_abstract_quote($acces_forum) . " WHERE id_groupe=$id_groupe"); |
---|
88 | |
---|
89 | } else { // creation groupe |
---|
90 | $id_groupe = spip_abstract_insert('spip_groupes_mots', "(titre, texte, descriptif, unseul, obligatoire, articles, breves, rubriques, syndic, minirezo, comite, forum)", "(" . spip_abstract_quote($change_type) . ", " . spip_abstract_quote($texte) . " , " . spip_abstract_quote($descriptif) . " , " . spip_abstract_quote($unseul) . " , " . spip_abstract_quote($obligatoire) . " , " . spip_abstract_quote($articles) . " ," . spip_abstract_quote($breves) . " , " . spip_abstract_quote($rubriques) . " , " . spip_abstract_quote($syndic) . " , " . spip_abstract_quote($acces_minirezo) . " , " . spip_abstract_quote($acces_comite) . " , " . spip_abstract_quote($acces_forum) . " )"); |
---|
91 | } |
---|
92 | if ($id_groupe && isset($tables_principales['spip_evenements'])) |
---|
93 | spip_query("UPDATE spip_groupes_mots SET evenements=".spip_abstract_quote($evenements)." WHERE id_groupe=$id_groupe"); |
---|
94 | if ($id_groupe && isset($tables_principales['spip_pim_agenda'])) |
---|
95 | spip_query("UPDATE spip_groupes_mots SET pim_agenda=".spip_abstract_quote($pim_agenda)." WHERE id_groupe=$id_groupe"); |
---|
96 | } |
---|
97 | if ($supp_group){ |
---|
98 | spip_query("DELETE FROM spip_groupes_mots WHERE id_groupe=" . intval($supp_group)); |
---|
99 | } |
---|
100 | } |
---|
101 | |
---|
102 | |
---|
103 | pipeline('exec_init',array('args'=>array('exec'=>'mots_tous'),'data'=>'')); |
---|
104 | debut_page(_T('titre_page_mots_tous'), "naviguer", "mots"); |
---|
105 | debut_gauche(); |
---|
106 | |
---|
107 | echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_tous'),'data'=>'')); |
---|
108 | creer_colonne_droite(); |
---|
109 | echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_tous'),'data'=>'')); |
---|
110 | debut_droite(); |
---|
111 | |
---|
112 | gros_titre(_T('titre_mots_tous')); |
---|
113 | if (acces_mots()) { |
---|
114 | echo typo(_T('info_creation_mots_cles')) . aide ("mots") ; |
---|
115 | } |
---|
116 | echo "<br><br>"; |
---|
117 | |
---|
118 | // Preliminaire: confirmation de suppression d'un mot lie à qqch |
---|
119 | // (cf fin de afficher_groupe_mots_boucle executee a l'appel precedent) |
---|
120 | // Faudrait ajaxer ça. |
---|
121 | |
---|
122 | if ($conf_mot = intval($conf_mot)) { |
---|
123 | $row = spip_fetch_array(spip_query("SELECT * FROM spip_mots WHERE id_mot=$conf_mot")); |
---|
124 | $id_mot = $row['id_mot']; |
---|
125 | $titre_mot = typo($row['titre']); |
---|
126 | $type_mot = typo($row['type']); |
---|
127 | |
---|
128 | if (($na = intval($na)) == 1) { |
---|
129 | $texte_lie = _T('info_un_article')." "; |
---|
130 | } else if ($na > 1) { |
---|
131 | $texte_lie = _T('info_nombre_articles', array('nb_articles' => $na)) ." "; |
---|
132 | } |
---|
133 | if (($nb = intval($nb)) == 1) { |
---|
134 | $texte_lie .= _T('info_une_breve')." "; |
---|
135 | } else if ($nb > 1) { |
---|
136 | $texte_lie .= _T('info_nombre_breves', array('nb_breves' => $nb))." "; |
---|
137 | } |
---|
138 | if (($ns = intval($ns)) == 1) { |
---|
139 | $texte_lie .= _T('info_un_site')." "; |
---|
140 | } else if ($ns > 1) { |
---|
141 | $texte_lie .= _T('info_nombre_sites', array('nb_sites' => $ns))." "; |
---|
142 | } |
---|
143 | if (($nr = intval($nr)) == 1) { |
---|
144 | $texte_lie .= _T('info_une_rubrique')." "; |
---|
145 | } else if ($nr > 1) { |
---|
146 | $texte_lie .= _T('info_nombre_rubriques', array('nb_rubriques' => $nr))." "; |
---|
147 | } |
---|
148 | if ($nb_evenements == 1) { |
---|
149 | $texte_lie .= _T('agenda:info_un_evenement')." "; |
---|
150 | } else if ($nb_evenements > 1) { |
---|
151 | $texte_lie .= _T('agenda:info_nombre_evenements', array('$nb_evenements' => $nb_evenements))." "; |
---|
152 | } |
---|
153 | |
---|
154 | debut_boite_info(); |
---|
155 | echo "<div class='serif'>"; |
---|
156 | echo _T('info_delet_mots_cles', array('titre_mot' => $titre_mot, 'type_mot' => $type_mot, 'texte_lie' => $texte_lie)); |
---|
157 | |
---|
158 | echo "<UL>"; |
---|
159 | echo "<LI><B><A href='", |
---|
160 | redirige_action_auteur('editer_mot', ",$id_mot,,,",'mots_tous'), |
---|
161 | "'>", |
---|
162 | _T('item_oui'), |
---|
163 | "</A>,</B> ", |
---|
164 | _T('info_oui_suppression_mot_cle'); |
---|
165 | echo "<LI><B><A href='" . generer_url_ecrire("mots_tous","") . "'>"._T('item_non')."</A>,</B> "._T('info_non_suppression_mot_cle'); |
---|
166 | echo "</UL>"; |
---|
167 | echo "</div>"; |
---|
168 | fin_boite_info(); |
---|
169 | echo "<br />"; |
---|
170 | } |
---|
171 | |
---|
172 | // |
---|
173 | // On boucle d'abord sur les groupes de mots |
---|
174 | // |
---|
175 | |
---|
176 | $result_groupes = spip_query("SELECT *, ".creer_objet_multi ("titre", "$spip_lang")." FROM spip_groupes_mots ORDER BY multi"); |
---|
177 | |
---|
178 | |
---|
179 | while ($row_groupes = spip_fetch_array($result_groupes)) { |
---|
180 | $id_groupe = $row_groupes['id_groupe']; |
---|
181 | $titre_groupe = typo($row_groupes['titre']); |
---|
182 | $descriptif = $row_groupes['descriptif']; |
---|
183 | $texte = $row_groupes['texte']; |
---|
184 | $unseul = $row_groupes['unseul']; |
---|
185 | $obligatoire = $row_groupes['obligatoire']; |
---|
186 | $articles = $row_groupes['articles']; |
---|
187 | $breves = $row_groupes['breves']; |
---|
188 | $rubriques = $row_groupes['rubriques']; |
---|
189 | $syndic = $row_groupes['syndic']; |
---|
190 | if (isset($tables_principales['spip_evenements'])) $evenements = $row_groupes['evenements']; |
---|
191 | if (isset($tables_principales['spip_pim_agenda'])) $pim_agenda = $row_groupes['pim_agenda']; |
---|
192 | $acces_minirezo = $row_groupes['minirezo']; |
---|
193 | $acces_comite = $row_groupes['comite']; |
---|
194 | $acces_forum = $row_groupes['forum']; |
---|
195 | |
---|
196 | // Afficher le titre du groupe |
---|
197 | debut_cadre_enfonce("groupe-mot-24.gif", false, '', $titre_groupe); |
---|
198 | // Affichage des options du groupe (types d'elements, permissions...) |
---|
199 | echo "<font face='Verdana,Arial,Sans,sans-serif' size=1>"; |
---|
200 | if ($articles == "oui") echo "> "._T('info_articles_2')." "; |
---|
201 | if ($breves == "oui") echo "> "._T('info_breves_02')." "; |
---|
202 | if ($rubriques == "oui") echo "> "._T('info_rubriques')." "; |
---|
203 | if ($syndic == "oui") echo "> "._T('icone_sites_references')." "; |
---|
204 | if (isset($tables_principales['spip_evenements'])) |
---|
205 | if ($evenements == "oui") echo "> "._T('agenda:info_evenements')." "; |
---|
206 | if (isset($tables_principales['spip_pim_agenda'])) |
---|
207 | if ($pim_agenda == "oui") echo "> "._T('pimagenda:info_evenements')." "; |
---|
208 | |
---|
209 | if ($unseul == "oui" OR $obligatoire == "oui") echo "<br>"; |
---|
210 | if ($unseul == "oui") echo "> "._T('info_un_mot')." "; |
---|
211 | if ($obligatoire == "oui") echo "> "._T('info_groupe_important')." "; |
---|
212 | |
---|
213 | echo "<br />"; |
---|
214 | if ($acces_minirezo == "oui") echo "> "._T('info_administrateurs')." "; |
---|
215 | if ($acces_comite == "oui") echo "> "._T('info_redacteurs')." "; |
---|
216 | if ($acces_forum == "oui") echo "> "._T('info_visiteurs_02')." "; |
---|
217 | |
---|
218 | echo "</font>"; |
---|
219 | if ($descriptif) { |
---|
220 | echo "<div style='border: 1px dashed #aaaaaa;'>"; |
---|
221 | echo "<font size='2' face='Verdana,Arial,Sans,sans-serif'>"; |
---|
222 | echo "<b>",_T('info_descriptif'),"</b> "; |
---|
223 | echo propre($descriptif); |
---|
224 | echo " "; |
---|
225 | echo "</font>"; |
---|
226 | echo "</div>"; |
---|
227 | } |
---|
228 | |
---|
229 | if (strlen($texte)>0){ |
---|
230 | echo "<FONT FACE='Verdana,Arial,Sans,sans-serif'>"; |
---|
231 | echo propre($texte); |
---|
232 | echo "</FONT>"; |
---|
233 | } |
---|
234 | |
---|
235 | // |
---|
236 | // Afficher les mots-cles du groupe |
---|
237 | // |
---|
238 | $supprimer_groupe = afficher_groupe_mots($id_groupe); |
---|
239 | |
---|
240 | echo $supprimer_groupe; |
---|
241 | |
---|
242 | if (acces_mots() AND !$conf_mot){ |
---|
243 | echo "\n<table cellpadding=0 cellspacing=0 border=0 width=100%>"; |
---|
244 | echo "<tr>"; |
---|
245 | echo "<td>"; |
---|
246 | icone(_T('icone_modif_groupe_mots'), generer_url_ecrire("mots_type","id_groupe=$id_groupe"), "groupe-mot-24.gif", "edit.gif"); |
---|
247 | echo "</td>"; |
---|
248 | if (!$supprimer_groupe) { |
---|
249 | echo "<td>"; |
---|
250 | icone(_T('icone_supprimer_groupe_mots'), generer_url_ecrire("mots_tous","supp_group=$id_groupe"), "groupe-mot-24.gif", "supprimer.gif"); |
---|
251 | echo "</td>"; |
---|
252 | echo "<td> </td>"; // Histoire de forcer "supprimer" un peu plus vers la gauche |
---|
253 | } |
---|
254 | echo "<td>"; |
---|
255 | echo "<div align='$spip_lang_right'>"; |
---|
256 | icone(_T('icone_creation_mots_cles'), generer_url_ecrire("mots_edit","new=oui&id_groupe=$id_groupe&redirect=" . generer_url_retour('mots_tous')), "mot-cle-24.gif", "creer.gif"); |
---|
257 | echo "</div>"; |
---|
258 | echo "</td></tr></table>"; |
---|
259 | } |
---|
260 | |
---|
261 | fin_cadre_enfonce(); |
---|
262 | } |
---|
263 | |
---|
264 | if (acces_mots() AND !$conf_mot){ |
---|
265 | echo "<p> </p><div align='right'>"; |
---|
266 | icone(_T('icone_creation_groupe_mots'), generer_url_ecrire("mots_type","new=oui"), "groupe-mot-24.gif", "creer.gif"); |
---|
267 | echo "</div>"; |
---|
268 | } |
---|
269 | |
---|
270 | fin_page(); |
---|
271 | } |
---|
272 | |
---|
273 | |
---|
274 | // |
---|
275 | // Calculer les nombres d'elements (articles, etc.) lies a chaque mot |
---|
276 | // |
---|
277 | |
---|
278 | // http://doc.spip.org/@calculer_liens_mots |
---|
279 | function calculer_liens_mots() |
---|
280 | { |
---|
281 | |
---|
282 | if ($GLOBALS['connect_statut'] =="0minirezo") $aff_articles = "'prepa','prop','publie'"; |
---|
283 | else $aff_articles = "'prop','publie'"; |
---|
284 | |
---|
285 | $articles = array(); |
---|
286 | $result_articles = spip_query("SELECT COUNT(*) as cnt, lien.id_mot FROM spip_mots_articles AS lien, spip_articles AS article WHERE article.id_article=lien.id_article AND article.statut IN ($aff_articles) GROUP BY lien.id_mot"); |
---|
287 | while ($row = spip_fetch_array($result_articles)){ |
---|
288 | $articles[$row['id_mot']] = $row['cnt']; |
---|
289 | } |
---|
290 | |
---|
291 | |
---|
292 | $rubriques = array(); |
---|
293 | $result_rubriques = spip_query("SELECT COUNT(*) AS cnt, lien.id_mot FROM spip_mots_rubriques AS lien, spip_rubriques AS rubrique WHERE rubrique.id_rubrique=lien.id_rubrique GROUP BY lien.id_mot"); |
---|
294 | |
---|
295 | while ($row = spip_fetch_array($result_rubriques)){ |
---|
296 | $rubriques[$row['id_mot']] = $row['cnt']; |
---|
297 | } |
---|
298 | |
---|
299 | $breves = array(); |
---|
300 | $result_breves = spip_query("SELECT COUNT(*) AS cnt, lien.id_mot FROM spip_mots_breves AS lien, spip_breves AS breve WHERE breve.id_breve=lien.id_breve AND breve.statut IN ($aff_articles) GROUP BY lien.id_mot"); |
---|
301 | |
---|
302 | while ($row = spip_fetch_array($result_breves)){ |
---|
303 | $breves[$row['id_mot']] = $row['cnt']; |
---|
304 | } |
---|
305 | |
---|
306 | $syndic = array(); |
---|
307 | $result_syndic = spip_query("SELECT COUNT(*) AS cnt, lien.id_mot FROM spip_mots_syndic AS lien, spip_syndic AS syndic WHERE syndic.id_syndic=lien.id_syndic AND syndic.statut IN ($aff_articles) GROUP BY lien.id_mot"); |
---|
308 | while ($row = spip_fetch_array($result_syndic)){ |
---|
309 | $sites[$row['id_mot']] = $row['cnt']; |
---|
310 | |
---|
311 | } |
---|
312 | |
---|
313 | return array('articles' => $articles, |
---|
314 | 'breves' => $breves, |
---|
315 | 'rubriques' => $rubriques, |
---|
316 | 'syndic' => $syndic); |
---|
317 | } |
---|
318 | |
---|
319 | // http://doc.spip.org/@afficher_groupe_mots |
---|
320 | function afficher_groupe_mots($id_groupe) { |
---|
321 | global $connect_id_auteur, $connect_statut; |
---|
322 | global $spip_lang_right, $couleur_claire, $spip_lang; |
---|
323 | |
---|
324 | $jjscript = array("fonction" => "afficher_groupe_mots", |
---|
325 | "id_groupe" => $id_groupe); |
---|
326 | $jjscript = (serialize($jjscript)); |
---|
327 | $hash = "0x".substr(md5($connect_id_auteur.$jjscript), 0, 16); |
---|
328 | $tmp_var = substr($hash, 2, 6); |
---|
329 | |
---|
330 | $javascript = "charger_id_url('" . generer_url_ecrire('memoriser',"&var_ajax=1&id_ajax_fonc=::id_ajax_fonc::::deb::", true) . "','$tmp_var')"; |
---|
331 | |
---|
332 | $select = 'id_mot, titre, ' . creer_objet_multi ("titre", $spip_lang); |
---|
333 | $from = 'spip_mots'; |
---|
334 | $where = "id_groupe=$id_groupe" ; |
---|
335 | |
---|
336 | $cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM $from WHERE $where")); |
---|
337 | |
---|
338 | if (! ($cpt = $cpt['n'])) return '' ; |
---|
339 | |
---|
340 | $occurrences = calculer_liens_mots(); |
---|
341 | |
---|
342 | $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 1"); |
---|
343 | if ($row = spip_fetch_array($res_proch)) { |
---|
344 | $id_ajax_fonc = $row["id_ajax_fonc"]; |
---|
345 | } else { |
---|
346 | include_spip('base/abstract_sql'); |
---|
347 | $id_ajax_fonc = spip_abstract_insert("spip_ajax_fonc", "(id_auteur, variables, hash, date)", "($connect_id_auteur, " . spip_abstract_quote($jjscript) . ", $hash, NOW())"); |
---|
348 | } |
---|
349 | |
---|
350 | $nb_aff = 1.5 * _TRANCHES; |
---|
351 | $deb_aff = intval(_request('t_' .$tmp_var)); |
---|
352 | $limit = ($deb_aff >= 0 ? "$deb_aff, $nb_aff" : "99999"); |
---|
353 | |
---|
354 | if ($cpt > $nb_aff) { |
---|
355 | $nb_aff = (_TRANCHES); |
---|
356 | $tranches = afficher_tranches_requete($cpt, 3, $tmp_var, $javascript, $nb_aff); |
---|
357 | } else $tranches = ''; |
---|
358 | |
---|
359 | |
---|
360 | $table = array(); |
---|
361 | $result = spip_query("SELECT $select FROM $from WHERE $where ORDER BY multi LIMIT $limit"); |
---|
362 | while ($row = spip_fetch_array($result)) { |
---|
363 | $table[] = afficher_groupe_mots_boucle($row, $occurrences); |
---|
364 | } |
---|
365 | |
---|
366 | if ($connect_statut=="0minirezo") { |
---|
367 | $largeurs = array('', 100, 130); |
---|
368 | $styles = array('arial11', 'arial1', 'arial1'); |
---|
369 | } |
---|
370 | else { |
---|
371 | $largeurs = array('', 100); |
---|
372 | $styles = array('arial11', 'arial1'); |
---|
373 | } |
---|
374 | |
---|
375 | $res = http_img_pack("searching.gif", "*", "style='visibility: hidden; position: absolute; $spip_lang_right: 0px; top: -20px;' id='img_$tmp_var'") |
---|
376 | . "<div class='liste'>" |
---|
377 | . "<table border='0' cellspacing='0' cellpadding='3' width='100%'>" |
---|
378 | . str_replace("::id_ajax_fonc::", "$id_ajax_fonc", $tranches) |
---|
379 | . afficher_liste($largeurs, $table, $styles) |
---|
380 | . "</table>" |
---|
381 | . "</div>"; |
---|
382 | |
---|
383 | if ($deb_aff) return $res; |
---|
384 | |
---|
385 | return "<div id='$tmp_var' style='position: relative;'>$res</div>"; |
---|
386 | } |
---|
387 | |
---|
388 | // http://doc.spip.org/@afficher_groupe_mots_boucle |
---|
389 | function afficher_groupe_mots_boucle($row, $occurrences) |
---|
390 | { |
---|
391 | global $connect_statut, $connect_toutes_rubriques; |
---|
392 | |
---|
393 | $id_mot = $row['id_mot']; |
---|
394 | $titre_mot = typo($row['titre']); |
---|
395 | |
---|
396 | if ($connect_statut == "0minirezo" OR $occurrences['articles'][$id_mot] > 0) |
---|
397 | $titre_mot = "<a href='" . |
---|
398 | generer_url_ecrire('mots_edit', "id_mot=$id_mot&redirect=" . generer_url_retour('mots_tous')) . |
---|
399 | "' class='liste-mot'>$titre_mot</a>"; |
---|
400 | |
---|
401 | $vals = array($titre_mot); |
---|
402 | |
---|
403 | $texte_lie = array(); |
---|
404 | |
---|
405 | $na = isset($occurrences['articles'][$id_mot]) ? $occurrences['articles'][$id_mot] : 0; |
---|
406 | if ($na == 1) |
---|
407 | $texte_lie[] = _T('info_1_article'); |
---|
408 | else if ($na > 1) |
---|
409 | $texte_lie[] = $na." "._T('info_articles_02'); |
---|
410 | |
---|
411 | $nb = isset($occurrences['breves'][$id_mot]) ? $occurrences['breves'][$id_mot] : 0; |
---|
412 | if ($nb == 1) |
---|
413 | $texte_lie[] = _T('info_1_breve'); |
---|
414 | else if ($nb > 1) |
---|
415 | $texte_lie[] = $nb." "._T('info_breves_03'); |
---|
416 | |
---|
417 | $ns = isset($occurrences['sites'][$id_mot]) ? $occurrences['sites'][$id_mot] : 0; |
---|
418 | if ($ns == 1) |
---|
419 | $texte_lie[] = _T('info_1_site'); |
---|
420 | else if ($ns > 1) |
---|
421 | $texte_lie[] = $ns." "._T('info_sites'); |
---|
422 | |
---|
423 | $nr = isset($occurrences['rubriques'][$id_mot]) ? $occurrences['rubriques'][$id_mot] : 0; |
---|
424 | if ($nr == 1) |
---|
425 | $texte_lie[] = _T('info_une_rubrique_02'); |
---|
426 | else if ($nr > 1) |
---|
427 | $texte_lie[] = $nr." "._T('info_rubriques_02'); |
---|
428 | |
---|
429 | $texte_lie = join($texte_lie,", "); |
---|
430 | |
---|
431 | $vals[] = $texte_lie; |
---|
432 | |
---|
433 | if (acces_mots()) { |
---|
434 | $href = ($nr OR $na OR $ns OR $nb) |
---|
435 | ? generer_url_ecrire("mots_tous","conf_mot=$id_mot&na=$na&nb=$nb&nr=$nr&ns=$ns") |
---|
436 | : redirige_action_auteur('editer_mot', ",$id_mot,,,",'mots_tous'); |
---|
437 | |
---|
438 | $vals[] = "<div style='text-align:right;'><a href='$href'>" |
---|
439 | . _T('info_supprimer_mot') |
---|
440 | . " <img src='" |
---|
441 | . _DIR_IMG_PACK |
---|
442 | . "croix-rouge.gif' alt='X' width='7' height='7' align='bottom' /></a></div>"; |
---|
443 | } |
---|
444 | |
---|
445 | return $vals; |
---|
446 | } |
---|
447 | ?> |
---|