Example #1
0
    function execute()
    {
        global $wgCookieExpiration;
        $expirationDays = ceil($wgCookieExpiration / (3600 * 24));
        ?>
<div class="mw-ui-container">
	<?php 
        if ($this->haveData('languages')) {
            ?>
		<div id="languagelinks">
			<p><?php 
            $this->html('languages');
            ?>
</p>
		</div>
	<?php 
        }
        if (!wfMessage('signupstart')->isDisabled()) {
            ?>
		<div id="signupstart"><?php 
            $this->msgWiki('signupstart');
            ?>
</div>
	<?php 
        }
        ?>
	<div id="userloginForm">
		<h2 class="createaccount-join">
			<?php 
        $this->msg($this->data['loggedin'] ? 'createacct-another-join' : 'createacct-join');
        ?>
		</h2>
		<form name="userlogin2" id="userlogin2" class="mw-ui-vform" method="post" action="<?php 
        $this->text('action');
        ?>
">
			<section class="mw-form-header">
				<?php 
        $this->html('header');
        /* extensions such as ConfirmEdit add form HTML here */
        ?>
			</section>
			<!-- This element is used by the mediawiki.special.userlogin.signup.js module. -->
			<div
				id="mw-createacct-status-area"
				<?php 
        if ($this->data['message']) {
            ?>
					class="<?php 
            echo $this->data['messagetype'];
            ?>
box"
				<?php 
        } else {
            ?>
					style="display: none;"
				<?php 
        }
        ?>
			>
			<?php 
        if ($this->data['message']) {
            ?>
					<?php 
            if ($this->data['messagetype'] == 'error') {
                ?>
						<strong><?php 
                $this->msg('createacct-error');
                ?>
</strong>
						<br />
					<?php 
            }
            ?>
					<?php 
            $this->html('message');
            ?>
			<?php 
        }
        ?>
			</div>

			<div>
				<label for='wpName2'>
					<?php 
        $this->msg('userlogin-yourname');
        ?>

					<span class="mw-ui-flush-right"><?php 
        echo $this->getMsg('createacct-helpusername')->parse();
        ?>
</span>
				</label>
				<?php 
        echo Html::input('wpName', $this->data['name'], 'text', array('class' => 'mw-input loginText', 'id' => 'wpName2', 'tabindex' => '1', 'size' => '20', 'required', 'placeholder' => $this->getMsg($this->data['loggedin'] ? 'createacct-another-username-ph' : 'userlogin-yourname-ph')->text()));
        ?>
			</div>

			<div>
				<?php 
        if ($this->data['createemail']) {
            ?>
					<label class="mw-ui-checkbox-label">
						<input name="wpCreateaccountMail" type="checkbox" value="1" id="wpCreateaccountMail" tabindex="2"
							<?php 
            if ($this->data['createemailset']) {
                echo 'checked="checked"';
            }
            ?>
						>
						<?php 
            $this->msg('createaccountmail');
            ?>
					</label>
				<?php 
        }
        ?>
			</div>

			<div class="mw-row-password">
				<label for='wpPassword2'><?php 
        $this->msg('userlogin-yourpassword');
        ?>
</label>
				<?php 
        echo Html::input('wpPassword', null, 'password', array('class' => 'mw-input loginPassword', 'id' => 'wpPassword2', 'tabindex' => '3', 'size' => '20', 'required', 'placeholder' => $this->getMsg('createacct-yourpassword-ph')->text()) + User::passwordChangeInputAttribs());
        ?>
			</div>

			<?php 
        if ($this->data['usedomain']) {
            $select = new XmlSelect('wpDomain', false, $this->data['domain']);
            $select->setAttribute('tabindex', 4);
            foreach ($this->data['domainnames'] as $dom) {
                $select->addOption($dom);
            }
            ?>
				<div id="mw-user-domain-section">
					<label for="wpDomain"><?php 
            $this->msg('yourdomainname');
            ?>
</label>
					<div class="mw-input">
						<?php 
            echo $select->getHTML();
            ?>
					</div>
				</div>
			<?php 
        }
        ?>

			<div class="mw-row-password">
				<label for='wpRetype'><?php 
        $this->msg('createacct-yourpasswordagain');
        ?>
</label>
				<?php 
        echo Html::input('wpRetype', null, 'password', array('class' => 'mw-input loginPassword', 'id' => 'wpRetype', 'tabindex' => '5', 'size' => '20', 'required', 'placeholder' => $this->getMsg('createacct-yourpasswordagain-ph')->text()) + User::passwordChangeInputAttribs());
        ?>
			</div>

			<div>
				<?php 
        if ($this->data['useemail']) {
            ?>
					<label for='wpEmail'>
						<?php 
            $this->msg($this->data['emailrequired'] ? 'createacct-emailrequired' : 'createacct-emailoptional');
            ?>
					</label>
					<?php 
            echo Html::input('wpEmail', $this->data['email'], 'email', array('class' => 'mw-input loginText', 'id' => 'wpEmail', 'tabindex' => '6', 'size' => '20', 'required' => $this->data['emailrequired'], 'placeholder' => $this->getMsg($this->data['loggedin'] ? 'createacct-another-email-ph' : 'createacct-email-ph')->text()));
            ?>
				<?php 
        }
        ?>
			</div>

			<?php 
        if ($this->data['userealname']) {
            ?>
				<div>
					<label for='wpRealName'><?php 
            $this->msg('createacct-realname');
            ?>
</label>
					<input type='text' class='mw-input loginText' name="wpRealName" id="wpRealName"
						tabindex="7"
						value="<?php 
            $this->text('realname');
            ?>
" size='20' />
					<div class="prefsectiontip">
						<?php 
            $this->msgWiki($this->data['loggedin'] ? 'createacct-another-realname-tip' : 'prefs-help-realname');
            ?>
					</div>
				</div>
			<?php 
        }
        ?>

			<?php 
        if ($this->data['usereason']) {
            ?>
				<div>
					<label for='wpReason'><?php 
            $this->msg('createacct-reason');
            ?>
</label>
					<?php 
            echo Html::input('wpReason', $this->data['reason'], 'text', array('class' => 'mw-input loginText', 'id' => 'wpReason', 'tabindex' => '8', 'size' => '20', 'placeholder' => $this->getMsg('createacct-reason-ph')->text()));
            ?>
				</div>
			<?php 
        }
        ?>

			<?php 
        $tabIndex = 9;
        if (isset($this->data['extraInput']) && is_array($this->data['extraInput'])) {
            foreach ($this->data['extraInput'] as $inputItem) {
                ?>
					<div>
						<?php 
                // If it's a checkbox, output the whole thing (assume it has a msg).
                if ($inputItem['type'] == 'checkbox') {
                    ?>
							<label class="mw-ui-checkbox-label">
								<input
									name="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
									id="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
									type="checkbox" value="1"
									tabindex="<?php 
                    echo $tabIndex++;
                    ?>
"
									<?php 
                    if (!empty($inputItem['value'])) {
                        echo 'checked="checked"';
                    }
                    ?>
								>
								<?php 
                    $this->msgHtml($inputItem['msg']);
                    ?>
							</label>
						<?php 
                } else {
                    // Not a checkbox.
                    // TODO (bug 31909) support other input types, e.g. select boxes.
                    ?>
							<?php 
                    if (!empty($inputItem['msg'])) {
                        ?>
								<label for="<?php 
                        echo htmlspecialchars($inputItem['name']);
                        ?>
">
									<?php 
                        $this->msgWiki($inputItem['msg']);
                        ?>
								</label>
							<?php 
                    }
                    ?>
							<input
								type="<?php 
                    echo htmlspecialchars($inputItem['type']);
                    ?>
"
								class="mw-input"
								name="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
								tabindex="<?php 
                    echo $tabIndex++;
                    ?>
"
								value="<?php 
                    echo htmlspecialchars($inputItem['value']);
                    ?>
"
								id="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
							/>
						<?php 
                }
                ?>
						<?php 
                if ($inputItem['helptext'] !== false) {
                    ?>
							<div class="prefsectiontip">
								<?php 
                    $this->msgWiki($inputItem['helptext']);
                    ?>
							</div>
						<?php 
                }
                ?>
					</div>
				<?php 
            }
        }
        // JS attempts to move the image CAPTCHA below this part of the form,
        // so skip one index.
        $tabIndex++;
        ?>
			<div class="mw-submit">
				<?php 
        echo Html::input('wpCreateaccount', $this->getMsg($this->data['loggedin'] ? 'createacct-another-submit' : 'createacct-submit'), 'submit', array('class' => "mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive", 'id' => 'wpCreateaccount', 'tabindex' => $tabIndex++));
        ?>
			</div>
			<?php 
        if ($this->haveData('uselang')) {
            ?>
<input type="hidden" name="uselang" value="<?php 
            $this->text('uselang');
            ?>
" /><?php 
        }
        ?>
			<?php 
        if ($this->haveData('token')) {
            ?>
<input type="hidden" name="wpCreateaccountToken" value="<?php 
            $this->text('token');
            ?>
" /><?php 
        }
        ?>
		</form>
		<?php 
        if (!wfMessage('signupend')->isDisabled()) {
            ?>
			<div id="signupend"><?php 
            $this->html('signupend');
            ?>
</div>
		<?php 
        }
        ?>
	</div>
	<div class="mw-createacct-benefits-container">
		<h2><?php 
        $this->msg('createacct-benefit-heading');
        ?>
</h2>
		<div class="mw-createacct-benefits-list">
			<?php 
        for ($benefitIdx = 1; $benefitIdx <= $this->data['benefitCount']; $benefitIdx++) {
            // Pass each benefit's head text (by default a number) as a parameter to the body's message for PLURAL handling.
            $headUnescaped = $this->getMsg("createacct-benefit-head{$benefitIdx}")->text();
            ?>
				<div class="mw-number-text <?php 
            $this->msg("createacct-benefit-icon{$benefitIdx}");
            ?>
">
					<h3><?php 
            $this->msg("createacct-benefit-head{$benefitIdx}");
            ?>
</h3>
					<p><?php 
            echo $this->getMsg("createacct-benefit-body{$benefitIdx}")->params($headUnescaped)->escaped();
            ?>
</p>
				</div>
			<?php 
        }
        ?>
		</div>
	</div>
</div>
<?php 
    }
    function execute()
    {
        if ($this->data['message']) {
            ?>
	<div class="<?php 
            $this->text('messagetype');
            ?>
box">
		<?php 
            if ($this->data['messagetype'] == 'error') {
                ?>
			<strong><?php 
                $this->msg('loginerror');
                ?>
</strong><br />
		<?php 
            }
            ?>
		<?php 
            $this->html('message');
            ?>
	</div>
	<div class="visualClear"></div>
<?php 
        }
        ?>

<div id="signupstart"><?php 
        $this->msgWiki('signupstart');
        ?>
</div>
<div id="userlogin">

<form name="userlogin2" id="userlogin2" method="post" action="<?php 
        $this->text('action');
        ?>
">
	<h2><?php 
        $this->msg('createaccount');
        ?>
</h2>
	<p id="userloginlink"><?php 
        $this->html('link');
        ?>
</p>
	<?php 
        $this->html('header');
        /* pre-table point for form plugins... */
        ?>
	<?php 
        if ($this->haveData('languages')) {
            ?>
<div id="languagelinks"><p><?php 
            $this->html('languages');
            ?>
</p></div><?php 
        }
        ?>
	<table>
		<tr>
			<td class="mw-label"><label for='wpName2'><?php 
        $this->msg('yourname');
        ?>
</label></td>
			<td class="mw-input">
				<?php 
        echo Html::input('wpName', $this->data['name'], 'text', array('class' => 'loginText', 'id' => 'wpName2', 'tabindex' => '1', 'size' => '20', 'required', 'autofocus'));
        ?>
			</td>
		</tr>
		<tr>
			<td></td>
			<td class="mw-input">
				<?php 
        if ($this->data['createemail']) {
            echo Xml::checkLabel(wfMessage('createaccountmail')->text(), 'wpCreateaccountMail', 'wpCreateaccountMail', $this->data['createemailset'], array('tabindex' => '2'));
        }
        ?>
			</td>
		</tr>
		<tr class="mw-row-password">
			<td class="mw-label"><label for='wpPassword2'><?php 
        $this->msg('yourpassword');
        ?>
</label></td>
			<td class="mw-input">
<?php 
        echo Html::input('wpPassword', null, 'password', array('class' => 'loginPassword', 'id' => 'wpPassword2', 'tabindex' => '3', 'size' => '20') + User::passwordChangeInputAttribs());
        ?>
			</td>
		</tr>
	<?php 
        if ($this->data['usedomain']) {
            $doms = "";
            foreach ($this->data['domainnames'] as $dom) {
                $doms .= "<option>" . htmlspecialchars($dom) . "</option>";
            }
            ?>
		<tr id="mw-user-domain-section">
			<td class="mw-label"><?php 
            $this->msg('yourdomainname');
            ?>
</td>
			<td class="mw-input">
				<select name="wpDomain" value="<?php 
            $this->text('domain');
            ?>
"
					tabindex="4">
					<?php 
            echo $doms;
            ?>
				</select>
			</td>
		</tr>
	<?php 
        }
        ?>
		<tr class="mw-row-password">
			<td class="mw-label"><label for='wpRetype'><?php 
        $this->msg('yourpasswordagain');
        ?>
</label></td>
			<td class="mw-input">
				<?php 
        echo Html::input('wpRetype', null, 'password', array('class' => 'loginPassword', 'id' => 'wpRetype', 'tabindex' => '5', 'size' => '20') + User::passwordChangeInputAttribs());
        ?>
			</td>
		</tr>
		<tr>
			<?php 
        if ($this->data['useemail']) {
            ?>
				<td class="mw-label"><label for='wpEmail'><?php 
            $this->msg('youremail');
            ?>
</label></td>
				<td class="mw-input">
					<?php 
            echo Html::input('wpEmail', $this->data['email'], 'email', array('class' => 'loginText', 'id' => 'wpEmail', 'tabindex' => '6', 'size' => '20'));
            ?>
					<div class="prefsectiontip">
						<?php 
            // duplicated in Preferences.php profilePreferences()
            if ($this->data['emailrequired']) {
                $this->msgWiki('prefs-help-email-required');
            } else {
                $this->msgWiki('prefs-help-email');
            }
            if ($this->data['emailothers']) {
                $this->msgWiki('prefs-help-email-others');
            }
            ?>
					</div>
				</td>
			<?php 
        }
        ?>
			<?php 
        if ($this->data['userealname']) {
            ?>
				</tr>
				<tr>
					<td class="mw-label"><label for='wpRealName'><?php 
            $this->msg('yourrealname');
            ?>
</label></td>
					<td class="mw-input">
						<input type='text' class='loginText' name="wpRealName" id="wpRealName"
							tabindex="7"
							value="<?php 
            $this->text('realname');
            ?>
" size='20' />
						<div class="prefsectiontip">
							<?php 
            $this->msgWiki('prefs-help-realname');
            ?>
						</div>
					</td>
			<?php 
        }
        ?>
			<?php 
        if ($this->data['usereason']) {
            ?>
				</tr>
				<tr>
					<td class="mw-label"><label for='wpReason'><?php 
            $this->msg('createaccountreason');
            ?>
</label></td>
					<td class="mw-input">
						<input type='text' class='loginText' name="wpReason" id="wpReason"
							tabindex="8"
							value="<?php 
            $this->text('reason');
            ?>
" size='20' />
					</td>
			<?php 
        }
        ?>
		</tr>
		<?php 
        if ($this->data['canremember']) {
            ?>
		<tr>
			<td></td>
			<td class="mw-input">
				<?php 
            global $wgCookieExpiration;
            $expirationDays = ceil($wgCookieExpiration / (3600 * 24));
            echo Xml::checkLabel(wfMessage('remembermypassword')->numParams($expirationDays)->text(), 'wpRemember', 'wpRemember', $this->data['remember'], array('tabindex' => '9'));
            ?>
			</td>
		</tr>
<?php 
        }
        $tabIndex = 10;
        if (isset($this->data['extraInput']) && is_array($this->data['extraInput'])) {
            foreach ($this->data['extraInput'] as $inputItem) {
                ?>
		<tr>
			<?php 
                if (!empty($inputItem['msg']) && $inputItem['type'] != 'checkbox') {
                    ?>
<td class="mw-label"><label for="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"><?php 
                    $this->msgWiki($inputItem['msg']);
                    ?>
</label><?php 
                } else {
                    ?>
<td><?php 
                }
                ?>
</td>
			<td class="mw-input">
				<input type="<?php 
                echo htmlspecialchars($inputItem['type']);
                ?>
" name="<?php 
                echo htmlspecialchars($inputItem['name']);
                ?>
"
					tabindex="<?php 
                echo $tabIndex++;
                ?>
"
					value="<?php 
                if ($inputItem['type'] != 'checkbox') {
                    echo htmlspecialchars($inputItem['value']);
                } else {
                    echo '1';
                }
                ?>
" id="<?php 
                echo htmlspecialchars($inputItem['name']);
                ?>
"
					<?php 
                if ($inputItem['type'] == 'checkbox' && !empty($inputItem['value'])) {
                    echo 'checked="checked"';
                }
                ?>
 /> <?php 
                if ($inputItem['type'] == 'checkbox' && !empty($inputItem['msg'])) {
                    ?>
				<label for="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"><?php 
                    $this->msgHtml($inputItem['msg']);
                    ?>
</label><?php 
                }
                if ($inputItem['helptext'] !== false) {
                    ?>
				<div class="prefsectiontip">
					<?php 
                    $this->msgWiki($inputItem['helptext']);
                    ?>
				</div>
				<?php 
                }
                ?>
			</td>
		</tr>
<?php 
            }
        }
        ?>
		<tr>
			<td></td>
			<td class="mw-submit">
				<input type='submit' name="wpCreateaccount" id="wpCreateaccount"
					tabindex="<?php 
        echo $tabIndex++;
        ?>
"
					value="<?php 
        $this->msg('createaccount');
        ?>
" />
			</td>
		</tr>
	</table>
<?php 
        if ($this->haveData('uselang')) {
            ?>
<input type="hidden" name="uselang" value="<?php 
            $this->text('uselang');
            ?>
" /><?php 
        }
        if ($this->haveData('token')) {
            ?>
<input type="hidden" name="wpCreateaccountToken" value="<?php 
            $this->text('token');
            ?>
" /><?php 
        }
        ?>
</form>
</div>
<div id="signupend"><?php 
        $this->html('signupend');
        ?>
</div>
<?php 
    }
