feat: add new notification methods (telegram, webhooks, gotify) (#295)
This commit is contained in:
parent
5fff7c59eb
commit
a408031ef8
4
.tmp/.gitignore
vendored
4
.tmp/.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
*
|
*
|
||||||
!.gitignore
|
!.gitignore
|
||||||
|
|||||||
@ -2,5 +2,4 @@
|
|||||||
|
|
||||||
#Webroot path
|
#Webroot path
|
||||||
$webPath = "/var/www/html/";
|
$webPath = "/var/www/html/";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -6,36 +6,109 @@
|
|||||||
require_once 'conf.php';
|
require_once 'conf.php';
|
||||||
require_once $webPath . 'includes/connect_endpoint_crontabs.php';
|
require_once $webPath . 'includes/connect_endpoint_crontabs.php';
|
||||||
|
|
||||||
$query = "SELECT * FROM notifications WHERE id = 1";
|
$days = 1;
|
||||||
|
$emailNotificationsEnabled = false;
|
||||||
|
$gotifyNotificationsEnabled = false;
|
||||||
|
$telegramNotificationsEnabled = false;
|
||||||
|
$webhookNotificationsEnabled = false;
|
||||||
|
|
||||||
|
// Get notification settings (how many days before the subscription ends should the notification be sent)
|
||||||
|
$query = "SELECT days FROM notification_settings";
|
||||||
$result = $db->query($query);
|
$result = $db->query($query);
|
||||||
|
|
||||||
if ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
if ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
$notificationsEnabled = $row['enabled'];
|
|
||||||
$days = $row['days'];
|
$days = $row['days'];
|
||||||
$smtpAddress = $row["smtp_address"];
|
|
||||||
$smtpPort = $row["smtp_port"];
|
|
||||||
$encryption = $row["encryption"];
|
|
||||||
$smtpUsername = $row["smtp_username"];
|
|
||||||
$smtpPassword = $row["smtp_password"];
|
|
||||||
$fromEmail = $row["from_email"] ? $row["from_email"] : "wallos@wallosapp.com";
|
|
||||||
} else {
|
|
||||||
echo "Notifications are disabled. No need to run.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($notificationsEnabled) {
|
|
||||||
|
// Check if email notifications are enabled and get the settings
|
||||||
|
$query = "SELECT * FROM email_notifications";
|
||||||
|
$result = $db->query($query);
|
||||||
|
|
||||||
|
if ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$emailNotificationsEnabled = $row['enabled'];
|
||||||
|
$email['smtpAddress'] = $row["smtp_address"];
|
||||||
|
$email['smtpPort'] = $row["smtp_port"];
|
||||||
|
$email['encryption'] = $row["encryption"];
|
||||||
|
$email['smtpUsername'] = $row["smtp_username"];
|
||||||
|
$email['smtpPassword'] = $row["smtp_password"];
|
||||||
|
$email['fromEmail'] = $row["from_email"] ? $row["from_email"] : "wallos@wallosapp.com";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if Gotify notifications are enabled and get the settings
|
||||||
|
$query = "SELECT * FROM gotify_notifications";
|
||||||
|
$result = $db->query($query);
|
||||||
|
|
||||||
|
if ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$gotifyNotificationsEnabled = $row['enabled'];
|
||||||
|
$gotify['serverUrl'] = $row["url"];
|
||||||
|
$gotify['appToken'] = $row["token"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if Telegram notifications are enabled and get the settings
|
||||||
|
$query = "SELECT * FROM telegram_notifications";
|
||||||
|
$result = $db->query($query);
|
||||||
|
|
||||||
|
if ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$telegramNotificationsEnabled = $row['enabled'];
|
||||||
|
$telegram['botToken'] = $row["bot_token"];
|
||||||
|
$telegram['chatId'] = $row["chat_id"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if Webhook notifications are enabled and get the settings
|
||||||
|
$query = "SELECT * FROM webhook_notifications";
|
||||||
|
$result = $db->query($query);
|
||||||
|
|
||||||
|
if ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$webhookNotificationsEnabled = $row['enabled'];
|
||||||
|
$webhook['url'] = $row["url"];
|
||||||
|
$webhook['request_method'] = $row["request_method"];
|
||||||
|
$webhook['headers'] = $row["headers"];
|
||||||
|
$webhook['payload'] = $row["payload"];
|
||||||
|
$webhook['iterator'] = $row["iterator"];
|
||||||
|
if ($webhook['iterator'] === "") {
|
||||||
|
$webhook['iterator'] = "subscriptions";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$notificationsEnabled = $emailNotificationsEnabled || $gotifyNotificationsEnabled || $telegramNotificationsEnabled || $webhookNotificationsEnabled;
|
||||||
|
|
||||||
|
// If no notifications are enabled, no need to run
|
||||||
|
if (!$notificationsEnabled) {
|
||||||
|
echo "Notifications are disabled. No need to run.";
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
// Get all currencies
|
||||||
$currencies = array();
|
$currencies = array();
|
||||||
$query = "SELECT * FROM currencies";
|
$query = "SELECT * FROM currencies";
|
||||||
$result = $db->query($query);
|
$result = $db->query($query);
|
||||||
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
$currencyId = $row['id'];
|
$currencies[$row['id']] = $row;
|
||||||
$currencies[$currencyId] = $row;
|
}
|
||||||
|
|
||||||
|
// Get all household members
|
||||||
|
$stmt = $db->prepare('SELECT * FROM household');
|
||||||
|
$resultHousehold = $stmt->execute();
|
||||||
|
|
||||||
|
$household = [];
|
||||||
|
while ($rowHousehold = $resultHousehold->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$household[$rowHousehold['id']] = $rowHousehold;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all categories
|
||||||
|
$stmt = $db->prepare('SELECT * FROM categories');
|
||||||
|
$resultCategories = $stmt->execute();
|
||||||
|
|
||||||
|
$categories = [];
|
||||||
|
while ($rowCategory = $resultCategories->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$categories[$rowCategory['id']] = $rowCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $db->prepare('SELECT * FROM subscriptions WHERE notify = :notify AND inactive = :inactive ORDER BY payer_user_id ASC');
|
$stmt = $db->prepare('SELECT * FROM subscriptions WHERE notify = :notify AND inactive = :inactive ORDER BY payer_user_id ASC');
|
||||||
$stmt->bindValue(':notify', 1, SQLITE3_INTEGER);
|
$stmt->bindValue(':notify', 1, SQLITE3_INTEGER);
|
||||||
$stmt->bindValue(':inactive', 0, SQLITE3_INTEGER);
|
$stmt->bindValue(':inactive', 0, SQLITE3_INTEGER);
|
||||||
$resultSubscriptions = $stmt->execute();
|
$resultSubscriptions = $stmt->execute();
|
||||||
|
|
||||||
$notify = []; $i = 0;
|
$notify = []; $i = 0;
|
||||||
$currentDate = new DateTime('now');
|
$currentDate = new DateTime('now');
|
||||||
while ($rowSubscription = $resultSubscriptions->fetchArray(SQLITE3_ASSOC)) {
|
while ($rowSubscription = $resultSubscriptions->fetchArray(SQLITE3_ASSOC)) {
|
||||||
@ -44,62 +117,224 @@
|
|||||||
if ($difference === $days) {
|
if ($difference === $days) {
|
||||||
$notify[$rowSubscription['payer_user_id']][$i]['name'] = $rowSubscription['name'];
|
$notify[$rowSubscription['payer_user_id']][$i]['name'] = $rowSubscription['name'];
|
||||||
$notify[$rowSubscription['payer_user_id']][$i]['price'] = $rowSubscription['price'] . $currencies[$rowSubscription['currency_id']]['symbol'];
|
$notify[$rowSubscription['payer_user_id']][$i]['price'] = $rowSubscription['price'] . $currencies[$rowSubscription['currency_id']]['symbol'];
|
||||||
|
$notify[$rowSubscription['payer_user_id']][$i]['currency'] = $currencies[$rowSubscription['currency_id']]['name'];
|
||||||
|
$notify[$rowSubscription['payer_user_id']][$i]['category'] = $categories[$rowSubscription['category_id']]['name'];
|
||||||
|
$notify[$rowSubscription['payer_user_id']][$i]['payer'] = $household[$rowSubscription['payer_user_id']]['name'];
|
||||||
|
$notify[$rowSubscription['payer_user_id']][$i]['date'] = $rowSubscription['next_payment'];
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($notify)) {
|
if (!empty($notify)) {
|
||||||
|
|
||||||
require $webPath . 'libs/PHPMailer/PHPMailer.php';
|
// Email notifications if enabled
|
||||||
require $webPath . 'libs/PHPMailer/SMTP.php';
|
if ($emailNotificationsEnabled) {
|
||||||
require $webPath . 'libs/PHPMailer/Exception.php';
|
require $webPath . 'libs/PHPMailer/PHPMailer.php';
|
||||||
|
require $webPath . 'libs/PHPMailer/SMTP.php';
|
||||||
|
require $webPath . 'libs/PHPMailer/Exception.php';
|
||||||
|
|
||||||
$stmt = $db->prepare('SELECT * FROM user WHERE id = :id');
|
$stmt = $db->prepare('SELECT * FROM user WHERE id = :id');
|
||||||
$stmt->bindValue(':id', 1, SQLITE3_INTEGER);
|
$stmt->bindValue(':id', 1, SQLITE3_INTEGER);
|
||||||
$result = $stmt->execute();
|
|
||||||
$defaultUser = $result->fetchArray(SQLITE3_ASSOC);
|
|
||||||
$defaultEmail = $defaultUser['email'];
|
|
||||||
$defaultName = $defaultUser['username'];
|
|
||||||
|
|
||||||
foreach ($notify as $userId => $perUser) {
|
|
||||||
$dayText = $days == 1 ? "tomorrow" : "in " . $days . " days";
|
|
||||||
$message = "The following subscriptions are up for renewal " . $dayText . ":\n";
|
|
||||||
|
|
||||||
foreach ($perUser as $subscription) {
|
|
||||||
$message .= $subscription['name'] . " for " . $subscription['price'] . "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$mail = new PHPMailer(true);
|
|
||||||
$mail->CharSet="UTF-8";
|
|
||||||
$mail->isSMTP();
|
|
||||||
|
|
||||||
$mail->Host = $smtpAddress;
|
|
||||||
$mail->SMTPAuth = true;
|
|
||||||
$mail->Username = $smtpUsername;
|
|
||||||
$mail->Password = $smtpPassword;
|
|
||||||
$mail->SMTPSecure = $encryption;
|
|
||||||
$mail->Port = $smtpPort;
|
|
||||||
|
|
||||||
$stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');
|
|
||||||
$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);
|
|
||||||
$result = $stmt->execute();
|
$result = $stmt->execute();
|
||||||
$user = $result->fetchArray(SQLITE3_ASSOC);
|
$defaultUser = $result->fetchArray(SQLITE3_ASSOC);
|
||||||
|
$defaultEmail = $defaultUser['email'];
|
||||||
|
$defaultName = $defaultUser['username'];
|
||||||
|
|
||||||
$email = !empty($user['email']) ? $user['email'] : $defaultEmail;
|
foreach ($notify as $userId => $perUser) {
|
||||||
$name = !empty($user['name']) ? $user['name'] : $defaultName;
|
$dayText = $days == 1 ? "tomorrow" : "in " . $days . " days";
|
||||||
|
$message = "The following subscriptions are up for renewal " . $dayText . ":\n";
|
||||||
$mail->setFrom($fromEmail, 'Wallos App');
|
|
||||||
$mail->addAddress($email, $name);
|
foreach ($perUser as $subscription) {
|
||||||
|
$message .= $subscription['name'] . " for " . $subscription['price'] . "\n";
|
||||||
$mail->Subject = 'Wallos Notification';
|
}
|
||||||
$mail->Body = $message;
|
|
||||||
|
$mail = new PHPMailer(true);
|
||||||
if ($mail->send()) {
|
$mail->CharSet="UTF-8";
|
||||||
echo "Notifications sent";
|
$mail->isSMTP();
|
||||||
} else {
|
|
||||||
echo "Error sending notifications: " . $mail->ErrorInfo;
|
$mail->Host = $email['smtpAddress'];
|
||||||
|
$mail->SMTPAuth = true;
|
||||||
|
$mail->Username = $email['smtpUsername'];
|
||||||
|
$mail->Password = $email['smtpPassword'];
|
||||||
|
$mail->SMTPSecure = $email['encryption'];
|
||||||
|
$mail->Port = $email['smtpPort'];
|
||||||
|
|
||||||
|
$stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');
|
||||||
|
$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);
|
||||||
|
$result = $stmt->execute();
|
||||||
|
$user = $result->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
|
$emailaddress = !empty($user['email']) ? $user['email'] : $defaultEmail;
|
||||||
|
$name = !empty($user['name']) ? $user['name'] : $defaultName;
|
||||||
|
|
||||||
|
$mail->setFrom($email['fromEmail'], 'Wallos App');
|
||||||
|
$mail->addAddress($emailaddress, $name);
|
||||||
|
|
||||||
|
$mail->Subject = 'Wallos Notification';
|
||||||
|
$mail->Body = $message;
|
||||||
|
|
||||||
|
if ($mail->send()) {
|
||||||
|
echo "Email Notifications sent<br />";
|
||||||
|
} else {
|
||||||
|
echo "Error sending notifications: " . $mail->ErrorInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gotify notifications if enabled
|
||||||
|
if ($gotifyNotificationsEnabled) {
|
||||||
|
foreach ($notify as $userId => $perUser) {
|
||||||
|
// Get name of user from household table
|
||||||
|
$stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');
|
||||||
|
$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);
|
||||||
|
$result = $stmt->execute();
|
||||||
|
$user = $result->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
|
$dayText = $days == 1 ? "tomorrow" : "in " . $days . " days";
|
||||||
|
if ($user['name']) {
|
||||||
|
$message = $user['name'] . ", the following subscriptions are up for renewal " . $dayText . ":\n";
|
||||||
|
} else {
|
||||||
|
$message = "The following subscriptions are up for renewal " . $dayText . ":\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($perUser as $subscription) {
|
||||||
|
$message .= $subscription['name'] . " for " . $subscription['price'] . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'message' => $message,
|
||||||
|
'priority' => 5
|
||||||
|
);
|
||||||
|
|
||||||
|
$data_string = json_encode($data);
|
||||||
|
|
||||||
|
$ch = curl_init($gotify['serverUrl'] . '/message?token=' . $gotify['appToken']);
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Content-Length: ' . strlen($data_string))
|
||||||
|
);
|
||||||
|
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
if ($result === false) {
|
||||||
|
echo "Error sending notifications: " . curl_error($ch);
|
||||||
|
} else {
|
||||||
|
echo "Gotify Notifications sent<br />";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Telegram notifications if enabled
|
||||||
|
if ($telegramNotificationsEnabled) {
|
||||||
|
foreach ($notify as $userId => $perUser) {
|
||||||
|
// Get name of user from household table
|
||||||
|
$stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');
|
||||||
|
$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);
|
||||||
|
$result = $stmt->execute();
|
||||||
|
$user = $result->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
|
$dayText = $days == 1 ? "tomorrow" : "in " . $days . " days";
|
||||||
|
if ($user['name']) {
|
||||||
|
$message = $user['name'] . ", the following subscriptions are up for renewal " . $dayText . ":\n";
|
||||||
|
} else {
|
||||||
|
$message = "The following subscriptions are up for renewal " . $dayText . ":\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($perUser as $subscription) {
|
||||||
|
$message .= $subscription['name'] . " for " . $subscription['price'] . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'chat_id' => $telegram['chatId'],
|
||||||
|
'text' => $message
|
||||||
|
);
|
||||||
|
|
||||||
|
$data_string = json_encode($data);
|
||||||
|
|
||||||
|
$ch = curl_init('https://api.telegram.org/bot' . $telegram['botToken'] . '/sendMessage');
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Content-Length: ' . strlen($data_string))
|
||||||
|
);
|
||||||
|
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
if ($result === false) {
|
||||||
|
echo "Error sending notifications: " . curl_error($ch);
|
||||||
|
} else {
|
||||||
|
echo "Telegram Notifications sent<br />";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Webhook notifications if enabled
|
||||||
|
if ($webhookNotificationsEnabled) {
|
||||||
|
// Get webhook payload and turn it into a json object
|
||||||
|
|
||||||
|
$payload = str_replace("{{days_until}}", $days, $webhook['payload']);
|
||||||
|
$payload_json = json_decode($payload, true);
|
||||||
|
|
||||||
|
$subscription_template = $payload_json["{{subscriptions}}"];
|
||||||
|
$subscriptions = [];
|
||||||
|
|
||||||
|
foreach ($notify as $userId => $perUser) {
|
||||||
|
// Get name of user from household table
|
||||||
|
$stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');
|
||||||
|
$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);
|
||||||
|
$result = $stmt->execute();
|
||||||
|
$user = $result->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
|
if ($user['name']) {
|
||||||
|
$payer = $user['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($perUser as $k => $subscription) {
|
||||||
|
$temp_subscription = $subscription_template[0];
|
||||||
|
|
||||||
|
foreach ($temp_subscription as $key => $value) {
|
||||||
|
if (is_string($value)) {
|
||||||
|
$temp_subscription[$key] = str_replace("{{subscription_name}}", $subscription['name'], $value);
|
||||||
|
$temp_subscription[$key] = str_replace("{{subscription_price}}", $subscription['price'], $temp_subscription[$key]);
|
||||||
|
$temp_subscription[$key] = str_replace("{{subscription_currency}}", $subscription['currency'], $temp_subscription[$key]);
|
||||||
|
$temp_subscription[$key] = str_replace("{{subscription_category}}", $subscription['category'], $temp_subscription[$key]);
|
||||||
|
$temp_subscription[$key] = str_replace("{{subscription_payer}}", $subscription['payer'], $temp_subscription[$key]);
|
||||||
|
$temp_subscription[$key] = str_replace("{{subscription_date}}", $subscription['date'], $temp_subscription[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$subscriptions[] = $temp_subscription;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$payload_json["{{subscriptions}}"] = $subscriptions;
|
||||||
|
$payload_json[$webhook['iterator']] = $subscriptions;
|
||||||
|
unset($payload_json["{{subscriptions}}"]);
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $webhook['url']);
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $webhook['request_method']);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload_json));
|
||||||
|
if (!empty($customheaders)) {
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $webhook['headers']);
|
||||||
|
}
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false) {
|
||||||
|
echo "Error sending notifications: " . curl_error($ch);
|
||||||
|
} else {
|
||||||
|
echo "Webhook Notifications sent<br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "Nothing to notify.";
|
echo "Nothing to notify.";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,12 +2,18 @@
|
|||||||
require_once '../../includes/connect_endpoint.php';
|
require_once '../../includes/connect_endpoint.php';
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('session_expired', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
$postData = file_get_contents("php://input");
|
$postData = file_get_contents("php://input");
|
||||||
$data = json_decode($postData, true);
|
$data = json_decode($postData, true);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!isset($data["days"]) || $data['days'] == "" ||
|
|
||||||
!isset($data["smtpaddress"]) || $data["smtpaddress"] == "" ||
|
!isset($data["smtpaddress"]) || $data["smtpaddress"] == "" ||
|
||||||
!isset($data["smtpport"]) || $data["smtpport"] == "" ||
|
!isset($data["smtpport"]) || $data["smtpport"] == "" ||
|
||||||
!isset($data["smtpusername"]) || $data["smtpusername"] == "" ||
|
!isset($data["smtpusername"]) || $data["smtpusername"] == "" ||
|
||||||
@ -20,7 +26,6 @@
|
|||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
} else {
|
} else {
|
||||||
$enabled = $data["enabled"];
|
$enabled = $data["enabled"];
|
||||||
$days = $data["days"];
|
|
||||||
$smtpAddress = $data["smtpaddress"];
|
$smtpAddress = $data["smtpaddress"];
|
||||||
$smtpPort = $data["smtpport"];
|
$smtpPort = $data["smtpport"];
|
||||||
$encryption = "tls";
|
$encryption = "tls";
|
||||||
@ -31,7 +36,7 @@
|
|||||||
$smtpPassword = $data["smtppassword"];
|
$smtpPassword = $data["smtppassword"];
|
||||||
$fromEmail = $data["fromemail"];
|
$fromEmail = $data["fromemail"];
|
||||||
|
|
||||||
$query = "SELECT COUNT(*) FROM notifications";
|
$query = "SELECT COUNT(*) FROM email_notifications";
|
||||||
$result = $db->querySingle($query);
|
$result = $db->querySingle($query);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
@ -42,17 +47,16 @@
|
|||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
} else {
|
} else {
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
$query = "INSERT INTO notifications (enabled, days, smtp_address, smtp_port, smtp_username, smtp_password, from_email, encryption)
|
$query = "INSERT INTO email_notifications (enabled, smtp_address, smtp_port, smtp_username, smtp_password, from_email, encryption)
|
||||||
VALUES (:enabled, :days, :smtpAddress, :smtpPort, :smtpUsername, :smtpPassword, :fromEmail, :encryption)";
|
VALUES (:enabled, :smtpAddress, :smtpPort, :smtpUsername, :smtpPassword, :fromEmail, :encryption)";
|
||||||
} else {
|
} else {
|
||||||
$query = "UPDATE notifications
|
$query = "UPDATE email_notifications
|
||||||
SET enabled = :enabled, days = :days, smtp_address = :smtpAddress, smtp_port = :smtpPort,
|
SET enabled = :enabled, smtp_address = :smtpAddress, smtp_port = :smtpPort,
|
||||||
smtp_username = :smtpUsername, smtp_password = :smtpPassword, from_email = :fromEmail, encryption = :encryption";
|
smtp_username = :smtpUsername, smtp_password = :smtpPassword, from_email = :fromEmail, encryption = :encryption";
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $db->prepare($query);
|
$stmt = $db->prepare($query);
|
||||||
$stmt->bindValue(':enabled', $enabled, SQLITE3_INTEGER);
|
$stmt->bindValue(':enabled', $enabled, SQLITE3_INTEGER);
|
||||||
$stmt->bindValue(':days', $days, SQLITE3_INTEGER);
|
|
||||||
$stmt->bindValue(':smtpAddress', $smtpAddress, SQLITE3_TEXT);
|
$stmt->bindValue(':smtpAddress', $smtpAddress, SQLITE3_TEXT);
|
||||||
$stmt->bindValue(':smtpPort', $smtpPort, SQLITE3_INTEGER);
|
$stmt->bindValue(':smtpPort', $smtpPort, SQLITE3_INTEGER);
|
||||||
$stmt->bindValue(':smtpUsername', $smtpUsername, SQLITE3_TEXT);
|
$stmt->bindValue(':smtpUsername', $smtpUsername, SQLITE3_TEXT);
|
||||||
69
endpoints/notifications/savegotifynotifications.php
Normal file
69
endpoints/notifications/savegotifynotifications.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../includes/connect_endpoint.php';
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('session_expired', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$postData = file_get_contents("php://input");
|
||||||
|
$data = json_decode($postData, true);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isset($data["gotify_url"]) || $data["gotify_url"] == "" ||
|
||||||
|
!isset($data["token"]) || $data["token"] == ""
|
||||||
|
) {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('fill_mandatory_fields', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
$enabled = $data["enabled"];
|
||||||
|
$url = $data["gotify_url"];
|
||||||
|
$token = $data["token"];
|
||||||
|
|
||||||
|
$query = "SELECT COUNT(*) FROM gotify_notifications";
|
||||||
|
$result = $db->querySingle($query);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('error_saving_notifications', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
if ($result == 0) {
|
||||||
|
$query = "INSERT INTO gotify_notifications (enabled, url, token)
|
||||||
|
VALUES (:enabled, :url, :token)";
|
||||||
|
} else {
|
||||||
|
$query = "UPDATE gotify_notifications
|
||||||
|
SET enabled = :enabled, url = :url, token = :token";
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $db->prepare($query);
|
||||||
|
$stmt->bindValue(':enabled', $enabled, SQLITE3_INTEGER);
|
||||||
|
$stmt->bindValue(':url', $url, SQLITE3_TEXT);
|
||||||
|
$stmt->bindValue(':token', $token, SQLITE3_TEXT);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$response = [
|
||||||
|
"success" => true,
|
||||||
|
"message" => translate('notifications_settings_saved', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('error_saving_notifications', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
67
endpoints/notifications/savenotificationsettings.php
Normal file
67
endpoints/notifications/savenotificationsettings.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../../includes/connect_endpoint.php';
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('session_expired', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$postData = file_get_contents("php://input");
|
||||||
|
$data = json_decode($postData, true);
|
||||||
|
|
||||||
|
if (!isset($data["days"]) || $data['days'] == "") {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('fill_mandatory_fields', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
$days = $data["days"];
|
||||||
|
$query = "SELECT COUNT(*) FROM notification_settings";
|
||||||
|
$result = $db->querySingle($query);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('error_saving_notifications', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
if ($result == 0) {
|
||||||
|
$query = "INSERT INTO notification_settings (days)
|
||||||
|
VALUES (:days)";
|
||||||
|
} else {
|
||||||
|
$query = "UPDATE notification_settings SET days = :days";
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $db->prepare($query);
|
||||||
|
$stmt->bindValue(':days', $days, SQLITE3_INTEGER);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$response = [
|
||||||
|
"success" => true,
|
||||||
|
"message" => translate('notifications_settings_saved', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('error_saving_notifications', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => "Invalid request method"
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
69
endpoints/notifications/savetelegramnotifications.php
Normal file
69
endpoints/notifications/savetelegramnotifications.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../includes/connect_endpoint.php';
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('session_expired', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$postData = file_get_contents("php://input");
|
||||||
|
$data = json_decode($postData, true);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isset($data["bot_token"]) || $data["bot_token"] == "" ||
|
||||||
|
!isset($data["chat_id"]) || $data["chat_id"] == ""
|
||||||
|
) {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('fill_mandatory_fields', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
$enabled = $data["enabled"];
|
||||||
|
$bot_token = $data["bot_token"];
|
||||||
|
$chat_id = $data["chat_id"];
|
||||||
|
|
||||||
|
$query = "SELECT COUNT(*) FROM telegram_notifications";
|
||||||
|
$result = $db->querySingle($query);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('error_saving_notifications', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
if ($result == 0) {
|
||||||
|
$query = "INSERT INTO telegram_notifications (enabled, bot_token, chat_id)
|
||||||
|
VALUES (:enabled, :bot_token, :chat_id)";
|
||||||
|
} else {
|
||||||
|
$query = "UPDATE telegram_notifications
|
||||||
|
SET enabled = :enabled, bot_token = :bot_token, chat_id = :chat_id";
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $db->prepare($query);
|
||||||
|
$stmt->bindValue(':enabled', $enabled, SQLITE3_INTEGER);
|
||||||
|
$stmt->bindValue(':bot_token', $bot_token, SQLITE3_TEXT);
|
||||||
|
$stmt->bindValue(':chat_id', $chat_id, SQLITE3_TEXT);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$response = [
|
||||||
|
"success" => true,
|
||||||
|
"message" => translate('notifications_settings_saved', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('error_saving_notifications', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
71
endpoints/notifications/savewebhooknotifications.php
Normal file
71
endpoints/notifications/savewebhooknotifications.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../includes/connect_endpoint.php';
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('session_expired', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$postData = file_get_contents("php://input");
|
||||||
|
$data = json_decode($postData, true);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isset($data["webhook_url"]) || $data["webhook_url"] == "" ||
|
||||||
|
!isset($data["payload"]) || $data["payload"] == ""
|
||||||
|
) {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('fill_mandatory_fields', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
$enabled = $data["enabled"];
|
||||||
|
$url = $data["webhook_url"];
|
||||||
|
$headers = $data["headers"];
|
||||||
|
$payload = $data["payload"];
|
||||||
|
|
||||||
|
$query = "SELECT COUNT(*) FROM webhook_notifications";
|
||||||
|
$result = $db->querySingle($query);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('error_saving_notifications', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
if ($result == 0) {
|
||||||
|
$query = "INSERT INTO webhook_notifications (enabled, url, headers, payload)
|
||||||
|
VALUES (:enabled, :url, :headers, :payload)";
|
||||||
|
} else {
|
||||||
|
$query = "UPDATE webhook_notifications
|
||||||
|
SET enabled = :enabled, url = :url, headers = :headers, payload = :payload";
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $db->prepare($query);
|
||||||
|
$stmt->bindValue(':enabled', $enabled, SQLITE3_INTEGER);
|
||||||
|
$stmt->bindValue(':url', $url, SQLITE3_TEXT);
|
||||||
|
$stmt->bindValue(':headers', $headers, SQLITE3_TEXT);
|
||||||
|
$stmt->bindValue(':payload', $payload, SQLITE3_TEXT);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$response = [
|
||||||
|
"success" => true,
|
||||||
|
"message" => translate('notifications_settings_saved', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('error_saving_notifications', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -7,6 +7,13 @@ use PHPMailer\PHPMailer\Exception;
|
|||||||
require_once '../../includes/connect_endpoint.php';
|
require_once '../../includes/connect_endpoint.php';
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('session_expired', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
$postData = file_get_contents("php://input");
|
$postData = file_get_contents("php://input");
|
||||||
$data = json_decode($postData, true);
|
$data = json_decode($postData, true);
|
||||||
@ -21,14 +28,13 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|||||||
"success" => false,
|
"success" => false,
|
||||||
"errorMessage" => translate('fill_all_fields', $i18n)
|
"errorMessage" => translate('fill_all_fields', $i18n)
|
||||||
];
|
];
|
||||||
echo json_encode($response);
|
die(json_encode($response));
|
||||||
} else {
|
} else {
|
||||||
$enxryption = "tls";
|
$enxryption = "tls";
|
||||||
if (isset($data["encryption"])) {
|
if (isset($data["encryption"])) {
|
||||||
$encryption = $data["encryption"];
|
$encryption = $data["encryption"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
require '../../libs/PHPMailer/PHPMailer.php';
|
require '../../libs/PHPMailer/PHPMailer.php';
|
||||||
require '../../libs/PHPMailer/SMTP.php';
|
require '../../libs/PHPMailer/SMTP.php';
|
||||||
require '../../libs/PHPMailer/Exception.php';
|
require '../../libs/PHPMailer/Exception.php';
|
||||||
@ -66,13 +72,13 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|||||||
"success" => true,
|
"success" => true,
|
||||||
"message" => translate('notification_sent_successfuly', $i18n)
|
"message" => translate('notification_sent_successfuly', $i18n)
|
||||||
];
|
];
|
||||||
echo json_encode($response);
|
die(json_encode($response));
|
||||||
} else {
|
} else {
|
||||||
$response = [
|
$response = [
|
||||||
"success" => false,
|
"success" => false,
|
||||||
"errorMessage" => translate('email_error', $i18n) . $mail->ErrorInfo
|
"errorMessage" => translate('email_error', $i18n) . $mail->ErrorInfo
|
||||||
];
|
];
|
||||||
echo json_encode($response);
|
die(json_encode($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
71
endpoints/notifications/testgotifynotifications.php
Normal file
71
endpoints/notifications/testgotifynotifications.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../includes/connect_endpoint.php';
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('session_expired', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$postData = file_get_contents("php://input");
|
||||||
|
$data = json_decode($postData, true);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isset($data["gotify_url"]) || $data["gotify_url"] == "" ||
|
||||||
|
!isset($data["token"]) || $data["token"] == ""
|
||||||
|
) {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('fill_mandatory_fields', $i18n)
|
||||||
|
];
|
||||||
|
die(json_encode($response));
|
||||||
|
} else {
|
||||||
|
// Set the message parameters
|
||||||
|
$title = translate('wallos_notification', $i18n);
|
||||||
|
$message = translate('test_notification', $i18n);
|
||||||
|
$priority = 5;
|
||||||
|
|
||||||
|
$url = $data["gotify_url"];
|
||||||
|
$token = $data["token"];
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
|
||||||
|
// Set the URL and other options
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url . "/message?token=" . $token);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
|
||||||
|
'title' => $title,
|
||||||
|
'message' => $message,
|
||||||
|
'priority' => $priority,
|
||||||
|
]));
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
|
// Execute the request
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
|
||||||
|
// Close the cURL session
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
// Check if the message was sent successfully
|
||||||
|
if ($response === false) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('notification_failed', $i18n)
|
||||||
|
]));
|
||||||
|
} else {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => true,
|
||||||
|
"message" => translate('notification_sent_successfuly', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate("invalid_request_method", $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
?>
|
||||||
69
endpoints/notifications/testtelegramnotifications.php
Normal file
69
endpoints/notifications/testtelegramnotifications.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
require_once '../../includes/connect_endpoint.php';
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('session_expired', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$postData = file_get_contents("php://input");
|
||||||
|
$data = json_decode($postData, true);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isset($data["bottoken"]) || $data["bottoken"] == "" ||
|
||||||
|
!isset($data["chatid"]) || $data["chatid"] == ""
|
||||||
|
) {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('fill_mandatory_fields', $i18n)
|
||||||
|
];
|
||||||
|
echo json_encode($response);
|
||||||
|
} else {
|
||||||
|
// Set the message parameters
|
||||||
|
$title = translate('wallos_notification', $i18n);
|
||||||
|
$message = translate('test_notification', $i18n);
|
||||||
|
|
||||||
|
$botToken = $data["bottoken"];
|
||||||
|
$chatId = $data["chatid"];
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
|
||||||
|
// Set the URL and other options
|
||||||
|
curl_setopt($ch, CURLOPT_URL, "https://api.telegram.org/bot" . $botToken . "/sendMessage");
|
||||||
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
|
||||||
|
'chat_id' => $chatId,
|
||||||
|
'text' => $message,
|
||||||
|
]));
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
|
// Execute the request
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
|
||||||
|
// Close the cURL session
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
// Check if the message was sent successfully
|
||||||
|
if ($response === false) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('notification_failed', $i18n)
|
||||||
|
]));
|
||||||
|
} else {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => true,
|
||||||
|
"message" => translate('notification_sent_successfuly', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate("invalid_request_method", $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
?>
|
||||||
74
endpoints/notifications/testwebhooknotifications.php
Normal file
74
endpoints/notifications/testwebhooknotifications.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '../../includes/connect_endpoint.php';
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('session_expired', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$postData = file_get_contents("php://input");
|
||||||
|
$data = json_decode($postData, true);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isset($data["requestmethod"]) || $data["requestmethod"] == "" ||
|
||||||
|
!isset($data["url"]) || $data["url"] == "" ||
|
||||||
|
!isset($data["payload"]) || $data["payload"] == ""
|
||||||
|
) {
|
||||||
|
$response = [
|
||||||
|
"success" => false,
|
||||||
|
"errorMessage" => translate('fill_mandatory_fields', $i18n)
|
||||||
|
];
|
||||||
|
die(json_encode($response));
|
||||||
|
} else {
|
||||||
|
// Set the message parameters
|
||||||
|
$title = translate('wallos_notification', $i18n);
|
||||||
|
$message = translate('test_notification', $i18n);
|
||||||
|
|
||||||
|
$requestmethod = $data["requestmethod"];
|
||||||
|
$url = $data["url"];
|
||||||
|
$payload = $data["payload"];
|
||||||
|
$customheaders = json_decode($data["customheaders"], true);
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
|
||||||
|
// Set the URL and other options
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $requestmethod);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
||||||
|
if (!empty($customheaders)) {
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $customheaders);
|
||||||
|
}
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
|
// Execute the request
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
|
||||||
|
// Close the cURL session
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
// Check if the message was sent successfully
|
||||||
|
if ($response === false) {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate('notification_failed', $i18n)
|
||||||
|
]));
|
||||||
|
} else {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => true,
|
||||||
|
"message" => translate('notification_sent_successfuly', $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
die(json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => translate("invalid_request_method", $i18n)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.1 KiB |
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "SMTP Passwort",
|
"smtp_password" => "SMTP Passwort",
|
||||||
"from_email" => "Absender E-Mail Adresse (optional)",
|
"from_email" => "Absender E-Mail Adresse (optional)",
|
||||||
"smtp_info" => "Das SMTP Passwort wird in Klartext übermittelt und gespeichert. Aus Sicherheitsgründen erstelle bitte einen gesonderten Account nur zu diesem Zweck.",
|
"smtp_info" => "Das SMTP Passwort wird in Klartext übermittelt und gespeichert. Aus Sicherheitsgründen erstelle bitte einen gesonderten Account nur zu diesem Zweck.",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Telegram Bot Token",
|
||||||
|
"telegram_chat_id" => "Telegram Chat ID",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "Webhook URL",
|
||||||
|
"request_method" => "Request Methode",
|
||||||
|
"custom_headers" => "Benutzerdefinierte Kopfzeilen",
|
||||||
|
"webhook_payload" => "Webhook Payload",
|
||||||
|
"webhook_iterator_key" => "Ersetze {{subscriptions}} durch den Schlüsselnamen",
|
||||||
|
"variables_available" => "Verfügbare Variablen",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Token",
|
||||||
"categories" => "Kategorien",
|
"categories" => "Kategorien",
|
||||||
"save_category" => "Kategorie speichern",
|
"save_category" => "Kategorie speichern",
|
||||||
"delete_category" => "Kategorie löschen",
|
"delete_category" => "Kategorie löschen",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "E-Mail konnte nicht gesendet werden",
|
"email_error" => "E-Mail konnte nicht gesendet werden",
|
||||||
"notification_sent_successfuly" => "Benachrichtigung erfolgreich gesendet",
|
"notification_sent_successfuly" => "Benachrichtigung erfolgreich gesendet",
|
||||||
"notifications_settings_saved" => "Benachrichtigungseinstellungen erfolgreich gespeichert.",
|
"notifications_settings_saved" => "Benachrichtigungseinstellungen erfolgreich gespeichert.",
|
||||||
|
"notification_failed" => "Benachrichtigung fehlgeschlagen",
|
||||||
// Payments
|
// Payments
|
||||||
"payment_in_use" => "Genutzte Zahlungsmethoden können nicht deaktiviert werden",
|
"payment_in_use" => "Genutzte Zahlungsmethoden können nicht deaktiviert werden",
|
||||||
"failed_update_payment" => "Zahlungsmethode in Datenbank konnte nicht aktualisiert werden",
|
"failed_update_payment" => "Zahlungsmethode in Datenbank konnte nicht aktualisiert werden",
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "SMTP κωδικός",
|
"smtp_password" => "SMTP κωδικός",
|
||||||
"from_email" => "Από (Προαιρετικό)",
|
"from_email" => "Από (Προαιρετικό)",
|
||||||
"smtp_info" => "Ο κωδικός πρόσβασης SMTP μεταδίδεται και αποθηκεύεται σε απλό κείμενο. Για λόγους ασφαλείας, παρακαλούμε δημιούργησε έναν λογαριασμό μόνο γι' αυτό το σκοπό.",
|
"smtp_info" => "Ο κωδικός πρόσβασης SMTP μεταδίδεται και αποθηκεύεται σε απλό κείμενο. Για λόγους ασφαλείας, παρακαλούμε δημιούργησε έναν λογαριασμό μόνο γι' αυτό το σκοπό.",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Τηλεγραφήματα Bot Token",
|
||||||
|
"telegram_chat_id" => "Τηλεγραφήματα Chat ID",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "Webhook URL",
|
||||||
|
"request_method" => "Μέθοδος αίτησης",
|
||||||
|
"custom_headers" => "Προσαρμοσμένες κεφαλίδες",
|
||||||
|
"webhook_payload" => "Webhook Payload",
|
||||||
|
"webhook_iterator_key" => "Αντικαταστήστε {{subscriptions}} με το όνομα του κλειδιού",
|
||||||
|
"variables_available" => "Διαθέσιμες μεταβλητές",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Token",
|
||||||
"categories" => "Κατηγορίες",
|
"categories" => "Κατηγορίες",
|
||||||
"save_category" => "Αποθήκευση κατηγορίας",
|
"save_category" => "Αποθήκευση κατηγορίας",
|
||||||
"delete_category" => "Διαγραφή κατηγορίας",
|
"delete_category" => "Διαγραφή κατηγορίας",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "Σφάλμα αποστολής email",
|
"email_error" => "Σφάλμα αποστολής email",
|
||||||
"notification_sent_successfuly" => "Η ειδοποίηση εστάλη επιτυχώς",
|
"notification_sent_successfuly" => "Η ειδοποίηση εστάλη επιτυχώς",
|
||||||
"notifications_settings_saved" => "Οι ρυθμίσεις ειδοποίησης αποθηκεύτηκαν με επιτυχία.",
|
"notifications_settings_saved" => "Οι ρυθμίσεις ειδοποίησης αποθηκεύτηκαν με επιτυχία.",
|
||||||
|
"notification_failed" => "Η ειδοποίηση απέτυχε",
|
||||||
// Payments
|
// Payments
|
||||||
"payment_in_use" => "Δεν είναι εφικτό να απενεργοποιηθεί η χρησιμοποιούμενη μέθοδο πληρωμής",
|
"payment_in_use" => "Δεν είναι εφικτό να απενεργοποιηθεί η χρησιμοποιούμενη μέθοδο πληρωμής",
|
||||||
"failed_update_payment" => "Απέτυχε η ενημέρωση της μεθόδου πληρωμής στη βάση δεδομένων",
|
"failed_update_payment" => "Απέτυχε η ενημέρωση της μεθόδου πληρωμής στη βάση δεδομένων",
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "SMTP Password",
|
"smtp_password" => "SMTP Password",
|
||||||
"from_email" => "From email (Optional)",
|
"from_email" => "From email (Optional)",
|
||||||
"smtp_info" => "SMTP Password is transmitted and stored in plaintext. For security, please create an account just for this.",
|
"smtp_info" => "SMTP Password is transmitted and stored in plaintext. For security, please create an account just for this.",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Telegram Bot Token",
|
||||||
|
"telegram_chat_id" => "Telegram Chat ID",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "Webhook URL",
|
||||||
|
"request_method" => "Request Method",
|
||||||
|
"custom_headers" => "Custom Headers",
|
||||||
|
"webhook_payload" => "Webhook Payload",
|
||||||
|
"webhook_iterator_key" => "Replace {{subscriptions}} with key name",
|
||||||
|
"variables_available" => "Variables available",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Token",
|
||||||
"categories" => "Categories",
|
"categories" => "Categories",
|
||||||
"save_category" => "Save Category",
|
"save_category" => "Save Category",
|
||||||
"delete_category" => "Delete Category",
|
"delete_category" => "Delete Category",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "Error sending email",
|
"email_error" => "Error sending email",
|
||||||
"notification_sent_successfuly" => "Notification sent successfully",
|
"notification_sent_successfuly" => "Notification sent successfully",
|
||||||
"notifications_settings_saved" => "Notification settings saved successfully.",
|
"notifications_settings_saved" => "Notification settings saved successfully.",
|
||||||
|
"notification_failed" => "Notification failed",
|
||||||
// Payments
|
// Payments
|
||||||
"payment_in_use" => "Can't disable used payment method",
|
"payment_in_use" => "Can't disable used payment method",
|
||||||
"failed_update_payment" => "Failed to update payment method in the database",
|
"failed_update_payment" => "Failed to update payment method in the database",
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "Contraseña SMTP",
|
"smtp_password" => "Contraseña SMTP",
|
||||||
"from_email" => "Correo electrónico de origen (Opcional)",
|
"from_email" => "Correo electrónico de origen (Opcional)",
|
||||||
"smtp_info" => "La contraseña SMTP se transmite y almacena en texto plano. Por seguridad, crea una cuenta solo para esto.",
|
"smtp_info" => "La contraseña SMTP se transmite y almacena en texto plano. Por seguridad, crea una cuenta solo para esto.",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Token del Bot de Telegram",
|
||||||
|
"telegram_chat_id" => "ID del Chat de Telegram",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "URL del Webhook",
|
||||||
|
"request_method" => "Método de Solicitud",
|
||||||
|
"custom_headers" => "Cabeceras Personalizadas",
|
||||||
|
"webhook_payload" => "Carga del Webhook",
|
||||||
|
"webhook_iterator_key" => "Sustituye {{subscriptions}} por el nombre de la clave",
|
||||||
|
"variables_available" => "Variables disponibles",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Token",
|
||||||
"categories" => "Categorías",
|
"categories" => "Categorías",
|
||||||
"save_category" => "Guardar Categoría",
|
"save_category" => "Guardar Categoría",
|
||||||
"delete_category" => "Eliminar Categoría",
|
"delete_category" => "Eliminar Categoría",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "Error al enviar correo electrónico",
|
"email_error" => "Error al enviar correo electrónico",
|
||||||
"notification_sent_successfuly" => "Notificación enviada con éxito",
|
"notification_sent_successfuly" => "Notificación enviada con éxito",
|
||||||
"notifications_settings_saved" => "Configuración de notificaciones guardada con éxito.",
|
"notifications_settings_saved" => "Configuración de notificaciones guardada con éxito.",
|
||||||
|
"notification_failed" => "Error al enviar la notificación",
|
||||||
// Payments
|
// Payments
|
||||||
"payment_in_use" => "No se puede desactivar el método de pago utilizado",
|
"payment_in_use" => "No se puede desactivar el método de pago utilizado",
|
||||||
"failed_update_payment" => "Error al actualizar el método de pago en la base de datos",
|
"failed_update_payment" => "Error al actualizar el método de pago en la base de datos",
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "Mot de passe SMTP",
|
"smtp_password" => "Mot de passe SMTP",
|
||||||
"from_email" => "De l'adresse courriel (facultatif)",
|
"from_email" => "De l'adresse courriel (facultatif)",
|
||||||
"smtp_info" => "Le mot de passe SMTP est transmis et stocké en texte brut. Pour des raisons de sécurité, veuillez créer un compte uniquement à cette fin.",
|
"smtp_info" => "Le mot de passe SMTP est transmis et stocké en texte brut. Pour des raisons de sécurité, veuillez créer un compte uniquement à cette fin.",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Jeton du bot Telegram",
|
||||||
|
"telegram_chat_id" => "ID de chat Telegram",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "URL du webhook",
|
||||||
|
"request_method" => "Méthode de requête",
|
||||||
|
"custom_headers" => "En-têtes personnalisés",
|
||||||
|
"webhook_payload" => "Charge utile du webhook",
|
||||||
|
"webhook_iterator_key" => "Remplacer {{subscriptions}} par le nom de la clé",
|
||||||
|
"variables_available" => "Variables disponibles",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Jeton",
|
||||||
"categories" => "Catégories",
|
"categories" => "Catégories",
|
||||||
"save_category" => "Enregistrer la catégorie",
|
"save_category" => "Enregistrer la catégorie",
|
||||||
"delete_category" => "Supprimer la catégorie",
|
"delete_category" => "Supprimer la catégorie",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "Erreur dlors de l'envoi de courriel",
|
"email_error" => "Erreur dlors de l'envoi de courriel",
|
||||||
"notification_sent_successfuly" => "Notification envoyée avec succès",
|
"notification_sent_successfuly" => "Notification envoyée avec succès",
|
||||||
"notifications_settings_saved" => "Paramètres de notifications enregistrés avec succès.",
|
"notifications_settings_saved" => "Paramètres de notifications enregistrés avec succès.",
|
||||||
|
"notification_failed" => "Échec de la notification",
|
||||||
// Paiements
|
// Paiements
|
||||||
"payment_in_use" => "Impossible de désactiver la méthode de paiement utilisée",
|
"payment_in_use" => "Impossible de désactiver la méthode de paiement utilisée",
|
||||||
"failed_update_payment" => "Échec de la mise à jour de la méthode de paiement dans la base de données",
|
"failed_update_payment" => "Échec de la mise à jour de la méthode de paiement dans la base de données",
|
||||||
|
|||||||
@ -125,6 +125,18 @@ $i18n = [
|
|||||||
'smtp_password' => 'Password SMTP',
|
'smtp_password' => 'Password SMTP',
|
||||||
'from_email' => 'Da quale e-mail (Opzionale)',
|
'from_email' => 'Da quale e-mail (Opzionale)',
|
||||||
'smtp_info' => 'La password SMTP viene memorizzata e trasmessa in chiaro. Per motivi di sicurezza, si prega di creare un account da utilizzare solo per questo.',
|
'smtp_info' => 'La password SMTP viene memorizzata e trasmessa in chiaro. Per motivi di sicurezza, si prega di creare un account da utilizzare solo per questo.',
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Telegram Bot Token",
|
||||||
|
"telegram_chat_id" => "Telegram Chat ID",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "Webhook URL",
|
||||||
|
"request_method" => "Metodo di richiesta",
|
||||||
|
"custom_headers" => "Intestazioni personalizzate",
|
||||||
|
"webhook_payload" => "Webhook Payload",
|
||||||
|
"webhook_iterator_key" => "Sostituisci {{subscriptions}} con il nome della chiave",
|
||||||
|
"variables_available" => "Variabili disponibili",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Token",
|
||||||
'categories' => 'Categorie',
|
'categories' => 'Categorie',
|
||||||
'save_category' => 'Salva categoria',
|
'save_category' => 'Salva categoria',
|
||||||
'delete_category' => 'Elimina categoria',
|
'delete_category' => 'Elimina categoria',
|
||||||
@ -193,6 +205,57 @@ $i18n = [
|
|||||||
// Category
|
// Category
|
||||||
'failed_add_category' => 'Impossibile aggiungere la categoria',
|
'failed_add_category' => 'Impossibile aggiungere la categoria',
|
||||||
'failed_edit_category' => 'Impossibile modificare la categoria',
|
'failed_edit_category' => 'Impossibile modificare la categoria',
|
||||||
|
"category_in_use" => "La categoria è attualmente in uso da almeno un abbonamento",
|
||||||
|
"failed_remove_category" => "Impossibile rimuovere la categoria",
|
||||||
|
"category_saved" => "Categoria salvata",
|
||||||
|
"category_removed" => "Categoria rimossa",
|
||||||
|
"sort_order_saved" => "Ordine di visualizzazione salvato",
|
||||||
|
|
||||||
|
// Currency
|
||||||
|
"currency_saved" => "Valuta salvata con successo",
|
||||||
|
"error_adding_currency" => "Errore nell'aggiunta della valuta",
|
||||||
|
"failed_to_store_currency" => "Impossibile salvare la valuta nel Database",
|
||||||
|
"currency_in_use" => "La valuta è attualmente in uso da almeno un abbonamento",
|
||||||
|
"currency_is_main" => "Impossibile rimuovere la valuta principale",
|
||||||
|
"failed_to_remove_currency" => "Impossibile rimuovere la valuta",
|
||||||
|
"failed_to_store_api_key" => "Impossibile salvare la chiave API",
|
||||||
|
"invalid_api_key" => "Chiave API non valida",
|
||||||
|
"api_key_saved" => "Chiave API salvata",
|
||||||
|
"currency_removed" => "Valuta rimossa",
|
||||||
|
|
||||||
|
// Household
|
||||||
|
"failed_add_household" => "Impossibile aggiungere un membro del nucleo familiare",
|
||||||
|
"failed_edit_household" => "Impossibile modificare un membro del nucleo familiare",
|
||||||
|
"failed_remove_household" => "Impossibile rimuovere un membro del nucleo familiare",
|
||||||
|
"household_in_use" => "Il membro del nucleo familiare è attualmente in uso da almeno un abbonamento",
|
||||||
|
"member_saved" => "Membro salvato",
|
||||||
|
"member_removed" => "Membro rimosso",
|
||||||
|
|
||||||
|
// Notifications
|
||||||
|
"error_saving_notifications" => "Errore nel salvataggio delle notifiche",
|
||||||
|
"wallos_notification" => "Notifica Wallos",
|
||||||
|
"test_notification" => "Questa è una notifica di prova",
|
||||||
|
"email_error" => "Errore nell'invio dell'e-mail",
|
||||||
|
"notification_sent_successfuly" => "Notifica inviata con successo",
|
||||||
|
"notifications_settings_saved" => "Impostazioni delle notifiche salvate",
|
||||||
|
"notification_failed" => "Invio della notifica fallito",
|
||||||
|
|
||||||
|
// Payments
|
||||||
|
"payment_in_use" => "Questo metodo di pagamento è attualmente in uso da almeno un abbonamento",
|
||||||
|
"failed_update_payment" => "Aggiornamento del metodo di pagamento fallito",
|
||||||
|
"enabled" => "abilitato",
|
||||||
|
"disabled" => "disabilitato",
|
||||||
|
|
||||||
|
// Subscription
|
||||||
|
"error_fetching_image" => "Errore nel recupero dell'immagine",
|
||||||
|
"subscription_updated_successfuly" => "Abbonamento aggiornato con successo",
|
||||||
|
"subscription_added_successfuly" => "Abbonamento aggiunto con successo",
|
||||||
|
"error_deleting_subscription" => "Errore nell'eliminazione dell'abbonamento",
|
||||||
|
"invalid_request_method" => "Metodo di richiesta non valido",
|
||||||
|
|
||||||
|
// User
|
||||||
|
"error_updating_user_data" => "Errore nell'aggiornamento dei dati utente",
|
||||||
|
"user_details_saved" => "Dettagli utente salvati",
|
||||||
];
|
];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "SMTPパスワード",
|
"smtp_password" => "SMTPパスワード",
|
||||||
"from_email" => "送信元アドレス (オプション)",
|
"from_email" => "送信元アドレス (オプション)",
|
||||||
"smtp_info" => "SMTPパスワードは平文で送信および保存されます。セキュリティのため専用のアカウントを作成してください。",
|
"smtp_info" => "SMTPパスワードは平文で送信および保存されます。セキュリティのため専用のアカウントを作成してください。",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Telegramボットトークン",
|
||||||
|
"telegram_chat_id" => "TelegramチャットID",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "Webhook URL",
|
||||||
|
"request_method" => "リクエストメソッド",
|
||||||
|
"custom_headers" => "カスタムヘッダー",
|
||||||
|
"webhook_payload" => "Webhookペイロード",
|
||||||
|
"webhook_iterator_keu" => "{{subscriptions}}をキー名に置き換える」",
|
||||||
|
"variables_available" => "利用可能な変数",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "トークン",
|
||||||
"categories" => "カテゴリ",
|
"categories" => "カテゴリ",
|
||||||
"save_category" => "カテゴリを保存",
|
"save_category" => "カテゴリを保存",
|
||||||
"delete_category" => "カテゴリを削除",
|
"delete_category" => "カテゴリを削除",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "電子メールの送信エラー",
|
"email_error" => "電子メールの送信エラー",
|
||||||
"notification_sent_successfuly" => "通知の送信に成功しました",
|
"notification_sent_successfuly" => "通知の送信に成功しました",
|
||||||
"notifications_settings_saved" => "通知設定の保存に成功",
|
"notifications_settings_saved" => "通知設定の保存に成功",
|
||||||
|
"notification_failed" => "通知の送信に失敗",
|
||||||
// Payments
|
// Payments
|
||||||
"payment_in_use" => "使用中の支払い方法は削除できません",
|
"payment_in_use" => "使用中の支払い方法は削除できません",
|
||||||
"failed_update_payment" => "データーベースの支払い方法の更新に失敗しました",
|
"failed_update_payment" => "データーベースの支払い方法の更新に失敗しました",
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "Hasło SMTP",
|
"smtp_password" => "Hasło SMTP",
|
||||||
"from_email" => "Z adresu e-mail (opcjonalnie)",
|
"from_email" => "Z adresu e-mail (opcjonalnie)",
|
||||||
"smtp_info" => "Hasło SMTP jest przesyłane i przechowywane w postaci zwykłego tekstu. Ze względów bezpieczeństwa utwórz konto tylko w tym celu.",
|
"smtp_info" => "Hasło SMTP jest przesyłane i przechowywane w postaci zwykłego tekstu. Ze względów bezpieczeństwa utwórz konto tylko w tym celu.",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Token bota",
|
||||||
|
"telegram_chat_id" => "ID czatu",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "URL webhooka",
|
||||||
|
"request_method" => "Metoda żądania",
|
||||||
|
"custom_headers" => "Niestandardowe nagłówki",
|
||||||
|
"webhook_payload" => "Dane webhooka",
|
||||||
|
"webhook_iterator_key" => "Zastąp {{subscriptions}} nazwą klucza",
|
||||||
|
"variables_available" => "Dostępne zmienne",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Token",
|
||||||
"categories" => "Kategorie",
|
"categories" => "Kategorie",
|
||||||
"save_category" => "Zapisz kategorię",
|
"save_category" => "Zapisz kategorię",
|
||||||
"delete_category" => "Usuń kategorię",
|
"delete_category" => "Usuń kategorię",
|
||||||
@ -213,6 +225,7 @@ $i18n = [
|
|||||||
"wallos_notification" => "Powiadomienie Wallos",
|
"wallos_notification" => "Powiadomienie Wallos",
|
||||||
"test_notification" => "To jest powiadomienie testowe. Jeśli to widzisz, konfiguracja jest prawidłowa.",
|
"test_notification" => "To jest powiadomienie testowe. Jeśli to widzisz, konfiguracja jest prawidłowa.",
|
||||||
"email_error" => "Błąd podczas wysyłania wiadomości e-mail",
|
"email_error" => "Błąd podczas wysyłania wiadomości e-mail",
|
||||||
|
"notification_failed" => "Powiadomienie nie powiodło się",
|
||||||
"notification_sent_successfuly" => "Powiadomienie wysłane pomyślnie",
|
"notification_sent_successfuly" => "Powiadomienie wysłane pomyślnie",
|
||||||
"notifications_settings_saved" => "Ustawienia powiadomień zostały zapisane.",
|
"notifications_settings_saved" => "Ustawienia powiadomień zostały zapisane.",
|
||||||
// Payments
|
// Payments
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "Password SMTP",
|
"smtp_password" => "Password SMTP",
|
||||||
"from_email" => "Email de envio (Opcional)",
|
"from_email" => "Email de envio (Opcional)",
|
||||||
"smtp_info" => "A Password é armazenada e transmitida em texto. Por segurança, crie uma conta só para esta finalidade.",
|
"smtp_info" => "A Password é armazenada e transmitida em texto. Por segurança, crie uma conta só para esta finalidade.",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Token do Bot Telegram",
|
||||||
|
"telegram_chat_id" => "ID do Chat Telegram",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "URL do Webhook",
|
||||||
|
"request_method" => "Método de Pedido",
|
||||||
|
"custom_headers" => "Cabeçalhos Personalizados",
|
||||||
|
"webhook_payload" => "Payload do Webhook",
|
||||||
|
"webhook_iterator_key" => "Substituir {{subscriptions}} pelo nome da chave",
|
||||||
|
"variables_available" => "Variáveis Disponíveis",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Token",
|
||||||
"categories" => "Categorias",
|
"categories" => "Categorias",
|
||||||
"save_category" => "Guardar Categoria",
|
"save_category" => "Guardar Categoria",
|
||||||
"delete_category" => "Apagar Categoria",
|
"delete_category" => "Apagar Categoria",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "Erro ao enviar email",
|
"email_error" => "Erro ao enviar email",
|
||||||
"notification_sent_successfuly" => "Notificação enviada com sucesso",
|
"notification_sent_successfuly" => "Notificação enviada com sucesso",
|
||||||
"notifications_settings_saved" => "Configuração de notificações guardada.",
|
"notifications_settings_saved" => "Configuração de notificações guardada.",
|
||||||
|
"notification_failed" => "Erro ao enviar notificação",
|
||||||
// Payments
|
// Payments
|
||||||
"payment_in_use" => "Não pode desactivar método de pagamento em uso",
|
"payment_in_use" => "Não pode desactivar método de pagamento em uso",
|
||||||
"failed_update_payment" => "Erro ao actualizar método de pagamento na base de dados",
|
"failed_update_payment" => "Erro ao actualizar método de pagamento na base de dados",
|
||||||
|
|||||||
@ -118,6 +118,18 @@ $i18n = [
|
|||||||
"smtp_password" => "Senha SMTP",
|
"smtp_password" => "Senha SMTP",
|
||||||
"from_email" => "Email de envio (Opcional)",
|
"from_email" => "Email de envio (Opcional)",
|
||||||
"smtp_info" => "A senha do SMTP é transmitida em texto puro. Por segurança, crie uma conta só para esta finalidade.",
|
"smtp_info" => "A senha do SMTP é transmitida em texto puro. Por segurança, crie uma conta só para esta finalidade.",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Token do Bot",
|
||||||
|
"telegram_chat_id" => "Chat ID",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "URL do Webhook",
|
||||||
|
"request_method" => "Método de requisição",
|
||||||
|
"custom_headers" => "Cabeçalhos personalizados",
|
||||||
|
"webhook_payload" => "Payload do Webhook",
|
||||||
|
"webhook_iterator_key" => "Substituir {{subscriptions}} pelo nome da chave",
|
||||||
|
"variables_available" => "Variáveis disponíveis",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Token",
|
||||||
"categories" => "Categorias",
|
"categories" => "Categorias",
|
||||||
"save_category" => "Salvar categoria",
|
"save_category" => "Salvar categoria",
|
||||||
"delete_category" => "Excluir categoria",
|
"delete_category" => "Excluir categoria",
|
||||||
@ -213,6 +225,7 @@ $i18n = [
|
|||||||
"email_error" => "Erro ao enviar email",
|
"email_error" => "Erro ao enviar email",
|
||||||
"notification_sent_successfuly" => "Notificação enviada com sucesso",
|
"notification_sent_successfuly" => "Notificação enviada com sucesso",
|
||||||
"notifications_settings_saved" => "Configurações de notificação salvas com sucesso",
|
"notifications_settings_saved" => "Configurações de notificação salvas com sucesso",
|
||||||
|
"notification_failed" => "Falha ao enviar notificação",
|
||||||
// Payments
|
// Payments
|
||||||
"payment_in_use" => "Não é possível desativar o método de pagamento",
|
"payment_in_use" => "Não é possível desativar o método de pagamento",
|
||||||
"failed_update_payment" => "Erro ao atualizar o método de pagamento no banco de dados.",
|
"failed_update_payment" => "Erro ao atualizar o método de pagamento no banco de dados.",
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "SMTP лозинка",
|
"smtp_password" => "SMTP лозинка",
|
||||||
"from_email" => "Од е-поште (Опционо)",
|
"from_email" => "Од е-поште (Опционо)",
|
||||||
"smtp_info" => "SMTP лозинка се преноси и чува у обичном тексту. Из сигурносних разлога, молимо вас да направите налог само за ово.",
|
"smtp_info" => "SMTP лозинка се преноси и чува у обичном тексту. Из сигурносних разлога, молимо вас да направите налог само за ово.",
|
||||||
|
"telegram" => "Телеграм",
|
||||||
|
"telegram_bot_token" => "Телеграм бот токен",
|
||||||
|
"telegram_chat_id" => "Телеграм чет ID",
|
||||||
|
"webhook" => "Вебхук",
|
||||||
|
"webhook_url" => "Вебхук URL",
|
||||||
|
"request_method" => "Метод захтева",
|
||||||
|
"custom_headers" => "Прилагођени заглавља",
|
||||||
|
"webhook_payload" => "Вебхук Пајлоад",
|
||||||
|
"webhook_iterator_key" => "{{subscriptions}} замени кључним итератором",
|
||||||
|
"variables_available" => "Доступне променљиве",
|
||||||
|
"gotify" => "Готифи",
|
||||||
|
"token" => "Токен",
|
||||||
"categories" => "Категорије",
|
"categories" => "Категорије",
|
||||||
"save_category" => "Сачувај категорију",
|
"save_category" => "Сачувај категорију",
|
||||||
"delete_category" => "Избриши категорију",
|
"delete_category" => "Избриши категорију",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "Грешка при слању е-поште",
|
"email_error" => "Грешка при слању е-поште",
|
||||||
"notification_sent_successfuly" => "Обавештење успешно послато",
|
"notification_sent_successfuly" => "Обавештење успешно послато",
|
||||||
"notifications_settings_saved" => "Подешавања обавештења успешно сачувана.",
|
"notifications_settings_saved" => "Подешавања обавештења успешно сачувана.",
|
||||||
|
"notification_failed" => "Обавештење није послато",
|
||||||
// Плаћања
|
// Плаћања
|
||||||
"payment_in_use" => "Не може се онемогућити коришћени начин плаћања",
|
"payment_in_use" => "Не може се онемогућити коришћени начин плаћања",
|
||||||
"failed_update_payment" => "Ажурирање начина плаћања у бази података није успело",
|
"failed_update_payment" => "Ажурирање начина плаћања у бази података није успело",
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "SMTP lozinka",
|
"smtp_password" => "SMTP lozinka",
|
||||||
"from_email" => "Od e-pošte (Opciono)",
|
"from_email" => "Od e-pošte (Opciono)",
|
||||||
"smtp_info" => "SMTP lozinka se prenosi i čuva u običnom tekstu. Iz sigurnosnih razloga, molimo vas da napravite nalog samo za ovo.",
|
"smtp_info" => "SMTP lozinka se prenosi i čuva u običnom tekstu. Iz sigurnosnih razloga, molimo vas da napravite nalog samo za ovo.",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Telegram bot token",
|
||||||
|
"telegram_chat_id" => "Telegram chat ID",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "Webhook URL",
|
||||||
|
"request_method" => "Metod zahteva",
|
||||||
|
"custom_headers" => "Prilagođeni zaglavlja",
|
||||||
|
"webhook_payload" => "Webhook payload",
|
||||||
|
"webhook_iterator_key" => "Zameni {{subscriptions}} sa ključem",
|
||||||
|
"variables_available" => "Dostupne promenljive",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Token",
|
||||||
"categories" => "Kategorije",
|
"categories" => "Kategorije",
|
||||||
"save_category" => "Sačuvaj kategoriju",
|
"save_category" => "Sačuvaj kategoriju",
|
||||||
"delete_category" => "Izbriši kategoriju",
|
"delete_category" => "Izbriši kategoriju",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "Greška pri slanju e-pošte",
|
"email_error" => "Greška pri slanju e-pošte",
|
||||||
"notification_sent_successfuly" => "Obaveštenje uspešno poslato",
|
"notification_sent_successfuly" => "Obaveštenje uspešno poslato",
|
||||||
"notifications_settings_saved" => "Podešavanja obaveštenja uspešno sačuvana.",
|
"notifications_settings_saved" => "Podešavanja obaveštenja uspešno sačuvana.",
|
||||||
|
"notification_failed" => "Obaveštenje nije poslato",
|
||||||
// Plaćanja
|
// Plaćanja
|
||||||
"payment_in_use" => "Nije moguće onemogućiti korišćeni način plaćanja",
|
"payment_in_use" => "Nije moguće onemogućiti korišćeni način plaćanja",
|
||||||
"failed_update_payment" => "Nije uspelo ažuriranje načina plaćanja u bazi podataka",
|
"failed_update_payment" => "Nije uspelo ažuriranje načina plaćanja u bazi podataka",
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "SMTP Şifresi",
|
"smtp_password" => "SMTP Şifresi",
|
||||||
"from_email" => "Gönderen e-posta (İsteğe bağlı)",
|
"from_email" => "Gönderen e-posta (İsteğe bağlı)",
|
||||||
"smtp_info" => "SMTP Şifresi düz metin olarak iletilir ve saklanır. Güvenlik için, lütfen bunun için özel bir hesap oluşturun.",
|
"smtp_info" => "SMTP Şifresi düz metin olarak iletilir ve saklanır. Güvenlik için, lütfen bunun için özel bir hesap oluşturun.",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Telegram Bot Token",
|
||||||
|
"telegram_chat_id" => "Telegram Chat ID",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "Webhook URL",
|
||||||
|
"request_method" => "İstek Metodu",
|
||||||
|
"custom_headers" => "Özel Başlıklar",
|
||||||
|
"webhook_payload" => "Webhook Payload",
|
||||||
|
"webhook_iterator_key" => "{{subscriptions}}'yi anahtar olarak değiştir",
|
||||||
|
"variables_available" => "Kullanılabilir Değişkenler",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "Token",
|
||||||
"categories" => "Kategoriler",
|
"categories" => "Kategoriler",
|
||||||
"save_category" => "Kategoriyi Kaydet",
|
"save_category" => "Kategoriyi Kaydet",
|
||||||
"delete_category" => "Kategoriyi Sil",
|
"delete_category" => "Kategoriyi Sil",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "E-posta gönderilirken hata oluştu",
|
"email_error" => "E-posta gönderilirken hata oluştu",
|
||||||
"notification_sent_successfuly" => "Bildirim başarıyla gönderildi",
|
"notification_sent_successfuly" => "Bildirim başarıyla gönderildi",
|
||||||
"notifications_settings_saved" => "Bildirim ayarları başarıyla kaydedildi.",
|
"notifications_settings_saved" => "Bildirim ayarları başarıyla kaydedildi.",
|
||||||
|
"notification_failed" => "Bildirim gönderilemedi",
|
||||||
// Payments
|
// Payments
|
||||||
"payment_in_use" => "Kullanımda olan ödeme yöntemi devre dışı bırakılamaz",
|
"payment_in_use" => "Kullanımda olan ödeme yöntemi devre dışı bırakılamaz",
|
||||||
"failed_update_payment" => "Ödeme yöntemi veritabanında güncellenemedi",
|
"failed_update_payment" => "Ödeme yöntemi veritabanında güncellenemedi",
|
||||||
|
|||||||
@ -127,6 +127,18 @@ $i18n = [
|
|||||||
"smtp_password" => "SMTP 密码",
|
"smtp_password" => "SMTP 密码",
|
||||||
"from_email" => "发件人邮箱(可选)",
|
"from_email" => "发件人邮箱(可选)",
|
||||||
"smtp_info" => "SMTP 密码以明文传输和存储。为安全起见,建议专门为 Wallos 创建一个账户。",
|
"smtp_info" => "SMTP 密码以明文传输和存储。为安全起见,建议专门为 Wallos 创建一个账户。",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Telegram 机器人令牌",
|
||||||
|
"telegram_chat_id" => "Telegram 聊天 ID",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "Webhook URL",
|
||||||
|
"request_method" => "请求方法",
|
||||||
|
"custom_headers" => "自定义标头",
|
||||||
|
"webhook_payload" => "Webhook 负载",
|
||||||
|
"webhook_iterator_key" => "替换 {{subscriptions}} 为键名",
|
||||||
|
"variables_available" => "可用变量",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "令牌",
|
||||||
"categories" => "分类",
|
"categories" => "分类",
|
||||||
"save_category" => "保存分类",
|
"save_category" => "保存分类",
|
||||||
"delete_category" => "删除分类",
|
"delete_category" => "删除分类",
|
||||||
@ -226,6 +238,7 @@ $i18n = [
|
|||||||
"wallos_notification" => "Wallos 通知",
|
"wallos_notification" => "Wallos 通知",
|
||||||
"test_notification" => "这是一条测试通知。如果您看到此消息,说明 Wallos 通知邮件配置正确。",
|
"test_notification" => "这是一条测试通知。如果您看到此消息,说明 Wallos 通知邮件配置正确。",
|
||||||
"email_error" => "发送电子邮件时出错",
|
"email_error" => "发送电子邮件时出错",
|
||||||
|
"notification_failed" => "通知发送失败",
|
||||||
"notification_sent_successfuly" => "通知已成功发送",
|
"notification_sent_successfuly" => "通知已成功发送",
|
||||||
"notifications_settings_saved" => "通知设置已成功保存。",
|
"notifications_settings_saved" => "通知设置已成功保存。",
|
||||||
|
|
||||||
|
|||||||
@ -120,6 +120,18 @@ $i18n = [
|
|||||||
"smtp_password" => "SMTP 密碼",
|
"smtp_password" => "SMTP 密碼",
|
||||||
"from_email" => "寄件人信箱(可選)",
|
"from_email" => "寄件人信箱(可選)",
|
||||||
"smtp_info" => "SMTP 密碼將以明文傳輸和儲存。為了安全起見,建議專門為 Wallos 建立一個帳戶。",
|
"smtp_info" => "SMTP 密碼將以明文傳輸和儲存。為了安全起見,建議專門為 Wallos 建立一個帳戶。",
|
||||||
|
"telegram" => "Telegram",
|
||||||
|
"telegram_bot_token" => "Telegram 機器人令牌",
|
||||||
|
"telegram_chat_id" => "Telegram 聊天 ID",
|
||||||
|
"webhook" => "Webhook",
|
||||||
|
"webhook_url" => "Webhook URL",
|
||||||
|
"request_method" => "請求方法",
|
||||||
|
"custom_headers" => "自訂標頭",
|
||||||
|
"webhook_payload" => "Webhook 載荷",
|
||||||
|
"webhook_iterator_key" => "替換 {{subscriptions}} 為鍵名",
|
||||||
|
"variables_available" => "可用變數",
|
||||||
|
"gotify" => "Gotify",
|
||||||
|
"token" => "令牌",
|
||||||
"categories" => "分類",
|
"categories" => "分類",
|
||||||
"save_category" => "儲存分類",
|
"save_category" => "儲存分類",
|
||||||
"delete_category" => "刪除分類",
|
"delete_category" => "刪除分類",
|
||||||
@ -215,6 +227,7 @@ $i18n = [
|
|||||||
"email_error" => "傳送到電子信箱時發生錯誤",
|
"email_error" => "傳送到電子信箱時發生錯誤",
|
||||||
"notification_sent_successfuly" => "通知已成功傳送",
|
"notification_sent_successfuly" => "通知已成功傳送",
|
||||||
"notifications_settings_saved" => "通知設定已成功儲存。",
|
"notifications_settings_saved" => "通知設定已成功儲存。",
|
||||||
|
"notification_failed" => "通知傳送失敗",
|
||||||
// Payments
|
// Payments
|
||||||
"payment_in_use" => "無法停用正在使用的付款方式",
|
"payment_in_use" => "無法停用正在使用的付款方式",
|
||||||
"failed_update_payment" => "更新資料庫中的付款方式失敗",
|
"failed_update_payment" => "更新資料庫中的付款方式失敗",
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
$version = "v1.23.0";
|
$version = "v1.24.0";
|
||||||
?>
|
?>
|
||||||
|
|||||||
16
index.php
16
index.php
@ -26,16 +26,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$notificationsEnabled = false;
|
|
||||||
$query = "SELECT enabled FROM notifications WHERE id = 1";
|
|
||||||
$result = $db->query($query);
|
|
||||||
if ($result) {
|
|
||||||
$row = $result->fetchArray(SQLITE3_ASSOC);
|
|
||||||
if ($row) {
|
|
||||||
$notificationsEnabled = $row['enabled'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden";
|
$headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden";
|
||||||
$defaultLogo = $theme == "light" ? "images/siteicons/" . $colorTheme . "/wallos.png" : "images/siteicons/" . $colorTheme . "/walloswhite.png";
|
$defaultLogo = $theme == "light" ? "images/siteicons/" . $colorTheme . "/wallos.png" : "images/siteicons/" . $colorTheme . "/walloswhite.png";
|
||||||
?>
|
?>
|
||||||
@ -285,16 +275,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
|
||||||
if ($notificationsEnabled) {
|
|
||||||
?>
|
|
||||||
<div class="form-group-inline">
|
<div class="form-group-inline">
|
||||||
<input type="checkbox" id="notifications" name="notifications">
|
<input type="checkbox" id="notifications" name="notifications">
|
||||||
<label for="notifications"><?= translate('enable_notifications', $i18n) ?></label>
|
<label for="notifications"><?= translate('enable_notifications', $i18n) ?></label>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="payment_method"><?= translate('payment_method', $i18n) ?></label>
|
<label for="payment_method"><?= translate('payment_method', $i18n) ?></label>
|
||||||
|
|||||||
64
migrations/000016.php
Normal file
64
migrations/000016.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This migration adds tables to store the date about the new notification methods (telegram, webhooks and gotify)
|
||||||
|
* Existing values on the notifications table will be split and migrated to the new tables.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @noinspection PhpUndefinedVariableInspection */
|
||||||
|
$db->exec('CREATE TABLE IF NOT EXISTS telegram_notifications (
|
||||||
|
enabled BOOLEAN DEFAULT 0,
|
||||||
|
bot_token TEXT DEFAULT "",
|
||||||
|
chat_id TEXT DEFAULT ""
|
||||||
|
)');
|
||||||
|
|
||||||
|
$db->exec('CREATE TABLE IF NOT EXISTS webhook_notifications (
|
||||||
|
enabled BOOLEAN DEFAULT 0,
|
||||||
|
headers TEXT DEFAULT "",
|
||||||
|
url TEXT DEFAULT "",
|
||||||
|
request_method TEXT DEFAULT "POST",
|
||||||
|
payload TEXT DEFAULT "",
|
||||||
|
iterator TEXT DEFAULT ""
|
||||||
|
)');
|
||||||
|
|
||||||
|
$db->exec('CREATE TABLE IF NOT EXISTS gotify_notifications (
|
||||||
|
enabled BOOLEAN DEFAULT 0,
|
||||||
|
url TEXT DEFAULT "",
|
||||||
|
token TEXT DEFAULT ""
|
||||||
|
)');
|
||||||
|
|
||||||
|
$db->exec('CREATE TABLE IF NOT EXISTS email_notifications (
|
||||||
|
enabled BOOLEAN DEFAULT 0,
|
||||||
|
smtp_address TEXT DEFAULT "",
|
||||||
|
smtp_port INTEGER DEFAULT 587,
|
||||||
|
smtp_username TEXT DEFAULT "",
|
||||||
|
smtp_password TEXT DEFAULT "",
|
||||||
|
from_email TEXT DEFAULT "",
|
||||||
|
encryption TEXT DEFAULT "tls"
|
||||||
|
)');
|
||||||
|
|
||||||
|
$db->exec('CREATE TABLE IF NOT EXISTS notification_settings (
|
||||||
|
days INTEGER DEFAULT 0
|
||||||
|
)');
|
||||||
|
|
||||||
|
// Check if old email notifications table has data and migrate it
|
||||||
|
$result = $db->query('SELECT COUNT(*) as count FROM notifications');
|
||||||
|
$row = $result->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
|
if ($row['count'] > 0) {
|
||||||
|
// Copy data from notifications to email_notifications
|
||||||
|
$db->exec('INSERT INTO email_notifications (enabled, smtp_address, smtp_port, smtp_username, smtp_password, from_email, encryption)
|
||||||
|
SELECT enabled, smtp_address, smtp_port, smtp_username, smtp_password, from_email, encryption FROM notifications');
|
||||||
|
|
||||||
|
// Copy data from notifications to notification_settings
|
||||||
|
$db->exec('INSERT INTO notification_settings (days)
|
||||||
|
SELECT days FROM notifications');
|
||||||
|
|
||||||
|
if ($db->changes() > 0) {
|
||||||
|
$db->exec('DROP TABLE IF EXISTS notifications');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$db->exec('DROP TABLE IF EXISTS notifications');
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
212
scripts/notifications.js
Normal file
212
scripts/notifications.js
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
function openNotificationsSettings(type) {
|
||||||
|
// Get all .account-notification-section-settings elements
|
||||||
|
var sections = document.querySelectorAll('.account-notification-section-settings');
|
||||||
|
var targetSection = document.querySelector(`.account-notification-section-settings[data-type="${type}"]`);
|
||||||
|
|
||||||
|
// Remove the is-open class from all elements
|
||||||
|
sections.forEach(function(section) {
|
||||||
|
if (section !== targetSection) {
|
||||||
|
section.classList.remove('is-open');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the is-open class to the element with data-type=type
|
||||||
|
|
||||||
|
if (targetSection && !targetSection.classList.contains('is-open')) {
|
||||||
|
targetSection.classList.add('is-open');
|
||||||
|
} else {
|
||||||
|
targetSection.classList.remove('is-open');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeFetchCall(url, data, button) {
|
||||||
|
return fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
showSuccessMessage(data.message);
|
||||||
|
} else {
|
||||||
|
showErrorMessage(data.message);
|
||||||
|
}
|
||||||
|
button.disabled = false;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
showErrorMessage(error);
|
||||||
|
button.disabled = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveNotifications() {
|
||||||
|
const button = document.getElementById("saveNotifications");
|
||||||
|
button.disabled = true;
|
||||||
|
const days = document.querySelector('#days').value;
|
||||||
|
|
||||||
|
const url = 'endpoints/notifications/savenotificationsettings.php';
|
||||||
|
const data = { days: days };
|
||||||
|
|
||||||
|
makeFetchCall(url, data, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveNotificationsEmailButton() {
|
||||||
|
const button = document.getElementById("saveNotificationsEmail");
|
||||||
|
button.disabled = true;
|
||||||
|
|
||||||
|
const enabled = document.getElementById("emailenabled").checked ? 1 : 0;
|
||||||
|
const smtpAddress = document.getElementById("smtpaddress").value;
|
||||||
|
const smtpPort = document.getElementById("smtpport").value;
|
||||||
|
const encryption = document.querySelector('input[name="encryption"]:checked').value;
|
||||||
|
const smtpUsername = document.getElementById("smtpusername").value;
|
||||||
|
const smtpPassword = document.getElementById("smtppassword").value;
|
||||||
|
const fromEmail = document.getElementById("fromemail").value;
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
enabled: enabled,
|
||||||
|
smtpaddress: smtpAddress,
|
||||||
|
smtpport: smtpPort,
|
||||||
|
encryption: encryption,
|
||||||
|
smtpusername: smtpUsername,
|
||||||
|
smtppassword: smtpPassword,
|
||||||
|
fromemail: fromEmail
|
||||||
|
};
|
||||||
|
|
||||||
|
makeFetchCall('endpoints/notifications/saveemailnotifications.php', data, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testNotificationEmailButton() {
|
||||||
|
const button = document.getElementById("testNotificationsEmail");
|
||||||
|
button.disabled = true;
|
||||||
|
|
||||||
|
const smtpAddress = document.getElementById("smtpaddress").value;
|
||||||
|
const smtpPort = document.getElementById("smtpport").value;
|
||||||
|
const encryption = document.querySelector('input[name="encryption"]:checked').value;
|
||||||
|
const smtpUsername = document.getElementById("smtpusername").value;
|
||||||
|
const smtpPassword = document.getElementById("smtppassword").value;
|
||||||
|
const fromEmail = document.getElementById("fromemail").value;
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
smtpaddress: smtpAddress,
|
||||||
|
smtpport: smtpPort,
|
||||||
|
encryption: encryption,
|
||||||
|
smtpusername: smtpUsername,
|
||||||
|
smtppassword: smtpPassword,
|
||||||
|
fromemail: fromEmail
|
||||||
|
};
|
||||||
|
|
||||||
|
makeFetchCall('endpoints/notifications/testemailnotifications.php', data, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveNotificationsWebhookButton() {
|
||||||
|
const button = document.getElementById("saveNotificationsWebhook");
|
||||||
|
button.disabled = true;
|
||||||
|
|
||||||
|
const enabled = document.getElementById("webhookenabled").checked ? 1 : 0;
|
||||||
|
const webhook_url = document.getElementById("webhookurl").value;
|
||||||
|
const headers = document.getElementById("webhookcustomheaders").value;
|
||||||
|
const payload = document.getElementById("webhookpayload").value;
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
enabled: enabled,
|
||||||
|
webhook_url: webhook_url,
|
||||||
|
headers: headers,
|
||||||
|
payload: payload
|
||||||
|
};
|
||||||
|
|
||||||
|
makeFetchCall('endpoints/notifications/savewebhooknotifications.php', data, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testNotificationsWebhookButton() {
|
||||||
|
const button = document.getElementById("testNotificationsWebhook");
|
||||||
|
button.disabled = true;
|
||||||
|
|
||||||
|
const enabled = document.getElementById("webhookenabled").checked ? 1 : 0;
|
||||||
|
const requestmethod = document.getElementById("webhookrequestmethod").value;
|
||||||
|
const url = document.getElementById("webhookurl").value;
|
||||||
|
const customheaders = document.getElementById("webhookcustomheaders").value;
|
||||||
|
const payload = document.getElementById("webhookpayload").value;
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
enabled: enabled,
|
||||||
|
requestmethod: requestmethod,
|
||||||
|
url: url,
|
||||||
|
customheaders: customheaders,
|
||||||
|
payload: payload
|
||||||
|
};
|
||||||
|
|
||||||
|
makeFetchCall('endpoints/notifications/testwebhooknotifications.php', data, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveNotificationsTelegramButton() {
|
||||||
|
const button = document.getElementById("saveNotificationsTelegram");
|
||||||
|
button.disabled = true;
|
||||||
|
|
||||||
|
const enabled = document.getElementById("telegramenabled").checked ? 1 : 0;
|
||||||
|
const chat_id = document.getElementById("telegramchatid").value;
|
||||||
|
const bot_token = document.getElementById("telegrambottoken").value;
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
enabled: enabled,
|
||||||
|
chat_id: chat_id,
|
||||||
|
bot_token: bot_token
|
||||||
|
};
|
||||||
|
|
||||||
|
makeFetchCall('endpoints/notifications/savetelegramnotifications.php', data, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testNotificationsTelegramButton() {
|
||||||
|
const button = document.getElementById("testNotificationsTelegram");
|
||||||
|
button.disabled = true;
|
||||||
|
|
||||||
|
const enabled = document.getElementById("telegramenabled").checked ? 1 : 0;
|
||||||
|
const bottoken = document.getElementById("telegrambottoken").value;
|
||||||
|
const chatid = document.getElementById("telegramchatid").value;
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
enabled: enabled,
|
||||||
|
bottoken: bottoken,
|
||||||
|
chatid: chatid
|
||||||
|
};
|
||||||
|
|
||||||
|
makeFetchCall('endpoints/notifications/testtelegramnotifications.php', data, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveNotificationsGotifyButton() {
|
||||||
|
const button = document.getElementById("saveNotificationsGotify");
|
||||||
|
button.disabled = true;
|
||||||
|
|
||||||
|
const enabled = document.getElementById("gotifyenabled").checked ? 1 : 0;
|
||||||
|
const gotify_url = document.getElementById("gotifyurl").value;
|
||||||
|
const token = document.getElementById("gotifytoken").value;
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
enabled: enabled,
|
||||||
|
gotify_url: gotify_url,
|
||||||
|
token: token
|
||||||
|
};
|
||||||
|
|
||||||
|
makeFetchCall('endpoints/notifications/savegotifynotifications.php', data, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testNotificationsGotifyButton() {
|
||||||
|
const button = document.getElementById("testNotificationsGotify");
|
||||||
|
button.disabled = true;
|
||||||
|
|
||||||
|
const enabled = document.getElementById("gotifyenabled").checked ? 1 : 0;
|
||||||
|
const gotify_url = document.getElementById("gotifyurl").value;
|
||||||
|
const token = document.getElementById("gotifytoken").value;
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
enabled: enabled,
|
||||||
|
gotify_url: gotify_url,
|
||||||
|
token: token
|
||||||
|
};
|
||||||
|
|
||||||
|
makeFetchCall('endpoints/notifications/testgotifynotifications.php', data, button);
|
||||||
|
}
|
||||||
|
|
||||||
@ -842,94 +842,6 @@ function addFixerKeyButton() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveNotificationsButton() {
|
|
||||||
const button = document.getElementById("saveNotifications");
|
|
||||||
button.disabled = true;
|
|
||||||
|
|
||||||
const enabled = document.getElementById("notifications").checked ? 1 : 0;
|
|
||||||
const days = document.getElementById("days").value;
|
|
||||||
const smtpAddress = document.getElementById("smtpaddress").value;
|
|
||||||
const smtpPort = document.getElementById("smtpport").value;
|
|
||||||
const encryption = document.querySelector('input[name="encryption"]:checked').value;
|
|
||||||
const smtpUsername = document.getElementById("smtpusername").value;
|
|
||||||
const smtpPassword = document.getElementById("smtppassword").value;
|
|
||||||
const fromEmail = document.getElementById("fromemail").value;
|
|
||||||
|
|
||||||
const data = {
|
|
||||||
enabled: enabled,
|
|
||||||
days: days,
|
|
||||||
smtpaddress: smtpAddress,
|
|
||||||
smtpport: smtpPort,
|
|
||||||
encryption: encryption,
|
|
||||||
smtpusername: smtpUsername,
|
|
||||||
smtppassword: smtpPassword,
|
|
||||||
fromemail: fromEmail
|
|
||||||
};
|
|
||||||
|
|
||||||
fetch('endpoints/notifications/save.php', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: JSON.stringify(data)
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
showSuccessMessage(data.message);
|
|
||||||
} else {
|
|
||||||
showErrorMessage(data.errorMessage);
|
|
||||||
}
|
|
||||||
button.disabled = false;
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
showErrorMessage(translate('error_saving_notification_data'));
|
|
||||||
button.disabled = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function testNotificationButton() {
|
|
||||||
const button = document.getElementById("testNotifications");
|
|
||||||
button.disabled = true;
|
|
||||||
|
|
||||||
const smtpAddress = document.getElementById("smtpaddress").value;
|
|
||||||
const smtpPort = document.getElementById("smtpport").value;
|
|
||||||
const encryption = document.querySelector('input[name="encryption"]:checked').value;
|
|
||||||
const smtpUsername = document.getElementById("smtpusername").value;
|
|
||||||
const smtpPassword = document.getElementById("smtppassword").value;
|
|
||||||
const fromEmail = document.getElementById("fromemail").value;
|
|
||||||
|
|
||||||
const data = {
|
|
||||||
smtpaddress: smtpAddress,
|
|
||||||
smtpport: smtpPort,
|
|
||||||
encryption: encryption,
|
|
||||||
smtpusername: smtpUsername,
|
|
||||||
smtppassword: smtpPassword,
|
|
||||||
fromemail: fromEmail
|
|
||||||
};
|
|
||||||
|
|
||||||
fetch('endpoints/notifications/sendtestmail.php', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: JSON.stringify(data)
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
showSuccessMessage(data.message);
|
|
||||||
} else {
|
|
||||||
showErrorMessage(data.errorMessage);
|
|
||||||
}
|
|
||||||
button.disabled = false;
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
showErrorMessage(translate('error_sending_notification'));
|
|
||||||
button.disabled = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function switchTheme() {
|
function switchTheme() {
|
||||||
const darkThemeCss = document.querySelector("#dark-theme");
|
const darkThemeCss = document.querySelector("#dark-theme");
|
||||||
darkThemeCss.disabled = !darkThemeCss.disabled;
|
darkThemeCss.disabled = !darkThemeCss.disabled;
|
||||||
|
|||||||
@ -23,6 +23,7 @@ self.addEventListener('install', function(event) {
|
|||||||
'scripts/dashboard.js',
|
'scripts/dashboard.js',
|
||||||
'scripts/stats.js',
|
'scripts/stats.js',
|
||||||
'scripts/settings.js',
|
'scripts/settings.js',
|
||||||
|
'scripts/notifications.js',
|
||||||
'scripts/registration.js',
|
'scripts/registration.js',
|
||||||
'scripts/i18n/en.js',
|
'scripts/i18n/en.js',
|
||||||
'scripts/i18n/de.js',
|
'scripts/i18n/de.js',
|
||||||
|
|||||||
311
settings.php
311
settings.php
@ -176,7 +176,8 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql = "SELECT * FROM notifications LIMIT 1";
|
// Notification settings
|
||||||
|
$sql = "SELECT * FROM notification_settings LIMIT 1";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
$rowCount = 0;
|
$rowCount = 0;
|
||||||
@ -186,14 +187,107 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($rowCount == 0) {
|
if ($rowCount == 0) {
|
||||||
$notifications['enabled'] = false;
|
|
||||||
$notifications['days'] = 1;
|
$notifications['days'] = 1;
|
||||||
$notifications['smtp_address'] = "";
|
}
|
||||||
$notifications['smtp_port'] = "";
|
|
||||||
$notifications['smtp_username'] = "";
|
// Email notifications
|
||||||
$notifications['smtp_password'] = "";
|
$sql = "SELECT * FROM email_notifications LIMIT 1";
|
||||||
$notifications['from_email'] = "";
|
$result = $db->query($sql);
|
||||||
$notifications['encryption'] = "tls";
|
|
||||||
|
$rowCount = 0;
|
||||||
|
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$notificationsEmail['enabled'] = $row['enabled'];
|
||||||
|
$notificationsEmail['smtp_address'] = $row['smtp_address'];
|
||||||
|
$notificationsEmail['smtp_port'] = $row['smtp_port'];
|
||||||
|
$notificationsEmail['encryption'] = $row['encryption'];
|
||||||
|
$notificationsEmail['smtp_username'] = $row['smtp_username'];
|
||||||
|
$notificationsEmail['smtp_password'] = $row['smtp_password'];
|
||||||
|
$notificationsEmail['from_email'] = $row['from_email'];
|
||||||
|
$rowCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rowCount == 0) {
|
||||||
|
$notificationsEmail['enabled'] = 0;
|
||||||
|
$notificationsEmail['smtp_address'] = "";
|
||||||
|
$notificationsEmail['smtp_port'] = 587;
|
||||||
|
$notificationsEmail['encryption'] = "tls";
|
||||||
|
$notificationsEmail['smtp_username'] = "";
|
||||||
|
$notificationsEmail['smtp_password'] = "";
|
||||||
|
$notificationsEmail['from_email'] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Telegram notifications
|
||||||
|
$sql = "SELECT * FROM telegram_notifications LIMIT 1";
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
$rowCount = 0;
|
||||||
|
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$notificationsTelegram['enabled'] = $row['enabled'];
|
||||||
|
$notificationsTelegram['bot_token'] = $row['bot_token'];
|
||||||
|
$notificationsTelegram['chat_id'] = $row['chat_id'];
|
||||||
|
$rowCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rowCount == 0) {
|
||||||
|
$notificationsTelegram['enabled'] = 0;
|
||||||
|
$notificationsTelegram['bot_token'] = "";
|
||||||
|
$notificationsTelegram['chat_id'] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Webhook notifications
|
||||||
|
$sql = "SELECT * FROM webhook_notifications LIMIT 1";
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
$rowCount = 0;
|
||||||
|
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$notificationsWebhook['enabled'] = $row['enabled'];
|
||||||
|
$notificationsWebhook['url'] = $row['url'];
|
||||||
|
$notificationsWebhook['request_method'] = $row['request_method'];
|
||||||
|
$notificationsWebhook['headers'] = $row['headers'];
|
||||||
|
$notificationsWebhook['payload'] = $row['payload'];
|
||||||
|
$notificationsWebhook['iterator'] = $row['iterator'];
|
||||||
|
$rowCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rowCount == 0) {
|
||||||
|
$notificationsWebhook['enabled'] = 0;
|
||||||
|
$notificationsWebhook['url'] = "";
|
||||||
|
$notificationsWebhook['request_method'] = "POST";
|
||||||
|
$notificationsWebhook['headers'] = "";
|
||||||
|
$notificationsWebhook['iterator'] = "";
|
||||||
|
$notificationsWebhook['payload'] = '
|
||||||
|
{
|
||||||
|
"days_until": "{{days_until}}",
|
||||||
|
"{{subscriptions}}": [
|
||||||
|
{
|
||||||
|
"name": "{{subscription_name}}",
|
||||||
|
"price": "{{subscription_price}}",
|
||||||
|
"currency": "{{subscription_currency}}",
|
||||||
|
"category": "{{subscription_category}}",
|
||||||
|
"date": "{{subscription_date}}",
|
||||||
|
"payer": "{{subscription_payer}}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
}';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gotify notifications
|
||||||
|
$sql = "SELECT * FROM gotify_notifications LIMIT 1";
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
$rowCount = 0;
|
||||||
|
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||||
|
$notificationsGotify['enabled'] = $row['enabled'];
|
||||||
|
$notificationsGotify['url'] = $row['url'];
|
||||||
|
$notificationsGotify['token'] = $row['token'];
|
||||||
|
$rowCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rowCount == 0) {
|
||||||
|
$notificationsGotify['enabled'] = 0;
|
||||||
|
$notificationsGotify['url'] = "";
|
||||||
|
$notificationsGotify['token'] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -203,54 +297,160 @@
|
|||||||
<h2><?= translate('notifications', $i18n) ?></h2>
|
<h2><?= translate('notifications', $i18n) ?></h2>
|
||||||
</header>
|
</header>
|
||||||
<div class="account-notifications">
|
<div class="account-notifications">
|
||||||
<div class="form-group-inline">
|
<section>
|
||||||
<input type="checkbox" id="notifications" name="notifications" <?= $notifications['enabled'] ? "checked" : "" ?>>
|
|
||||||
<label for="notifications"><?= translate('enable_email_notifications', $i18n) ?></label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="days"><?= translate('notify_me', $i18n) ?>:</label>
|
<label for="days"><?= translate('notify_me', $i18n) ?>:</label>
|
||||||
<select name="days" id="days">
|
<div class="form-group-inline">
|
||||||
<?php
|
<select name="days" id="days">
|
||||||
for ($i = 1; $i <= 7; $i++) {
|
<?php
|
||||||
$dayText = $i > 1 ? translate('days_before', $i18n) : translate('day_before', $i18n);
|
for ($i = 1; $i <= 7; $i++) {
|
||||||
$selected = $i == $notifications['days'] ? "selected" : "";
|
$dayText = $i > 1 ? translate('days_before', $i18n) : translate('day_before', $i18n);
|
||||||
?>
|
$selected = $i == $notifications['days'] ? "selected" : "";
|
||||||
<option value="<?= $i ?>" <?= $selected ?>>
|
?>
|
||||||
<?= $i ?> <?= $dayText ?>
|
<option value="<?= $i ?>" <?= $selected ?>>
|
||||||
</option>
|
<?= $i ?> <?= $dayText ?>
|
||||||
<?php
|
</option>
|
||||||
}
|
<?php
|
||||||
?>
|
}
|
||||||
</select>
|
?>
|
||||||
</div>
|
</select>
|
||||||
<div class="form-group-inline">
|
<input type="submit" class="thin" value="<?= translate('save', $i18n) ?>" id="saveNotifications" onClick="saveNotifications()"/>
|
||||||
<input type="text" name="smtpaddress" id="smtpaddress" placeholder="<?= translate('smtp_address', $i18n) ?>" value="<?= $notifications['smtp_address'] ?>" />
|
</div>
|
||||||
<input type="text" name="smtpport" id="smtpport" placeholder="<?= translate('port', $i18n) ?>" class="one-third" value="<?= $notifications['smtp_port'] ?>" />
|
</section>
|
||||||
</div>
|
<section class="account-notifications-section">
|
||||||
<div class="form-group-inline">
|
<header class="account-notification-section-header" onclick="openNotificationsSettings('email')">
|
||||||
<input type="radio" name="encryption" id="encryptiontls" value="tls" <?= $notifications['encryption'] == "tls" ? "checked" : "" ?> />
|
<h3>
|
||||||
<label for="encryptiontls"><?= translate('tls', $i18n) ?></label>
|
<i class="fa-solid fa-envelope"></i>
|
||||||
<input type="radio" name="encryption" id="encryptionssl" value="ssl" <?= $notifications['encryption'] == "ssl" ? "checked" : "" ?> />
|
<?= translate('email', $i18n) ?>
|
||||||
<label for="encryptionssl"><?= translate('ssl', $i18n) ?></label>
|
</h3>
|
||||||
</div>
|
</header>
|
||||||
<div class="form-group-inline">
|
<div class="account-notification-section-settings" data-type="email">
|
||||||
<input type="text" name="smtpusername" id="smtpusername" placeholder="<?= translate('smtp_username', $i18n) ?>" value="<?= $notifications['smtp_username'] ?>" />
|
<div class="form-group-inline">
|
||||||
</div>
|
<input type="checkbox" id="emailenabled" name="emailenabled" <?= $notificationsEmail['enabled'] ? "checked" : "" ?>>
|
||||||
<div class="form-group-inline">
|
<label for="emailenabled" class="capitalize"><?= translate('enabled', $i18n) ?></label>
|
||||||
<input type="password" name="smtppassword" id="smtppassword" placeholder="<?= translate('smtp_password', $i18n) ?>" value="<?= $notifications['smtp_password'] ?>" />
|
</div>
|
||||||
</div>
|
<div class="form-group-inline">
|
||||||
<div class="form-group-inline">
|
<input type="text" name="smtpaddress" id="smtpaddress" placeholder="<?= translate('smtp_address', $i18n) ?>" value="<?= $notificationsEmail['smtp_address'] ?>" />
|
||||||
<input type="text" name="fromemail" id="fromemail" placeholder="<?= translate('from_email', $i18n) ?>" value="<?= $notifications['from_email'] ?>" />
|
<input type="text" name="smtpport" id="smtpport" placeholder="<?= translate('port', $i18n) ?>" class="one-third" value="<?= $notificationsEmail['smtp_port'] ?>" />
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-notes">
|
<div class="form-group-inline">
|
||||||
<p>
|
<input type="radio" name="encryption" id="encryptiontls" value="tls" <?= $notificationsEmail['encryption'] == "tls" ? "checked" : "" ?> />
|
||||||
<i class="fa-solid fa-circle-info"></i> <?= translate('smtp_info', $i18n) ?></p>
|
<label for="encryptiontls"><?= translate('tls', $i18n) ?></label>
|
||||||
<p>
|
<input type="radio" name="encryption" id="encryptionssl" value="ssl" <?= $notificationsEmail['encryption'] == "ssl" ? "checked" : "" ?> />
|
||||||
</div>
|
<label for="encryptionssl"><?= translate('ssl', $i18n) ?></label>
|
||||||
<div class="buttons">
|
</div>
|
||||||
<input type="button" class="secondary-button thin" value="<?= translate('test', $i18n) ?>" id="testNotifications" onClick="testNotificationButton()"/>
|
<div class="form-group-inline">
|
||||||
<input type="submit" value="<?= translate('save', $i18n) ?>" id="saveNotifications" onClick="saveNotificationsButton()" class="thin"/>
|
<input type="text" name="smtpusername" id="smtpusername" placeholder="<?= translate('smtp_username', $i18n) ?>" value="<?= $notificationsEmail['smtp_username'] ?>" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="password" name="smtppassword" id="smtppassword" placeholder="<?= translate('smtp_password', $i18n) ?>" value="<?= $notificationsEmail['smtp_password'] ?>" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="text" name="fromemail" id="fromemail" placeholder="<?= translate('from_email', $i18n) ?>" value="<?= $notificationsEmail['from_email'] ?>" />
|
||||||
|
</div>
|
||||||
|
<div class="settings-notes">
|
||||||
|
<p>
|
||||||
|
<i class="fa-solid fa-circle-info"></i> <?= translate('smtp_info', $i18n) ?></p>
|
||||||
|
<p>
|
||||||
|
</div>
|
||||||
|
<div class="buttons">
|
||||||
|
<input type="button" class="secondary-button thin" value="<?= translate('test', $i18n) ?>" id="testNotificationsEmail" onClick="testNotificationEmailButton()"/>
|
||||||
|
<input type="submit" class="thin" value="<?= translate('save', $i18n) ?>" id="saveNotificationsEmail" onClick="saveNotificationsEmailButton()"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="account-notifications-section">
|
||||||
|
<header class="account-notification-section-header" onclick="openNotificationsSettings('gotify');">
|
||||||
|
<h3>
|
||||||
|
<i class="fa-solid fa-envelopes-bulk"></i>
|
||||||
|
<?= translate('gotify', $i18n) ?>
|
||||||
|
</h3>
|
||||||
|
</header>
|
||||||
|
<div class="account-notification-section-settings" data-type="gotify">
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="checkbox" id="gotifyenabled" name="gotifyenabled" <?= $notificationsGotify['enabled'] ? "checked" : "" ?>>
|
||||||
|
<label for="gotifyenabled" class="capitalize"><?= translate('enabled', $i18n) ?></label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="text" name="gotifyurl" id="gotifyurl" placeholder="<?= translate('url', $i18n) ?>" value="<?= $notificationsGotify['url'] ?>" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="text" name="gotifytoken" id="gotifytoken" placeholder="<?= translate('token', $i18n) ?>" value="<?= $notificationsGotify['token'] ?>" />
|
||||||
|
</div>
|
||||||
|
<div class="buttons">
|
||||||
|
<input type="button" class="secondary-button thin" value="<?= translate('test', $i18n) ?>" id="testNotificationsGotify" onClick="testNotificationsGotifyButton()"/>
|
||||||
|
<input type="submit" class="thin" value="<?= translate('save', $i18n) ?>" id="saveNotificationsGotify" onClick="saveNotificationsGotifyButton()"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="account-notifications-section">
|
||||||
|
<header class="account-notification-section-header" onclick="openNotificationsSettings('telegram');">
|
||||||
|
<h3>
|
||||||
|
<i class="fa-solid fa-paper-plane"></i>
|
||||||
|
<?= translate('telegram', $i18n) ?>
|
||||||
|
</h3>
|
||||||
|
</header>
|
||||||
|
<div class="account-notification-section-settings" data-type="telegram">
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="checkbox" id="telegramenabled" name="telegramenabled" <?= $notificationsTelegram['enabled'] ? "checked" : "" ?>>
|
||||||
|
<label for="telegramenabled" class="capitalize"><?= translate('enabled', $i18n) ?></label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="text" name="telegrambottoken" id="telegrambottoken" placeholder="<?= translate('telegram_bot_token', $i18n) ?>" value="<?= $notificationsTelegram['bot_token'] ? $notificationsTelegram['bot_token'] : "" ?>" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="text" name="telegramchatid" id="telegramchatid" placeholder="<?= translate('telegram_chat_id', $i18n) ?>" value="<?= $notificationsTelegram['chat_id'] ?>" />
|
||||||
|
</div>
|
||||||
|
<div class="buttons">
|
||||||
|
<input type="button" class="secondary-button thin" value="<?= translate('test', $i18n) ?>" id="testNotificationsTelegram" onClick="testNotificationsTelegramButton()"/>
|
||||||
|
<input type="submit" class="thin" value="<?= translate('save', $i18n) ?>" id="saveNotificationsTelegram" onClick="saveNotificationsTelegramButton()"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="account-notifications-section">
|
||||||
|
<header class="account-notification-section-header" onclick="openNotificationsSettings('webhook');">
|
||||||
|
<h3>
|
||||||
|
<i class="fa-solid fa-bolt"></i>
|
||||||
|
<?= translate('webhook', $i18n) ?>
|
||||||
|
</h3>
|
||||||
|
</header>
|
||||||
|
<div class="account-notification-section-settings" data-type="webhook">
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="checkbox" id="webhookenabled" name="webhookenabled" <?= $notificationsWebhook['enabled'] ? "checked" : "" ?>>
|
||||||
|
<label for="webhookenabled" class="capitalize"><?= translate('enabled', $i18n) ?></label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="webhookrequestmethod" class="capitalize"><?= translate('request_method', $i18n) ?>:</label>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<select name="webhookrequestmethod" id="webhookrequestmethod">
|
||||||
|
<option value="GET" <?= $notificationsWebhook['request_method'] == 'GET' ? 'selected' : '' ?>>GET</option>
|
||||||
|
<option value="POST" <?= $notificationsWebhook['request_method'] == 'POST' ? 'selected' : '' ?>>POST</option>
|
||||||
|
<option value="PUT" <?= $notificationsWebhook['request_method'] == 'PUT' ? 'selected' : '' ?>>PUT</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="text" name="webhookurl" id="webhookurl" placeholder="<?= translate('webhook_url', $i18n) ?>" value="<?= $notificationsWebhook['url'] ?>" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<textarea class="thin" name="webhookcustomheaders" id="webhookcustomheaders" placeholder="<?= translate('custom_headers', $i18n) ?>"><?= $notificationsWebhook['headers'] ?></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<textarea name="webhookpayload" id="webhookpayload" placeholder="<?= translate('webhook_payload', $i18n) ?>"><?= $notificationsWebhook['payload'] ?></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="text" name="webhookiteratorkey" id="webhookiteratorkey" placeholder="<?= translate('webhook_iterator_key', $i18n) ?>" value="<?= $notificationsWebhook['iterator'] ?>" />
|
||||||
|
</div>
|
||||||
|
<div class="settings-notes">
|
||||||
|
<p>
|
||||||
|
<i class="fa-solid fa-circle-info"></i> <?= translate('variables_available', $i18n) ?>: {{days_until}}, {{subscription_name}}, {{subscription_price}}, {{subscription_currency}}, {{subscription_category}}, {{subscription_date}}, {{subscription_payer}}</p>
|
||||||
|
<p>
|
||||||
|
</div>
|
||||||
|
<div class="buttons">
|
||||||
|
<input type="button" class="secondary-button thin" value="<?= translate('test', $i18n) ?>" id="testNotificationsWebhook" onClick="testNotificationsWebhookButton()"/>
|
||||||
|
<input type="submit" class="thin" value="<?= translate('save', $i18n) ?>" id="saveNotificationsWebhook" onClick="saveNotificationsWebhookButton()"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@ -702,6 +902,7 @@
|
|||||||
|
|
||||||
</section>
|
</section>
|
||||||
<script src="scripts/settings.js?<?= $version ?>"></script>
|
<script src="scripts/settings.js?<?= $version ?>"></script>
|
||||||
|
<script src="scripts/notifications.js?<?= $version ?>"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once 'includes/footer.php';
|
require_once 'includes/footer.php';
|
||||||
|
|||||||
@ -100,6 +100,12 @@ input[type="color"] {
|
|||||||
background-color: #F2F2F2;
|
background-color: #F2F2F2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
background-color: #555;
|
||||||
|
border: 1px solid #666;
|
||||||
|
color: #E0E0E0;
|
||||||
|
}
|
||||||
|
|
||||||
.avatar-select .avatar-list .remove-avatar {
|
.avatar-select .avatar-list .remove-avatar {
|
||||||
background-color: #222;
|
background-color: #222;
|
||||||
}
|
}
|
||||||
@ -118,6 +124,10 @@ input[type="color"] {
|
|||||||
background-color: #666;
|
background-color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.account-notification-section-header:hover {
|
||||||
|
background-color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
.toast {
|
.toast {
|
||||||
border: 1px solid #333;
|
border: 1px solid #333;
|
||||||
background: #222;
|
background: #222;
|
||||||
|
|||||||
@ -654,6 +654,49 @@ header #avatar {
|
|||||||
gap: 30px;
|
gap: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.account-notifications-section {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-notification-section-header {
|
||||||
|
padding: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-notification-section-header:hover {
|
||||||
|
background-color: #EEE;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-notification-section-header h3 {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-notification-section-header h3 i {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-notification-section-settings {
|
||||||
|
max-height: 0px;
|
||||||
|
overflow: hidden; /* Hide content that goes beyond the height */
|
||||||
|
transition: max-height 0.3s ease-in-out; /* Animate max-height changes */
|
||||||
|
padding: 0px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-notification-section-settings.is-open {
|
||||||
|
max-height: 1000px; /* Set to a value larger than the content's natural height */
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-notification-section-settings > div:first-of-type {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-notification-section-settings > div:last-of-type {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.account-notifications .buttons {
|
.account-notifications .buttons {
|
||||||
gap: 15px;
|
gap: 15px;
|
||||||
}
|
}
|
||||||
@ -965,6 +1008,21 @@ input[type="text"]:disabled {
|
|||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
font-size: 16px;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 5px 14px;
|
||||||
|
color: #202020;
|
||||||
|
width: 100%;
|
||||||
|
height: 245px;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea.thin {
|
||||||
|
height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
input[type="checkbox"] {
|
input[type="checkbox"] {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
@ -1046,6 +1104,9 @@ input[type="text"]:disabled {
|
|||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.capitalize {
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user