[ Index ] |
|
Code source de SPIP 1.8.3 |
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 *, ".creer_objet_multi ("titre", "$spip_lang")." FROM spip_groupes_mots ORDER BY multi"; 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 id_mot, titre, ".creer_objet_multi ("titre", "$spip_lang")." FROM spip_mots WHERE id_groupe = '$id_groupe' ORDER BY multi"; 243 244 $tranches = afficher_tranches_requete($query, 3); 245 246 $table = ''; 247 248 if (strlen($tranches)) { 249 echo "<div class='liste'>"; 250 echo "<table border=0 cellspacing=0 cellpadding=3 width=\"100%\">"; 251 252 echo $tranches; 253 254 $result = spip_query($query); 255 while ($row = spip_fetch_array($result)) { 256 257 $vals = ''; 258 259 $id_mot = $row['id_mot']; 260 $titre_mot = $row['titre']; 261 262 if ($connect_statut == "0minirezo") 263 $aff_articles="prepa,prop,publie,refuse"; 264 else 265 $aff_articles="prop,publie"; 266 267 if ($id_mot!=$conf_mot) { 268 $couleur = $ifond ? "#FFFFFF" : $couleur_claire; 269 $ifond = $ifond ^ 1; 270 271 if ($connect_statut == "0minirezo" OR $nb_articles[$id_mot] > 0) 272 $s = "<a href='mots_edit.php3?id_mot=$id_mot&redirect=mots_tous.php3' class='liste-mot'>".typo($titre_mot)."</a>"; 273 else 274 $s = typo($titre_mot); 275 276 $vals[] = $s; 277 278 $texte_lie = array(); 279 280 if ($nb_articles[$id_mot] == 1) 281 $texte_lie[] = _T('info_1_article'); 282 else if ($nb_articles[$id_mot] > 1) 283 $texte_lie[] = $nb_articles[$id_mot]." "._T('info_articles_02'); 284 285 if ($nb_breves[$id_mot] == 1) 286 $texte_lie[] = _T('info_1_breve'); 287 else if ($nb_breves[$id_mot] > 1) 288 $texte_lie[] = $nb_breves[$id_mot]." "._T('info_breves_03'); 289 290 if ($nb_sites[$id_mot] == 1) 291 $texte_lie[] = _T('info_1_site'); 292 else if ($nb_sites[$id_mot] > 1) 293 $texte_lie[] = $nb_sites[$id_mot]." "._T('info_sites'); 294 295 if ($nb_rubriques[$id_mot] == 1) 296 $texte_lie[] = _T('info_une_rubrique_02'); 297 else if ($nb_rubriques[$id_mot] > 1) 298 $texte_lie[] = $nb_rubriques[$id_mot]." "._T('info_rubriques_02'); 299 300 $texte_lie = join($texte_lie,", "); 301 302 $vals[] = $texte_lie; 303 304 305 if ($connect_statut=="0minirezo") { 306 $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='bottom' /></a>"; 307 } 308 309 $table[] = $vals; 310 311 312 } 313 314 } 315 if ($connect_statut=="0minirezo") { 316 $largeurs = array('', 100, 130); 317 $styles = array('arial11', 'arial1', 'arial1'); 318 } 319 else { 320 $largeurs = array('', 100); 321 $styles = array('arial11', 'arial1'); 322 } 323 afficher_liste($largeurs, $table, $styles); 324 325 echo "</table>"; 326 // fin_cadre_relief(); 327 echo "</div>"; 328 $supprimer_groupe = false; 329 } 330 else 331 if ($connect_statut =="0minirezo") 332 $supprimer_groupe = true; 333 334 if ($connect_statut =="0minirezo" AND !$conf_mot){ 335 echo "\n<table cellpadding=0 cellspacing=0 border=0 width=100%>"; 336 echo "<tr>"; 337 echo "<td>"; 338 icone(_T('icone_modif_groupe_mots'), "mots_type.php3?id_groupe=$id_groupe", "groupe-mot-24.gif", "edit.gif"); 339 echo "</td>"; 340 if ($supprimer_groupe) { 341 echo "<td>"; 342 icone(_T('icone_supprimer_groupe_mots'), "mots_tous.php3?supp_group=$id_groupe", "groupe-mot-24.gif", "supprimer.gif"); 343 echo "</td>"; 344 echo "<td> </td>"; // Histoire de forcer "supprimer" un peu plus vers la gauche 345 } 346 echo "<td>"; 347 echo "<div align='$spip_lang_right'>"; 348 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"); 349 echo "</div>"; 350 echo "</td></tr></table>"; 351 } 352 353 fin_cadre_enfonce(); 354 } 355 356 if ($connect_statut =="0minirezo" AND !$conf_mot){ 357 echo "<p> </p><div align='right'>"; 358 icone(_T('icone_creation_groupe_mots'), "mots_type.php3?new=oui", "groupe-mot-24.gif", "creer.gif"); 359 echo "</div>"; 360 } 361 362 fin_page(); 363 364 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Feb 22 22:27:47 2007 | par Balluche grâce à PHPXref 0.7 |