Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.
feat: user can delete their own account
Miguel Ribeiro8f1e1554787c
diff --git a/endpoints/settings/deleteaccount.php b/endpoints/settings/deleteaccount.phpnew file mode 100644index 0000000..9c5c72f--- /dev/null+++ b/endpoints/settings/deleteaccount.php@@ -0,0 +1,124 @@+<?php++require_once '../../includes/connect_endpoint.php';++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);++ $userIdToDelete = $data['userId'];++ if ($userIdToDelete == 1 || $userIdToDelete != $userId) {+ die(json_encode([+ "success" => false,+ "message" => translate('error', $i18n)+ ]));+ } else {+ // Delete user+ $stmt = $db->prepare('DELETE FROM user WHERE id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete subscriptions+ $stmt = $db->prepare('DELETE FROM subscriptions WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete settings+ $stmt = $db->prepare('DELETE FROM settings WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete fixer+ $stmt = $db->prepare('DELETE FROM fixer WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete custom colors+ $stmt = $db->prepare('DELETE FROM custom_colors WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete currencies+ $stmt = $db->prepare('DELETE FROM currencies WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete categories+ $stmt = $db->prepare('DELETE FROM categories WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete household+ $stmt = $db->prepare('DELETE FROM household WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete payment methods+ $stmt = $db->prepare('DELETE FROM payment_methods WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete email notifications+ $stmt = $db->prepare('DELETE FROM email_notifications WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete telegram notifications+ $stmt = $db->prepare('DELETE FROM telegram_notifications WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete webhook notifications+ $stmt = $db->prepare('DELETE FROM webhook_notifications WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete gotify notifications+ $stmt = $db->prepare('DELETE FROM gotify_notifications WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete pushover notifications+ $stmt = $db->prepare('DELETE FROM pushover_notifications WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Dele notification settings+ $stmt = $db->prepare('DELETE FROM notification_settings WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete last exchange update+ $stmt = $db->prepare('DELETE FROM last_exchange_update WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ // Delete email verification+ $stmt = $db->prepare('DELETE FROM email_verification WHERE user_id = :id');+ $stmt->bindValue(':id', $userIdToDelete, SQLITE3_INTEGER);+ $result = $stmt->execute();++ die(json_encode([+ "success" => true,+ "message" => translate('success', $i18n)+ ]));++ }++} else {+ die(json_encode([+ "success" => false,+ "message" => translate('error', $i18n)+ ]));+}++?>\ No newline at end of filediff --git a/endpoints/subscriptions/export.php b/endpoints/subscriptions/export.phpnew file mode 100644index 0000000..c72f87a--- /dev/null+++ b/endpoints/subscriptions/export.php@@ -0,0 +1,44 @@+<?php+require_once '../../includes/connect_endpoint.php';++if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {+ die(json_encode([+ "success" => false,+ "message" => translate('session_expired', $i18n)+ ]));+}++require_once '../../includes/getdbkeys.php';++$subscriptions = array();++$query = "SELECT * FROM subscriptions WHERE user_id = :userId";+$stmt = $db->prepare($query);+$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+$result = $stmt->execute();++while ($row = $result->fetchArray(SQLITE3_ASSOC)) {+ $subscriptionDetails = array(+ 'Name' => str_replace(',', ' ', $row['name']),+ 'Next Payment' => $row['next_payment'],+ 'Categpry' => str_replace(',', ' ', $categories[$row['category_id']]['name']),+ 'Payment Method' => str_replace(',', ' ', $payment_methods[$row['payment_method_id']]['name']),+ 'Paid By' => str_replace(',', ' ', $members[$row['payer_user_id']]['name']),+ 'Price' => $currencies[$row['currency_id']]['symbol'] . $row['price'],+ 'Notes' => str_replace(',', ' ', $row['notes']),+ 'URL' => $row['url'],+ 'State' => $row['inactive'] ? 'Disabled' : 'Enabled',+ 'Notifications' => $row['notify'] ? 'Enabled' : 'Disabled',+ 'Cancellation Date' => $row['cancellation_date']+ );++ $subscriptions[] = $subscriptionDetails;+}++die(json_encode([+ "success" => true,+ "subscriptions" => $subscriptions+]));+++?>\ No newline at end of filediff --git a/includes/i18n/de.php b/includes/i18n/de.phpindex 27ea997..371cd32 100644--- a/includes/i18n/de.php+++ b/includes/i18n/de.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Backup","restore" => "Wiederherstellen","restore_info" => "Durch die Wiederherstellung der Datenbank werden alle aktuellen Daten überschrieben. Nach der Wiederherstellung werden Sie abgemeldet.",+ "account" => "Konto",+ "export_subscriptions" => "Abonnements exportieren",+ "export_as_json" => "Als JSON exportieren",+ "export_as_csv" => "Als CSV exportieren",+ "danger_zone" => "Gefahrenzone",+ "delete_account" => "Konto löschen",+ "delete_account_info" => "Mit dem Löschen Ihres Kontos werden auch alle Ihre Abonnements und Einstellungen gelöscht.",// Filters menu"filter" => "Filter","clear" => "Leeren",diff --git a/includes/i18n/el.php b/includes/i18n/el.phpindex 4a8218b..c3a1b8a 100644--- a/includes/i18n/el.php+++ b/includes/i18n/el.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Αντίγραφο ασφαλείας","restore" => "Επαναφορά","restore_info" => "Η επαναφορά της βάσης δεδομένων θα ακυρώσει όλα τα τρέχοντα δεδομένα. Μετά την επαναφορά θα αποσυνδεθείτε.",+ "account" => "Λογαριασμός",+ "export_subscriptions" => "Εξαγωγή συνδρομών",+ "export_as_json" => "Εξαγωγή ως JSON",+ "export_as_csv" => "Εξαγωγή ως CSV",+ "danger_zone" => "Ζώνη κινδύνου",+ "delete_account" => "Διαγραφή λογαριασμού",+ "delete_account_info" => "Η διαγραφή του λογαριασμού θα ακυρώσει όλα τα δεδομένα και θα αποσυνδεθείτε. Αυτή η ενέργεια είναι μη αναστρέψιμη.",// Filters menu"filter" => "Φίλτρο","clear" => "Καθαρισμός",diff --git a/includes/i18n/en.php b/includes/i18n/en.phpindex de5a754..31176a8 100644--- a/includes/i18n/en.php+++ b/includes/i18n/en.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Backup","restore" => "Restore","restore_info" => "Restoring the database will override all current data. You will be signed out after the restore.",+ "account" => "Account",+ "export_subscriptions" => "Export Subscriptions",+ "export_as_json" => "Export as JSON",+ "export_as_csv" => "Export as CSV",+ "danger_zone" => "Danger Zone",+ "delete_account" => "Delete Account",+ "delete_account_info" => "Deleting your account will also delete all your subscriptions and settings.",// Filters menu"filter" => "Filter","clear" => "Clear",diff --git a/includes/i18n/es.php b/includes/i18n/es.phpindex a868030..199efac 100644--- a/includes/i18n/es.php+++ b/includes/i18n/es.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Copia de Seguridad","restore" => "Restaurar","restore_info" => "La restauración de la base de datos anulará todos los datos actuales. Se cerrará la sesión después de la restauración.",+ "account" => "Cuenta",+ "export_subscriptions" => "Exportar suscripciones",+ "export_as_json" => "Exportar como JSON",+ "export_as_csv" => "Exportar como CSV",+ "danger_zone" => "Zona de peligro",+ "delete_account" => "Eliminar cuenta",+ "delete_account_info" => "Al eliminar tu cuenta también se eliminarán todas tus suscripciones y configuraciones.",// Filters menu"filter" => "Filtrar","clear" => "Limpiar",diff --git a/includes/i18n/fr.php b/includes/i18n/fr.phpindex c691f9c..cbe6ac5 100644--- a/includes/i18n/fr.php+++ b/includes/i18n/fr.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Sauvegarde","restore" => "Restauration","restore_info" => "La restauration de la base de données annulera toutes les données actuelles. Vous serez déconnecté après la restauration.",+ "account" => "Compte",+ "export_subscriptions" => "Exporter les abonnements",+ "export_as_json" => "Exporter en JSON",+ "export_as_csv" => "Exporter en CSV",+ "danger_zone" => "Zone de danger",+ "delete_account" => "Supprimer le compte",+ "delete_account_info" => "La suppression de votre compte entraînera également la suppression de tous vos abonnements et paramètres.",// Menu des filtes"filter" => "Filtre","clear" => "Effacer",diff --git a/includes/i18n/it.php b/includes/i18n/it.phpindex 06979ed..cc6c47c 100644--- a/includes/i18n/it.php+++ b/includes/i18n/it.php@@ -230,6 +230,14 @@ $i18n = ["backup" => 'Backup',"restore" => 'Ripristina',"restore_info" => "Il ripristino del database annullerà tutti i dati correnti. Al termine del ripristino, l'utente verrà disconnesso.",+ "account" => "Account",+ "export_subscriptions" => "Esporta abbonamenti",+ "export_as_json" => "Esporta come JSON",+ "export_as_csv" => "Esporta come CSV",+ "danger_zone" => "Zona di pericolo",+ "delete_account" => "Elimina account",+ "delete_account_info" => "L'eliminazione del vostro account cancellerà anche tutte le vostre sottoscrizioni e impostazioni.",+// Filters'filter' => 'Filtra','clear' => 'Pulisci',diff --git a/includes/i18n/ko.php b/includes/i18n/ko.phpindex a73db4a..98aadce 100644--- a/includes/i18n/ko.php+++ b/includes/i18n/ko.php@@ -223,6 +223,13 @@ $i18n = ["backup" => "백업","restore" => "복구","restore_info" => "데이터베이스를 복구하면 현재 데이터를 모두 덮어씁니다. 복구 후 로그아웃됩니다.",+ "account" => "계정",+ "export_subscriptions" => "구독 내보내기",+ "export_as_json" => "JSON으로 내보내기",+ "export_as_csv" => "CSV로 내보내기",+ "danger_zone" => "위험 구역",+ "delete_account" => "계정 삭제",+ "delete_account_info" => "계정을 삭제하면 모든 구독과 설정도 함께 삭제됩니다.",// Filters menu"filter" => "필터","clear" => "초기화",diff --git a/includes/i18n/pl.php b/includes/i18n/pl.phpindex 8fbe156..233c824 100644--- a/includes/i18n/pl.php+++ b/includes/i18n/pl.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Kopia zapasowa","restore" => "Przywróć","restore_info" => "Przywrócenie bazy danych zastąpi wszystkie bieżące dane. Po przywróceniu zostaniesz wylogowany.",+ "account" => "Konto",+ "export_subscriptions" => "Eksportuj subskrypcje",+ "export_as_json" => "Eksportuj jako JSON",+ "export_as_csv" => "Eksportuj jako CSV",+ "danger_zone" => "Strefa zagrożenia",+ "delete_account" => "Usuń konto",+ "delete_account_info" => "Usunięcie konta spowoduje również usunięcie wszystkich subskrypcji i ustawień.",// Filters menu"filter" => "Filtr","clear" => "Wyczyść",diff --git a/includes/i18n/pt.php b/includes/i18n/pt.phpindex 048e9f4..7871749 100644--- a/includes/i18n/pt.php+++ b/includes/i18n/pt.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Backup","restore" => "Restauro","restore_info" => "O restauro da base de dados apagará todos os dados actuais. A sua sessão irá terminar após o restauro.",+ "account" => "Conta",+ "export_subscriptions" => "Exportar Subscrições",+ "export_as_json" => "Exportar como JSON",+ "export_as_csv" => "Exportar como CSV",+ "danger_zone" => "Zona de Perigo",+ "delete_account" => "Eliminar Conta",+ "delete_account_info" => "A eliminação da sua conta também eliminará todas as suas subscrições e definições.",// Filters menu"filter" => "Filtro","clear" => "Limpar",diff --git a/includes/i18n/pt_br.php b/includes/i18n/pt_br.phpindex bc6d9ef..f8835d5 100644--- a/includes/i18n/pt_br.php+++ b/includes/i18n/pt_br.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Backup","restore" => "Restaurar","restore_info" => "A restauração do banco de dados substituirá todos os dados atuais. Você será desconectado após a restauração.",+ "account" => "Conta",+ "export_subscriptions" => "Exportar assinaturas",+ "export_as_json" => "Exportar como JSON",+ "export_as_csv" => "Exportar como CSV",+ "danger_zone" => "Zona de perigo",+ "delete_account" => "Excluir conta",+ "delete_account_info" => "Excluir sua conta também excluirá todas as assinaturas e configurações.",// Filters menu"filter" => "Filtrar","clear" => "Limpar",diff --git a/includes/i18n/ru.php b/includes/i18n/ru.phpindex b8615f7..2f78470 100644--- a/includes/i18n/ru.php+++ b/includes/i18n/ru.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Резервное копирование","restore" => "Восстановление","restore_info" => "Восстановление базы данных отменит все текущие данные. После восстановления вы выйдете из системы.",+ "account" => "Учетная запись",+ "export_subscriptions" => "Экспорт подписок",+ "export_as_json" => "Экспорт в JSON",+ "export_as_csv" => "Экспорт в CSV",+ "danger_zone" => "Опасная зона",+ "delete_account" => "Удалить учетную запись",+ "delete_account_info" => "При удалении аккаунта также будут удалены все ваши подписки и настройки.",// Filters menu"filter" => "Фильтр","clear" => "Очистить",diff --git a/includes/i18n/sr.php b/includes/i18n/sr.phpindex 4f2d4df..a8c008f 100644--- a/includes/i18n/sr.php+++ b/includes/i18n/sr.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Бекап","restore" => "Ресторе","restore_info" => "Враћање базе података ће заменити све тренутне податке. Бићете одјављени након враћања.",+ "account" => "Налог",+ "export_subscriptions" => "Извоз претплата",+ "export_as_json" => "Извоз као JSON",+ "export_as_csv" => "Извоз као CSV",+ "danger_zone" => "Зона опасности",+ "delete_account" => "Обриши налог",+ "delete_account_info" => "Брисање налога ће обрисати све ваше податке, укључујући претплате, подешавања и чланове домаћинства.",// Мени са филтерима"filter" => "Филтер","clear" => "Очисти",diff --git a/includes/i18n/sr_lat.php b/includes/i18n/sr_lat.phpindex 3a17c2b..546852e 100644--- a/includes/i18n/sr_lat.php+++ b/includes/i18n/sr_lat.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Backup","restore" => "Restore","restore_info" => "Vraćanje baze podataka će zameniti sve trenutne podatke. Bićete odjavljeni nakon vraćanja.",+ "account" => "Nalog",+ "export_subscriptions" => "Izvezi pretplate",+ "export_as_json" => "Izvezi kao JSON",+ "export_as_csv" => "Izvezi kao CSV",+ "danger_zone" => "Opasna zona",+ "delete_account" => "Izbriši nalog",+ "delete_account_info" => "Brisanjem naloga izbrisaćete sve podatke, uključujući pretplate, podešavanja, članove domaćinstva i načine plaćanja.",// Meni sa filterima"filter" => "Filter","clear" => "Očisti",diff --git a/includes/i18n/tr.php b/includes/i18n/tr.phpindex d3ec94e..952f74f 100644--- a/includes/i18n/tr.php+++ b/includes/i18n/tr.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "Yedekle","restore" => "Geri Yükle","restore_info" => "Veritabanının geri yüklenmesi tüm mevcut verileri geçersiz kılacaktır. Geri yüklemeden sonra oturumunuz kapatılacaktır.",+ "account" => "Hesap",+ "export_subscriptions" => "Abonelikleri dışa aktar",+ "export_as_json" => "JSON olarak dışa aktar",+ "export_as_csv" => "CSV olarak dışa aktar",+ "danger_zone" => "Tehlikeli Bölge",+ "delete_account" => "Hesabı Sil",+ "delete_account_info" => "Hesabınızı sildiğinizde tüm abonelikleriniz ve ayarlarınız da silinecektir.",// Filters menu"filter" => "Filtre","clear" => "Temizle",diff --git a/includes/i18n/zh_cn.php b/includes/i18n/zh_cn.phpindex 3acae3a..17d9514 100644--- a/includes/i18n/zh_cn.php+++ b/includes/i18n/zh_cn.php@@ -230,6 +230,13 @@ $i18n = ["backup" => "备份","restore" => "恢复","restore_info" => "还原数据库将覆盖所有当前数据。还原后,您将退出登录。",+ "account" => "账户",+ "export_subscriptions" => "导出订阅",+ "export_as_json" => "导出为 JSON",+ "export_as_csv" => "导出为 CSV",+ "danger_zone" => "危险区",+ "delete_account" => "删除账户",+ "delete_account_info" => "删除账户将删除所有数据,包括订阅、设置和家庭成员。此操作不可逆。",// Filters menu"filter" => "筛选","clear" => "清除",diff --git a/includes/i18n/zh_tw.php b/includes/i18n/zh_tw.phpindex 014c815..2c62828 100644--- a/includes/i18n/zh_tw.php+++ b/includes/i18n/zh_tw.php@@ -222,6 +222,13 @@ $i18n = ["backup" => "備份","restore" => "還原","restore_info" => "復原資料庫將覆蓋所有目前資料。 恢復後您將被註銷。",+ "account" => "帳戶",+ "export_subscriptions" => "匯出訂閱",+ "export_as_json" => "匯出為 JSON",+ "export_as_csv" => "匯出為 CSV",+ "danger_zone" => "危險區域",+ "delete_account" => "刪除帳戶",+ "delete_account_info" => "刪除帳戶將刪除所有訂閱和設定。 此操作無法撤銷。",// Filters menu"filter" => "篩選","clear" => "清除",diff --git a/includes/version.php b/includes/version.phpindex d06d7b8..63787b5 100644--- a/includes/version.php+++ b/includes/version.php@@ -1,3 +1,3 @@<?php-$version = "v2.19.3";+$version = "v2.20.0";?>\ No newline at end of filediff --git a/scripts/i18n/de.js b/scripts/i18n/de.jsindex fe1eb1e..9a5349a 100644--- a/scripts/i18n/de.js+++ b/scripts/i18n/de.js@@ -35,6 +35,8 @@ let i18n = {error_saving_notification_data:"Fehler beim Speichern der Benachrichtigungsangaben",error_sending_notification: "Fehler beim Senden der Benachrichtigung",+ delete_account_confirmation: "Möchten Sie Ihr Konto wirklich löschen?",+ this_will_delete_all_data: "Dadurch werden alle Daten gelöscht und können nicht wiederhergestellt werden. Fortfahren?",// Calendarprice: "Preis",category: "Kategorie",diff --git a/scripts/i18n/el.js b/scripts/i18n/el.jsindex 055c530..f6aad95 100644--- a/scripts/i18n/el.js+++ b/scripts/i18n/el.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "Άγνωστο σφάλμα, προσπάθησε ξανά.",error_saving_notification_data: "Σφάλμα αποθήκευσης δεδομένων ειδοποίησης",error_sending_notification: "Σφάλμα αποστολής ειδοποίησης",+ delete_account_confirmation: "Είστε σίγουρος ότι θέλετε να διαγράψετε το λογαριασμό σας;",+ this_will_delete_all_data: "Αυτό θα διαγράψει όλα τα δεδομένα σας και δεν μπορεί να ανακτηθεί. Να συνεχίσω;",// Calendarprice: "Τιμή",category: "Κατηγορία",diff --git a/scripts/i18n/en.js b/scripts/i18n/en.jsindex 2d20738..8a4bf4e 100644--- a/scripts/i18n/en.js+++ b/scripts/i18n/en.js@@ -33,7 +33,9 @@ let i18n = {unknown_error: "Unknown error, please try again.",error_saving_notification_data: "Error saving notification data",error_sending_notification: "Error sending notification",- // Calendar+ delete_account_confirmation: "Are you sure you want to delete your account?",+ this_will_delete_all_data: "This will delete all your data and can't be undone. Continue?",+ // Calendarprice: "Price",category: "Category",paid_by: "Paid by",diff --git a/scripts/i18n/es.js b/scripts/i18n/es.jsindex 63396c7..ed01889 100644--- a/scripts/i18n/es.js+++ b/scripts/i18n/es.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "Error desconocido, por favor inténtalo de nuevo.",error_saving_notification_data: "Error al guardar los datos de notificación",error_sending_notification: "Error al enviar la notificación",+ delete_account_confirmation: "¿Estás seguro de que quieres eliminar tu cuenta?",+ this_will_delete_all_data: "Esto eliminará todos tus datos y no se podrán recuperar. ¿Continuar?",// Calendarprice: "Precio",category: "Categoría",diff --git a/scripts/i18n/fr.js b/scripts/i18n/fr.jsindex 6c58afc..16e115e 100644--- a/scripts/i18n/fr.js+++ b/scripts/i18n/fr.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "Erreur inconnue, veuillez réessayer.",error_saving_notification_data: "Erreur lors de l'enregistrement des données de notification",error_sending_notification: "Erreur lors de l'envoi de la notification",+ delete_account_confirmation: "Êtes-vous sûr de vouloir supprimer votre compte ?",+ this_will_delete_all_data: "Cela supprimera toutes vos données et ne pourra pas être annulé. Continuer ?",// Calendarprice: "Prix",category: "Catégorie",diff --git a/scripts/i18n/it.js b/scripts/i18n/it.jsindex 476b9e6..a05c3bc 100644--- a/scripts/i18n/it.js+++ b/scripts/i18n/it.js@@ -34,6 +34,8 @@ let i18n = {unknown_error: "Errore sconosciuto, si prega di riprovare.",error_saving_notification_data: "Errore nel salvataggio delle impostazioni di notifica",error_sending_notification: "Errore nell'invio della notifica",+ delete_account_confirmation: "Sei sicuro di voler eliminare il tuo account?",+ this_will_delete_all_data: "Questo eliminerà tutti i tuoi dati e non potrà essere annullato. Continuare?",// Calendarprice: "Prezzo",category: "Categoria",diff --git a/scripts/i18n/jp.js b/scripts/i18n/jp.jsindex b79c6f6..f2bbd8a 100644--- a/scripts/i18n/jp.js+++ b/scripts/i18n/jp.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "不明なエラー。もう一度試してください。",error_saving_notification_data: "通知データの保存エラー",error_sending_notification: "通知の送信エラー",+ delete_account_confirmation: "アカウントを削除してもよろしいですか?",+ this_will_delete_all_data: "これによりすべてのデータが削除され、元に戻すことはできません。続行しますか?",// Calendarprice: "価格",category: "カテゴリ",diff --git a/scripts/i18n/ko.js b/scripts/i18n/ko.jsindex 4d49895..45c8611 100644--- a/scripts/i18n/ko.js+++ b/scripts/i18n/ko.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "알 수 없는 에러입니다. 다시 시도해 주세요.",error_saving_notification_data: "알림 데이터 저장 에러",error_sending_notification: "알림 전송 에러",+ delete_account_confirmation: "정말 계정을 삭제하시겠습니까?",+ this_will_delete_all_data: "이로 인해 모든 데이터가 삭제되며 복구할 수 없습니다. 계속하시겠습니까?",// Calendarprice: "가격",category: "카테고리",diff --git a/scripts/i18n/pl.js b/scripts/i18n/pl.jsindex 5c19524..2569782 100644--- a/scripts/i18n/pl.js+++ b/scripts/i18n/pl.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "Nieznany błąd, spróbuj ponownie.",error_saving_notification_data: "Błąd zapisywania danych powiadomienia",error_sending_notification: "Błąd wysyłania powiadomienia",+ delete_account_confirmation: "Czy na pewno chcesz usunąć swoje konto?",+ this_will_delete_all_data: "Spowoduje to usunięcie wszystkich danych i nie będzie można tego cofnąć. Kontynuować?",// Calendarprice: "Cena",category: "Kategoria",diff --git a/scripts/i18n/pt.js b/scripts/i18n/pt.jsindex b0a6c47..cd6f919 100644--- a/scripts/i18n/pt.js+++ b/scripts/i18n/pt.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: 'Erro desconhecido, por favor, tente novamente.',error_saving_notification_data: 'Erro ao guardar dados de notificação',error_sending_notification: 'Erro ao enviar notificação',+ delete_account_confirmation: "Tem a certeza de que deseja eliminar a sua conta?",+ this_will_delete_all_data: "Isto irá eliminar todos os seus dados e não poderão ser recuperados. Continuar?",// Calendarprice: "Preço",category: "Categoria",diff --git a/scripts/i18n/pt_br.js b/scripts/i18n/pt_br.jsindex 9460283..cb1f3e3 100644--- a/scripts/i18n/pt_br.js+++ b/scripts/i18n/pt_br.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "Erro desconhecido. Por favor, tente novamente",error_saving_notification_data: "Erro ao salvar dados da notificação",error_sending_notification: "Erro ao enviar notificação",+ delete_account_confirmation: "Você tem certeza que deseja excluir sua conta?",+ this_will_delete_all_data: "Isso excluirá todos os seus dados e não poderão ser recuperados. Continuar?",// Calendarprice: "Preço",category: "Categoria",diff --git a/scripts/i18n/ru.js b/scripts/i18n/ru.jsindex c0493ea..4b04841 100644--- a/scripts/i18n/ru.js+++ b/scripts/i18n/ru.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "Неизвестная ошибка. Повторите попытку.",error_saving_notification_data: "Ошибка сохранения данных уведомления.",error_sending_notification: "Ошибка отправки уведомления",+ delete_account_confirmation: "Вы уверены, что хотите удалить свою учетную запись?",+ this_will_delete_all_data: "Это удалит все ваши данные и не может быть отменено. Продолжить?",// Calendarprice: "Цена",category: "Категория",diff --git a/scripts/i18n/sl.js b/scripts/i18n/sl.jsindex 29d1e9c..ed61d6e 100644--- a/scripts/i18n/sl.js+++ b/scripts/i18n/sl.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "Neznana napaka, poskusite znova.",error_saving_notification_data: "Napaka pri shranjevanju obvestilnih podatkov",error_sending_notification: "Napaka pri pošiljanju obvestila",+ delete_account_confirmation: "Ali ste prepričani, da želite izbrisati svoj račun?",+ this_will_delete_all_data: "To bo izbrisalo vse vaše podatke in jih ni mogoče obnoviti. Nadaljujem?",// Calendarprice: "Cena",category: "Kategorija",diff --git a/scripts/i18n/sr.js b/scripts/i18n/sr.jsindex ff76c38..0e70942 100644--- a/scripts/i18n/sr.js+++ b/scripts/i18n/sr.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "Непозната грешка, молимо покушајте поново.",error_saving_notification_data: "Грешка при чувању података о обавештењима",error_sending_notification: "Грешка при слању обавештења",+ delete_account_confirmation: "Да ли сте сигурни да желите да избришете свој налог?",+ this_will_delete_all_data: "Ово ће избрисати све ваше податке и не може се поништити. Настави?",// Calendarprice: "Цена",category: "Категорија",diff --git a/scripts/i18n/sr_lat.js b/scripts/i18n/sr_lat.jsindex 6103e57..5eb1761 100644--- a/scripts/i18n/sr_lat.js+++ b/scripts/i18n/sr_lat.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "Nepoznata greška, molimo pokušajte ponovo.",error_saving_notification_data: "Greška pri čuvanju podataka o obaveštenjima",error_sending_notification: "Greška pri slanju obaveštenja",+ delete_account_confirmation: "Da li ste sigurni da želite da izbrišete svoj nalog?",+ this_will_delete_all_data: "Ovo će izbrisati sve vaše podatke i ne može se poništiti. Da li nastaviti?",// Calendarprice: "Cena",category: "Kategorija",diff --git a/scripts/i18n/tr.js b/scripts/i18n/tr.jsindex 6ba73e2..579339b 100644--- a/scripts/i18n/tr.js+++ b/scripts/i18n/tr.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: "Bilinmeyen hata, lütfen tekrar deneyin.",error_saving_notification_data: "Bildirim verisi kaydedilirken hata oluştu",error_sending_notification: "Bildirim gönderilirken hata oluştu",+ delete_account_confirmation: "Hesabınızı silmek istediğinizden emin misiniz?",+ this_will_delete_all_data: "Bu tüm verilerinizi silecek ve geri alınamaz. Devam etmek istiyor musunuz?",// Calendarprice: "Price",category: "Category",diff --git a/scripts/i18n/zh_cn.js b/scripts/i18n/zh_cn.jsindex a9e673e..1e06f34 100644--- a/scripts/i18n/zh_cn.js+++ b/scripts/i18n/zh_cn.js@@ -33,6 +33,8 @@ let i18n = {'unknown_error': '未知错误,请重试。','error_saving_notification_data': '保存通知数据时出错','error_sending_notification': '发送通知时出错',+ 'delete_account_confirmation': "您确定要删除您的帐户吗?",+ 'this_will_delete_all_data': "这将删除所有您的数据,且无法撤销。是否继续?",// Calendarprice: "价格",category: "类别",diff --git a/scripts/i18n/zh_tw.js b/scripts/i18n/zh_tw.jsindex 51391eb..43c5155 100644--- a/scripts/i18n/zh_tw.js+++ b/scripts/i18n/zh_tw.js@@ -33,6 +33,8 @@ let i18n = {unknown_error: '發生未知的錯誤,請再試一次。',error_saving_notification_data: '保存通知資料時發生錯誤',error_sending_notification: '發送通知時發生錯誤',+ delete_account_confirmation: "您確定要刪除您的帳戶嗎?",+ this_will_delete_all_data: "這將刪除所有資料,且無法復原。繼續?",// Calendarprice: "價格",category: "類別",diff --git a/scripts/settings.js b/scripts/settings.jsindex ea6d71f..b6d2a90 100644--- a/scripts/settings.js+++ b/scripts/settings.js@@ -956,4 +956,81 @@ var sortable = Sortable.create(el, {onEnd: function (evt) {saveCategorySorting();},-});\ No newline at end of file+});++function exportAsJson() {+ fetch("endpoints/subscriptions/export.php")+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ const subscriptions = JSON.stringify(data.subscriptions);+ const element = document.createElement('a');+ element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(subscriptions));+ element.setAttribute('download', 'subscriptions.json');+ element.style.display = 'none';+ document.body.appendChild(element);+ element.click();+ document.body.removeChild(element);+ } else {+ showErrorMessage(data.message);+ }+ })+ .catch(error => {+ console.log(error);+ showErrorMessage(translate('unknown_error'));+ });+}++function exportAsCsv() {+ fetch("endpoints/subscriptions/export.php")+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ const subscriptions = data.subscriptions;+ const header = Object.keys(subscriptions[0]).join(',');+ const csv = subscriptions.map(subscription => Object.values(subscription).join(',')).join('\n');+ const csvWithHeader = header + '\n' + csv;+ const element = document.createElement('a');+ element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(csvWithHeader));+ element.setAttribute('download', 'subscriptions.csv');+ element.style.display = 'none';+ document.body.appendChild(element);+ element.click();+ document.body.removeChild(element);+ } else {+ showErrorMessage(data.message);+ }+ })+ .catch(error => {+ showErrorMessage(translate('unknown_error'));+ });+}++function deleteAccount(userId) {+ if (!confirm(translate('delete_account_confirmation'))) {+ return;+ }++ if (!confirm(translate('this_will_delete_all_data'))) {+ return;+ }++ fetch('endpoints/settings/deleteaccount.php', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json',+ },+ body: JSON.stringify({ userId: userId }),+ })+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ window.location.href = 'logout.php';+ } else {+ showErrorMessage(data.message);+ }+ })+ .catch((error) => {+ showErrorMessage(translate('unknown_error'));+ });+}\ No newline at end of filediff --git a/settings.php b/settings.phpindex 635141d..4001545 100644--- a/settings.php+++ b/settings.php@@ -1104,8 +1104,8 @@ require_once 'includes/header.php';<h3><?= translate('colors', $i18n) ?></h3><div class="form-group-inline wrap"><div class="theme">- <input type="radio" name="theme" id="theme-blue" value="blue"- onClick="setTheme('blue')" <?= $settings['color_theme'] == 'blue' ? 'checked' : '' ?>>+ <input type="radio" name="theme" id="theme-blue" value="blue" onClick="setTheme('blue')"+ <?= $settings['color_theme'] == 'blue' ? 'checked' : '' ?>><label for="theme-blue"class="theme-preview blue <?= $settings['color_theme'] == 'blue' ? 'is-selected' : '' ?>"><span class="main-color"></span>@@ -1114,8 +1114,8 @@ require_once 'includes/header.php';</label></div><div class="theme">- <input type="radio" name="theme" id="theme-green" value="green"- onClick="setTheme('green')" <?= $settings['color_theme'] == 'green' ? 'checked' : '' ?>>+ <input type="radio" name="theme" id="theme-green" value="green" onClick="setTheme('green')"+ <?= $settings['color_theme'] == 'green' ? 'checked' : '' ?>><label for="theme-green"class="theme-preview green <?= $settings['color_theme'] == 'green' ? 'is-selected' : '' ?>"><span class="main-color"></span>@@ -1124,8 +1124,8 @@ require_once 'includes/header.php';</label></div><div class="theme">- <input type="radio" name="theme" id="theme-red" value="red"- onClick="setTheme('red')" <?= $settings['color_theme'] == 'red' ? 'checked' : '' ?>>+ <input type="radio" name="theme" id="theme-red" value="red" onClick="setTheme('red')"+ <?= $settings['color_theme'] == 'red' ? 'checked' : '' ?>><label for="theme-red"class="theme-preview red <?= $settings['color_theme'] == 'red' ? 'is-selected' : '' ?>"><span class="main-color"></span>@@ -1135,7 +1135,7 @@ require_once 'includes/header.php';</div><div class="theme"><input type="radio" name="theme" id="theme-yellow" value="yellow"- onClick="setTheme('yellow')" <?= $settings['color_theme'] == 'yellow' ? 'checked' : '' ?>>+ onClick="setTheme('yellow')" <?= $settings['color_theme'] == 'yellow' ? 'checked' : '' ?>><label for="theme-yellow"class="theme-preview yellow <?= $settings['color_theme'] == 'yellow' ? 'is-selected' : '' ?>"><span class="main-color"></span>@@ -1145,7 +1145,7 @@ require_once 'includes/header.php';</div><div class="theme"><input type="radio" name="theme" id="theme-purple" value="purple"- onClick="setTheme('purple')" <?= $settings['color_theme'] == 'purple' ? 'checked' : '' ?>>+ onClick="setTheme('purple')" <?= $settings['color_theme'] == 'purple' ? 'checked' : '' ?>><label for="theme-purple"class="theme-preview purple <?= $settings['color_theme'] == 'purple' ? 'is-selected' : '' ?>"><span class="main-color"></span>@@ -1215,9 +1215,11 @@ require_once 'includes/header.php';<div><div class="form-group-inline"><input type="checkbox" id="convertcurrency" name="convertcurrency" onChange="setConvertCurrency()"- <?php- if ($settings['convert_currency']) echo ' checked';- if ($apiKey == "") echo ' disabled';+ <?php+ if ($settings['convert_currency'])+ echo ' checked';+ if ($apiKey == "")+ echo ' disabled';?>><label for="convertcurrency"><?= translate('convert_prices', $i18n) ?></label></div>@@ -1254,6 +1256,42 @@ require_once 'includes/header.php';</div></section>+ <section class="account-section">+ <header>+ <h2><?= translate('account', $i18n) ?></h2>+ </header>+ <div class="account-list">+ <div>+ <h3><?= translate('export_subscriptions', $i18n) ?></h3>+ <div class="form-group-inline">+ <input type="button" value="<?= translate('export_as_json', $i18n) ?>" onClick="exportAsJson()"+ class="secondary-button thin mobile-grow" id="export-json">+ <input type="button" value="<?= translate('export_as_csv', $i18n) ?>" onClick="exportAsCsv()"+ class="secondary-button thin mobile-grow" id="export-csv">+ </div>+ </div>+ </div>+ <div>+ <?php+ if ($userId != 1) {+ ?>+ <h3><?= translate('danger_zone', $i18n) ?></h3>+ <div class="form-group-inline">+ <input type="button" value="<?= translate('delete_account', $i18n) ?>" onClick="deleteAccount(<?= $userId ?>)"+ class="warning-button thin mobile-grow" id="delete-account">+ </div>+ <div class="settings-notes">+ <p>+ <i class="fa-solid fa-circle-info"></i>+ <?= translate('delete_account_info', $i18n) ?>+ </p>+ </div>+ <?php+ }+ ?>+ </div>+ </section>+</section><script src="scripts/settings.js?<?= $version ?>"></script><script src="scripts/theme.js?<?= $version ?>"></script>