r100506 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100505‎ | r100506 | r100507 >
Date:17:44, 22 October 2011
Author:johnduhart
Status:resolved (Comments)
Tags:
Comment:
Moved CheckUser log stuff into a separate special page
Modified paths:
  • /trunk/extensions/CheckUser/CheckUser.alias.php (modified) (history)
  • /trunk/extensions/CheckUser/CheckUser.i18n.php (modified) (history)
  • /trunk/extensions/CheckUser/CheckUser.php (modified) (history)
  • /trunk/extensions/CheckUser/CheckUserLogPager.php (added) (history)
  • /trunk/extensions/CheckUser/CheckUser_body.php (modified) (history)
  • /trunk/extensions/CheckUser/SpecialCheckUserLog.php (added) (history)

Diff [purge]

Index: trunk/extensions/CheckUser/CheckUser_body.php
@@ -11,11 +11,7 @@
1212 */
1313 public function __construct() {
1414 global $wgUser;
15 - if ( $wgUser->isAllowed( 'checkuser' ) || !$wgUser->isAllowed( 'checkuser-log' ) ) {
16 - parent::__construct( 'CheckUser', 'checkuser' );
17 - } else {
18 - parent::__construct( 'CheckUser', 'checkuser-log' );
19 - }
 15+ parent::__construct( 'CheckUser', 'checkuser' );
2016
2117 $this->sk = $wgUser->getSkin();
2218 }
@@ -25,37 +21,6 @@
2622
2723 $this->setHeaders();
2824
29 - // This is horribly shitty.
30 - // Lacking formal aliases, it's tough to ensure we have compatibility.
31 - // Links may break, which sucks.
32 - // Language fallbacks will not always be properly utilized.
33 - $logMatches = array(
34 - wfMsgForContent( 'checkuser-log-subpage' ),
35 - 'Log'
36 - );
37 -
38 - foreach ( $logMatches as $log ) {
39 - if ( str_replace( '_', ' ', $wgContLang->lc( $subpage ) )
40 - == str_replace( '_ ', ' ', $wgContLang->lc( $log ) ) ) {
41 - if ( !$wgUser->isAllowed( 'checkuser-log' ) ) {
42 - $wgOut->permissionRequired( 'checkuser-log' );
43 - return;
44 - }
45 -
46 - $this->showLog();
47 - return;
48 - }
49 - }
50 -
51 - if ( !$wgUser->isAllowed( 'checkuser' ) ) {
52 - if ( $wgUser->isAllowed( 'checkuser-log' ) ) {
53 - $this->showGuide();
54 - } else {
55 - $wgOut->permissionRequired( 'checkuser' );
56 - }
57 - return;
58 - }
59 -
6025 $user = $wgRequest->getText( 'user' ) ?
6126 $wgRequest->getText( 'user' ) : $wgRequest->getText( 'ip' );
6227 $user = trim( $user );
@@ -130,17 +95,17 @@
13196 /**
13297 * @return Title
13398 */
134 - public function getLogSubpageTitle() {
 99+ public function getLogTitle() {
135100 if ( !isset( $this->logSubpageTitle ) ) {
136 - $this->logSubpageTitle = $this->getTitle( wfMsgForContent( 'checkuser-log-subpage' ) );
 101+ $this->logTitle = Title::makeTitle( NS_SPECIAL, 'CheckUserLog' );
137102 }
138 - return $this->logSubpageTitle;
 103+ return $this->logTitle;
139104 }
140105
141106 protected function showGuide() {
142107 global $wgOut;
143108 $wgOut->addWikiText( wfMsg( 'checkuser-summary' ) .
144 - "\n\n[[" . $this->getLogSubpageTitle()->getPrefixedText() .
 109+ "\n\n[[" . $this->getLogTitle()->getPrefixedText() .
145110 '|' . wfMsg( 'checkuser-showlog' ) . ']]'
146111 );
147112 }
@@ -1325,133 +1290,6 @@
13261291 return "cuc_timestamp > $cutoff";
13271292 }
13281293
1329 - protected function showLog() {
1330 - global $wgRequest, $wgOut;
1331 - $type = $wgRequest->getVal( 'cuSearchType' );
1332 - $target = $wgRequest->getVal( 'cuSearch' );
1333 - $year = $wgRequest->getIntOrNull( 'year' );
1334 - $month = $wgRequest->getIntOrNull( 'month' );
1335 - $error = false;
1336 - $dbr = wfGetDB( DB_SLAVE );
1337 - $searchConds = false;
1338 -
1339 - $wgOut->setPageTitle( wfMsg( 'checkuser-log' ) );
1340 -
1341 - $wgOut->addHTML( $this->sk->makeKnownLinkObj( $this->getTitle(), wfMsgHtml( 'checkuser-log-return' ) ) );
1342 -
1343 - if ( $type === null ) {
1344 - $type = 'target';
1345 - } elseif ( $type == 'initiator' ) {
1346 - $user = User::newFromName( $target );
1347 - if ( !$user || !$user->getID() ) {
1348 - $error = 'checkuser-user-nonexistent';
1349 - } else {
1350 - $searchConds = array( 'cul_user' => $user->getID() );
1351 - }
1352 - } else /* target */ {
1353 - $type = 'target';
1354 - // Is it an IP?
1355 - list( $start, $end ) = IP::parseRange( $target );
1356 - if ( $start !== false ) {
1357 - if ( $start == $end ) {
1358 - $searchConds = array( 'cul_target_hex = ' . $dbr->addQuotes( $start ) . ' OR ' .
1359 - '(cul_range_end >= ' . $dbr->addQuotes( $start ) . ' AND ' .
1360 - 'cul_range_start <= ' . $dbr->addQuotes( $end ) . ')'
1361 - );
1362 - } else {
1363 - $searchConds = array(
1364 - '(cul_target_hex >= ' . $dbr->addQuotes( $start ) . ' AND ' .
1365 - 'cul_target_hex <= ' . $dbr->addQuotes( $end ) . ') OR ' .
1366 - '(cul_range_end >= ' . $dbr->addQuotes( $start ) . ' AND ' .
1367 - 'cul_range_start <= ' . $dbr->addQuotes( $end ) . ')'
1368 - );
1369 - }
1370 - } else {
1371 - // Is it a user?
1372 - $user = User::newFromName( $target );
1373 - if ( $user && $user->getID() ) {
1374 - $searchConds = array(
1375 - 'cul_type' => array( 'userips', 'useredits' ),
1376 - 'cul_target_id' => $user->getID(),
1377 - );
1378 - } elseif ( $target ) {
1379 - $error = 'checkuser-user-nonexistent';
1380 - }
1381 - }
1382 - }
1383 -
1384 - $searchTypes = array( 'initiator', 'target' );
1385 - $select = "<select name=\"cuSearchType\" style='margin-top:.2em;'>\n";
1386 - foreach ( $searchTypes as $searchType ) {
1387 - if ( $type == $searchType ) {
1388 - $checked = 'selected="selected"';
1389 - } else {
1390 - $checked = '';
1391 - }
1392 - $caption = wfMsgHtml( 'checkuser-search-' . $searchType );
1393 - $select .= "<option value=\"$searchType\" $checked>$caption</option>\n";
1394 - }
1395 - $select .= '</select>';
1396 -
1397 - $encTarget = htmlspecialchars( $target );
1398 - $msgSearch = wfMsgHtml( 'checkuser-search' );
1399 - $input = "<input type=\"text\" name=\"cuSearch\" value=\"$encTarget\" size=\"40\"/>";
1400 - $msgSearchForm = wfMsgHtml( 'checkuser-search-form', $select, $input );
1401 - $formAction = $this->getLogSubpageTitle()->escapeLocalURL();
1402 - $msgSearchSubmit = '&#160;&#160;' . wfMsgHtml( 'checkuser-search-submit' ) . '&#160;&#160;';
1403 -
1404 - $s = "<form method='get' action=\"$formAction\">\n" .
1405 - "<fieldset><legend>$msgSearch</legend>\n" .
1406 - "<p>$msgSearchForm</p>\n" .
1407 - "<p>" . $this->getDateMenu( $year, $month ) . "&#160;&#160;&#160;\n" .
1408 - "<input type=\"submit\" name=\"cuSearchSubmit\" value=\"$msgSearchSubmit\"/></p>\n" .
1409 - "</fieldset></form>\n";
1410 - $wgOut->addHTML( $s );
1411 -
1412 - if ( $error !== false ) {
1413 - $wgOut->wrapWikiMsg( '<div class="errorbox">$1</div>', $error );
1414 - return;
1415 - }
1416 -
1417 - $pager = new CheckUserLogPager( $this, $searchConds, $year, $month );
1418 - $wgOut->addHTML(
1419 - $pager->getNavigationBar() .
1420 - $pager->getBody() .
1421 - $pager->getNavigationBar()
1422 - );
1423 - }
1424 -
1425 - /**
1426 - * @return string Formatted HTML
1427 - * @param int $year
1428 - * @param int $month
1429 - */
1430 - protected function getDateMenu( $year, $month ) {
1431 - # Offset overrides year/month selection
1432 - if ( $month && $month !== - 1 ) {
1433 - $encMonth = intval( $month );
1434 - } else {
1435 - $encMonth = '';
1436 - }
1437 - if ( $year ) {
1438 - $encYear = intval( $year );
1439 - } elseif ( $encMonth ) {
1440 - $thisMonth = intval( gmdate( 'n' ) );
1441 - $thisYear = intval( gmdate( 'Y' ) );
1442 - if ( intval( $encMonth ) > $thisMonth ) {
1443 - $thisYear--;
1444 - }
1445 - $encYear = $thisYear;
1446 - } else {
1447 - $encYear = '';
1448 - }
1449 - return Xml::label( wfMsg( 'year' ), 'year' ) . ' ' .
1450 - Xml::input( 'year', 4, $encYear, array( 'id' => 'year', 'maxlength' => 4 ) ) .
1451 - ' ' .
1452 - Xml::label( wfMsg( 'month' ), 'month' ) . ' ' .
1453 - Xml::monthSelector( $encMonth, - 1 );
1454 - }
1455 -
14561294 public static function addLogEntry( $logType, $targetType, $target, $reason, $targetID = 0 ) {
14571295 global $wgUser;
14581296
@@ -1485,94 +1323,3 @@
14861324 }
14871325 }
14881326
1489 -class CheckUserLogPager extends ReverseChronologicalPager {
1490 - var $searchConds, $specialPage, $y, $m;
1491 -
1492 - function __construct( $specialPage, $searchConds, $y, $m ) {
1493 - parent::__construct();
1494 - /*
1495 - $this->messages = array_map( 'wfMsg',
1496 - array( 'comma-separator', 'checkuser-log-userips', 'checkuser-log-ipedits', 'checkuser-log-ipusers',
1497 - 'checkuser-log-ipedits-xff', 'checkuser-log-ipusers-xff' ) );*/
1498 -
1499 - $this->getDateCond( $y, $m );
1500 - $this->searchConds = $searchConds ? $searchConds : array();
1501 - $this->specialPage = $specialPage;
1502 - }
1503 -
1504 - function formatRow( $row ) {
1505 - global $wgLang;
1506 -
1507 - $skin = $this->getSkin();
1508 -
1509 - if ( $row->cul_reason === '' ) {
1510 - $comment = '';
1511 - } else {
1512 - $comment = $skin->commentBlock( $row->cul_reason );
1513 - }
1514 -
1515 - $user = $skin->userLink( $row->cul_user, $row->user_name );
1516 -
1517 - if ( $row->cul_type == 'userips' || $row->cul_type == 'useredits' ) {
1518 - $target = $skin->userLink( $row->cul_target_id, $row->cul_target_text ) .
1519 - $skin->userToolLinks( $row->cul_target_id, $row->cul_target_text );
1520 - } else {
1521 - $target = $row->cul_target_text;
1522 - }
1523 -
1524 - return '<li>' .
1525 - $wgLang->timeanddate( wfTimestamp( TS_MW, $row->cul_timestamp ), true ) .
1526 - wfMsg( 'comma-separator' ) .
1527 - wfMsg(
1528 - 'checkuser-log-' . $row->cul_type,
1529 - $user,
1530 - $target
1531 - ) .
1532 - $comment .
1533 - '</li>';
1534 - }
1535 -
1536 - function getStartBody() {
1537 - if ( $this->getNumRows() ) {
1538 - return '<ul>';
1539 - } else {
1540 - return '';
1541 - }
1542 - }
1543 -
1544 - function getEndBody() {
1545 - if ( $this->getNumRows() ) {
1546 - return '</ul>';
1547 - } else {
1548 - return '';
1549 - }
1550 - }
1551 -
1552 - function getEmptyBody() {
1553 - return '<p>' . wfMsgHtml( 'checkuser-empty' ) . '</p>';
1554 - }
1555 -
1556 - function getQueryInfo() {
1557 - $this->searchConds[] = 'user_id = cul_user';
1558 - return array(
1559 - 'tables' => array( 'cu_log', 'user' ),
1560 - 'fields' => $this->selectFields(),
1561 - 'conds' => $this->searchConds
1562 - );
1563 - }
1564 -
1565 - function getIndexField() {
1566 - return 'cul_timestamp';
1567 - }
1568 -
1569 - function getTitle() {
1570 - return $this->specialPage->getLogSubpageTitle();
1571 - }
1572 -
1573 - function selectFields() {
1574 - return array(
1575 - 'cul_id', 'cul_timestamp', 'cul_user', 'cul_reason', 'cul_type',
1576 - 'cul_target_id', 'cul_target_text', 'user_name'
1577 - );
1578 - }
1579 -}
Index: trunk/extensions/CheckUser/CheckUser.i18n.php
@@ -20,6 +20,7 @@
2121 'checkuser-desc' => 'Grants users with the appropriate permission the ability to check user\'s IP addresses and other information',
2222 'checkuser-logcase' => 'The log search is case sensitive.',
2323 'checkuser' => 'Check user',
 24+ 'checkuserlog' => 'Check user log',
2425 'checkuser-contribs' => 'check user IP addresses',
2526 'group-checkuser' => 'Check users',
2627 'group-checkuser-member' => '{{GENDER:$1|check user}}',
@@ -29,7 +30,6 @@
3031 'checkuser-reason' => 'Reason:',
3132 'checkuser-reason-api' => 'API: $1',
3233 'checkuser-showlog' => 'Show log',
33 - 'checkuser-log' => 'CheckUser log',
3434 'checkuser-query' => 'Query recent changes',
3535 'checkuser-target' => 'IP address or username:',
3636 'checkuser-users' => 'Get users',
@@ -124,6 +124,7 @@
125125 'checkuser' => 'Check user extension. The name of the special page where checkusers can check the IP addresses of users. The message is used in the list of special pages, and at the top of [[Special:Checkuser]].
126126
127127 {{Identical|Check user}}',
 128+ 'checkuserlog' => 'The name of the special page where checkusers can look at a log of past checkuser actions. The message is used in the list of special pages, and at the top of [[Special:CheckUserLog]].',
128129 'group-checkuser' => '{{doc-group|checkuser}}
129130 check is a noun, not a verb here
130131
Index: trunk/extensions/CheckUser/CheckUserLogPager.php
@@ -0,0 +1,89 @@
 2+<?php
 3+
 4+class CheckUserLogPager extends ReverseChronologicalPager {
 5+ var $searchConds, $specialPage, $y, $m;
 6+
 7+ function __construct( $specialPage, $searchConds, $y, $m ) {
 8+ parent::__construct();
 9+ /*
 10+ $this->messages = array_map( 'wfMsg',
 11+ array( 'comma-separator', 'checkuser-log-userips', 'checkuser-log-ipedits', 'checkuser-log-ipusers',
 12+ 'checkuser-log-ipedits-xff', 'checkuser-log-ipusers-xff' ) );*/
 13+
 14+ $this->getDateCond( $y, $m );
 15+ $this->searchConds = $searchConds ? $searchConds : array();
 16+ $this->specialPage = $specialPage;
 17+ }
 18+
 19+ function formatRow( $row ) {
 20+ global $wgLang;
 21+
 22+ $skin = $this->getSkin();
 23+
 24+ if ( $row->cul_reason === '' ) {
 25+ $comment = '';
 26+ } else {
 27+ $comment = $skin->commentBlock( $row->cul_reason );
 28+ }
 29+
 30+ $user = $skin->userLink( $row->cul_user, $row->user_name );
 31+
 32+ if ( $row->cul_type == 'userips' || $row->cul_type == 'useredits' ) {
 33+ $target = $skin->userLink( $row->cul_target_id, $row->cul_target_text ) .
 34+ $skin->userToolLinks( $row->cul_target_id, $row->cul_target_text );
 35+ } else {
 36+ $target = $row->cul_target_text;
 37+ }
 38+
 39+ return '<li>' .
 40+ $wgLang->timeanddate( wfTimestamp( TS_MW, $row->cul_timestamp ), true ) .
 41+ wfMsg( 'comma-separator' ) .
 42+ wfMsg(
 43+ 'checkuser-log-' . $row->cul_type,
 44+ $user,
 45+ $target
 46+ ) .
 47+ $comment .
 48+ '</li>';
 49+ }
 50+
 51+ function getStartBody() {
 52+ if ( $this->getNumRows() ) {
 53+ return '<ul>';
 54+ } else {
 55+ return '';
 56+ }
 57+ }
 58+
 59+ function getEndBody() {
 60+ if ( $this->getNumRows() ) {
 61+ return '</ul>';
 62+ } else {
 63+ return '';
 64+ }
 65+ }
 66+
 67+ function getEmptyBody() {
 68+ return '<p>' . wfMsgHtml( 'checkuser-empty' ) . '</p>';
 69+ }
 70+
 71+ function getQueryInfo() {
 72+ $this->searchConds[] = 'user_id = cul_user';
 73+ return array(
 74+ 'tables' => array( 'cu_log', 'user' ),
 75+ 'fields' => $this->selectFields(),
 76+ 'conds' => $this->searchConds
 77+ );
 78+ }
 79+
 80+ function getIndexField() {
 81+ return 'cul_timestamp';
 82+ }
 83+
 84+ function selectFields() {
 85+ return array(
 86+ 'cul_id', 'cul_timestamp', 'cul_user', 'cul_reason', 'cul_type',
 87+ 'cul_target_id', 'cul_target_text', 'user_name'
 88+ );
 89+ }
 90+}
