예제 #1
0
    protected function display_login_form($uname = null, $class = null)
    {
        echo '<div id="loginModule"><div class="LoginWrap"><div class="loginForm">' . "\n";
        $this->display_login_message('pre');
        show_cookie_capability('<p class="smallText">You must have cookies enabled to login.  You do not have cookies enabled.</p>');
        $current_url = carl_make_link(array('dest_page' => $this->dest_page, 'redir_link_text' => $this->redir_link_text, 'logout' => ''));
        $username_value = $uname ? 'value="' . htmlspecialchars($uname) . '"' : '';
        $form_class = $class ? 'class="' . htmlspecialchars($class) . '"' : '';
        ?>
		<form action="<?php 
        echo $current_url;
        ?>
" method="post" <?php 
        echo $form_class;
        ?>
>
			<div class="loginElement" id="usernameLoginElement">
				<label for="usernameLoginInput">Username</label>
				<input type="text" name="username" id="usernameLoginInput" <?php 
        echo $username_value;
        ?>
/>
			</div>
			<div class="loginElement" id="passwordLoginElement">
				<label for="passwordLoginInput">Password</label>
				<input type="password" name="password" id="passwordLoginInput" />
			</div>
			<div class="formActions">
				<div id="loginSubmitElement">
					<input type="submit" value="Sign In" id="loginSubmit" />
				</div>
				<div id="loginHelpElement">
					<a href="/login/help/">Username/<br />Password Help</a>
				</div>
			</div>
		</form>
		<?php 
        $this->display_login_message('post');
        echo '</div></div></div>' . "\n";
    }
예제 #2
0
    function run()
    {
        if (DISABLE_REASON_LOGIN) {
            echo '<div id="login">' . "\n";
            echo '<h4 class="msg">Reason login is currently disabled</h4>' . "\n";
            echo '<div class="msg_extra">Please try again later.</div>' . "\n";
            echo '</div>' . "\n";
            return false;
        }
        if ($this->close_window) {
            ?>
				<script language="JavaScript" type="text/javascript">
				window.close();
				</script>
				<?php 
        }
        echo '<div id="login">' . "\n";
        if (!empty($this->msg)) {
            echo '<h4 class="msg">' . $this->msg . '</h4>' . "\n";
        }
        if (!empty($this->msg_extra)) {
            echo '<div class="msg_extra">' . $this->msg_extra . '</div>' . "\n";
        }
        if (!$this->logged_in) {
            if (!$this->on_secure_page_if_available) {
                $url = get_current_url(securest_available_protocol());
                if ($this->params['login_mode'] == 'standalone') {
                    header('Location: ' . $url);
                    exit;
                } else {
                    echo '<a href="' . $url . '">Use Secure Login</a>';
                }
            } else {
                $this->set_test_cookie();
                $uname = '';
                if (!empty($this->request['username'])) {
                    $uname = $this->request['username'];
                }
                $current_url = !empty($this->dest_page) ? carl_make_link(array('dest_page' => $this->dest_page)) : get_current_url();
                // carl_make_link also runs htmlspecialchars
                ?>
					<form action="<?php 
                echo $current_url;
                ?>
" method="post">
						<table cellpadding="4" cellspacing="2" summary="Login Form">
							<tr><td style="text-align:right;">Username:</td><td><input type="text" name="username" value="<?php 
                echo htmlspecialchars($uname);
                ?>
" /></td></tr>
							<tr><td style="text-align:right;">Password:</td><td><input type="password" name="password" /></td></tr>
							<tr><td></td><td><input type="submit" value="Log In" /></td></tr>
						</table>
					</form>
					<?php 
                show_cookie_capability('<p class="smallText">You must have cookies enabled to login.  You do not have cookies enabled.</p>');
                if (!empty($this->dest_page)) {
                    if ($this->dest_page != get_current_url()) {
                        $dest_txt = $this->_get_dest_page_text();
                        $cleaned_dest_page = htmlspecialchars($this->dest_page);
                        echo '<p class="smallText">You will be redirected to <a href="' . $cleaned_dest_page . '" title="' . $cleaned_dest_page . '">' . htmlspecialchars($dest_txt) . '</a> once you login.</p>';
                    }
                }
            }
        } else {
            echo '<a href="?logout=1" class="logoutLink">Logout</a>';
        }
        echo '</div>' . "\n";
    }