diff --git a/ecrire/inc_db_mysql.php3 b/ecrire/inc_db_mysql.php3 index a77c7b9a731a8b4c7ef7710a248faf6349199097..da77d5d9c4d809057c5e37a87274d43261c780d2 100644 --- a/ecrire/inc_db_mysql.php3 +++ b/ecrire/inc_db_mysql.php3 @@ -256,4 +256,31 @@ function calcul_mysql_in($val, $valeurs, $not='') { return "($in_sql)"; } + +function creer_objet_multi ($objet, $lang) { + $retour = "(IF(INSTR(".$objet.", '<multi>') = 0 , ". + " TRIM(".$objet."), ". + " CONCAT( ". + " LEFT(".$objet.", INSTR(".$objet.", '<multi>')-1), ". + " IF( ". + " INSTR(TRIM(RIGHT(".$objet.", LENGTH(".$objet.") -(6+INSTR(".$objet.", '<multi>')))),'[".$lang."]') = 0, ". + " IF( ". + " TRIM(RIGHT(".$objet.", LENGTH(".$objet.") -(6+INSTR(".$objet.", '<multi>')))) REGEXP '^\\[[a-z\_]{2,}\\]', ". + " INSERT( ". + " TRIM(RIGHT(".$objet.", LENGTH(".$objet.") -(6+INSTR(".$objet.", '<multi>')))), ". + " 1, ". + " INSTR(TRIM(RIGHT(".$objet.", LENGTH(".$objet.") -(6+INSTR(".$objet.", '<multi>')))), ']'), ". + " '' ". + " ), ". + " TRIM(RIGHT(".$objet.", LENGTH(".$objet.") -(6+INSTR(".$objet.", '<multi>')))) ". + " ), ". + " TRIM(RIGHT(".$objet.", ( LENGTH(".$objet.") - (INSTR(".$objet.", '[".$lang."]')+ LENGTH('[".$lang."]')-1) ) )) ". + " ) ". + " ) ". + ")) AS multi "; + + return $retour; +} + + ?> diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index 6bed5ee1bedd21f745ca4002d6dc00ba215970b8..3558c3be10868c3c08701eddf2af9762b3cc2f76 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -489,7 +489,8 @@ function afficher_tranches_requete(&$query, $colspan) { $query = trim($query); $query_count = eregi_replace('^(SELECT)[[:space:]].*[[:space:]](FROM)[[:space:]]', '\\1 COUNT(*) \\2 ', $query); - + $query_count = eregi_replace('ORDER[[:space:]]+BY.*$', '', $query); + list($num_rows) = spip_fetch_array(spip_query($query_count)); if (!$num_rows) return; diff --git a/ecrire/mots_tous.php3 b/ecrire/mots_tous.php3 index 6afb4400d68a8f811c6b5b9c8f162420e1874db6..de7ed7be3906a1d4b4a8b283fc96818571001874 100644 --- a/ecrire/mots_tous.php3 +++ b/ecrire/mots_tous.php3 @@ -183,7 +183,7 @@ while ($row_syndic = spip_fetch_array($result_syndic)){ // On boucle d'abord sur les groupes de mots // -$query_groupes = "SELECT * FROM spip_groupes_mots ORDER BY titre"; +$query_groupes = "SELECT *, ".creer_objet_multi ("titre", "$spip_lang")." FROM spip_groupes_mots ORDER BY multi"; $result_groupes = spip_query($query_groupes); while ($row_groupes = spip_fetch_array($result_groupes)) { @@ -239,7 +239,8 @@ while ($row_groupes = spip_fetch_array($result_groupes)) { // // Afficher les mots-cles du groupe // - $query = "SELECT * FROM spip_mots WHERE id_groupe = '$id_groupe' ORDER BY titre"; + $query = "SELECT id_mot, titre, ".creer_objet_multi ("titre", "$spip_lang")." FROM spip_mots WHERE id_groupe = '$id_groupe' ORDER BY multi"; + $tranches = afficher_tranches_requete($query, 3); $table = ''; @@ -248,8 +249,6 @@ while ($row_groupes = spip_fetch_array($result_groupes)) { echo "<div class='liste'>"; echo "<table border=0 cellspacing=0 cellpadding=3 width=\"100%\">"; - echo $tranches; - $result = spip_query($query); while ($row = spip_fetch_array($result)) { @@ -257,7 +256,8 @@ while ($row_groupes = spip_fetch_array($result_groupes)) { $id_mot = $row['id_mot']; $titre_mot = $row['titre']; - + $multi = $row['multi']; + if ($connect_statut == "0minirezo") $aff_articles="prepa,prop,publie,refuse"; else