Example #3
0
    function execute()
    {
        global $wgCookieExpiration, $wgLanguageCode;
        $expirationDays = ceil($wgCookieExpiration / (3600 * 24));
        //is the user already logged in?
        if ($this->data['loggedin']) {
            //why is this user even here? let's give the user some options
            echo wfMessage('alreadysignedin', 'Special:UserLogout')->parse();
            return;
        }
        if ($wgLanguageCode != "en") {
            ?>
<style type="text/css">
#userlogin2 > div > label {                                                       
    float:left;
    display:inline-block;
    width:80px;
}
label[for="wpName2"], label[for="wpPassword2"] {
    margin-top:1.5em;
}
#realname_check {
	margin-left:95px;
}
</style>

<?php 
        }
        ?>
<div class="mw-ui-container">
	<?php 
        if ($this->haveData('languages')) {
            ?>
		<div id="languagelinks">
			<p><?php 
            $this->html('languages');
            ?>
</p>
		</div>
	<?php 
        }
        if (!wfMessage('signupstart')->isDisabled()) {
            ?>
		<div id="signupstart"><?php 
            $this->msgWiki('signupstart');
            ?>
</div>
	<?php 
        }
        ?>
	<div id="userloginForm" class="usercreateform">
		<form name="userlogin2" id="userlogin2" class="mw-ui-vform" method="post" action="<?php 
        $this->text('action');
        ?>
