diff --git a/.gitattributes b/.gitattributes index 596b42bab9224a1f20570bfb02d8ba04a52659df..b21f413885f3991dfe0cf4635e37186b17758da9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -318,6 +318,7 @@ ecrire/action/instituer_breve.php -text ecrire/action/instituer_collaboration.php -text ecrire/action/instituer_forum.php -text ecrire/action/instituer_langue_rubrique.php -text +ecrire/action/instituer_mot.php -text ecrire/action/instituer_syndic.php -text ecrire/action/joindre.php -text ecrire/action/legender.php -text diff --git a/ecrire/action/instituer_mot.php b/ecrire/action/instituer_mot.php new file mode 100644 index 0000000000000000000000000000000000000000..bae0ad3080bdabd25c32186d44150b8d448b496b --- /dev/null +++ b/ecrire/action/instituer_mot.php @@ -0,0 +1,89 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2006 * + * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * + * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +if (!defined("_ECRIRE_INC_VERSION")) return; + +include_spip('inc/actions'); +include_spip('inc/filtres'); +include_spip('base/abstract_sql'); + +// Modifier le reglage des forums publics de l'article x +// http://doc.spip.org/@action_poster_dist +function action_instituer_mot_dist() +{ + $var_f = charger_fonction('controler_action_auteur', 'inc'); + $var_f(); + + $arg = _request('arg'); + + if (!preg_match(",^(\d+)$,", $arg, $r)) { + spip_log("action_instituer_mot_dist $arg pas compris"); + } else action_instituer_mot_post($r); +} + +// http://doc.spip.org/@action_poster_post +function action_instituer_mot_post($r) +{ + $id_mot = $r[1]; + global $titre_mot, $id_groupe, $descriptif, $texte, $new, $table, $table_id, $ajouter_id_article; + + if (strval($titre_mot)!='') { + if ($new == 'oui' && $id_groupe) { + $id_mot = spip_abstract_insert("spip_mots", '(id_groupe)', "($id_groupe)"); + + if($ajouter_id_article = intval($ajouter_id_article)) + // heureusement que c'est pour les admin complet, + // sinon bonjour le XSS + ajouter_nouveau_mot($id_groupe, $table, $table_id, $id_mot, $ajouter_id_article); + + } + + $result = spip_query("SELECT titre FROM spip_groupes_mots WHERE id_groupe=$id_groupe"); + if ($row = spip_fetch_array($result)) + $type = (corriger_caracteres($row['titre'])); + else $type = (corriger_caracteres($type)); + // recoller les champs du extra + if ($champs_extra) { + include_spip('inc/extra'); + $add_extra = extra_recup_saisie("mots"); + } else + $add_extra = ''; + + spip_query("UPDATE spip_mots SET titre=" . _q($titre_mot) . ", texte=" . _q($texte) . ", descriptif=" . _q($descriptif) . ", type=" . _q($type) . ", id_groupe=$id_groupe" . (!$add_extra ? '' : (", extra = " . _q($add_extra))) . " WHERE id_mot=$id_mot"); + + if ($GLOBALS['meta']['activer_moteur'] == 'oui') { + include_spip("inc/indexation"); + marquer_indexer('spip_mots', $id_mot); + } + } +} + +// http://doc.spip.org/@ajouter_nouveau_mot +function ajouter_nouveau_mot($id_groupe, $table, $table_id, $id_mot, $id) +{ + if (un_seul_mot_dans_groupe($id_groupe)) { + $mots = spip_query("SELECT id_mot FROM spip_mots WHERE id_groupe = $id_groupe"); + while ($r = spip_fetch_array($mots)) + spip_query("DELETE FROM spip_mots_$table WHERE id_mot=" . $r['id_mot'] ." AND $table_id=$id"); + } + spip_abstract_insert("spip_mots_$table", "(id_mot, $table_id)", "($id_mot, $id)"); +} + + +// http://doc.spip.org/@un_seul_mot_dans_groupe +function un_seul_mot_dans_groupe($id_groupe) +{ + $u = spip_fetch_array(spip_query("SELECT unseul FROM spip_groupes_mots WHERE id_groupe = $id_groupe")); + return ($u['unseul'] == 'oui'); +} + +?> diff --git a/ecrire/exec/mots_edit.php b/ecrire/exec/mots_edit.php index f4c03a1119670473750ed8aba918a4671a15a938..ecfe830e0d5f6b67b425c202bc131f8e5ea221f3 100644 --- a/ecrire/exec/mots_edit.php +++ b/ecrire/exec/mots_edit.php @@ -22,308 +22,251 @@ global $ajouter_id_article, // attention, ce n'est pas forcement un id d'article $champs_extra, $connect_statut, - $connect_toutes_rubriques, $descriptif, $id_groupe, $id_mot, $table_id, $new, - $onfocus, $options, $redirect, - $redirect_ok, $spip_display, $table, $texte, $titre, - $titre_groupe, $titre_mot, - $les_notes, - $type; + $les_notes; $id_groupe = intval($id_groupe); $id_mot = intval($id_mot); -// -// modifications mot -// - if (acces_mots()) { - if (strval($titre_mot)!='') { - if ($new == 'oui' && $id_groupe) { - $id_mot = spip_abstract_insert("spip_mots", '(id_groupe)', "($id_groupe)"); - - if($ajouter_id_article = intval($ajouter_id_article)) - // heureusement que c'est pour les admin complet, - // sinon bonjour le XSS - ajouter_nouveau_mot($id_groupe, $table, $table_id, $id_mot, $ajouter_id_article); - - } - - $result = spip_query("SELECT titre FROM spip_groupes_mots WHERE id_groupe=$id_groupe"); - if ($row = spip_fetch_array($result)) - $type = (corriger_caracteres($row['titre'])); - else $type = (corriger_caracteres($type)); - // recoller les champs du extra - if ($champs_extra) { - include_spip('inc/extra'); - $add_extra = extra_recup_saisie("mots"); - } else - $add_extra = ''; - - spip_query("UPDATE spip_mots SET titre=" . _q($titre_mot) . ", texte=" . _q($texte) . ", descriptif=" . _q($descriptif) . ", type=" . _q($type) . ", id_groupe=$id_groupe" . (!$add_extra ? '' : (", extra = " . _q($add_extra))) . " WHERE id_mot=$id_mot"); - - if ($GLOBALS['meta']['activer_moteur'] == 'oui') { - include_spip("inc/indexation"); - marquer_indexer('spip_mots', $id_mot); - } - } - else if ($new == 'oui') { - if (!$titre_mot = $titre) { - $titre_mot = filtrer_entites(_T('texte_nouveau_mot')); - $onfocus = " onfocus=\"if(!antifocus){this.value='';antifocus=true;}\""; - } - } - } - -// -// redirection ou affichage -// -if ($redirect_ok == 'oui' && $redirect) { - redirige_par_entete(rawurldecode($redirect)); -} // // Recupere les donnees // - if ($id_mot) { + $row = spip_fetch_array(spip_query("SELECT * FROM spip_mots WHERE id_mot=$id_mot")); if ($row) { $id_mot = $row['id_mot']; $titre_mot = $row['titre']; $descriptif = $row['descriptif']; $texte = $row['texte']; - $type = $row['type']; $extra = $row['extra']; $id_groupe = $row['id_groupe']; } else $id_mot = 0; - } -pipeline('exec_init',array('args'=>array('exec'=>'mots_edit','id_mot'=>$id_mot),'data'=>'')); + + pipeline('exec_init',array('args'=>array('exec'=>'mots_edit','id_mot'=>$id_mot),'data'=>'')); -debut_page("« $titre_mot »", "naviguer", "mots"); -debut_gauche(); + debut_page("« $titre_mot »", "naviguer", "mots"); + debut_gauche(); ////////////////////////////////////////////////////// // Boite "voir en ligne" // -if ($id_mot) { - debut_boite_info(); - echo "<CENTER>"; - echo "<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=1><B>"._T('titre_gauche_mots_edit')."</B></FONT>"; - echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=6><B>$id_mot</B></FONT>"; - echo "</CENTER>"; + if ($id_mot) { + debut_boite_info(); + echo "<CENTER>"; + echo "<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=1><B>"._T('titre_gauche_mots_edit')."</B></FONT>"; + echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=6><B>$id_mot</B></FONT>"; + echo "</CENTER>"; - voir_en_ligne ('mot', $id_mot); + voir_en_ligne ('mot', $id_mot); - fin_boite_info(); - } else if (!$new) {echo _T('info_mot_sans_groupe'); exit;} + fin_boite_info(); + $onfocus =''; + + } elseif (!$new OR !acces_mots()) { + echo _T('info_mot_sans_groupe'); + exit; + } else { + if (!$titre_mot = $titre) { + $titre_mot = filtrer_entites(_T('texte_nouveau_mot')); + $onfocus = " onfocus=\"if(!antifocus){this.value='';antifocus=true;}\""; + } + } ////////////////////////////////////////////////////// // Logos du mot-clef // -if ($id_mot > 0 AND acces_mots() AND ($spip_display != 4)) { - $iconifier = charger_fonction('iconifier', 'inc'); - echo $iconifier('id_mot', $id_mot, 'mots_edit'); - } + if ($id_mot > 0 AND acces_mots() AND ($spip_display != 4)) { + $iconifier = charger_fonction('iconifier', 'inc'); + echo $iconifier('id_mot', $id_mot, 'mots_edit'); + } // -// Afficher les boutons de creation d'article et de breve +// Afficher les boutons de creation // - $res =''; - -if (acces_mots() AND $id_groupe) { - $res = icone_horizontale(_T('icone_modif_groupe_mots'), generer_url_ecrire("mots_type","id_groupe=$id_groupe"), "groupe-mot-24.gif", "edit.gif", false) - . icone_horizontale(_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", false); - } - echo bloc_des_raccourcis($res . - icone_horizontale(_T('icone_voir_tous_mots_cles'), generer_url_ecrire("mots_tous",""), "mot-cle-24.gif", "rien.gif", false)); + $res =''; + if (acces_mots() AND $id_groupe) { + $res = icone_horizontale(_T('icone_modif_groupe_mots'), generer_url_ecrire("mots_type","id_groupe=$id_groupe"), "groupe-mot-24.gif", "edit.gif", false) + . icone_horizontale(_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", false); + } + echo bloc_des_raccourcis($res . icone_horizontale(_T('icone_voir_tous_mots_cles'), generer_url_ecrire("mots_tous",""), "mot-cle-24.gif", "rien.gif", false)); + echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_edit','id_mot'=>$id_mot),'data'=>'')); -echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_edit','id_mot'=>$id_mot),'data'=>'')); -creer_colonne_droite(); -echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_edit','id_mot'=>$id_mot),'data'=>'')); -debut_droite(); + creer_colonne_droite(); -debut_cadre_relief("mot-cle-24.gif"); + echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_edit','id_mot'=>$id_mot),'data'=>'')); + debut_droite(); -echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>"; -echo "<tr width='100%'>"; -echo "<td width='100%' valign='top'>"; -gros_titre($titre_mot); + debut_cadre_relief("mot-cle-24.gif"); -if ($descriptif) { - echo "<p><div style='border: 1px dashed #aaaaaa;'>"; - echo "<font size='2' face='Verdana,Arial,Sans,sans-serif'>"; - echo "<b>",_T('info_descriptif'),"</b> "; - echo propre($descriptif); - echo " "; - echo "</font>"; - echo "</div>"; -} -echo "</td>"; -echo "</tr></table>\n"; + echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>"; + echo "<tr width='100%'>"; + echo "<td width='100%' valign='top'>"; + gros_titre($titre_mot); -if (strlen($texte)>0){ - echo "<FONT FACE='Verdana,Arial,Sans,sans-serif'>"; - echo "<P>".propre($texte); - echo "</FONT>"; -} + if ($descriptif) { + echo "<p><div style='border: 1px dashed #aaaaaa;'>"; + echo "<font size='2' face='Verdana,Arial,Sans,sans-serif'>"; + echo "<b>",_T('info_descriptif'),"</b> "; + echo propre($descriptif); + echo " "; + echo "</font>"; + echo "</div>"; + } - if ($les_notes) { - echo debut_cadre_relief(); - echo "<div $dir_lang class='arial11'>"; - echo justifier("<b>"._T('info_notes')." :</b> ".$les_notes); - echo "</div>"; - echo fin_cadre_relief(); - } + echo "</td>"; + echo "</tr></table>\n"; -if ($id_mot) { - echo "<P>"; + if (strlen($texte)>0){ + echo "<FONT FACE='Verdana,Arial,Sans,sans-serif'>"; + echo "<P>".propre($texte); + echo "</FONT>"; + } - if ($connect_statut == "0minirezo") - $aff_articles = "'prepa','prop','publie','refuse'"; - else - $aff_articles = "'prop','publie'"; + if ($les_notes) { + echo debut_cadre_relief(); + echo "<div $dir_lang class='arial11'>"; + echo justifier("<b>"._T('info_notes')." :</b> ".$les_notes); + echo "</div>"; + echo fin_cadre_relief(); + } - afficher_rubriques(_T('info_rubriques_liees_mot'), array("FROM" => 'spip_rubriques AS rubrique, spip_mots_rubriques AS lien', 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_rubrique=rubrique.id_rubrique", 'ORDER BY' => "rubrique.titre")); + if ($id_mot) { + echo "<P>"; - echo afficher_articles(_T('info_articles_lies_mot'), array('FROM' => "spip_articles AS articles, spip_mots_articles AS lien", 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_article=articles.id_article AND articles.statut IN ($aff_articles)", 'ORDER BY' => "articles.date DESC")); + if ($connect_statut == "0minirezo") + $aff_articles = "'prepa','prop','publie','refuse'"; + else + $aff_articles = "'prop','publie'"; - afficher_breves(_T('info_breves_liees_mot'), array("FROM" => 'spip_breves AS breves, spip_mots_breves AS lien', 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_breve=breves.id_breve", 'ORDER BY' => "breves.date_heure DESC")); + afficher_rubriques(_T('info_rubriques_liees_mot'), array("FROM" => 'spip_rubriques AS rubrique, spip_mots_rubriques AS lien', 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_rubrique=rubrique.id_rubrique", 'ORDER BY' => "rubrique.titre")); - include_spip('inc/sites_voir'); - afficher_sites(_T('info_sites_lies_mot'), array("FROM" => 'spip_syndic AS syndic, spip_mots_syndic AS lien', 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_syndic=syndic.id_syndic", 'ORDER BY' => "syndic.nom_site DESC")); -} + echo afficher_articles(_T('info_articles_lies_mot'), array('FROM' => "spip_articles AS articles, spip_mots_articles AS lien", 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_article=articles.id_article AND articles.statut IN ($aff_articles)", 'ORDER BY' => "articles.date DESC")); -fin_cadre_relief(); + afficher_breves(_T('info_breves_liees_mot'), array("FROM" => 'spip_breves AS breves, spip_mots_breves AS lien', 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_breve=breves.id_breve", 'ORDER BY' => "breves.date_heure DESC")); + include_spip('inc/sites_voir'); + afficher_sites(_T('info_sites_lies_mot'), array("FROM" => 'spip_syndic AS syndic, spip_mots_syndic AS lien', 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_syndic=syndic.id_syndic", 'ORDER BY' => "syndic.nom_site DESC")); + } + fin_cadre_relief(); -if (acces_mots()){ - echo "<P>"; - debut_cadre_formulaire(); - echo "<div class='serif'>"; - echo generer_url_post_ecrire("mots_edit", ($id_mot ? "id_mot=$id_mot" : "")); - if ($new=='oui') - echo "<input type='hidden' name='new' VALUE='oui' />\n"; - echo "<input type='hidden' name='redirect' VALUE=\"$redirect\" />\n"; - echo "<input type='hidden' name='redirect_ok' VALUE='oui' />\n"; - echo "<input type='hidden' name='table' VALUE='$table' />\n"; - echo "<input type='hidden' name='table_id' VALUE='$table_id' />\n"; - echo "<input type='hidden' name='ajouter_id_article' VALUE=\"$ajouter_id_article\" />\n"; + if (acces_mots()){ + echo "<P>"; + debut_cadre_formulaire(); - $titre_mot = entites_html($titre_mot); - $descriptif = entites_html($descriptif); - $texte = entites_html($texte); + $res = "<div class='serif'>"; - echo "<B>"._T('info_titre_mot_cle')."</B> "._T('info_obligatoire_02'); - echo aide ("mots"); + if ($new=='oui') + $res .= "<input type='hidden' name='new' value='oui' />\n"; + $res .= "<input type='hidden' name='table' value='$table' />\n"; + $res .= "<input type='hidden' name='table_id' value='$table_id' />\n"; + $res .= "<input type='hidden' name='ajouter_id_article' value=\"$ajouter_id_article\" />\n"; + + $titre_mot = entites_html($titre_mot); + $descriptif = entites_html($descriptif); + $texte = entites_html($texte); + + $res .= "<b>"._T('info_titre_mot_cle')."</b> "._T('info_obligatoire_02'); + $res .= aide ("mots"); - echo "<BR><input type='text' NAME='titre_mot' CLASS='formo' VALUE=\"$titre_mot\" SIZE='40' $onfocus />"; + $res .= "<br /><input type='text' name='titre_mot' class='formo' value=\"$titre_mot\" size='40' $onfocus />"; - determine_groupe_mots($table, $id_groupe); + $res .= determine_groupe_mots($table, $id_groupe); - if ($options == 'avancees' OR $descriptif) { - echo "<B>"._T('texte_descriptif_rapide')."</B><BR>"; - echo "<TEXTAREA NAME='descriptif' CLASS='forml' ROWS='4' COLS='40' wrap=soft>"; - echo $descriptif; - echo "</TEXTAREA><P>\n"; - } - else - echo "<input type='hidden' NAME='descriptif' VALUE=\"$descriptif\">"; - - if ($options == 'avancees' OR $texte) { - echo "<B>"._T('info_texte_explicatif')."</B><BR>"; - echo "<TEXTAREA NAME='texte' ROWS='8' CLASS='forml' COLS='40' wrap=soft>"; - echo $texte; - echo "</TEXTAREA><P>\n"; - } - else - echo "<input type='hidden' NAME='texte' VALUE=\"$texte\">"; + if ($options == 'avancees' OR $descriptif) { + $res .= "<b>"._T('texte_descriptif_rapide')."</b><br />"; + $res .= "<textarea name='descriptif' CLASS='forml' ROWS='4' COLS='40' wrap=soft>"; + $res .= $descriptif; + $res .= "</textarea><p>\n"; + } + else + $res .= "<input type='hidden' NAME='descriptif' VALUE=\"$descriptif\">"; + + if ($options == 'avancees' OR $texte) { + $res .= "<B>"._T('info_texte_explicatif')."</B><BR>"; + $res .= "<textarea name='texte' rows='8' class='forml' cols='40' wrap='soft'>"; + $res .= $texte; + $res .= "</textarea><p>\n"; + } + else + $res .= "<input type='hidden' name='texte' value=\"$texte\">"; - if ($champs_extra) { - include_spip('inc/extra'); - echo extra_saisie($extra, 'mots', $id_groupe); - } + if ($champs_extra) { + include_spip('inc/extra'); + $res .= extra_saisie($extra, 'mots', $id_groupe); + } - echo "<DIV align='right'><input type='submit' NAME='Valider' VALUE='"._T('bouton_enregistrer')."' CLASS='fondo'></div>"; + $res .= "<div align='right'><input type='submit' value='"._T('bouton_enregistrer')."' class='fondo'></div>"; - echo "</div>"; - echo "</FORM>"; + $res .= "</div>"; - fin_cadre_formulaire(); - } + if (!$redirect) + $redirect = generer_url_ecrire('mots_tous','',false,true); + else $redirect = rawurldecode($redirect); + echo generer_action_auteur("instituer_mot", $id_mot, _DIR_RESTREINT_ABS . $redirect, $res); -echo fin_page(); + fin_cadre_formulaire(); + } + + echo fin_page(); } // http://doc.spip.org/@determine_groupe_mots function determine_groupe_mots($table, $id_groupe) { - $result = spip_query("SELECT id_groupe, titre FROM spip_groupes_mots ". ($table ? "WHERE $table='oui'" : '') . " ORDER BY titre"); + $q = spip_query("SELECT id_groupe, titre FROM spip_groupes_mots ". ($table ? "WHERE $table='oui'" : '') . " ORDER BY titre"); - echo _T('info_dans_groupe'), aide("motsgroupes"); - debut_cadre_relief("groupe-mot-24.gif"); - if (spip_num_rows($result)>1) { + if (spip_num_rows($q)>1) { - echo " <SELECT NAME='id_groupe' class='fondl'>\n"; - while ($row_groupes = spip_fetch_array($result)){ - $groupe = $row_groupes['id_groupe']; - $titre_groupe = texte_backend(supprimer_tags(typo($row_groupes['titre']))); - echo "<OPTION".mySel($groupe, $id_groupe).">$titre_groupe</OPTION>\n"; + $res = " <select name='id_groupe' class='fondl'>\n"; + while ($row = spip_fetch_array($q)){ + $groupe = $row['id_groupe']; + $titre_groupe = texte_backend(supprimer_tags(typo($row['titre']))); + $res .= "<option".mySel($groupe, $id_groupe).">$titre_groupe</option>\n"; } - echo "</SELECT>"; + $res .= "</select>"; } else { - $row_groupes = spip_fetch_array($result); - if (!$row_groupes) { - // il faut creer un groupe de mots (cas d'un mot cree depuis le script articles) + $row = spip_fetch_array($q); + if (!$row) { + // il faut creer un groupe de mots + // (cas d'un mot cree depuis le script articles) $titre = _T('info_mot_sans_groupe'); - $row_groupes['id_groupe'] = spip_abstract_insert("spip_groupes_mots", "(titre, unseul, obligatoire, articles, breves, rubriques, syndic, minirezo, comite, forum)", "(" . _q($titre) . ", 'non', 'non', '" . (($table=='articles') ? 'oui' : 'non') ."', '" . (($table=='breves') ? 'oui' : 'non') ."','" . (($table=='rubriques') ? 'oui' : 'non') ."','" . (($table=='syndic') ? 'oui' : 'non') ."', 'oui', 'non', 'non'" . ")"); - } else $titre = $row_groupes['titre']; - echo $titre, '<br />'; - echo "<input type='hidden' name='id_groupe' value='".$row_groupes['id_groupe']."' />"; + $row['id_groupe'] = spip_abstract_insert("spip_groupes_mots", "(titre, unseul, obligatoire, articles, breves, rubriques, syndic, minirezo, comite, forum)", "(" . _q($titre) . ", 'non', 'non', '" . (($table=='articles') ? 'oui' : 'non') ."', '" . (($table=='breves') ? 'oui' : 'non') ."','" . (($table=='rubriques') ? 'oui' : 'non') ."','" . (($table=='syndic') ? 'oui' : 'non') ."', 'oui', 'non', 'non'" . ")"); + } else $titre = $row['titre']; + $res = $titre + . "<br /><input type='hidden' name='id_groupe' value='".$row['id_groupe']."' />"; } - fin_cadre_relief(); -} -// http://doc.spip.org/@un_seul_mot_dans_groupe -function un_seul_mot_dans_groupe($id_groupe) -{ - $u = spip_fetch_array(spip_query("SELECT unseul FROM spip_groupes_mots WHERE id_groupe = $id_groupe")); - return ($u['unseul'] == 'oui'); + return _T('info_dans_groupe') + . aide("motsgroupes") + . debut_cadre_relief("groupe-mot-24.gif", true) + . $res + . fin_cadre_relief(true); } - -// http://doc.spip.org/@ajouter_nouveau_mot -function ajouter_nouveau_mot($id_groupe, $table, $table_id, $id_mot, $id) -{ - if (un_seul_mot_dans_groupe($id_groupe)) { - $mots = spip_query("SELECT id_mot FROM spip_mots WHERE id_groupe = $id_groupe"); - while ($r = spip_fetch_array($mots)) - spip_query("DELETE FROM spip_mots_$table WHERE id_mot=" . $r['id_mot'] ." AND $table_id=$id"); - } - spip_abstract_insert("spip_mots_$table", "(id_mot, $table_id)", "($id_mot, $id)"); -} - ?> diff --git a/ecrire/inc/grouper_mots.php b/ecrire/inc/grouper_mots.php index e151a2435e77acaef6774802e28a37fcc04dc5e0..e92e2de10e22565bdc052cbeed6d05d8ea290a6e 100644 --- a/ecrire/inc/grouper_mots.php +++ b/ecrire/inc/grouper_mots.php @@ -36,7 +36,7 @@ function inc_grouper_mots_dist($id_groupe, $cpt) { $deb_aff = _request($tmp_var); $deb_aff = ($deb_aff !== NULL ? intval($deb_aff) : 0); - $select = 'id_mot, id_groupe, titre, ' + $select = 'id_mot, id_groupe, titre, descriptif,' . creer_objet_multi ("titre", $spip_lang); $result = spip_query($q="SELECT $select FROM spip_mots WHERE id_groupe=$id_groupe ORDER BY multi" . (($deb_aff < 0) ? '' : " LIMIT $deb_aff, $nb_aff")); @@ -72,14 +72,15 @@ function afficher_groupe_mots_boucle($row, $occurrences, $total) $id_mot = $row['id_mot']; $id_groupe = $row['id_groupe']; - $titre_mot = typo($row['titre']); + $titre = typo($row['titre']); + $descriptif = entites_html($row['descriptif']); - if ($connect_statut == "0minirezo" OR $occurrences['articles'][$id_mot] > 0) - $titre_mot = "<a href='" . - generer_url_ecrire('mots_edit', "id_mot=$id_mot&redirect=" . generer_url_retour('mots_tous') . "#editer_mot-$id_groupe") . - "' class='liste-mot'>$titre_mot</a>"; - - $vals = array($titre_mot); + if ($connect_statut == "0minirezo" OR $occurrences['articles'][$id_mot] > 0) { + $h = generer_url_ecrire('mots_edit', "id_mot=$id_mot&redirect=" . generer_url_retour('mots_tous') . "#editer_mot-$id_groupe"); + if ($descriptif) $descriptif = " title=\"$descriptif\""; + $titre = "<a href='$h' class='liste-mot'$descriptif>$titre</a>"; + } + $vals = array($titre); $texte_lie = array();