Esempio n. 1
0
/**
 * check if someone tried to log in and couldn't
 */
function smarty_function_login_error($params, &$smarty)
{
    global $user;
    if (SMIAction::action() == 'Log In' && !$user->valid()) {
        return 'Bad login or password!';
    }
}
Esempio n. 2
0
/**
 * show sanitized action name
 */
function smarty_function_action($params, &$smarty)
{
    $action = SMIAction::action();
    if ($action == 'Log In') {
        if ($_SESSION['user']) {
            return 'Home';
        }
    }
    return htmlentities(substr($action, 0, VIEW_MAXFIELDSIZE));
}
Esempio n. 3
0
/*
---------------------------------------------------------------
Author Cal Woodruff cwoodruf.com
Licensed under the Perl Artistic License version 2.0
http://www.perlfoundation.org/attachment/legal/artistic-2_0.txt
---------------------------------------------------------------
*/
/**
 * main entry point for all request processing
 */
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', true);
# if __SMI__ is not false then its not defined - php defines unknown strings to true (ps: gah!)
define('__SMI__', false);
session_start();
require_once 'lib/includes.php';
$user = new Login();
$action = new SMIAction();
View::assign('user', $user);
View::assign('action', $action->get());
$contenttype = 'text-html';
if (!$action->unblocked() and !$user->valid()) {
    View::head();
    View::display('login.tpl');
    exit;
} else {
    $template = $action->process();
    View::head($contenttype);
    View::display($template);
}
View::foot($contenttype);