change config to array
This commit is contained in:
18
cron.php
18
cron.php
@@ -20,9 +20,9 @@ foreach ($mx_db->query($sql) as $row) {
|
||||
try {
|
||||
switch ($state) {
|
||||
case RegisterState::PendingEmailSend:
|
||||
$verify_url = $webroot . "/verify.php?t=" . $row["verify_token"];
|
||||
$verify_url = $config["webroot"] . "/verify.php?t=" . $row["verify_token"];
|
||||
$success = send_mail_pending_verification(
|
||||
$homeserver,
|
||||
$config["homeserver"],
|
||||
$row["first_name"] . " " . $row["last_name"],
|
||||
$row["email"],
|
||||
$row["verify_url"]);
|
||||
@@ -35,8 +35,8 @@ foreach ($mx_db->query($sql) as $row) {
|
||||
break;
|
||||
case RegisterState::PendingAdminSend:
|
||||
require_once("MatrixConnection.php");
|
||||
$adminUrl = $webroot . "/verify_admin.php?t=" . $row["admin_token"];
|
||||
$mxConn = new MatrixConnection($homeserver, $access_token);
|
||||
$adminUrl = $config["webroot"] . "/verify_admin.php?t=" . $row["admin_token"];
|
||||
$mxConn = new MatrixConnection($config["homeserver"], $config["access_token"]);
|
||||
$mxMsg = new MatrixMessage();
|
||||
$mxMsg->set_body($first_name . ' ' . $last_name . " möchte sich registrieren und hat folgende Notiz hinterlassen:\r\n"
|
||||
. $row["note"] . "\r\n"
|
||||
@@ -45,12 +45,12 @@ foreach ($mx_db->query($sql) as $row) {
|
||||
. $row["note"] . "<br />"
|
||||
. "Zum Bearbeiten <a href=\"". $adminUrl . "\">hier</a> klicken");
|
||||
$mxMsg->set_type("m.text");
|
||||
$response = $mxConn->send($register_room, $mxMsg);
|
||||
$response = $mxConn->send($config["register_room"], $mxMsg);
|
||||
|
||||
if ($response) {
|
||||
$mx_db->setRegistrationStateById(RegisterState::PendingAdminVerify, $row["id"]);
|
||||
|
||||
send_mail_pending_approval($homeserver, $first_name . " " . $last_name, $email);
|
||||
send_mail_pending_approval($config["homeserver"], $first_name . " " . $last_name, $email);
|
||||
} else {
|
||||
throw new Exception("Could not send notification for ".$row["first_name"]." ".$row["last_name"]."(".$row["id"].") to admins.");
|
||||
}
|
||||
@@ -61,18 +61,18 @@ foreach ($mx_db->query($sql) as $row) {
|
||||
$password = addUser($row["first_name"], $row["last_name"], $row["username"], $row["email"]);
|
||||
if ($password != NULL) {
|
||||
// send registration_success
|
||||
$res = send_mail_registration_success($homeserver, $first_name . " " . $last_name, $email, $username, $password, $howToURL);
|
||||
$res = send_mail_registration_success($config["homeserver"], $first_name . " " . $last_name, $email, $username, $password, $config["howToURL"]);
|
||||
if ($res) {
|
||||
$mx_db->setRegistrationStateById(RegisterState::AllDone, $row["id"]);
|
||||
} else {
|
||||
$mx_db->setRegistrationStateById(RegisterState::PendingSendRegistrationMail, $row["id"]);
|
||||
}
|
||||
} else {
|
||||
send_mail_registration_allowed_but_failed($homeserver, $first_name . " " . $last_name, $email);
|
||||
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($register_room, $mxMsg);
|
||||
$mxConn->send($config["register_room"], $mxMsg);
|
||||
throw new Exception($language["REGISTRATION_FAILED"]);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user