Skip to content
Extraits de code Groupes Projets
Valider f969da1f rédigé par renato's avatar renato
Parcourir les fichiers

reintroduced var_recherche to debug the recherche underlining

parent 2a3c2541
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -40,26 +40,29 @@ function surligner_mots($page) {
$ref = $_SERVER['HTTP_REFERER'];
//avoid a js injection
$surcharge_surligne = preg_replace(",(?<!\\\\)',","\'",$_GET["var_recherche"]);
foreach($surlignejs_engines as $engine)
if(preg_match($engine[0],$ref))
if(preg_match($engine[1],$ref,$match)) {
//good referrer found
$script = "<script src='".find_in_path("javascript/SearchHighlight.js")."'></script>
<script type='text/javascript'>
jQuery(function(){
jQuery(document).SearchHighlight({
style_name:'spip_surligne',
exact:'whole',
style_name_suffix:false,
engines:[/^".str_replace(array("/","."),array("\/","\."),$GLOBALS['meta']['adresse_site'])."/i,/recherche=([^&]+)/i],
startHighlightComment:'".MARQUEUR_SURLIGNE."',
stopHighlightComment:'".MARQUEUR_FSURLIGNE."'
})
});
</script>";
$page = preg_replace(",</head>,",$script."\n</head>",$page);
break;
}
if($surcharge_surligne || (preg_match($engine[0],$ref) && preg_match($engine[1],$ref))) {
//good referrer found or var_recherche is not null
$script = "<script src='".find_in_path("javascript/SearchHighlight.js")."'></script>
<script type='text/javascript'>
jQuery(function(){
jQuery(document).SearchHighlight({
style_name:'spip_surligne',
exact:'whole',
style_name_suffix:false,
engines:[/^".str_replace(array("/","."),array("\/","\."),$GLOBALS['meta']['adresse_site'])."/i,/recherche=([^&]+)/i],
startHighlightComment:'".MARQUEUR_SURLIGNE."',
stopHighlightComment:'".MARQUEUR_FSURLIGNE."'".
($surcharge_surligne?",
keys:'$surcharge_surligne'":"")."
})
});
</script>";
$page = preg_replace(",</head>,",$script."\n</head>",$page);
break;
}
return $page;
}
......
......@@ -297,10 +297,10 @@ function inclure_balise_dynamique($texte, $echo=true, $ligne=0) {
}
// Traiter var_recherche pour surligner les mots
// Traiter var_recherche ou le referrer pour surligner les mots
// http://doc.spip.org/@f_surligne
function f_surligne ($texte) {
if (isset($_SERVER['HTTP_REFERER'])) {
if (isset($_SERVER['HTTP_REFERER']) || $_GET['var_recherche']) {
include_spip('inc/surligne');
$texte = surligner_mots($texte);
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter