Followup r104350, r104318: only allow custom limits through if they're valid positive...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 6 Dec 2011 19:45:56 +0000 (19:45 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 6 Dec 2011 19:45:56 +0000 (19:45 +0000)
includes/specials/SpecialBlockList.php

index 719a338..ea6fe22 100644 (file)
@@ -468,7 +468,11 @@ class HTMLBlockedUsersItemSelect extends HTMLSelectField {
                        return true;
                }
 
-               if ( !in_array( $value, $this->mParams['options'] ) ) {
+               // Let folks pick an explicit limit not from our list, as long as it's a real numbr.
+               if ( !in_array( $value, $this->mParams['options'] ) && $value == intval( $value ) && $value > 0 ) {
+                       // This adds the explicitly requested limit value to the drop-down,
+                       // then makes sure it's sorted correctly so when we output the list
+                       // later, the custom option doesn't just show up last.
                        $this->mParams['options'][ $this->mParent->getLanguage()->formatNum( $value ) ] = intval($value);
                        asort( $this->mParams['options'] );
                }