alert('".$msg["word_exist"]."'); document.location='".$baseurl."&action=add';"; } else print ""; default : //------------------------------------------- // $jscript : script de m.a.j. du parent //------------------------------------------- $jscript = " "; $words_for_syn=array(); $words_for_syn1=array(); //recherche des mots $rqt="select id_mot, mot from mots left join linked_mots on (num_mot=id_mot) where id_mot not in (select num_mot from linked_mots where linked_mots.num_linked_mot=0) group by id_mot order by mot"; $execute_query=mysql_query($rqt); while ($r=mysql_fetch_object($execute_query)) { $words_for_syn[$r->id_mot]=stripslashes($r->mot); $words_for_syn1[$r->id_mot]=convert_diacrit(pmb_strtolower($r->mot)); } if (count($words_for_syn)) { //toutes les lettres de l'alphabet dans un tableau $alphabet=array(); $alphabet[]=''; for ($i=97;$i<=122;$i++) { $alphabet[]=chr($i); } $bool=false; foreach($words_for_syn as $val) { if ($val!="") { $carac=convert_diacrit(pmb_strtolower(pmb_substr($val,0,1))); if ($bool==false) { if ($deb_rech) $premier_carac=convert_diacrit(pmb_strtolower(pmb_substr($deb_rech,0,1))); else $premier_carac=$carac; $bool=true; } if (array_search($carac,$alphabet)===FALSE) $alphabet_num[]=$carac; } } //dédoublonnage du tableau des autres caractères if (count($alphabet_num)) $alphabet_num = array_unique($alphabet_num); if (!$letter) { if (count($alphabet_num)) $letter="My"; elseif ($premier_carac) $letter=$premier_carac; else $letter="a"; } elseif (!array_search($letter,$alphabet)) $letter="My"; // affichage d'un sommaire par lettres $affichage_lettres="
"; if (count($alphabet_num)) { if ($letter=='My') $affichage_lettres.="# "; else $affichage_lettres.="# "; } foreach($alphabet as $char) { $present = pmb_preg_grep("/^$char/i", $words_for_syn1); if(sizeof($present) && strcasecmp($letter, $char)) $affichage_lettres.="$char "; else if(!strcasecmp($letter, $char)) $affichage_lettres.="$char "; else $affichage_lettres.="".$char." "; } $affichage_lettres.="
"; //affichage des mots $affichage_mots="
"; $compt=0; if (!$page) $page=1; if (!$nb_per_page) $nb_per_page=$nb_per_page_select; //parcours du tableau de mots, découpage en colonne et détermination des valeurs par rapport à la pagination et la lettre foreach ($words_for_syn as $key=>$valeur_syn) { if ($valeur_syn!="") { if ($letter!='My') { if (preg_match("/^$letter/i", convert_diacrit(pmb_strtolower($valeur_syn)))) { if (($compt>=(($page-1)*$nb_per_page))&&($compt<($page*$nb_per_page))) { $affichage_mots.=""; $affichage_mots.=htmlentities($valeur_syn,ENT_QUOTES,$charset)."
\n"; } $compt++; } } else { if (pmb_substr($valeur_syn,0,1)=='0'||!array_search(convert_diacrit(pmb_strtolower(pmb_substr($valeur_syn,0,1))),$alphabet)) { if (($compt>=(($page-1)*$nb_per_page))&&($compt<($page*$nb_per_page))) { $affichage_mots.=""; $affichage_mots.=htmlentities($valeur_syn,ENT_QUOTES,$charset)."
\n"; } } $compt++; } } } $affichage_mots.="
"; $affichage_mots.="
 

\n"; //affichage de la pagination $affichage_mots.=aff_pagination ($baseurl."&user_input=$user_input&letter=".$letter, $compt, $nb_per_page, $page) ; $affichage_mots.="
 
\n"; } //ajout du script $sel_word=str_replace("!!jscript!!",$jscript,$sel_word); //ajout des lettres $sel_word=str_replace("!!lettres!!",$affichage_lettres,$sel_word); //ajout des mots $sel_word=str_replace("!!liste_mots!!",$affichage_mots,$sel_word); //ajout de l'url $sel_word=str_replace("!!action!!",$baseurl,$sel_word); print $sel_word; } ?>