public function execute( $subpage ) { global $wgUser, $wgOut; if( !$wgUser->isAllowed( 'premoderation-wlist' ) ) { $this->displayRestrictionError(); return; } if( wfReadOnly() ) { $wgOut->readOnlyPage(); return; } if( $wgUser->isBlocked() ) { $wgOut->blockedPage(); return; } $wgOut->setPageTitle( wfMsg( 'premoderationwhitelist' ) ); $wgOut->addWikiMsg( 'premoderation-whitelist-intro' ); $params = array_values( explode( '/', $subpage ) ); $action = array_shift( &$params ); if( $action == '' ) { $action = 'list'; } elseif( $action == 'list' && isset( $params ) ) { $this->mParams = Premoderation::formatParams( $params ); } else { $wgOut->setPageTitle( wfMsg( 'premoderation-manager-invalidaction' ) ); $wgOut->addWikiMsg( 'premoderation-invalidaction' ); return; } if( $this->mPosted ) { $msg = $this->updateList(); $wgOut->addHTML( '<p class="error">' . wfMsg( $msg ) . '</p>' ); } $wgOut->addHTML( $this->getAddForm() ); $whiteList = Premoderation::loadWhitelist(); if( is_array( $whiteList ) ) { $output = '<table class="wikitable"><tr><th>' . wfMsg( 'premoderation-table-list-ip' ) . '</th><th>' . wfMsg( 'premoderation-table-list-delete' ) . '</th></tr>'; foreach( $whiteList as $ip ) { $output .= '<tr><td>' . $ip . '</td>' . '<td>' . $this->getDeletionButton( $ip ) . '</td></tr>'; } $output .= '</table>'; $wgOut->addHTML( $output ); } else { $wgOut->addWikiMsg( 'premoderation-whitelist-empty' ); } }
public function execute( $subpage ) { global $wgUser, $wgOut; if( !$wgUser->isAllowed( 'premoderation' ) ) { $this->displayRestrictionError(); return; } if( wfReadOnly() ) { $wgOut->readOnlyPage(); return; } if( $wgUser->isBlocked() ) { $wgOut->blockedPage(); return; } $params = array_values( explode( '/', $subpage ) ); $action = array_shift( &$params ); if( $action == '' ) { $action = 'list'; } elseif( isset( $params ) ) { $this->mParams = Premoderation::formatParams( $params ); } switch( $action ) { case 'list': $this->showList(); break; case 'status': ( $this->mPosted ) ? $this->performChanges() : $this->statusInterface(); break; default: $wgOut->setPageTitle( wfMsg( 'premoderation-manager-invalidaction' ) ); $wgOut->addWikiMsg( 'premoderation-invalidaction' ); } }