Index: trunk/extensions/CheckUser/CheckUser.alias.php
@@ -11,6 +11,7 @@
1212 /** English (English) */
1313 $specialPageAliases['en'] = array(
1414 'CheckUser' => array( 'CheckUser' ),
 15+ 'CheckUserLog' => array( 'CheckUserLog' ),
1516 );
1617
1718 /** Arabic (العربية) */
Index: trunk/extensions/CheckUser/CheckUser.php
@@ -81,9 +81,13 @@
8282 // Set up the new special page
8383 $wgSpecialPages['CheckUser'] = 'CheckUser';
8484 $wgSpecialPageGroups['CheckUser'] = 'users';
 85+$wgSpecialPages['CheckUserLog'] = 'SpecialCheckUserLog';
 86+$wgSpecialPageGroups['CheckUserLog'] = 'changes';
8587
8688 $wgAutoloadClasses['CheckUser'] = $dir . '/CheckUser_body.php';
8789 $wgAutoloadClasses['CheckUserHooks'] = $dir . '/CheckUser.hooks.php';
 90+$wgAutoloadClasses['CheckUserLogPager'] = $dir . '/CheckUserLogPager.php';
 91+$wgAutoloadClasses['SpecialCheckUserLog'] = $dir . '/SpecialCheckUserLog.php';
