analyser(); $carac = $carac_spec->table; reset($carac_spec->table); //Nettoyage de la chaine recherchée function nettoyer_chaine($tree = array(),&$tableau,&$tableau_l,$aq,$not) { global $empty_word,$charset; if (empty($tree)) $tree = $aq->tree; for ($i=0; $inot) $mul=-1; else $mul=1; if ($tree[$i]->sub==null) { if ($not*$mul==1) { $mot = str_replace("*","\w*",$tree[$i]->word); $mot = str_replace("+","\w+",$mot); if ($tree[$i]->literal){ $mot=pmb_strtolower(convert_diacrit($mot)); if($mot && !in_array($mot,$tableau_l) && !in_array($mot,$tableau)) $tableau_l[]= $mot; } else{ if(strlen($tree[$i]->word)<=1) $mot = ""; if($mot && !in_array($mot,$tableau) && !in_array($mot,$tableau_l)){ $tableau[]= $mot; } } } } else { $not=$not*$mul; nettoyer_chaine($tree[$i]->sub,$tableau,$tableau_l,$aq,$not); } } } $tableau=array(); $tableau_l=array(); if (!empty($user_query) && (trim($user_query) !== "*")) { $aq=new analyse_query(stripslashes($user_query),0,0,1,0,$opac_stemming_active); if (!$aq->error) { nettoyer_chaine("",$tableau,$tableau_l,$aq,1); } } //On calcule des variables de session qui seront utilisées dans surligner.js.php $_SESSION['surligner_tableau'] = strip_tags(implode("','",$tableau)); $_SESSION['surligner_tableau_l'] = strip_tags(implode("','",addslashes_array($tableau_l))); $_SESSION['surligner_codes'] = ""; $j=0; foreach($carac_spec->table as $key=>$val) { $values=explode("|",substr($val,1,strlen($val)-2)); $i=0; $temp="["; if(!isset($values[$i])) $values[$i] = ''; while ($values[$i]!="") { $temp .=$values[$i]; $i++; if(!isset($values[$i])) $values[$i] = ''; } $temp .= "]"; $_SESSION['surligner_codes'] .= "codes['".$key."']='".$temp."';\n"; $j++; } $_SESSION['surligner_key_carac'] = ""; foreach($carac_spec->table as $key=>$val) { $_SESSION['surligner_key_carac'] .= " reg=new RegExp(codes['".$key."'], 'g');\n"; $_SESSION['surligner_key_carac'] .= " chaine=chaine.replace(reg, '".$key."');\n"; } $inclure_recherche = ""; $inclure_recherche .= ""; // Ne pas déplacer l'inclusion - Ce fichier la variable de session $_SESSION['surligner_codes'] require_once("$include_path/javascript/surligner.js.php"); //$inclure_recherche .= ""; $inclure_recherche .= ""; $inclure_recherche .= ""; ?>