autoformatting

This commit is contained in:
2018-04-24 15:27:17 +02:00
parent d9e65f4b5d
commit d130ba30c8
7 changed files with 113 additions and 105 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright 2018 Matthias Kesler
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,15 +15,15 @@
* limitations under the License.
*/
function send_mail($receiver, $subject, $body) {
include(__DIR__ . "/../config.php");
$headers = "From: " . $config["register_email"] . "\r\n"
. "Content-Type: text/plain;charset=utf-8";
return mail($receiver, $subject, $body, $headers);
include(__DIR__ . "/../config.php");
$headers = "From: " . $config["register_email"] . "\r\n"
. "Content-Type: text/plain;charset=utf-8";
return mail($receiver, $subject, $body, $headers);
}
function send_mail_pending_verification($homeserver, $user, $receiver, $verify_url) {
$subject = "Pleast approve your registration request on $homeserver";
$body = "Dear " . $user . ",
$subject = "Pleast approve your registration request on $homeserver";
$body = "Dear " . $user . ",
It seems that you tried to register on $homeserver.
This homeserver requires a two step registration.
@@ -38,12 +39,12 @@ Others might take your username afterwards.
Thanks for your patience.
The admin team of " . $homeserver;
return send_mail($receiver, $subject, $body );
return send_mail($receiver, $subject, $body);
}
function send_mail_pending_approval($homeserver, $user, $receiver) {
$subject = "Registration is pending verification from an admin";
$body = "Dear " . $user . ",
$subject = "Registration is pending verification from an admin";
$body = "Dear " . $user . ",
You have verified your registration request. The admins are now checking your request.
@@ -52,12 +53,12 @@ You will get an email once they approve or decline your request.
Sincerely,
The admin team of " . $homeserver;
return send_mail($receiver, $subject, $body );
return send_mail($receiver, $subject, $body);
}
function send_mail_registration_allowed_but_failed($homeserver, $user, $receiver) {
$subject = "Registration on $homeserver got approved";
$body = "Dear " . $user . ",
$subject = "Registration on $homeserver got approved";
$body = "Dear " . $user . ",
Your registration request got approved by the admin team.
@@ -66,13 +67,12 @@ We hope that the issue will be fixed soon.
You will get another email with initial credentials once the registration got handled completely.
The admin team of " . $homeserver;
return send_mail($receiver, $subject, $body);
return send_mail($receiver, $subject, $body);
}
function send_mail_registration_success($homeserver, $user, $receiver, $username, $password, $howToURL) {
$subject = "Registration on $homeserver got approved";
$body = "Dear " . $user . ",
$subject = "Registration on $homeserver got approved";
$body = "Dear " . $user . ",
Your registration request got verified by the admin team.
@@ -84,35 +84,36 @@ Important: Please change your password as soon as possible after your first logi
The password is not stored in clear text on the server but people could get access to this mail
and compromise your account.
";
if (!empty($howToURL)) {
$body .= "
if (!empty($howToURL)) {
$body .= "
You can find further help here::
$howToURL\n";
}
$body .= "
}
$body .= "
Enjoy your usage of $homeserver.
You can ask further questions inside of the chat system.
The admin team of " . $homeserver;
return send_mail($receiver, $subject, $body);
return send_mail($receiver, $subject, $body);
}
function send_mail_registration_decline($homeserver, $user, $receiver, $reason) {
$subject = "Registration on $homeserver declined.";
$body = "Guten Tag " . $user . ",
$subject = "Registration on $homeserver declined.";
$body = "Guten Tag " . $user . ",
Your registration request got declined by the admin team.\n";
if (empty($reason)) {
$body .= "\nThey did not provide any reason for this\n";
} else {
$body .= "\nThey provide following hint for you:\n$reason\n";
}
if (empty($reason)) {
$body .= "\nThey did not provide any reason for this\n";
} else {
$body .= "\nThey provide following hint for you:\n$reason\n";
}
$body .= "
$body .= "
We hope that you can understand this reason.
The admin team of " . $homeserver;
return send_mail($receiver, $subject, $body );
return send_mail($receiver, $subject, $body);
}
?>