">
			<div>
				<div id="wpName2_mark" class="wpMark exclamation" />
				<label for='wpName2'>
					<?php 
        $this->msg('userlogin-yourname');
        ?>

					<span class="mw-ui-flush-right"><?php 
        echo $this->getMsg('createacct-helpusername')->parse();
        ?>
</span>
				</label>
				<?php 
        echo Html::input('wpName', $this->data['name'], 'text', array('class' => 'mw-input loginText input_med', 'id' => 'wpName2', 'tabindex' => '1', 'size' => '20', 'required'));
        ?>
				<div class="mw-error-bottom mw-error" id="wpName2_error" <?php 
        if (!isset($this->data['errorlist']['username'])) {
            echo 'style="display:none;"';
        }
        ?>
>
					<div class="mw-error-top">
						<?php 
        if (isset($this->data['errorlist']['username'])) {
            ?>
						<?php 
            foreach ($this->data['errorlist']['username'] as $error) {
                ?>
							<?php 
                if (is_array($error)) {
                    ?>
								<?php 
                    echo $this->msgHtml($error[0]);
                    ?>
							<?php 
                } elseif (get_class($error) == 'RawMessage') {
                    ?>
								<?php 
                    echo $error->parse();
                    ?>
							<?php 
                }
                ?>
						<?php 
            }
        }
        ?>

					</div>
				</div>
				<div class="mw-error-bottom mw-info" id="wpName2_info" style="display:none">
					<div class="mw-error-top">
						<?php 
        echo wfMsg('info_username');
        ?>
					</div>
				</div>
				<div id="realname_check">
					<input type='checkbox' id='wpUseRealNameAsDisplay' name='wpUseRealNameAsDisplay' tabindex='3' <?php 
        if ($this->data['userealname']) {
            ?>
checked='checked'<?php 
        }
        ?>
 />
					<label for="wpUseRealNameAsDisplay"><?php 
        $this->msg('user_real_name_display');
        ?>
