示例#1
0
        _e('Strength indicator');
        ?>
</div>
		</div>
	</div>

	<p class="user-pass2-wrap">
		<label for="pass2"><?php 
        _e('Confirm new password');
        ?>
</label><br />
		<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" />
	</p>

	<p class="description indicator-hint"><?php 
        echo wp_get_password_hint();
        ?>
</p>
	<br class="clear" />

	<?php 
        /**
         * Fires following the 'Strength indicator' meter in the user password reset form.
         *
         * @since 3.9.0
         *
         * @param WP_User $user User object of the user whose password is being reset.
         */
        do_action('resetpass_form', $user);
        ?>
	<input type="hidden" name="rp_key" value="<?php 
示例#2
0
/**
 * Display installer setup form.
 *
 * @since 2.8.0
 */
function display_setup_form($error = null)
{
    global $wpdb;
    $sql = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($wpdb->users));
    $user_table = $wpdb->get_var($sql) != null;
    // Ensure that Blogs appear in search engines by default.
    $blog_public = 1;
    if (isset($_POST['weblog_title'])) {
        $blog_public = isset($_POST['blog_public']);
    }
    $weblog_title = isset($_POST['weblog_title']) ? trim(wp_unslash($_POST['weblog_title'])) : '';
    $user_name = isset($_POST['user_name']) ? trim(wp_unslash($_POST['user_name'])) : '';
    $admin_email = isset($_POST['admin_email']) ? trim(wp_unslash($_POST['admin_email'])) : '';
    if (!is_null($error)) {
        ?>
<p class="message"><?php 
        echo $error;
        ?>
</p>
<?php 
    }
    ?>
<form id="setup" method="post" action="install.php?step=2" novalidate="novalidate">
	<table class="form-table">
		<tr>
			<th scope="row"><label for="weblog_title"><?php 
    _e('Site Title');
    ?>
</label></th>
			<td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php 
    echo esc_attr($weblog_title);
    ?>
" /></td>
		</tr>
		<tr>
			<th scope="row"><label for="user_login"><?php 
    _e('Tên đăng nhập');
    ?>
</label></th>
			<td>
			<?php 
    if ($user_table) {
        _e('User(s) already exists.');
        echo '<input name="user_name" type="hidden" value="admin" />';
    } else {
        ?>
<input name="user_name" type="text" id="user_login" size="25" value="<?php 
        echo esc_attr(sanitize_user($user_name, true));
        ?>
" />
				<p><?php 
        _e('Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.');
        ?>
</p>
			<?php 
    }
    ?>
			</td>
		</tr>
		<?php 
    if (!$user_table) {
        ?>
		<tr>
			<th scope="row">
				<label for="pass1"><?php 
        _e('Password, twice');
        ?>
</label>
				<p><?php 
        _e('A password will be automatically generated for you if you leave this blank.');
        ?>
</p>
			</th>
			<td>
				<input name="admin_password" type="password" id="pass1" size="25" value="" />
				<p><input name="admin_password2" type="password" id="pass2" size="25" value="" /></p>
				<div id="pass-strength-result"><?php 
        _e('Strength indicator');
        ?>
</div>
				<p><?php 
        echo wp_get_password_hint();
        ?>
</p>
			</td>
		</tr>
		<?php 
    }
    ?>
		<tr>
			<th scope="row"><label for="admin_email"><?php 
    _e('Your E-mail');
    ?>
</label></th>
			<td><input name="admin_email" type="email" id="admin_email" size="25" value="<?php 
    echo esc_attr($admin_email);
    ?>
" />
			<p><?php 
    _e('Double-check your email address before continuing.');
    ?>
</p></td>
		</tr>
		<tr>
			<th scope="row"><?php 
    _e('Privacy');
    ?>
</th>
			<td colspan="2"><label><input type="checkbox" name="blog_public" id="blog_public" value="1" <?php 
    checked($blog_public);
    ?>
 /> <?php 
    _e('Allow search engines to index this site.');
    ?>
