Ejemplo n.º 1
0
define('__VERN', true);
$iPinga = new \ipinga\ipinga(array_merge(array('manager.expired_url' => '/login', 'manager.ip_changed_url' => '/login', 'manager.login_url' => '/login', 'manager.max_minutes' => 10), config()));
if (isset($_SERVER['WEBSITE_ENVIRONMENT']) == true) {
    \ipinga\options::$environment = $_SERVER['WEBSITE_ENVIRONMENT'];
}
// define all the routes...
if (isset($_SERVER['REQUEST_METHOD']) == true && $_SERVER['REQUEST_METHOD'] == 'GET') {
    $iPinga->addRoute('login', 'login', 'index', null, '1');
} else {
    $iPinga->addRoute('login', 'login', 'post', null, '2');
}
if (isset($_SERVER['REQUEST_METHOD']) == true && $_SERVER['REQUEST_METHOD'] == 'GET') {
    $iPinga->addRoute('password/change', 'password', 'change', 'mustBeLoggedIn', '3');
} else {
    $iPinga->addRoute('password/change', 'password', 'post_change', 'mustBeLoggedIn', '4');
}
if (isset($_SERVER['REQUEST_METHOD']) == true && $_SERVER['REQUEST_METHOD'] == 'GET') {
    $iPinga->addRoute('password/forgot', 'password', 'forgot', null, '5');
} else {
    $iPinga->addRoute('password/forgot', 'password', 'post_forgot', null, '6');
}
if (isset($_SERVER['REQUEST_METHOD']) == true && $_SERVER['REQUEST_METHOD'] == 'GET') {
    $iPinga->addRoute('password_reset/$1', 'password', 'reset', null, '7');
} else {
    $iPinga->addRoute('password_reset', 'password', 'reset_new', null, '8');
}
$iPinga->addRoute('logout', 'logout', 'index', null, '9');
$iPinga->addRoute('', 'default', 'index', 'mustBeLoggedIn', '10');
$iPinga->defaultRoute('default', 'error404');
\ipinga\log::setThreshold((int) \ipinga\options::get('log_level'));
$iPinga->run();