8892
8993 // API modules
9094 $wgAutoloadClasses['ApiQueryCheckUser'] = "$dir/api/ApiQueryCheckUser.php";
Index: trunk/extensions/CheckUser/SpecialCheckUserLog.php
@@ -0,0 +1,133 @@
 2+<?php
 3+
 4+class SpecialCheckUserLog extends SpecialPage {
 5+ public function __construct() {
 6+ parent::__construct( 'CheckUserLog', 'checkuser-log' );
 7+ }
 8+
 9+ function execute( $par ) {
 10+ $out = $this->getOutput();
 11+ $request = $this->getRequest();
 12+ $this->setHeaders();
 13+
 14+ $type = $request->getVal( 'cuSearchType' );
 15+ $target = $request->getVal( 'cuSearch' );
 16+ $year = $request->getIntOrNull( 'year' );
 17+ $month = $request->getIntOrNull( 'month' );
 18+ $error = false;
 19+ $dbr = wfGetDB( DB_SLAVE );
 20+ $searchConds = false;
 21+
 22+ if ( $type === null ) {
 23+ $type = 'target';
 24+ } elseif ( $type == 'initiator' ) {
 25+ $user = User::newFromName( $target );
 26+ if ( !$user || !$user->getID() ) {
 27+ $error = 'checkuser-user-nonexistent';
 28+ } else {
 29+ $searchConds = array( 'cul_user' => $user->getID() );
 30+ }
 31+ } else /* target */ {
 32+ $type = 'target';
 33+ // Is it an IP?
 34+ list( $start, $end ) = IP::parseRange( $target );
 35+ if ( $start !== false ) {
 36+ if ( $start == $end ) {
 37+ $searchConds = array( 'cul_target_hex = ' . $dbr->addQuotes( $start ) . ' OR ' .
 38+ '(cul_range_end >= ' . $dbr->addQuotes( $start ) . ' AND ' .
 39+ 'cul_range_start <= ' . $dbr->addQuotes( $end ) . ')'
 40+ );
 41+ } else {
 42+ $searchConds = array(
 43+ '(cul_target_hex >= ' . $dbr->addQuotes( $start ) . ' AND ' .
 44+ 'cul_target_hex <= ' . $dbr->addQuotes( $end ) . ') OR ' .
 45+ '(cul_range_end >= ' . $dbr->addQuotes( $start ) . ' AND ' .
 46+ 'cul_range_start <= ' . $dbr->addQuotes( $end ) . ')'
 47+ );
 48+ }
 49+ } else {
 50+ // Is it a user?
 51+ $user = User::newFromName( $target );
 52+ if ( $user && $user->getID() ) {
 53+ $searchConds = array(
 54+ 'cul_type' => array( 'userips', 'useredits' ),
 55+ 'cul_target_id' => $user->getID(),
 56+ );
 57+ } elseif ( $target ) {
 58+ $error = 'checkuser-user-nonexistent';
 59+ }
 60+ }
 61+ }
 62+
 63+ $searchTypes = array( 'initiator', 'target' );
 64+ $select = "<select name=\"cuSearchType\" style='margin-top:.2em;'>\n";
 65+ foreach ( $searchTypes as $searchType ) {
 66+ if ( $type == $searchType ) {
 67+ $checked = 'selected="selected"';
 68+ } else {
 69+ $checked = '';
 70+ }
 71+ $caption = wfMsgHtml( 'checkuser-search-' . $searchType );
 72+ $select .= "<option value=\"$searchType\" $checked>$caption</option>\n";
 73+ }
 74+ $select .= '</select>';
 75+
 76+ $encTarget = htmlspecialchars( $target );
 77+ $msgSearch = wfMsgHtml( 'checkuser-search' );
 78+ $input = "<input type=\"text\" name=\"cuSearch\" value=\"$encTarget\" size=\"40\"/>";
 79+ $msgSearchForm = wfMsgHtml( 'checkuser-search-form', $select, $input );
 80+ $formAction = $this->getTitle()->escapeLocalURL();
 81+ $msgSearchSubmit = '&#160;&#160;' . wfMsgHtml( 'checkuser-search-submit' ) . '&#160;&#160;';
 82+
 83+ $s = "<form method='get' action=\"$formAction\">\n" .
 84+ "<fieldset><legend>$msgSearch</legend>\n" .
 85+ "<p>$msgSearchForm</p>\n" .
 86+ "<p>" . $this->getDateMenu( $year, $month ) . "&#160;&#160;&#160;\n" .
 87+ "<input type=\"submit\" name=\"cuSearchSubmit\" value=\"$msgSearchSubmit\"/></p>\n" .
 88+ "</fieldset></form>\n";
 89+ $out->addHTML( $s );
 90+
 91+ if ( $error !== false ) {
 92+ $out->wrapWikiMsg( '<div class="errorbox">$1</div>', $error );
 93+ return;
 94+ }
 95+
 96+ $pager = new CheckUserLogPager( $this, $searchConds, $year, $month );
 97+ $out->addHTML(
 98+ $pager->getNavigationBar() .
 99+ $pager->getBody() .
 100+ $pager->getNavigationBar()
 101+ );
 102+ }
 103+
 104+ /**
 105+ * @return string Formatted HTML
 106+ * @param int $year
 107+ * @param int $month
 108+ */
 109+ protected function getDateMenu( $year, $month ) {
 110+ # Offset overrides year/month selection
 111+ if ( $month && $month !== - 1 ) {
 112+ $encMonth = intval( $month );
 113+ } else {
 114+ $encMonth = '';
 115+ }
 116+ if ( $year ) {
 117+ $encYear = intval( $year );
 118+ } elseif ( $encMonth ) {
 119+ $thisMonth = intval( gmdate( 'n' ) );
 120+ $thisYear = intval( gmdate( 'Y' ) );
 121+ if ( intval( $encMonth ) > $thisMonth ) {
 122+ $thisYear--;
 123+ }
 124+ $encYear = $thisYear;
 125+ } else {
 126+ $encYear = '';
 127+ }
 128+ return Xml::label( wfMsg( 'year' ), 'year' ) . ' ' .
 129+ Xml::input( 'year', 4, $encYear, array( 'id' => 'year', 'maxlength' => 4 ) ) .
 130+ ' ' .
 131+ Xml::label( wfMsg( 'month' ), 'month' ) . ' ' .
 132+ Xml::monthSelector( $encMonth, - 1 );
 133+ }
 134+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r103096Followup r100506 and add permissions checking that I missed using functions a...johnduhart00:41, 15 November 2011
r112562Restore "checkuser-log-return" ("Return to CheckUser main form") link to the ...saper01:57, 28 February 2012
r112586Followup-to: r100506: Improve linking between Special:CheckUser and Special:C...saper11:23, 28 February 2012

Comments

#Comment by Petrb (talk | contribs)   10:51, 13 November 2011

where have the isAllowed parts gone huh?

#Comment by Nikerabbit (talk | contribs)   10:01, 14 November 2011

It moved to

parent::__construct( 'CheckUser', 'checkuser' );

But some of them seem to be gone indeed.

#Comment by Johnduhart (talk | contribs)   10:49, 14 November 2011

Yeah I assumed at some point it would check that but I was mistaken.

So what is that good for?

#Comment by Nikerabbit (talk | contribs)   10:51, 14 November 2011

I haven't tried myself, but it should work. Is there evidence that it doesn't?

#Comment by Johnduhart (talk | contribs)   10:51, 14 November 2011
#Comment by Saper (talk | contribs)   01:25, 28 February 2012

Link to go to the form is gone:

$wgOut->addHTML( $this->sk->makeKnownLinkObj( $this->getTitle(), wfMsgHtml( 'checkuser-log-return' ) ) );

#Comment by Saper (talk | contribs)   01:59, 28 February 2012

Fixed in r112562

Status & tagging log