</label>
				</div>
			</div>
			
			<div id="real_name_row" <?php 
        if ($this->data['userealname']) {
            ?>
style="display:none;"<?php 
        }
        ?>
>
				<label for='wpRealName' class="userlogin_label"><?php 
        $this->msg('yourrealname');
        ?>
</label>
				<input type='text' class='mw-input loginText input_med' name="wpRealName" id="wpRealName"
					tabindex="7"
					value="<?php 
        $this->text('realname');
        ?>
" size='20' />
				<div class="mw-error-bottom mw-info" id="wpRealName_info">
					<div class="mw-error-top">
						<?php 
        $this->msgWiki('info_realname');
        ?>
					</div>
				</div>
			</div>

			<div class="mw-row-password">
				<div id="wpPassword2_mark" class="wpMark exclamation" />
				<label for='wpPassword2'><?php 
        $this->msg('userlogin-yourpassword');
        ?>
</label>
				<?php 
        echo Html::input('wpPassword', null, 'password', array('class' => 'mw-input loginPassword input_med', 'id' => 'wpPassword2', 'tabindex' => '3', 'size' => '20', 'required') + User::passwordChangeInputAttribs());
        ?>
				<div class="mw-error-bottom mw-error" id="wpPassword2_error" <?php 
        if (!isset($this->data['errorlist']['password'])) {
            echo 'style="display:none;"';
        }
        ?>
