getUserForApproval($token); if ($user == NULL) { throw new Exception("UNKNOWN_TOKEN"); } $first_name = $user["first_name"]; $last_name = $user["last_name"]; $username = $user["username"]; $note = $user["note"]; $email = $user["email"]; if ($action == RegisterState::RegistrationAccepted) { $mx_db->setRegistrationStateAdmin(RegisterState::PendingRegistration, $token); // register user require_once("../MatrixConnection.php"); $mxConn = new MatrixConnection($config["homeserver"], $config["access_token"]); // generate a password with 8 characters $password = $mx_db->addUser($first_name, $last_name, $username, $email); if ($password != NULL) { // send registration_success $res = send_mail_registration_success($config["homeserver"], $first_name . " " . $last_name, $email, $username, $password, $config["howToURL"]); if ($res) { $mx_db->setRegistrationStateAdmin(RegisterState::AllDone, $token); } else { $mx_db->setRegistrationStateAdmin(RegisterState::PendingSendRegistrationMail, $token); } } else { send_mail_registration_allowed_but_failed($config["homeserver"], $first_name . " " . $last_name, $email); $mxMsg = new MatrixMessage(); $mxMsg->set_type("m.text"); $mxMsg->set_body("Fehler beim Registrieren von " . $first_name . " " . $last_name . "."); $mxConn->send($config["register_room"], $mxMsg); throw new Exception("REGISTRATION_FAILED"); } print("
" . $language["ADMIN_REGISTER_ACCEPTED_BODY"] . "
"); } elseif ($action == RegisterState::RegistrationDeclined) { $mx_db->setRegistrationStateAdmin(RegisterState::RegistrationDeclined, $token); send_mail_registration_decline( $config["homeserver"], strlen($first_name . $last_name) > 0 ? $first_name . " " . $last_name : $username, $email, $decline_reason ); print("" . $language["ADMIN_REGISTER_DECLINED_BODY"] . "
"); } else { print("