« MediaWiki pour débutants/Sécuriser son Wiki » : différence entre les versions

Contenu supprimé Contenu ajouté
Marc (discussion | contributions)
Marc (discussion | contributions)
Ligne 77 :
 
require_once("$IP/extensions/bannedips.php");
 
== Fonction $wgSpamRegex ==
 
Cette fonction utilise des [[w:expressions régulières]] et se configure dans le fichier LocalSettings.php. Les expressions régulières sont des suites de caractères qui permettent de définir de manière économique un ensemble d'expressions. Ainsi, au lieu de faire la liste de toutes les pages d'un domaine à bannir, une expression régulière permet de résumer toutes ces pages.
 
Le site MediaWiki fournit l'exemple suivant qui interdit l'ajout de liens contenant des mots très fréquents dans les spams et qui empêche aussi l'ajout de contenu caché :
 
$wgSpamRegex = "/". # The "/" is the opening wrapper
"s-e-x|zoofilia|sexyongpin|grusskarte|geburtstagskarten|animalsex|".
"sex-with|dogsex|adultchat|adultlive|camsex|sexcam|livesex|sexchat|".
"chatsex|onlinesex|adultporn|adultvideo|adultweb.|hardcoresex|hardcoreporn|".
"teenporn|xxxporn|lesbiansex|livegirl|livenude|livesex|livevideo|camgirl|".
"spycam|voyeursex|casino-online|online-casino|kontaktlinsen|cheapest-phone|".
"laser-eye|eye-laser|fuelcellmarket|lasikclinic|cragrats|parishilton|".
"paris-hilton|paris-tape|2large|fuel-dispenser|fueling-dispenser|huojia|".
"jinxinghj|telematicsone|telematiksone|a-mortgage|diamondabrasives|".
"reuterbrook|sex-plugin|sex-zone|lazy-stars|eblja|liuhecai|".
"buy-viagra|-cialis|-levitra|boy-and-girl-kissing|". # These match spammy words
"dirare\.com|". # This matches dirare.com a spammer's domain name
"overflow\s*:\s*auto|". # This matches against overflow:auto (regardless of whitespace on either side of the colon)
"height\s*:\s*[0-4]px|". # This matches against height:0px (most CSS hidden spam) (regardless of whitespace on either side of the colon)
"\<\s*a\s*href|". # This blocks all href links entirely, forcing wiki syntax
"display\s*:\s*none". # This matches against display:none (regardless of whitespace on either side of the colon)
"/i"; # The "/" ends the regular expression and the "i" switch which follows makes the test case-insensitive
# The "\s" matches whitespace
# The "*" is a repeater (zero or more times)
# The "\s*" means to look for 0 or more amount of whitespace
 
== Ressources==