コード例 #1
0
function wfSpamRegexSpecial($par)
{
    global $wgOut, $wgUser, $wgRequest;
    $wgOut->setPageTitle(wfMsgHtml('spamregex-page-title'));
    $sRF = new spamRegexForm($par);
    $sRL = new spamRegexList($par);
    $action = $wgRequest->getVal('action');
    if ('success_block' == $action) {
        $sRF->showSuccess();
        $sRF->showForm('');
    } else {
        if ('success_unblock' == $action) {
            $sRL->showSuccess();
            $sRF->showForm('');
        } else {
            if ('failure_unblock' == $action) {
                $text = htmlspecialchars($wgRequest->getVal('text'));
                $sRF->showForm("Error unblocking \"{$text}\". Probably there is no such pattern.");
            } else {
                if ($wgRequest->wasPosted() && 'submit' == $action && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) {
                    $sRF->doSubmit();
                } else {
                    if ('delete' == $action) {
                        $sRL->deleteFromList();
                    } else {
                        $sRF->showForm('');
                    }
                }
            }
        }
    }
    $sRL->showList('', $offset);
}
コード例 #2
0
	/**
	 * Show the special page
	 *
	 * @param $par Mixed: parameter passed to the page or null
	 */
	public function execute( $par ) {
		global $wgOut, $wgUser, $wgRequest;

		# No access for blocked users
		if ( $wgUser->isBlocked() ) {
			$wgOut->blockedPage();
			return;
		}

		# Can't use the special page if database is locked...
		if ( wfReadOnly() ) {
			$wgOut->readOnlyPage();
			return;
		}

		# And we'll also be needing the correct user rights in order to proceed
		if ( !$wgUser->isAllowed( 'spamregex' ) ) {
			$this->displayRestrictionError();
			return;
		}

		$wgOut->setPageTitle( wfMsgHtml( 'spamregex-page-title' ) );
		$sRF = new spamRegexForm( $par );
		$sRL = new spamRegexList( $par );

		$action = $wgRequest->getVal( 'action' );
		if ( 'success_block' == $action ) {
			$sRF->showSuccess();
			$sRF->showForm('');
		} elseif ( 'success_unblock' == $action ) {
			$sRL->showSuccess();
			$sRF->showForm('');
		} elseif ( 'failure_unblock' == $action ) {
			$text = htmlspecialchars( $wgRequest->getVal( 'text' ) );
			$sRF->showForm( wfMsg( 'spamregex-error-unblocking', $text ) );
		} elseif ( $wgRequest->wasPosted() && 'submit' == $action &&
			$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
			$sRF->doSubmit();
		} elseif ( 'delete' == $action ) {
			$sRL->deleteFromList();
		} else {
			$sRF->showForm( '' );
		}
		$sRL->showList( '' );
	}