2009-09-06 03:20:22 +02:00
|
|
|
<?php
|
|
|
|
|
2018-09-25 15:56:22 +02:00
|
|
|
spl_autoload_register(function ($class) {
|
2018-09-25 16:31:18 +02:00
|
|
|
if (file_exists("lib/$class.php")) { require_once("lib/$class.php"); }
|
2018-09-25 15:56:22 +02:00
|
|
|
});
|
|
|
|
|
2018-12-05 11:25:57 +01:00
|
|
|
Config::load();
|
2018-10-09 14:31:34 +02:00
|
|
|
Logger::init();
|
|
|
|
MailNotify::init();
|
|
|
|
|
|
|
|
session_name('EVOADMIN_SESS');
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
// Get content from LDAP
|
|
|
|
$server = NULL;
|
|
|
|
if (!empty($_SESSION['login'])) {
|
|
|
|
try {
|
|
|
|
$server = new LdapServer($_SESSION['login']);
|
|
|
|
} catch (Exception $e) {
|
|
|
|
PageController::$alerts[] = array('type' => 2, 'message' => $e->getMessage());
|
|
|
|
}
|
|
|
|
FormController::init($server);
|
|
|
|
} else {
|
|
|
|
if (!empty($_POST['login'])) {
|
|
|
|
try {
|
|
|
|
$input = filter_input_array(INPUT_POST, array(
|
|
|
|
'login' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH)
|
|
|
|
,'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH)
|
|
|
|
));
|
|
|
|
$server = new LdapServer($input['login']);
|
|
|
|
$server->login($input['password']);
|
|
|
|
$_SESSION['login'] = $server->getLogin();
|
|
|
|
} catch (Exception $e) {
|
|
|
|
PageController::$alerts[] = array('type' => 2, 'message' => $e->getMessage());
|
|
|
|
$server = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PageController::init($server);
|