>
					<div class="mw-error-top">
						<?php 
        if (isset($this->data['errorlist']['password'])) {
            ?>
						<?php 
            foreach ($this->data['errorlist']['password'] as $error) {
                ?>
							<?php 
                echo wfMessage($error[0])->params(array_splice($error, 1))->plain();
                ?>
						<?php 
            }
        }
        ?>
					</div>
				</div>
				<input type="hidden" id="wpPassword2_showhide" />
			</div>

			<div class="mw-row-password">
				<div id="wpRetype_mark" class="wpMark exclamation" />
				<label for='wpRetype' class="userlogin_label"><?php 
        $this->msg('createacct-yourpasswordagain');
        ?>
</label>
				<?php 
        echo Html::input('wpRetype', null, 'password', array('class' => 'mw-input loginPassword input_med', 'id' => 'wpRetype', 'tabindex' => '5', 'size' => '20', 'required') + User::passwordChangeInputAttribs());
        ?>
			</div>

			<div>
				<?php 
        if ($this->data['useemail']) {
            ?>
					<label for='wpEmail' class="userlogin_label">
						<?php 
            $this->msg($this->data['emailrequired'] ? 'createacct-emailrequired' : 'createacct-emailoptional');
            ?>
					</label>
					<?php 
            echo Html::input('wpEmail', $this->data['email'], 'email', array('class' => 'mw-input loginText input_med', 'id' => 'wpEmail', 'tabindex' => '6', 'size' => '20', 'required' => $this->data['emailrequired']));
            ?>
				<?php 
        }
        ?>
				<div class="mw-error-bottom mw-info" id="wpEmail_info">
					<div class="mw-error-top">
						<?php 
        $this->msgHtml('info_email');
        ?>
					</div>
				</div>
			</div>

			<?php 
        $tabIndex = 9;
        if (isset($this->data['extraInput']) && is_array($this->data['extraInput'])) {
            foreach ($this->data['extraInput'] as $inputItem) {
                ?>
					<div>
						<?php 
                // If it's a checkbox, output the whole thing (assume it has a msg).
                if ($inputItem['type'] == 'checkbox') {
                    ?>
							<label class="mw-ui-checkbox-label">
								<input
									name="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
									id="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
									type="checkbox" value="1"
									tabindex="<?php 
                    echo $tabIndex++;
                    ?>
"
									<?php 
                    if (!empty($inputItem['value'])) {
                        echo 'checked="checked"';
                    }
                    ?>
								>
								<?php 
                    $this->msg($inputItem['msg']);
                    ?>
							</label>
						<?php 
                } else {
                    // Not a checkbox.
                    // TODO (bug 31909) support other input types, e.g. select boxes.
                    ?>
							<?php 
                    if (!empty($inputItem['msg'])) {
                        ?>
								<label for="<?php 
                        echo htmlspecialchars($inputItem['name']);
                        ?>
">
									<?php 
                        $this->msgWiki($inputItem['msg']);
                        ?>
								</label>
							<?php 
                    }
                    ?>
							<input
								type="<?php 
                    echo htmlspecialchars($inputItem['type']);
                    ?>
"
								class="mw-input"
								name="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
								tabindex="<?php 
                    echo $tabIndex++;
                    ?>
"
								value="<?php 
                    echo htmlspecialchars($inputItem['value']);
                    ?>
"
								id="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
							/>
						<?php 
                }
                ?>
						<?php 
                if ($inputItem['helptext'] !== false) {
                    ?>
							<div class="prefsectiontip">
								<?php 
                    $this->msgWiki($inputItem['helptext']);
                    ?>
							</div>
						<?php 
                }
                ?>
					</div>
				<?php 
            }
        }
        // JS attempts to move the image CAPTCHA below this part of the form,
        // so skip one index.
        $tabIndex++;
        ?>
			<section class="mw-form-header">
				<?php 
        $this->html('header');
        /* extensions such as ConfirmEdit add form HTML here */
        ?>
				<div class="mw-error-bottom mw-info" id="wpCaptchaWord_info">
					<div class="mw-error-top">
						<?php 
        echo wfMsg('info_captcha');
        ?>
					</div>
				</div>
			</section>
			<br />

			<div class="remember_pwd">
				<?php 
        if ($this->data['canremember']) {
            ?>
					<label class="mw-ui-checkbox-label">
						<input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="9"
							<?php 
            if ($this->data['remember']) {
                echo 'checked="checked"';
            }
            ?>
						>
						<?php 
            echo $this->getMsg('rememberme')->numParams($expirationDays)->escaped();
            ?>
					</label>
				<?php 
        }
        ?>
			</div>
			
			<div class="mw-submit">
				<?php 
        echo Html::input('wpCreateaccount', $this->getMsg('createaccount'), 'submit', array('class' => "mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive button primary submit_button", 'id' => 'wpCreateaccount', 'tabindex' => $tabIndex++));
        ?>
			</div>
			<?php 
        if ($this->haveData('uselang')) {
            ?>
<input type="hidden" name="uselang" value="<?php 
            $this->text('uselang');
            ?>
" /><?php 
        }
        ?>
			<?php 
        if ($this->haveData('token')) {
            ?>
<input type="hidden" name="wpCreateaccountToken" value="<?php 
            $this->text('token');
            ?>
" /><?php 
        }
        ?>
		</form>
		<?php 
        if (!wfMessage('signupend')->isDisabled()) {
            ?>
			<div id="signupend"><?php 
            $this->html('signupend');
            ?>
</div>
		<?php 
        }
        ?>
	</div>
