backoffice) { $TeKe->add_system_message(_("Could not connect to Dippler database."), "error"); forward(""); } if ($backoffice_user = $TeKe->backoffice->authenticateUser($email,$password)) { $backoffice_user->bos = $TeKe->backoffice; $backoffice_session = new BackOfficeSession($TeKe->backoffice->sid); $backoffice_session->setUser($backoffice_user); $backoffice_session->setTimeZone($TeKe->backoffice->timeZone); // only teachers and above can log in if ($backoffice_user->getLevel() < 50) { $TeKe->add_system_message(_("You don't have enough permissions to log in."), 'error'); forward(""); } if (isset($_SESSION['backoffice_session'])) unset($_SESSION['backoffice_session']); $_SESSION['backoffice_session'] = $backoffice_session; $_SESSION['__sid'] = $backoffice_session->getSessionId(); $_SESSION['__bossid'] = $backoffice_session->getSessionId(); $bos_user_id = get_backoffice_session()->user->getId(); $teke_user = $TeKe->user->getUserById($bos_user_id); if (!$teke_user) { $teke_user = $TeKe->user->create(get_backoffice_session()->user); } else { $TeKe->user->update(get_backoffice_session()->user); } unset($_SESSION["user"]); $_SESSION["user"] = $teke_user->id; session_regenerate_id(); } else { $TeKe->add_system_message(_("Could not log in."), 'error'); } } else { $TeKe->add_system_message(_("At least one of the parameters is empty."), 'error'); } forward(""); ?>