Browse Source

Utiliser array_column de préférence (warning en moins) tout en assurant la compat avec SPIP 3.1

pull/7/head
Matthieu Marcillaud 1 year ago
parent
commit
e031a07a76
  1. 15
      inc/nospam.php

15
inc/nospam.php

@ -124,7 +124,7 @@ function nospam_verifier_jeton($jeton, $form, $qui = null) {
$qui = nospam_hash_env();
}
}
$ok = (verifier_cle_action("jeton$form$time$qui", $jeton)
or verifier_cle_action("jeton$form$time_old$qui", $jeton));
#if (!$ok)
@ -189,7 +189,7 @@ function nospam_analyser_spams($texte) {
// on travaille d'abord sur le texte 'brut' tel que saisi par
// l'utilisateur pour ne pas avoir les class= et style= que spip ajoute
// sur les raccourcis.
// on ne tient pas compte des blocs <code> et <cadre> ni de leurs contenus
include_spip('inc/texte_mini');
if (!function_exists('echappe_html')) { // SPIP 2.x
@ -321,11 +321,16 @@ function nospam_rechercher_presence_liens_spammes($liens, $seuil, $table, $champ
$where = $condstatut . '('.implode("$like OR ", $champs)."$like)";
if (($n=sql_countsel($table, $where))>=$seuil) {
// loger les 10 premiers messages concernes pour aider le webmestre
$all = sql_allfetsel(id_table_objet($table), $table, $where, '', '', '0,10');
$all = array_map('reset', $all);
$_id = id_table_objet($table);
$all = sql_allfetsel($_id, $table, $where, '', '', '0,10');
if (function_exists('array_column')) {
$all = array_column($all, $_id);
} else {
$all = array_map('reset', $all);
}
spip_log("$n liens trouves $like dans table $table (".implode(',', $all).') [champs '.implode(',', $champs).']', 'nospam');
return $h;
}
}
return false;
}
}

Loading…
Cancel
Save