</div>
<div class="captcha_fineprint"><?php 
        $this->msgWiki('fancycaptcha-createaccount');
        ?>
</div>
<?php 
    }
Example #4
0
 function pretty($fields)
 {
     $out = '';
     foreach ($fields as $list) {
         list($name, $label, $type, $value) = $list;
         if ($type == 'text') {
             $field = htmlspecialchars($value);
         } else {
             $attribs = array('id' => $name);
             if ($name == 'wpNewPassword' || $name == 'wpRetype') {
                 $attribs = array_merge($attribs, User::passwordChangeInputAttribs());
             }
             if ($name == 'wpPassword') {
                 $attribs[] = 'autofocus';
             }
             $field = Html::input($name, $value, $type, $attribs);
         }
         $out .= "<tr>\n";
         $out .= "\t<td class='mw-label'>";
         if ($type != 'text') {
             $out .= Xml::label(wfMsg($label), $name);
         } else {
             $out .= wfMsgHtml($label);
         }
         $out .= "</td>\n";
         $out .= "\t<td class='mw-input'>";
         $out .= $field;
         $out .= "</td>\n";
         $out .= "</tr>";
     }
     return $out;
 }
Example #5
0
    function execute()
    {
        global $wgCookieExpiration;
        $expirationDays = ceil($wgCookieExpiration / (3600 * 24));
        ?>
<div class="mw-ui-container">
	<?php 
        if ($this->haveData('languages')) {
            ?>
		<div id="languagelinks">
			<p><?php 
            $this->html('languages');
            ?>
</p>
		</div>
	<?php 
        }
        ?>
<div id="userloginForm">
<h2 class="createaccount-join"><?php 
        $this->msg('createacct-join');
        ?>
</h2>
<form name="userlogin2" id="userlogin2" class="mw-ui-vform" method="post" action="<?php 
        $this->text('action');
        ?>
">
	<section class="mw-form-header">
		<?php 
        $this->html('header');
        /* extensions such as ConfirmEdit add form HTML here */
        ?>
	</section>
	<?php 
        if ($this->data['message']) {
            ?>
		<div class="<?php 
            $this->text('messagetype');
            ?>
box">
		<?php 
            if ($this->data['messagetype'] == 'error') {
                ?>
			<strong><?php 
                $this->msg('createacct-error');
                ?>
</strong><br />
		<?php 
            }
            ?>
		<?php 
            $this->html('message');
            ?>
		</div>
	<?php 
        }
        ?>
		<div>
			<label for='wpName2'>
				<?php 
        $this->msg('userlogin-yourname');
        ?>

				<span class="mw-ui-flush-right"><?php 
        echo $this->getMsg('createacct-helpusername')->parse();
        ?>
</span>
			</label>
			<?php 
        echo Html::input('wpName', $this->data['name'], 'text', array('class' => 'mw-input loginText', 'id' => 'wpName2', 'tabindex' => '1', 'size' => '20', 'required', 'placeholder' => $this->getMsg('userlogin-yourname-ph')->text(), 'autofocus'));
        ?>
		</div>
		<div>
		<?php 
        if ($this->data['createemail']) {
            ?>
			<label class="mw-ui-checkbox-label">
				<input name="wpCreateaccountMail" type="checkbox" value="1" id="wpCreateaccountMail" tabindex="2"
					<?php 
            if ($this->data['createemailset']) {
                echo 'checked="checked"';
            }
            ?>
				>
				<?php 
            $this->msg('createaccountmail');
            ?>
			</label>
		<?php 
        }
        ?>
		</div>
		<div class="mw-row-password">
			<label for='wpPassword2'><?php 
        $this->msg('userlogin-yourpassword');
        ?>
</label>
			<?php 
        echo Html::input('wpPassword', null, 'password', array('class' => 'mw-input loginPassword', 'id' => 'wpPassword2', 'tabindex' => '3', 'size' => '20', 'required', 'placeholder' => $this->getMsg('createacct-yourpassword-ph')->text()) + User::passwordChangeInputAttribs());
        ?>
		</div>
	<?php 
        if ($this->data['usedomain']) {
            $doms = "";
            foreach ($this->data['domainnames'] as $dom) {
                $doms .= "<option>" . htmlspecialchars($dom) . "</option>";
            }
            ?>
		<div>
			<label><?php 
            $this->msg('yourdomainname');
            ?>
</label>
			<div class="mw-input">
				<select name="wpDomain" value="<?php 
            $this->text('domain');
            ?>
"
					tabindex="4">
					<?php 
            echo $doms;
            ?>
				</select>
			</div>
		</div>
	<?php 
        }
        ?>
		<div class="mw-row-password">
			<label for='wpRetype'><?php 
        $this->msg('createacct-yourpasswordagain');
        ?>
</label>
			<?php 
        echo Html::input('wpRetype', null, 'password', array('class' => 'mw-input loginPassword', 'id' => 'wpRetype', 'tabindex' => '5', 'size' => '20', 'required', 'placeholder' => $this->getMsg('createacct-yourpasswordagain-ph')->text()) + User::passwordChangeInputAttribs());
        ?>
		</div>
		<div>
		<?php 
        if ($this->data['useemail']) {
            ?>
			<label for='wpEmail'>
				<?php 
            $this->msg($this->data['emailrequired'] ? 'createacct-emailrequired' : 'createacct-emailoptional');
            ?>
			</label>
			<?php 
            echo Html::input('wpEmail', $this->data['email'], 'email', array('class' => 'mw-input loginText', 'id' => 'wpEmail', 'tabindex' => '6', 'size' => '20', 'placeholder' => $this->getMsg('createacct-email-ph')->text()) + ($this->data['emailrequired'] ? array() : array('required' => '')));
            ?>
			<?php 
            // VForm eliminates the prefsectiontip div tip:
            // prefs-help-email-required is redundant with the placeholder text
            // Doesn't show the wordy prefs-help-email
            // Doesn't show the wordy prefs-help-email-others
            ?>
		<?php 
        }
        ?>
		</div>
		<?php 
        if ($this->data['userealname']) {
            ?>
			<div>
				<label for='wpRealName'><?php 
            $this->msg('createacct-realname');
            ?>
</label>
				<input type='text' class='mw-input loginText' name="wpRealName" id="wpRealName"
					tabindex="7"
					value="<?php 
            $this->text('realname');
            ?>
" size='20' />
				<div class="prefsectiontip">
					<?php 
            $this->msgWiki('prefs-help-realname');
            ?>
				</div>
			</div>
		<?php 
        }
        if ($this->data['usereason']) {
            ?>
			<div>
				<label for='wpReason'><?php 
            $this->msg('createacct-reason');
            ?>
</label>
				<?php 
            echo Html::input('wpReason', $this->data['reason'], 'text', array('class' => 'mw-input loginText', 'id' => 'wpReason', 'tabindex' => '8', 'size' => '20', 'placeholder' => $this->getMsg('createacct-reason-ph')->text()));
            ?>
			</div>
		<?php 
        }
        $tabIndex = 9;
        if (isset($this->data['extraInput']) && is_array($this->data['extraInput'])) {
            foreach ($this->data['extraInput'] as $inputItem) {
                ?>
			<div>
				<?php 
                // If it's a checkbox, output the whole thing (assume it has a msg).
                if ($inputItem['type'] == 'checkbox') {
                    ?>
					<label class="mw-ui-checkbox-label">
						<input
							name="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
							id="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
							type="checkbox" value="1"
							tabindex="<?php 
                    echo $tabIndex++;
                    ?>
"
							<?php 
                    if (!empty($inputItem['value'])) {
                        echo 'checked="checked"';
                    }
                    ?>
						>
						<?php 
                    $this->msg($inputItem['msg']);
                    ?>
					</label>
				<?php 
                } else {
                    // Not a checkbox.
                    if (!empty($inputItem['msg'])) {
                        // Output the message label
                        ?>
						<label for="<?php 
                        echo htmlspecialchars($inputItem['name']);
                        ?>
">
							<?php 
                        $this->msgWiki($inputItem['msg']);
                        ?>
						</label>
					<?php 
                    }
                    ?>
					<input
						type="<?php 
                    echo htmlspecialchars($inputItem['type']);
                    ?>
"
						class="mw-input"
						name="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
						tabindex="<?php 
                    echo $tabIndex++;
                    ?>
"
						value="<?php 
                    echo htmlspecialchars($inputItem['value']);
                    ?>
"
						id="<?php 
                    echo htmlspecialchars($inputItem['name']);
                    ?>
"
					/>
				<?php 
                }
                if ($inputItem['helptext'] !== false) {
                    ?>
					<div class="prefsectiontip">
						<?php 
                    $this->msgWiki($inputItem['helptext']);
                    ?>
					</div>
				<?php 
                }
                ?>
				</div>
			<?php 
            }
        }
        // JS attempts to move the image CAPTCHA below this part of the form,
        // so skip one index.
        $tabIndex++;
        ?>
		<div class="mw-submit">
			<input type='submit' class="mw-ui-button mw-ui-big mw-ui-block mw-ui-primary" name="wpCreateaccount" id="wpCreateaccount"
				tabindex="<?php 
        echo $tabIndex++;
        ?>
"
				value="<?php 
        $this->msg('createacct-submit');
        ?>
" />
		</div>
	<input type="hidden" id="useNew" name="useNew" value="1" />
<?php 
        if ($this->haveData('uselang')) {
            ?>
<input type="hidden" name="uselang" value="<?php 
            $this->text('uselang');
            ?>
" /><?php 
        }
        if ($this->haveData('token')) {
            ?>
<input type="hidden" name="wpCreateaccountToken" value="<?php 
            $this->text('token');
            ?>
" /><?php 
        }
        ?>
</form>
</div>
<div class="mw-createacct-benefits-container">
	<h2><?php 
        $this->msg('createacct-benefit-heading');
        ?>
</h2>
	<div class="mw-createacct-benefits-list">
	<?php 
        for ($benefitIdx = 1; $benefitIdx <= $this->data['benefitCount']; $benefitIdx++) {
            // Pass each benefit's head text (by default a number) as a parameter to the body's message for PLURAL handling.
            $headUnescaped = $this->getMsg("createacct-benefit-head{$benefitIdx}")->text();
            ?>
		<div>
			<div class="mw-benefits-icon <?php 
            $this->msg("createacct-benefit-icon{$benefitIdx}");
            ?>
"></div>
			<div class="mw-number-text">
				<h3><?php 
            $this->msg("createacct-benefit-head{$benefitIdx}");
            ?>
</h3>
				<p><?php 
            echo $this->getMsg("createacct-benefit-body{$benefitIdx}")->params($headUnescaped)->escaped();
            ?>
</p>
			</div>
		</div>
	<?php 
        }
        ?>
	</div>
</div>
</div>
<?php 
    }