MediaWiki > MediaWiki security, MediaWiki spam protection >
Content banning allows you to stop editors from saving pages which have certain content. Unfortunately this method uses a regular expression and so most people won't be able to do anything complex without risking their sanity.
Banning spam div
blocks in MediaWiki ∞
There is no functionality to create an array of regular expressions, for tidier presentation.
See https://www.mediawiki.org/wiki/Manual:$wgSpamRegex
$wgSpamRegex="/<div/i";
so edits which include <div
should be blocked. (I can't see any of my regular users using <div>...</div>
)
You could also just use:
$wgSpamRegex="/overflow\s*:\s*auto/i";
- Blocking more than one string
$wgSpamRegexLines[] = 'display\s*:\s*none'; $wgSpamRegexLines[] = 'overflow:\s*\s*auto'; // [...] $wgSpamRegex = '/(' . implode( '|', $wgSpamRegexLines ) . ')/i';
- Notes:
Also, I believe that this combination of the two will work, but I haven't had a chance to test it yet:
$wgSpamRegex="/<div|overflow\s*:\s*auto/i";
Regex inline-commenting has not been tested, but this would be nice to use for more complex patterns.
Props to evernex.com for this beauty:
$wgSpamRegex = "/\<.*style.*?(display|position|overflow|visibility|height)\s*:.*?>/i";
I had this for a while.. but I don't think it works!!
$wgSpamRegex = "/". "overflow:\s*auto;\s*height:\s*[0-4]px;|". "\<\s*a\s*href|". "style\s*=\s*\"\s*display\s*:\s*none". "/i";
banning spam links ∞
[[http://example.org some text]]
block with
$wgSpamRegex = "/\[\[http:|^\[[^][]*\]/";
Notes / Resources ∞
-
Bad Image List -- Ban certain filenames.
Last updated 2020-07-04 at 10:27:04
ported
date estimated