Spam Filters

https://notes.ekvastra.in/ is hosted using PmWiki. I have placed the following near the end of my local/config.php file. It prevents posts with spammish edit summary.

## if an edit form is posted
if ($action == 'edit' && preg_grep('/^post/', array_keys(@$_POST)) ) {
  $tmp_csum = trim(@$_POST['csum']);
  $tmp_csum = preg_replace('/[$`]\\w+/', '', $tmp_csum); # allow $Vars and `Text

  ## edit summary doesn't look like language
  if ($tmp_csum && ( preg_match("/^\\w*([a-z]+[A-Z]{2,})\\w*$/", $tmp_csum)
     || preg_match("/[bcdfghjklmnpqrstvwxz]{5,}/i", $tmp_csum) )
    ) {
    $WhyBlockedFmt[] = 'Invalid "edit summary" entered';
  }

  if(count($WhyBlockedFmt)) {
    $EnablePost = 0;
    $IsBlocked = 1;
  }
}