perform() 공개 메소드

public perform ( )
예제 #1
0
파일: index.php 프로젝트: soonick/poMMo
    Pommo::$_auth->logout();
    header('Location: ' . Pommo::$_http . Pommo::$_baseUrl . 'index.php');
}
// 	check if user is already logged in
if (Pommo::$_hasConfigFile && Pommo::$_auth->isAuthenticated()) {
    // If user is authenticated (has logged in), redirect to admin.php
    Pommo::redirect(Pommo::$_http . Pommo::$_baseUrl . 'admin.php');
} elseif (isset($_POST['submit']) && !empty($_POST['username']) && !empty($_POST['password'])) {
    require_once Pommo::$_baseDir . 'classes/Pommo_User.php';
    $user = new Pommo_user();
    if ($user->login($_POST['username'], $_POST['password'])) {
        // don't perform maintenance if accessing support area
        if (!isset($_GET['referer']) || !basename($_GET['referer']) == 'support.php') {
            // login success. Perform maintenance, set auth, redirect to referer
            require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Maintenance.php';
            Pommo_Helper_Maintenance::perform();
        }
        Pommo::$_auth->login($_POST['username']);
        Pommo::redirect(Pommo::$_http . $_POST['referer']);
    } else {
        $logger->addMsg(Pommo::_T('Failed login attempt. Try again.'));
    }
} elseif (!empty($_POST['resetPassword'])) {
    // TODO -- visit this function later
    // Check if a reset password request has been received
    // check that captcha matched
    if (!isset($_POST['captcha'])) {
        // generate captcha
        $captcha = substr(md5(rand()), 0, 4);
        $view->assign('captcha', $captcha);
    } elseif ($_POST['captcha'] == $_POST['realdeal']) {