Exemplo n.º 1
0
    /**
     * Show the form for blocking IPs / users
     */
    private function showForm()
    {
        global $wgOut, $wgUser, $wgRequest;
        wfProfileIn(__METHOD__);
        $token = htmlspecialchars($wgUser->editToken());
        $action = $this->mTitle->escapeLocalURL("action=submit&" . $this->makeListUrlParams());
        $err = $this->mError;
        $msg = $this->mMsg;
        $expiries = RegexBlockData::getExpireValues();
        $regexBlockAddress = empty($this->mRegexBlockedAddress) && $wgRequest->getVal('ip') != null && $wgRequest->getVal('action') == null ? $wgRequest->getVal('ip') : $this->mRegexBlockedAddress;
        $wgOut->addHTML('<div style="float:left; clear:both; margin-left: auto; margin-right:auto">');
        if ('' != $err) {
            $wgOut->setSubtitle(wfMsgHtml('formerror'));
            $wgOut->addHTML('<h2 class="errorbox">' . $this->mError . '</h2>');
        } elseif ($msg != '') {
            $wgOut->addHTML('<h2 class="successbox">' . $this->mMsg . '</h2>');
        }
        $wgOut->addHTML('</div>
		<div style="clear:both; width:auto;">' . wfMsgExt('regexblock-help', 'parse') . '</div>
		<fieldset style="width:90%; margin:auto;" align="center">
			<legend>' . wfMsg('regexblock-form-submit') . '</legend>
		<form name="regexblock" method="post" action="' . $action . '">
		<table border="0">
			<tr>
				<td align="right">' . wfMsg('regexblock-form-username') . '</td>
				<td align="left">
					<input tabindex="1" name="wpRegexBlockedAddress" id="wpRegexBlockedAddress" size="40" value="' . $regexBlockAddress . '" style="border: 1px solid #2F6FAB;" />
				</td>
			</tr>
			<tr>
				<td align="right">' . wfMsg('regexblock-form-reason') . '</td>
				<td align="left">
					<input tabindex="2" name="wpRegexBlockedReason" id="wpRegexBlockedReason" size="40" value="' . $this->mRegexBlockedReason . '" style="border: 1px solid #2F6FAB;" />
				</td>
			</tr>
			<tr>
				<td align="right">' . wfMsg('regexblock-form-expiry') . '</td>
				<td align="left">
				<select name="wpRegexBlockedExpire" id="wpRegexBlockedExpire" tabindex="3" style="border: 1px solid #2F6FAB;">' . "\n");
        foreach ($expiries as $k => $v) {
            $selected = htmlspecialchars($k == $this->mRegexBlockedExpire) ? ' selected="selected"' : '';
            $wgOut->addHTML('<option value="' . htmlspecialchars($v) . '"' . $selected . '>' . htmlspecialchars($v) . '</option>');
        }
        $wgOut->addHTML('</select>');
        $checkExact = htmlspecialchars($this->mRegexBlockedExact) ? 'checked="checked"' : '';
        $checkCreation = htmlspecialchars($this->mRegexBlockedCreation) ? 'checked="checked"' : '';
        $wgOut->addHTML('</td>
			</tr>
			<tr>
				<td align="right">&#160;</td>
				<td align="left">
						<input type="checkbox" tabindex="4" name="wpRegexBlockedExact" id="wpRegexBlockedExact" value="1" ' . $checkExact . ' />
						<label for="wpRegexBlockedExact">' . wfMsg('regexblock-form-match') . '</label>
				</td>
			</tr>
			<tr>
				<td align="right">&#160;</td>
				<td align="left">
					<input type="checkbox" tabindex="5" name="wpRegexBlockedCreation" id="wpRegexBlockedCreation" value="1" ' . $checkCreation . ' />
					<label for="wpRegexBlockedCreation">' . wfMsg('regexblock-form-account-block') . '</label>
				</td>
			</tr>
			<tr>
				<td align="right">&#160;</td>
				<td align="left">
					<input tabindex="6" name="wpRegexBlockedSubmit" type="submit" value="' . wfMsg('regexblock-form-submit') . '" style="color:#2F6FAB;" />
				</td>
			</tr>
		</table>
		<input type="hidden" name="wpEditToken" value="' . $token . '" />
		</form>
		</fieldset>
		<br />');
        wfProfileOut(__METHOD__);
    }
Exemplo n.º 2
0
 private function showForm()
 {
     global $wgOut, $wgUser, $wgRequest;
     wfProfileIn(__METHOD__);
     $token = htmlspecialchars($wgUser->getEditToken());
     $titleObj = Title::makeTitle(NS_SPECIAL, 'RegexBlock');
     $action = htmlspecialchars($titleObj->getLocalURL("action=submit")) . "&" . $this->makeListUrlParams();
     $expiries = RegexBlockData::getExpireValues();
     $regexBlockAddress = empty($this->mRegexBlockedAddress) && $wgRequest->getVal('ip') != null && $wgRequest->getVal('action') == null ? $wgRequest->getVal('ip') : $this->mRegexBlockedAddress;
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("err" => $this->mError, "msg" => $this->mMsg, "action" => $action, "token" => $token, "out" => $wgOut, "sel_blocker" => $this->mFilter, "expiries" => $expiries, "mRegexBlockedAddress" => $regexBlockAddress, "mRegexBlockedExact" => $this->mRegexBlockedExact, "mRegexBlockedCreation" => $this->mRegexBlockedCreation, "mRegexBlockedExpire" => $this->mRegexBlockedExpire, "mRegexBlockedReason" => $this->mRegexBlockedReason));
     $wgOut->addHTML($oTmpl->render("page-form"));
     wfProfileOut(__METHOD__);
 }