X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_del%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialContributions.php;h=5a5f005bafeeacd36129de2a39b22fb4d0df4f2b;hb=d09554b6ef498a0182110427af6a5b0545de1293;hp=38456493140b3e2fcdfa92f9bb09f154d8594e95;hpb=10d1b7d12b5d097413cd507740c5c71781c2580b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 3845649314..5a5f005baf 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -103,7 +103,12 @@ class SpecialContributions extends IncludableSpecialPage { 'pagetitle', $this->msg( 'contributions-title', $target )->plain() )->inContentLanguage() ); - $this->getSkin()->setRelevantUser( $userObj ); + + # For IP ranges, we want the contributionsSub, but not the skin-dependent + # links under 'Tools', which may include irrelevant links like 'Logs'. + if ( !IP::isValidRange( $target ) ) { + $this->getSkin()->setRelevantUser( $userObj ); + } } else { $out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) ); $out->setHTMLTitle( $this->msg( @@ -131,17 +136,14 @@ class SpecialContributions extends IncludableSpecialPage { $skip = $request->getText( 'offset' ) || $request->getText( 'dir' ) == 'prev'; # Offset overrides year/month selection - if ( $skip ) { - $this->opts['year'] = ''; - $this->opts['month'] = ''; - } else { + if ( !$skip ) { $this->opts['year'] = $request->getVal( 'year' ); $this->opts['month'] = $request->getVal( 'month' ); $this->opts['start'] = $request->getVal( 'start' ); $this->opts['end'] = $request->getVal( 'end' ); - $this->opts = ContribsPager::processDateFilter( $this->opts ); } + $this->opts = ContribsPager::processDateFilter( $this->opts ); $feedType = $request->getVal( 'feed' ); @@ -209,7 +211,12 @@ class SpecialContributions extends IncludableSpecialPage { 'associated' => $this->opts['associated'], ] ); - if ( !$pager->getNumRows() ) { + if ( IP::isValidRange( $target ) && !$pager->isQueryableRange( $target ) ) { + // Valid range, but outside CIDR limit. + $limits = $this->getConfig()->get( 'RangeContributionsCIDRLimit' ); + $limit = $limits[ IP::isIPv4( $target ) ? 'IPv4' : 'IPv6' ]; + $out->addWikiMsg( 'sp-contributions-outofrange', $limit ); + } elseif ( !$pager->getNumRows() ) { $out->addWikiMsg( 'nocontribs', $target ); } else { # Show a message about replica DB lag, if applicable @@ -226,11 +233,14 @@ class SpecialContributions extends IncludableSpecialPage { } $out->addHTML( $output ); } + $out->preventClickjacking( $pager->getPreventClickjacking() ); # Show the appropriate "footer" message - WHOIS tools, etc. if ( $this->opts['contribs'] == 'newbie' ) { $message = 'sp-contributions-footer-newbies'; + } elseif ( IP::isValidRange( $target ) ) { + $message = 'sp-contributions-footer-anon-range'; } elseif ( IP::isIPAddress( $target ) ) { $message = 'sp-contributions-footer-anon'; } elseif ( $userObj->isAnon() ) { @@ -261,8 +271,11 @@ class SpecialContributions extends IncludableSpecialPage { */ protected function contributionsSub( $userObj ) { if ( $userObj->isAnon() ) { - // Show a warning message that the user being searched for doesn't exists - if ( !User::isIP( $userObj->getName() ) ) { + // Show a warning message that the user being searched for doesn't exists. + // User::isIP returns true for IP address and usemod IPs like '123.123.123.xxx', + // but returns false for IP ranges. We don't want to suggest either of these are + // valid usernames which we would with the 'contributions-userdoesnotexist' message. + if ( !User::isIP( $userObj->getName() ) && !$userObj->isIPRange() ) { $this->getOutput()->wrapWikiMsg( "