username
* Wrap special page summary message '$specialPageName-summary' into a div
with class 'mw-specialpage-summary'
+* $wgSummarySpamRegex added to handle edit summary spam. This is used *instead*
+ of $wgSpamRegex for edit summary checks. Text checks still use $wgSpamRegex.
=== Bug fixes in 1.15 ===
* (bug 16968) Special:Upload no longer throws useless warnings.
/**
- * Edits matching these regular expressions in body text or edit summary
+ * Edits matching these regular expressions in body text
* will be recognised as spam and rejected automatically.
*
* There's no administrator override on-wiki, so be careful what you set. :)
*/
$wgSpamRegex = array();
+/** Same as the above except for edit summaries */
+$wgSummarySpamRegex = array();
+
/** Similarly you can get a function to do the job. The function will be given
* the following args:
* - a Title object for the article the edit is made on
$this->mMetaData = '' ;
# Check for spam
- $match = self::matchSpamRegex( $this->summary );
+ $match = self::matchSummarySpamRegex( $this->summary );
if ( $match === false ) {
$match = self::matchSpamRegex( $this->textbox1 );
}
*/
public static function matchSpamRegex( $text ) {
global $wgSpamRegex;
- if ( $wgSpamRegex ) {
- // For back compatibility, $wgSpamRegex may be a single string or an array of regexes.
- $regexes = (array)$wgSpamRegex;
- foreach( $regexes as $regex ) {
- $matches = array();
- if ( preg_match( $regex, $text, $matches ) ) {
- return $matches[0];
- }
+ // For back compatibility, $wgSpamRegex may be a single string or an array of regexes.
+ $regexes = (array)$wgSpamRegex;
+ return self::matchSpamRegexInternal( $text, $regexes );
+ }
+
+ /**
+ * Check given input text against $wgSpamRegex, and return the text of the first match.
+ * @return mixed -- matching string or false
+ */
+ public static function matchSummarySpamRegex( $text ) {
+ global $wgSummarySpamRegex;
+ $regexes = (array)$wgSummarySpamRegex;
+ return self::matchSpamRegexInternal( $text, $regexes );
+ }
+
+ protected static function matchSpamRegexInternal( $text, $regexes ) {
+ foreach( $regexes as $regex ) {
+ $matches = array();
+ if( preg_match( $regex, $text, $matches ) ) {
+ return $matches[0];
}
}
return false;