r53401 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53400‎ | r53401 | r53402 >
Date:15:37, 17 July 2009
Author:werdna
Status:deferred
Tags:
Comment:
Require tags to be valid page titles. In the message, gives general recommendations that they be short and simple, rather than specifying the exact criteria. I want to encourage simplicity in tags, rather than fixing an immediate problem
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.i18n.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
@@ -73,6 +73,26 @@
7474 );
7575 return;
7676 }
 77+
 78+ // If we've activated the 'tag' option, check the arguments for validity.
 79+ if ( !empty($actions['tag']) ) {
 80+ $bad = false;
 81+ foreach( $actions['tag']['parameters'] as $tag ) {
 82+ $t = Title::makeTitleSafe( NS_MEDIAWIKI, 'tag-'.$tag );
 83+ if (!$t) {
 84+ $bad = true;
 85+ }
 86+
 87+ if ($bad) {
 88+ $wgOut->addHTML( $this->buildFilterEditor(
 89+ wfMsgExt( 'abusefilter-edit-bad-tags', 'parse' ),
 90+ $this->mFilter,
 91+ $history_id
 92+ ) );
 93+ return;
 94+ }
 95+ }
 96+ }
7797
7898 $newRow = get_object_vars($newRow); // Convert from object to array
7999
Index: trunk/extensions/AbuseFilter/AbuseFilter.i18n.php
@@ -216,6 +216,8 @@
217217 'abusefilter-edit-export' => 'Export this filter to another wiki',
218218 'abusefilter-edit-syntaxok' => 'No syntax errors detected.',
219219 'abusefilter-edit-syntaxerr' => 'Syntax error detected: $1',
 220+ 'abusefilter-edit-bad-tags' => 'One or more of the tags you specified is not valid.
 221+Tags should be short, and they should not contain special characters.',
220222
221223 // Filter editing helpers
222224 'abusefilter-edit-builder-select' => 'Select an option to add it at the cursor',

Status & tagging log