Ejemplo n.º 1
0
 private static function loadLang($lang)
 {
     if (!file_exists(__DIR__ . "/../I18n/{$lang}.json")) {
         ErrorManager::push("No I18n file for lang '{$lang}'", ErrorManager::ERROR_I18N_NO_LANG_FILE_FOUND);
     }
     self::$sentences = json_decode(file_get_contents(__DIR__ . "/../I18n/{$lang}.json"), true);
     self::$lang = $lang;
 }
Ejemplo n.º 2
0
$errors = [];
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (Utils::getPost("userNameEmail")) {
        $user->login(Utils::getPost("userNameEmail"), Utils::getPost("login_password"), $errors);
    } else {
        if ($user->register(Utils::getPost("username"), Utils::getPost("email"), Utils::getPost("reg_password"), Utils::getPost("pwd_check"), $errors)) {
            $user->login(Utils::getPost("username"), Utils::getPost("reg_password"), $errors);
        }
    }
} else {
    if (isset($_GET["logout"]) && $_GET["logout"] == "true") {
        $user->logout();
    }
}
foreach ($errors as $e) {
    ErrorManager::push($e);
}
if ($user->isLogged()) {
    header("Location: /");
}
$pageTitle = I18n::get("title") . " - " . I18n::get("login");
$page = "login";
include_once __DIR__ . "/template/top.php";
?>

    <div id="login" class="container">
        <div class="row">
            <div class="col-md-6">
                <h2><?php 
echo I18n::get("connexion");
?>