getSkin(), 'log' ); $this->setHeaders(); $this->outputHeader( 'abusefilter-log-summary' ); $this->loadParameters(); $wgOut->setPageTitle( wfMsg( 'abusefilter-log' ) ); $wgOut->setRobotPolicy( "noindex,nofollow" ); $wgOut->setArticleRelated( false ); $wgOut->enableClientCache( false ); global $wgScriptPath; $wgOut->addExtensionStyle( $wgScriptPath . "/extensions/AbuseFilter/abusefilter.css?$wgAbuseFilterStyleVersion" ); // Are we allowed? $errors = $this->getTitle()->getUserPermissionsErrors( 'abusefilter-log', $wgUser, true, array( 'ns-specialprotected' ) ); if ( count( $errors ) ) { // Go away. $wgOut->showPermissionsErrorPage( $errors, 'abusefilter-log' ); return; } // Show the search form. $this->searchForm(); // Show the log itself. $this->showList(); } function loadParameters() { global $wgRequest; $this->mSearchUser = $wgRequest->getText( 'wpSearchUser' ); $this->mSearchTitle = $wgRequest->getText( 'wpSearchTitle' ); if ($this->canSeeDetails()) $this->mSearchFilter = $wgRequest->getIntOrNull( 'wpSearchFilter' ); $detailsid = $wgRequest->getIntOrNull( 'details' ); if ($detailsid) { $this->showDetails( $detailsid ); } } function searchForm() { global $wgOut, $wgUser; $output = Xml::element( 'legend', null, wfMsg( 'abusefilter-log-search' ) ); $fields = array(); // Search conditions $fields['abusefilter-log-search-user'] = Xml::input( 'wpSearchUser', 45, $this->mSearchUser ); if ($this->canSeeDetails()) { $fields['abusefilter-log-search-filter'] = Xml::input( 'wpSearchFilter', 45, $this->mSearchFilter ); } $fields['abusefilter-log-search-title'] = Xml::input( 'wpSearchTitle', 45, $this->mSearchTitle ); $form = Xml::hidden( 'title', $this->getTitle()->getPrefixedText() ); $form .= Xml::buildForm( $fields, 'abusefilter-log-search-submit' ); $output .= Xml::tags( 'form', array( 'method' => 'GET', 'action' => $this->getTitle()->getLocalURL() ), $form ); $output = Xml::tags( 'fieldset', null, $output ); $wgOut->addHTML( $output ); } function showList() { global $wgOut; // Generate conditions list. $conds = array(); if (!empty($this->mSearchUser)) $conds['afl_user_text'] = $this->mSearchUser; if (!empty($this->mSearchFilter)) $conds['afl_filter'] = $this->mSearchFilter; $searchTitle = Title::newFromText( $this->mSearchTitle ); if ($this->mSearchTitle && $searchTitle) { $conds['afl_namespace'] = $searchTitle->getNamespace(); $conds['afl_title'] = $searchTitle->getDBKey(); } $pager = new AbuseLogPager( $this, $conds ); $wgOut->addHTML( $pager->getNavigationBar() . Xml::tags( 'ul', null, $pager->getBody() ) . $pager->getNavigationBar() ); } function showDetails( $id ) { if (!$this->canSeeDetails()) { return; } $dbr = wfGetDB( DB_SLAVE ); $row = $dbr->selectRow( array('abuse_filter_log','abuse_filter'), '*', array( 'afl_id' => $id, 'af_id=afl_filter' ), __METHOD__ ); if (!$row) return; $output = ''; $output .= Xml::element( 'legend', null, wfMsg( 'abusefilter-log-details-legend', $id ) ); $output .= Xml::tags( 'p', null, $this->formatRow( $row, false ) ); $output .= Xml::element( 'h3', null, wfMsg( 'abusefilter-log-details-vars' ) ); // Build a table. $vars = AbuseFilter::loadVarDump( $row->afl_var_dump ); $output .= AbuseFilter::buildVarDumpTable( $vars ); // Diff, if available if ( $vars->getVar( 'action' )->toString() == 'edit' ) { ## Stolen from DifferenceEngine.php global $wgStylePath, $wgStyleVersion, $wgOut; $wgOut->addStyle( 'common/diff.css' ); // JS is needed to detect old versions of Mozilla to work around an annoyance bug. $wgOut->addScript( "" ); $old_wikitext = $vars->getVar('old_wikitext')->toString(); $new_wikitext = $vars->getVar('new_wikitext')->toString(); $old_lines = explode( "\n", $old_wikitext ); $new_lines = explode( "\n", $new_wikitext ); $diff = new Diff( $old_lines, $new_lines ); $formatter = new TableDiffFormatter; static $colDescriptions = "