Working With MediaWiki
display to tables, for some reason.)
MediaWiki:Common.js, as you could guess, is meant to contain custom JavaScript that will be added to every page. It is often used to add additional functionality to help with the viewing or editing experience. The more standardized way to add such functionality is via the Gadgets extension ( see here ), although there you’re restricted to the gadgets that the administrator has selected for the wiki (this may change in the future).
In addition to Common.css and Common.js, there are pages that you can use to define custom JavaScript or CSS to be used only for one skin, or only for one user group. These follow a standard naming convention: to add CSS only for the MonoBook skin, for instance, you would add it to the page MediaWiki:monobook.css, while to add CSS only for the “bureaucrat” group, you would add it to the page MediaWiki:group-bureaucrat.css.
Site notice
You can set a message to be displayed at the top of every page; this is useful when you want to make a general announcement, such as that there will be an upcoming site outage, or that the wiki has some new feature, or that volunteers are needed for some task, etc. This can be done in a variety of ways:
Setting the global variable $wgSiteNotice in LocalSettings.php.
Modifying the page “MediaWiki:sitenotice”.
Modifying the page “MediaWiki:anonnotice” — this displays a notice only for anonymous, non-logged-in users.
Using the extension CentralNotice — this is a fairly heavy-duty extension, that allows for coordinating an entire “campaign” of banner ads and the like among a group of wikis; it is used by the Wikimedia Foundation during its annual fundraising drive:
https://www.mediawiki.org/wiki/Extension:CentralNotice
Using the extension DismissableSiteNotice — this extension displays a site notice that users can dismiss by clicking on a link, after which they won’t see it again:
https://www.mediawiki.org/wiki/Extension:DismissableSiteNotice
14 Protecting content
Handling spam
The web 2.0 revolution of user-generated content, for all its positive impact, has also been a godsend for spammers. Never before in human history has it been so easy to sell dubious merchandise or services, whether it’s prescription drugs, life insurance, college essay writing, or more of those prescription drugs. So spam has infiltrated countless blog comments, Twitter feeds, and wiki pages. If your wiki is not public, or is public but has closed registration, then you have nothing to fear and you can skip ahead to the next chapter. If, however, your wiki allows contributions from the general public, then chances are good that, at some point, one or more groups of wiki-spammers will find it and will start trying to turn it into a free advertising platform.
MediaWiki already does an important task in preventing spam, which is to add a “nofollow” tag to the HTML of every external link — this tells search engines not to go to that link, thus greatly minimizing the benefit that adding links can provide to spammers. You can undo that behavior, by the way, by adding the following to LocalSettings.php, though you really shouldn’t:
$wgNoFollowLinks = false;
Still, for whatever reason, some spammers really like to hit MediaWiki sites. Thankfully, there are a number of effective extensions that let you fight back against spam. The two most important ones, which are recommended for every publicly-editable wiki, are ConfirmEdit and SpamBlacklist; we’ll get to those in the next sections.
ConfirmEdit
The ConfirmEdit extensioncomes bundled in with every MediaWiki install. Its documentation can be found here:
https://www.mediawiki.org/wiki/Extension:ConfirmEdit
It sets up a CAPTCHAtool for page edits, user registration and user login. A CAPTCHA (which stands for "Completely Automated Public Turing test to tell Computers and Humans Apart") is any input that’s designed so that a human can enter but a software program can’t: its most common variety is those now-ubiquitous tests in online forms that ask you to look at an image with distorted numbers and letters and type them in. ConfirmEdit provides, at the moment, six different CAPTCHA options. They are:
SimpleCaptcha — the default option. Displays a simple math problem.
FancyCaptcha — displays an image of stylized set of letters that users have to decipher (this option is most like the standard CAPTCHAs).
MathCaptcha — like SimpleCaptcha, but the math problem
Weitere Kostenlose Bücher