r114625 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114624‎ | r114625 | r114626 >
Date:06:38, 30 March 2012
Author:tstarling
Status:resolved
Tags:live 
Comment:
Temporary fix for bug 35578. Reintroduce validation to processForm().
Modified paths:
  • /branches/wmf/1.19wmf1/includes/specials/SpecialBlock.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.19wmf1/includes/specials/SpecialBlock.php
@@ -546,7 +546,7 @@
547547 * @return Bool|String
548548 */
549549 public static function processForm( array $data, IContextSource $context ){
550 - global $wgBlockAllowsUTEdit;
 550+ global $wgBlockAllowsUTEdit, $wgBlockCIDRLimit;
551551
552552 $performer = $context->getUser();
553553
@@ -558,7 +558,14 @@
559559 $data['Confirm'] = !in_array( $data['Confirm'], array( '', '0', null, false ), true );
560560
561561 list( $target, $type ) = self::getTargetAndType( $data['Target'] );
 562+ ob_end_clean();
 563+ var_dump( compact( 'target', 'type' ) );
 564+ exit;
562565 if( $type == Block::TYPE_USER ){
 566+ if( !$target->getId() ){
 567+ return array( array( 'nosuchusershort', $target->getName() ) );
 568+ }
 569+
563570 $user = $target;
564571 $target = $user->getName();
565572 $userId = $user->getId();
@@ -576,6 +583,30 @@
577584 return array( 'ipb-blockingself' );
578585 }
579586 } elseif( $type == Block::TYPE_RANGE ){
 587+ list( $ip, $range ) = explode( '/', $target, 2 );
 588+
 589+ if( ( IP::isIPv4( $ip ) && $wgBlockCIDRLimit['IPv4'] == 32 )
 590+ || ( IP::isIPv6( $ip ) && $wgBlockCIDRLimit['IPV6'] == 128 ) )
 591+ {
 592+ # Range block effectively disabled
 593+ return array( 'range_block_disabled' );
 594+ }
 595+
 596+ if( ( IP::isIPv4( $ip ) && $range > 32 )
 597+ || ( IP::isIPv6( $ip ) && $range > 128 ) )
 598+ {
 599+ # Dodgy range
 600+ return array( 'ip_range_invalid' );
 601+ }
 602+
 603+ if( IP::isIPv4( $ip ) && $range < $wgBlockCIDRLimit['IPv4'] ) {
 604+ return array( array( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv4'] ) );
 605+ }
 606+
 607+ if( IP::isIPv6( $ip ) && $range < $wgBlockCIDRLimit['IPv6'] ) {
 608+ return array( array( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv6'] ) );
 609+ }
 610+
580611 $userId = 0;
581612 } elseif( $type == Block::TYPE_IP ){
582613 $target = $target->getName();

Follow-up revisions

RevisionCommit summaryAuthorDate
r114627Removed debugging codetstarling06:41, 30 March 2012

Status & tagging log