</label></td>
		</tr>
	</table>
	<p class="step"><input type="submit" name="Submit" value="<?php 
    esc_attr_e('Install WordPress');
    ?>
" class="button button-large" /></p>
	<input type="hidden" name="language" value="<?php 
    echo isset($_REQUEST['language']) ? esc_attr($_REQUEST['language']) : '';
    ?>
" />
</form>
<?php 
}
        /**
         * Display User Page
         * To do: translations
         * To do: harmonize form names
         * To do: i8n for password-strength-meter
         */
        function display_user_page()
        {
            $currentUser = $this->currentUser;
            $pluginOptions = $this->pluginOptions;
            $mailbox = $currentUser['user_login'] . "@" . $pluginOptions['email_tld'];
            ?>
			<div class="wrap">
			<h2><?php 
            echo $this->pluginOptions['usermenu_title'];
            ?>
</h2>
			<p><?php 
            if ($currentUser['mailbox_exists']) {
                printf(__("The Mailbox Manager allows you to configure your personal Mailbox <b>%s</b>.", $this->pluginTextDomain), $mailbox);
            } else {
                printf(__("The Mailbox Manager allows you to activate and configure your personal Mailbox <b>%s</b>.", $this->pluginTextDomain), $mailbox);
            }
            ?>
</p>
			<p><?php 
            printf(__('You can access emails sent to this address using software on your computer (such as Thunderbird or Outlook), your smartphone (Android / iPhone), or the <a href="%1$s" title="Link to webmail" target="_blank">webmail app</a>.', $this->pluginTextDomain), $pluginOptions['webmail_url']);
            ?>
</p>
			<?php 
            if (!$currentUser['mailbox_exists']) {
                ?>
			<form method="post" action="<?php 
                echo $_SERVER['REQUEST_URI'];
                ?>
" >
				<input name="sr-wp-plugin-umm-userid" type="hidden" value="<?php 
                echo $currentUser['ID'];
                ?>
" />
				<input name="sr-wp-plugin-umm-update-nonce" type="hidden" value="<?php 
                echo wp_create_nonce('sr-wp-plugin-umm-update-nonce');
                ?>
" />
				<input type="submit" class="button button-primary" id="sr-wp-plugin-umm-activate" name="sr-wp-plugin-umm-activate" value="<?php 
                printf(__("Activate my Mailbox %s", $this->pluginTextDomain), $mailbox);
                ?>
" />
			</form>
			<?php 
            } else {
                ?>
			<p><?php 
                printf(__('If you need help setting up access to your Mailbox, check out one of the following short instructions: <a href="%1$s" title="Instructions for Android">Android</a>, <a href="%2$s" title="Instructions for Gmail">Gmail</a>, and <a href="%3$s" title="Instructions for iPhone">iPhone</a>.', $this->pluginTextDomain), 'https://www.dropbox.com/s/bmzj7dxfbbydkme/Alle%20Schritte%20-%20Email-Konfiguration%20f%C3%BCr%20Android.pdf?dl=0', 'https://www.dropbox.com/s/1oouqr8y8v11z89/Alle%20Schritte%20-%20Email-Konfiguration%20f%C3%BCr%20Gmail.pdf?dl=0', 'https://www.dropbox.com/s/3kcway49f7d9p3i/Alle%20Schritte%20-%20Email-Konfiguration%20f%C3%BCr%20iPhone.pdf?dl=0');
                ?>
</p>
		<hr />
			<h3><?php 
                _e("Mailbox configuration", $this->pluginTextDomain);
                ?>
</h3>
			<form method="post" action="<?php 
                echo $_SERVER['REQUEST_URI'];
                ?>
" >
				<input name="sr-wp-plugin-umm-userid" type="hidden" value="<?php 
                echo $currentUser['ID'];
                ?>
" />
				<input name="sr-wp-plugin-umm-update-nonce" type="hidden" value="<?php 
                echo wp_create_nonce('sr-wp-plugin-umm-update-nonce');
                ?>
" />

				<table class="form-table">
					<tr class="sr-wp-plugin-umm-forward">
						<th scope="row"><label for="sr-wp-plugin-umm-forward"><?php 
                _e("Mailbox forwarding", $this->pluginTextDomain);
                ?>
</label></th>
						<td>
							<fieldset>
									<input name="sr-wp-plugin-umm-forward" type="checkbox" id="sr-wp-plugin-umm-forward" value="enabled" <?php 
                if ($currentUser['mailbox_forward_active']) {
                    echo 'checked="checked"';
                }
                ?>
/><?php 
                _e("Forward all incoming mail to the following address(es):", $this->pluginTextDomain);
                ?>
<br />
									<input type="text" name="sr-wp-plugin-umm-forward-address" id="sr-wp-plugin-umm-forward-address" class="regular-text" value="<?php 
                echo $currentUser['mailbox_forward_address'];
                ?>
"/><br />
									<?php 
                _e("You may enter multiple email addresses by separating them with a comma", $this->pluginTextDomain);
                ?>
							</fieldset>
						</td>
					</tr>
					<tr id="password" class="sr-wp-plugin-umm-password-wrap">
						<th><label for="sr-wp-plugin-umm-password"><?php 
                _e("Change Mailbox password", $this->pluginTextDomain);
                ?>
</label></th>
						<td>
							<input class="hidden" value=" " /><!-- #24364 workaround (otherwise Chrome disrespects autocomplete="off" on following field) -->
							<input type="password" name="sr-wp-plugin-umm-password" id="sr-wp-plugin-umm-password" class="regular-text" size="16" value="" autocomplete="off" /><br />
							<?php 
                /* To do: Javscript for password strength should reset to "Password strength" when field is emptied */
                ?>
							<div id="pass-strength-result" style="display:block; clear:both;"><?php 
                _e("Password strength", $this->pluginTextDomain);
                ?>
</div><div style="display:block; margin: 13px 5px 5px 1px; padding: 3px 5px;"><?php 
                echo __("Random password proposal:", $this->pluginTextDomain) . " " . wp_generate_password(8, false);
                ?>
</div>
							<p class="description" style="clear:both;"><?php 
                _e('If you would like to change the password type a new one. Otherwise leave this blank.');
                ?>
</p>
							<p class="description indicator-hint"><?php 
                echo wp_get_password_hint();
                ?>
</p>
						</td>
					</tr>
				</table>
				<div class="submit">
					<input type="submit" class="button button-primary" name="sr-wp-plugin-umm-update" value="<?php 
                _e('Update', 'sr-wp-plugin-umm');
                ?>
" />
				</div>
			</form>
			<hr />
				<h3><?php 
                _e("Configuration data for your email software", $this->pluginTextDomain);
                ?>
</h3>
				<table>
					<tr><th scope="row"><?php 
                _e("Username/Email", $this->pluginTextDomain);
                ?>
</th><td><?php 
                echo $mailbox;
                ?>
</td></tr>
					<tr><th scope="row"><?php 
                _e("Password", $this->pluginTextDomain);
                ?>
</th><td><?php 
                echo empty($this->passtmp) ? __("Please change above, if unknown.", $this->pluginTextDomain) : $this->passtmp;
                ?>
</td></tr>
					<?php 
                if (!empty($pluginOptions['email_server'])) {
                    echo "<tr><th scope=\"row\">" . __("Server", $this->pluginTextDomain) . "</th><td>" . $pluginOptions['email_server'] . "</td></tr>\n";
                }
                if (!empty($pluginOptions['imap_server'])) {
                    echo "<tr><th scope=\"row\">" . __("IMAP Server", $this->pluginTextDomain) . "</th><td>" . $pluginOptions['imap_server'] . "</td></tr>\n";
                }
                if (!empty($pluginOptions['imap_port'])) {
                    echo "<tr><th scope=\"row\">" . __("IMAP Port", $this->pluginTextDomain) . "</th><td>" . $pluginOptions['imap_port'] . "</td></tr>\n";
                }
                if (!empty($pluginOptions['imap_security'])) {
                    echo "<tr><th scope=\"row\">" . __("IMAP Security", $this->pluginTextDomain) . "</th><td>" . $pluginOptions['imap_security'] . "</td></tr>\n";
                }
                if (!empty($pluginOptions['pop3_server'])) {
                    echo "<tr><th scope=\"row\">" . __("POP3 Server", $this->pluginTextDomain) . "</th><td>" . $pluginOptions['pop3_server'] . "</td></tr>\n";
                }
                if (!empty($pluginOptions['pop3_port'])) {
                    echo "<tr><th scope=\"row\">" . __("POP3 Port", $this->pluginTextDomain) . "</th><td>" . $pluginOptions['pop3_port'] . "</td></tr>\n";
                }
                if (!empty($pluginOptions['pop3_security'])) {
                    echo "<tr><th scope=\"row\">" . __("POP3 Security", $this->pluginTextDomain) . "</th><td>" . $pluginOptions['pop3_security'] . "</td></tr>\n";
                }
                if (!empty($pluginOptions['smtp_server'])) {
                    echo "<tr><th scope=\"row\">" . __("SMTP Server", $this->pluginTextDomain) . "</th><td>" . $pluginOptions['smtp_server'] . "</td></tr>\n";
                }
                if (!empty($pluginOptions['smtp_port'])) {
                    echo "<tr><th scope=\"row\">" . __("SMTP Port", $this->pluginTextDomain) . "</th><td>" . $pluginOptions['smtp_port'] . "</td></tr>\n";
                }
                if (!empty($pluginOptions['smtp_security'])) {
                    echo "<tr><th scope=\"row\">" . __("SMTP Security", $this->pluginTextDomain) . "</th><td>" . $pluginOptions['smtp_security'] . "</td></tr>\n";
                }
                ?>
				</table>
				</div>
			<?php 
            }
        }
    /**
     * Returns HTML partial that contains password-reset form.
     * Based on WordPress core code from wp-login.php
     *
     * @since  1.0.0
     *
     * @return string
     */
    private function reset_form()
    {
        static $Reset_Result = null;
        if (null === $Reset_Result) {
            lib3()->array->equip_get('login', 'key');
            lib3()->array->equip_post('pass1', 'pass2');
            $rp_login = wp_unslash($_GET['login']);
            $rp_key = wp_unslash($_GET['key']);
            $err_msg = new WP_Error();
            $fatal_error = false;
            lib3()->array->strip_slashes($_POST, 'pass1', 'pass2');
            $pass1 = $_POST['pass1'];
            $pass2 = $_POST['pass2'];
            // Get the user object and validate the key.
            if ($rp_login && $rp_key) {
                $user = check_password_reset_key($rp_key, $rp_login);
            } else {
                $user = false;
            }
            if (!$user || is_wp_error($user)) {
                // If the user was not found then show an error message.
                if ($user && 'expired_key' == $user->get_error_code()) {
                    $fatal_error = true;
                    $err_msg->add('password_expired_key', __('Sorry, this reset-key is not valid anymore. Please request a new reset email and try again.', 'membership2'));
                } else {
                    $fatal_error = true;
                    $err_msg->add('password_invalid_key', __('Sorry, we did not find a valid reset-key. Please request a new reset email and try again.', 'membership2'));
                }
            } else {
                // If the user provided a new password, then check it now.
                if ($pass1 && $pass1 != $pass2) {
                    $pass1 = false;
                    $err_msg->add('password_reset_mismatch', __('The passwords do not match, try again.', 'membership2'));
                }
            }
            if ($fatal_error && count($err_msg->errors)) {
                $url = esc_url_raw(add_query_arg(array('show' => 'lostpass'), remove_query_arg(array('action', 'key', 'login'))));
                $Reset_Result = sprintf('[ms-note type="warning"]%s[/ms-note]<a href="%s">%s</a>', $err_msg->get_error_message(), $url, __('Request a new password-reset key', 'membership2'));
            } elseif ($pass1) {
                // This action is documented in wp-login.php
                do_action('validate_password_reset', $err_msg, $user);
                reset_password($user, $_POST['pass1']);
                // All done! Show success message and link to login form
                $url = esc_url_raw(remove_query_arg(array('action', 'key', 'login')));
                $Reset_Result = sprintf('[ms-note type="info"]%s[/ms-note]<a href="%s">%s</a>', __('Your Password has been reset.', 'membership2'), $url, __('Login with your new password', 'membership2'));
            } else {
                // This action is documented in wp-login.php
                do_action('validate_password_reset', $err_msg, $user);
                wp_enqueue_script('utils');
                wp_enqueue_script('user-profile');
                ob_start();
                if (count($err_msg->errors)) {
                    printf('[ms-note type="warning"]%s[/ms-note]', implode('<br>', $err_msg->get_error_messages()));
                }
                ?>
				<form name="resetpassform" id="resetpassform"
					action="" method="post" autocomplete="off" class="ms-form">
					<input type="hidden" id="user_login"
						value="<?php 
                echo esc_attr($rp_login);
                ?>
" autocomplete="off"/>

					<p class="user-pass1-wrap">
						<label for="pass1"><?php 
                _e('New password');
                ?>
</label><br />
						<div class="wp-pwd">
							<span class="password-input-wrapper">
								<input type="password" data-reveal="1" data-pw="<?php 
                echo esc_attr(wp_generate_password(16));
                ?>
" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" aria-describedby="pass-strength-result" />
							</span>
							<div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php 
                _e('Strength indicator');
                ?>
</div>
						</div>
					</p>
					<p class="user-pass2-wrap">
						<label for="pass2"><?php 
                _e('Confirm new password');
                ?>
</label><br />
						<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" />
					</p>

					<p class="description indicator-hint"><?php 
                echo wp_get_password_hint();
                ?>
</p>

					<br class="clear"/>

					<?php 
                // This action is documented in wp-login.php
                do_action('resetpass_form', $user);
                ?>
					<p class="submit">
						<input type="hidden" name="rp_key" value="<?php 
                echo esc_attr($rp_key);
                ?>
" />

						<button type="submit" name="wp-submit" id="wp-submit"
						class="button button-primary button-large">
						<?php 
                _e('Reset Password', 'membership2');
                ?>
						</button>
					</p>
				</form>
				<?php 
                $html = ob_get_clean();
                $Reset_Result = apply_filters('ms_compact_code', $html);
            }
            $Reset_Result = do_shortcode($Reset_Result);
        }
        return $Reset_Result;
    }
<tr id="password" class="user-pass1-wrap">
	<th><label for="pass1"><?php _e( 'New Password' ); ?></label></th>
	<td>
		<input class="hidden" value=" " /><!-- #24364 workaround -->
		<input type="password" name="pass1" id="pass1" class="regular-text" size="16" value="" autocomplete="off" />
		<p class="description"><?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.' ); ?></p>
	</td>
</tr>
<tr class="user-pass2-wrap">
	<th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th>
	<td>
	<input name="pass2" type="password" id="pass2" class="regular-text" size="16" value="" autocomplete="off" />
	<p class="description"><?php _e( 'Type your new password again.' ); ?></p>
	<br />
	<div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div>
	<p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
	</td>
</tr>
<?php endif; ?>

<?php
if ( IS_PROFILE_PAGE && count( $sessions->get_all() ) === 1 ) : ?>
	<tr class="user-sessions-wrap hide-if-no-js">
		<th>&nbsp;</th>
		<td aria-live="assertive">
			<div class="destroy-sessions"><button type="button" disabled class="button button-secondary"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
			<p class="description">
				<?php _e( 'You are only logged in at this location.' ); ?>
			</p>
		</td>
	</tr>