getOutput(); $request = $this->getRequest(); $user = $this->getUser(); $user_name = $request->getVal( 'user' ); /** * Redirect anonymous users to Login Page * It will automatically return them to the CommentIgnoreList page */ if ( $user->getId() == 0 && $user_name == '' ) { $loginPage = SpecialPage::getTitleFor( 'Userlogin' ); $out->redirect( $loginPage->getLocalURL( 'returnto=Special:CommentIgnoreList' ) ); return; } $out->setPageTitle( $this->msg( 'comments-ignore-title' )->text() ); $output = ''; // Prevent E_NOTICE if ( $user_name == '' ) { $output .= $this->displayCommentBlockList(); } else { if ( $request->wasPosted() ) { // Check for cross-site request forgeries (CSRF) if ( !$user->matchEditToken( $request->getVal( 'token' ) ) ) { $out->addWikiMsg( 'sessionfailure' ); return; } $user_name = htmlspecialchars_decode( $user_name ); $user_id = User::idFromName( $user_name ); // Anons can be comment-blocked, but idFromName returns nothing // for an anon, so... if ( !$user_id ) { $user_id = 0; } CommentFunctions::deleteBlock( $user->getId(), $user_id ); if ( $user_id && class_exists( 'UserStatsTrack' ) ) { $stats = new UserStatsTrack( $user_id, $user_name ); $stats->decStatField( 'comment_ignored' ); } $output .= $this->displayCommentBlockList(); } else { $output .= $this->confirmCommentBlockDelete(); } } $out->addHTML( $output ); } /** * Displays the list of users whose comments you're ignoring. * * @return string HTML */ function displayCommentBlockList() { $lang = $this->getLanguage(); $title = $this->getPageTitle(); $dbr = wfGetDB( DB_REPLICA ); $res = $dbr->select( 'Comments_block', [ 'cb_user_name_blocked', 'cb_date' ], [ 'cb_user_id' => $this->getUser()->getId() ], __METHOD__, [ 'ORDER BY' => 'cb_user_name' ] ); if ( $dbr->numRows( $res ) > 0 ) { $out = '