Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

feat: fisrt api endpoint

Miguel Ribeiroa173d2765fd2
diff --git a/README.md b/README.md
index bf51ff1..d553524 100644
--- a/README.md
+++ b/README.md
@@ -190,5 +190,5 @@ I strongly believe in the importance of open source software and the collaborati
## Links
- The author: [henrique.pt](https://henrique.pt)
-- Wallos Landinpage: [wallosapp.com](https://wallosapp.com)
+- Wallos Landingpage: [wallosapp.com](https://wallosapp.com)
- Join the conversation: [Discord Server](https://discord.gg/anex9GUrPW)
\ No newline at end of file
diff --git a/about.php b/about.php
index 8ba26f3..8929afa 100644
--- a/about.php
+++ b/about.php
@@ -78,6 +78,15 @@ require_once 'includes/header.php';
</a>
</span>
</p>
+ <p>
+ Icons by icons8:
+ <span>
+ https://icons8.com/
+ <a href="https://icons8.com/" target="_blank" title="<?= translate('external_url', $i18n) ?>">
+ <i class="fa-solid fa-arrow-up-right-from-square"></i>
+ </a>
+ </span>
+ </p>
</div>
</section>
diff --git a/api/subscriptions/get_monthly_cost.php b/api/subscriptions/get_monthly_cost.php
new file mode 100644
index 0000000..e0e7f4b
--- /dev/null
+++ b/api/subscriptions/get_monthly_cost.php
@@ -0,0 +1,151 @@
+<?php
+/*
+This API Endpoint accepts both POST and GET requests
+It receives as parameters:
+- month: the month for which the cost is to be calculated
+- year: the year for which the cost is to be calculated
+- apiKey: the API key of the user
+It returns a JSON object with the following properties:
+- success: a boolean indicating whether the request was successful
+- title: a string with "${month} ${year}" (e.g. "January 2022")
+- monthly_cost: a float with the total cost for the given month
+- currency_code: a string with the currency code of the user's main currency
+- currency_symbol: a string with the currency symbol of the user's main currency
+- notes: warning messages or additional information
+*/
+
+require_once '../../includes/connect_endpoint.php';
+
+header('Content-Type: application/json, charset=UTF-8');
+
+if ($_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "GET") {
+ // if the parameters are not set, return an error
+
+ if (!isset($_REQUEST['month']) || !isset($_REQUEST['year']) || !isset($_REQUEST['api_key'])) {
+ $response = [
+ "success" => false,
+ "title" => "Missing parameters"
+ ];
+ echo json_encode($response);
+ exit;
+ }
+
+ $month = $_REQUEST['month'];
+ $year = $_REQUEST['year'];
+ $apiKey = $_REQUEST['api_key'];
+
+ $sql = "SELECT * FROM user WHERE api_key = :apiKey";
+ $stmt = $db->prepare($sql);
+ $stmt->bindValue(':apiKey', $apiKey);
+ $result = $stmt->execute();
+ $user = $result->fetchArray(SQLITE3_ASSOC);
+
+ $sql = "SELECT * FROM last_exchange_update";
+ $result = $db->query($sql);
+ $lastExchangeUpdate = $result->fetchArray(SQLITE3_ASSOC);
+
+ $userId = $user['id'];
+ $userCurrencyId = $user['main_currency'];
+ $needsCurrencyConversion = false;
+ $canConvertCurrency = empty($lastExchangeUpdate['date']) ? false : true;
+
+ $sql = "SELECT * FROM currencies WHERE id = :currencyId";
+ $stmt = $db->prepare($sql);
+ $stmt->bindValue(':currencyId', $userCurrencyId);
+ $result = $stmt->execute();
+ $currency = $result->fetchArray(SQLITE3_ASSOC);
+ $currency_code = $currency['code'];
+ $currency_symbol = $currency['symbol'];
+
+
+ $title = date('F Y', strtotime($year . '-' . $month . '-01'));
+ $monthlyCost = 0;
+ $notes = [];
+
+ $sql = "SELECT * FROM subscriptions WHERE user_id = :userId AND inactive = 0";
+ $stmt = $db->prepare($sql);
+ $stmt->bindValue(':userId', $userId);
+ $result = $stmt->execute();
+ $subscriptions = [];
+ while ($subscription = $result->fetchArray(SQLITE3_ASSOC)) {
+ $subscriptions[] = $subscription;
+ if ($subscription['currency_id'] !== $userCurrencyId) {
+ $needsCurrencyConversion = true;
+ }
+ }
+
+ if ($needsCurrencyConversion) {
+ if (!$canConvertCurrency) {
+ $notes[] = "You are using multiple currencies, but the exchange rates have not been updated yet. Please check your Fixer API Key.";
+ } else {
+ $sql = "SELECT * FROM currencies WHERE user_id = :userId";
+ $stmt = $db->prepare($sql);
+ $stmt->bindValue(':userId', $userId);
+ $result = $stmt->execute();
+ $currencies = [];
+ while ($currency = $result->fetchArray(SQLITE3_ASSOC)) {
+ $currencies[$currency['id']] = $currency['rate'];
+ }
+ }
+ }
+
+ // Calculate the monthly cost based on the next_payment_date, payment cycle, and payment frequency
+ foreach ($subscriptions as $subscription) {
+ $nextPaymentDate = strtotime($subscription['next_payment']);
+ $cycle = $subscription['cycle']; // Integer from 1 to 4
+ $frequency = $subscription['frequency'];
+
+ // Determine the strtotime increment string based on cycle
+ switch ($cycle) {
+ case 1: // Days
+ $incrementString = "+{$frequency} days";
+ break;
+ case 2: // Weeks
+ $incrementString = "+{$frequency} weeks";
+ break;
+ case 3: // Months
+ $incrementString = "+{$frequency} months";
+ break;
+ case 4: // Years
+ $incrementString = "+{$frequency} years";
+ break;
+ default:
+ $incrementString = "+{$frequency} months"; // Default case, if needed
+ }
+
+ // Calculate the start of the month
+ $startOfMonth = strtotime($year . '-' . str_pad($month, 2, '0', STR_PAD_LEFT) . '-01');
+
+ // Find the first payment date of the month by moving backwards
+ $startDate = $nextPaymentDate;
+ while ($startDate > $startOfMonth) {
+ $startDate = strtotime("-" . $incrementString, $startDate);
+ }
+
+ // Calculate the monthly cost
+ for ($date = $startDate; $date <= strtotime("+1 month", $startOfMonth); $date = strtotime($incrementString, $date)) {
+ if (date('Y-m', $date) == $year . '-' . str_pad($month, 2, '0', STR_PAD_LEFT)) {
+ $price = $subscription['price'];
+ if ($userCurrencyId !== $subscription['currency_id']) {
+ $price *= $currencies[$userCurrencyId] / $currencies[$subscription['currency_id']];
+ }
+ $monthlyCost += $price;
+ }
+ }
+ }
+
+ $formatter = new NumberFormatter('en_US', NumberFormatter::CURRENCY);
+ $localizedMonthlyCost = $formatter->formatCurrency($monthlyCost, $currency_code);
+
+ echo json_encode([
+ 'success' => true,
+ 'title' => $title,
+ 'monthly_cost' => number_format($monthlyCost, 2),
+ 'localized_monthly_cost' => $localizedMonthlyCost,
+ 'currency_code' => $currency_code,
+ 'currency_symbol' => $currency_symbol,
+ 'notes' => $notes
+ ], JSON_UNESCAPED_UNICODE);
+
+}
+?>
\ No newline at end of file
diff --git a/endpoints/user/regenerateapikey.php b/endpoints/user/regenerateapikey.php
new file mode 100644
index 0000000..3034d12
--- /dev/null
+++ b/endpoints/user/regenerateapikey.php
@@ -0,0 +1,40 @@
+<?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);
+
+ $apiKey = bin2hex(random_bytes(32));
+
+ $sql = "UPDATE user SET api_key = :apiKey WHERE id = :userId";
+ $stmt = $db->prepare($sql);
+ $stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);
+ $stmt->bindValue(':userId', $userId, SQLITE3_TEXT);
+ $result = $stmt->execute();
+
+ if ($result) {
+ $response = [
+ "success" => true,
+ "message" => translate('user_details_saved', $i18n),
+ "apiKey" => $apiKey
+ ];
+ echo json_encode($response);
+ } else {
+ $response = [
+ "success" => false,
+ "message" => translate('error_updating_user_data', $i18n)
+ ];
+ echo json_encode($response);
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/images/siteicons/svg/mobile-menu/calendar.php b/images/siteicons/svg/mobile-menu/calendar.php
new file mode 100644
index 0000000..cc9b50d
--- /dev/null
+++ b/images/siteicons/svg/mobile-menu/calendar.php
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="100" height="100" viewBox="0 0 50 50">
+ <path fill="currentColor" d="M 12 0 C 10.90625 0 10 0.90625 10 2 L 10 4 L 4 4 C 3.476563 4 2.945313 4.191406 2.570313 4.570313 C 2.191406 4.945313 2 5.476563 2 6 L 2 46 C 2 46.523438 2.191406 47.054688 2.570313 47.433594 C 2.945313 47.808594 3.476563 48 4 48 L 46 48 C 46.523438 48 47.054688 47.808594 47.433594 47.433594 C 47.808594 47.054688 48 46.523438 48 46 L 48 6 C 48 5.476563 47.808594 4.945313 47.433594 4.570313 C 47.054688 4.191406 46.523438 4 46 4 L 40 4 L 40 2 C 40 0.90625 39.09375 0 38 0 L 36 0 C 34.90625 0 34 0.90625 34 2 L 34 4 L 16 4 L 16 2 C 16 0.90625 15.09375 0 14 0 Z M 12 2 L 14 2 L 14 8 L 12 8 Z M 36 2 L 38 2 L 38 8 L 36 8 Z M 4 6 L 10 6 L 10 8 C 10 9.09375 10.90625 10 12 10 L 14 10 C 15.09375 10 16 9.09375 16 8 L 16 6 L 34 6 L 34 8 C 34 9.09375 34.90625 10 36 10 L 38 10 C 39.09375 10 40 9.09375 40 8 L 40 6 L 46 6 L 46 13 L 4 13 Z M 4 15 L 46 15 L 46 46 L 4 46 Z M 10 19 L 10 42 L 40 42 L 40 19 Z M 12 21 L 17 21 L 17 26 L 12 26 Z M 19 21 L 24 21 L 24 26 L 19 26 Z M 26 21 L 31 21 L 31 26 L 26 26 Z M 33 21 L 38 21 L 38 26 L 33 26 Z M 12 28 L 17 28 L 17 33 L 12 33 Z M 19 28 L 24 28 L 24 33 L 19 33 Z M 26 28 L 31 28 L 31 33 L 26 33 Z M 33 28 L 38 28 L 38 33 L 33 33 Z M 12 35 L 17 35 L 17 40 L 12 40 Z M 19 35 L 24 35 L 24 40 L 19 40 Z M 26 35 L 31 35 L 31 40 L 26 40 Z M 33 35 L 38 35 L 38 40 L 33 40 Z"></path>
+</svg>
\ No newline at end of file
diff --git a/images/siteicons/svg/mobile-menu/home.php b/images/siteicons/svg/mobile-menu/home.php
new file mode 100644
index 0000000..af054b5
--- /dev/null
+++ b/images/siteicons/svg/mobile-menu/home.php
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="100" height="100" viewBox="0 0 50 50">
+ <path fill="currentColor" d="M 24.962891 1.0546875 A 1.0001 1.0001 0 0 0 24.384766 1.2636719 L 1.3847656 19.210938 A 1.0005659 1.0005659 0 0 0 2.6152344 20.789062 L 4 19.708984 L 4 46 C 4 46.552 4.448 47 5 47 L 45 47 C 45.552 47 46 46.552 46 46 L 46 19.708984 L 47.384766 20.789062 A 1.0005657 1.0005657 0 1 0 48.615234 19.210938 L 41 13.269531 C 40.999922 13.061489 41.00006 12.820623 41 12.507812 C 40.999859 11.776319 41.000062 10.809744 41 9.8457031 C 40.999875 7.9176211 41 6 41 6 A 1.0001 1.0001 0 0 0 40 5 L 36 5 A 1.0001 1.0001 0 0 0 35 6 C 35 6 35.000625 7.1570629 35 8.3144531 C 34.999946 8.4138611 35.000063 8.4892153 35 8.5878906 L 25.615234 1.2636719 A 1.0001 1.0001 0 0 0 24.962891 1.0546875 z M 25 3.3222656 L 35.378906 11.419922 A 1.0001 1.0001 0 0 0 36.367188 11.560547 C 36.367188 11.560547 36.986309 10.761867 36.986328 10.761719 C 36.986348 10.76157 36.991388 10.708386 36.992188 10.697266 C 36.993688 10.675006 36.993841 10.668839 36.994141 10.662109 C 36.994592 10.648659 36.995894 10.642016 36.996094 10.634766 C 36.996335 10.620266 36.995945 10.606331 36.996094 10.587891 C 36.996392 10.551011 36.995852 10.499661 36.996094 10.435547 C 36.996578 10.307318 36.997647 10.125735 36.998047 9.9082031 C 36.99857 9.4731324 36.999687 8.8954613 37 8.3164062 C 37.000355 7.6582563 36.999934 7.4454733 37 7 L 39 7 C 39.000006 7.6422969 38.999908 8.4189176 39 9.8457031 C 39.000063 10.809787 38.999859 11.77615 39 12.507812 C 39.00007 12.873644 38.999904 13.179924 39 13.398438 C 39.000096 13.61695 39.000933 13.681016 39.001953 13.769531 A 1.0001 1.0001 0 0 0 39.386719 14.546875 L 44 18.146484 L 44 45 L 6 45 L 6 18.148438 L 25 3.3222656 z M 15 27 A 1.0001 1.0001 0 1 0 15 29 L 35 29 A 1.0001 1.0001 0 1 0 35 27 L 15 27 z M 15 33 A 1.0001 1.0001 0 1 0 15 35 L 35 35 A 1.0001 1.0001 0 1 0 35 33 L 15 33 z"></path>
+</svg>
\ No newline at end of file
diff --git a/images/siteicons/svg/mobile-menu/profile.php b/images/siteicons/svg/mobile-menu/profile.php
new file mode 100644
index 0000000..831ce53
--- /dev/null
+++ b/images/siteicons/svg/mobile-menu/profile.php
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="100" height="100" viewBox="0 0 50 50">
+ <path fill="currentColor" d="M 25 2.0078125 C 12.309296 2.0078125 2.0000002 12.317108 2 25.007812 C 2 37.698518 12.309295 48.007812 25 48.007812 C 37.690705 48.007812 48 37.698518 48 25.007812 C 48 12.317108 37.690704 2.0078125 25 2.0078125 z M 25 4.0078125 C 36.609824 4.0078125 46 13.397988 46 25.007812 C 46 30.740509 43.703999 35.925856 39.988281 39.712891 C 38.158498 38.369571 35.928049 37.69558 34.039062 37.023438 C 32.975192 36.644889 32.018651 36.269758 31.320312 35.851562 C 30.651504 35.451051 30.280089 35.039466 30.083984 34.566406 C 29.992134 33.419545 30.010738 32.496253 30.017578 31.40625 C 30.13873 31.285594 30.294155 31.200823 30.417969 31.054688 C 30.709957 30.710058 31.007253 30.29128 31.291016 29.820312 C 31.777604 29.012711 32.131673 28.024913 32.330078 27.023438 C 32.63305 26.869 32.956699 26.835578 33.203125 26.521484 C 33.658098 25.941577 33.965233 25.125482 34.101562 23.988281 C 34.222454 22.984232 33.898957 22.29366 33.482422 21.763672 C 33.930529 20.298851 34.48532 17.969341 34.296875 15.558594 C 34.193203 14.232288 33.859467 12.897267 33.056641 11.787109 C 32.290173 10.727229 31.045786 9.9653642 29.453125 9.6894531 C 28.441568 8.5409775 26.834704 8 24.914062 8 L 24.904297 8 L 24.896484 8 C 20.593741 8.078993 17.817552 9.8598398 16.628906 12.576172 C 15.498615 15.159149 15.741603 18.37477 16.552734 21.722656 C 16.116708 22.25268 15.775146 22.95643 15.898438 23.988281 C 16.035282 25.125098 16.34224 25.94153 16.796875 26.521484 C 17.043118 26.835604 17.366808 26.868911 17.669922 27.023438 C 17.868296 28.024134 18.222437 29.01059 18.708984 29.818359 C 18.992747 30.289465 19.289737 30.707821 19.582031 31.052734 C 19.705876 31.198874 19.861128 31.285522 19.982422 31.40625 C 19.988922 32.49568 20.007396 33.418614 19.916016 34.566406 C 19.720294 35.037723 19.34937 35.449526 18.681641 35.851562 C 17.984409 36.271364 17.029015 36.648577 15.966797 37.029297 C 14.079805 37.705631 11.85061 38.384459 10.015625 39.716797 C 6.2976298 35.929423 4 30.742497 4 25.007812 C 4.0000002 13.397989 13.390176 4.0078125 25 4.0078125 z M 24.921875 10.001953 C 26.766001 10.003853 27.92628 10.549863 28.244141 11.107422 L 28.488281 11.535156 L 28.974609 11.601562 C 30.230788 11.776108 30.932655 12.263579 31.435547 12.958984 C 31.938439 13.654389 32.217535 14.624895 32.302734 15.714844 C 32.473134 17.894741 31.849129 20.468905 31.453125 21.660156 L 31.201172 22.416016 L 31.882812 22.830078 C 31.813472 22.787858 32.203297 23.018609 32.115234 23.75 C 32.008564 24.639799 31.781184 25.093017 31.628906 25.287109 C 31.476629 25.481202 31.411442 25.45641 31.427734 25.455078 L 30.603516 25.523438 L 30.515625 26.345703 C 30.440195 27.052169 30.04285 28.015793 29.578125 28.787109 C 29.345762 29.172767 29.098543 29.516317 28.890625 29.761719 C 28.682707 30.00712 28.461282 30.159117 28.544922 30.115234 L 28.009766 30.394531 L 28.009766 31 C 28.009766 32.324321 27.955813 33.407291 28.095703 34.949219 L 28.107422 35.082031 L 28.154297 35.207031 C 28.547829 36.266071 29.369275 37.013258 30.292969 37.566406 C 31.216662 38.119555 32.276387 38.519377 33.369141 38.908203 C 35.170096 39.549023 37.047465 40.179657 38.478516 41.111328 C 34.832228 44.16545 30.135566 46.007812 25 46.007812 C 19.866422 46.007812 15.171083 44.167232 11.525391 41.115234 C 12.964568 40.188909 14.844735 39.556492 16.642578 38.912109 C 17.73461 38.520704 18.79156 38.119183 19.712891 37.564453 C 20.634221 37.009723 21.452728 36.262662 21.845703 35.207031 L 21.892578 35.082031 L 21.904297 34.949219 C 22.043042 33.408482 21.990234 32.325309 21.990234 31 L 21.990234 30.394531 L 21.455078 30.113281 C 21.538828 30.157091 21.317362 30.005196 21.109375 29.759766 C 20.901388 29.514336 20.654237 29.172879 20.421875 28.787109 C 19.957151 28.015571 19.559775 27.05118 19.484375 26.345703 L 19.396484 25.523438 L 18.572266 25.455078 C 18.587716 25.456378 18.523206 25.481158 18.371094 25.287109 C 18.218979 25.093064 17.991921 24.640183 17.884766 23.75 C 17.797356 23.01846 18.191557 22.784891 18.117188 22.830078 L 18.751953 22.445312 L 18.566406 21.724609 C 17.705952 18.412902 17.575833 15.399621 18.460938 13.376953 C 19.345167 11.356284 21.116417 10.074289 24.921875 10.001953 z"></path>
+</svg>
\ No newline at end of file
diff --git a/images/siteicons/svg/mobile-menu/settings.php b/images/siteicons/svg/mobile-menu/settings.php
new file mode 100644
index 0000000..8aa56fd
--- /dev/null
+++ b/images/siteicons/svg/mobile-menu/settings.php
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="100" height="100" viewBox="0 0 50 50">
+ <path fill="currentColor" d="M 22.205078 2 A 1.0001 1.0001 0 0 0 21.21875 2.8378906 L 20.246094 8.7929688 C 19.076509 9.1331971 17.961243 9.5922728 16.910156 10.164062 L 11.996094 6.6542969 A 1.0001 1.0001 0 0 0 10.708984 6.7597656 L 6.8183594 10.646484 A 1.0001 1.0001 0 0 0 6.7070312 11.927734 L 10.164062 16.873047 C 9.583454 17.930271 9.1142098 19.051824 8.765625 20.232422 L 2.8359375 21.21875 A 1.0001 1.0001 0 0 0 2.0019531 22.205078 L 2.0019531 27.705078 A 1.0001 1.0001 0 0 0 2.8261719 28.691406 L 8.7597656 29.742188 C 9.1064607 30.920739 9.5727226 32.043065 10.154297 33.101562 L 6.6542969 37.998047 A 1.0001 1.0001 0 0 0 6.7597656 39.285156 L 10.648438 43.175781 A 1.0001 1.0001 0 0 0 11.927734 43.289062 L 16.882812 39.820312 C 17.936999 40.39548 19.054994 40.857928 20.228516 41.201172 L 21.21875 47.164062 A 1.0001 1.0001 0 0 0 22.205078 48 L 27.705078 48 A 1.0001 1.0001 0 0 0 28.691406 47.173828 L 29.751953 41.1875 C 30.920633 40.838997 32.033372 40.369697 33.082031 39.791016 L 38.070312 43.291016 A 1.0001 1.0001 0 0 0 39.351562 43.179688 L 43.240234 39.287109 A 1.0001 1.0001 0 0 0 43.34375 37.996094 L 39.787109 33.058594 C 40.355783 32.014958 40.813915 30.908875 41.154297 29.748047 L 47.171875 28.693359 A 1.0001 1.0001 0 0 0 47.998047 27.707031 L 47.998047 22.207031 A 1.0001 1.0001 0 0 0 47.160156 21.220703 L 41.152344 20.238281 C 40.80968 19.078827 40.350281 17.974723 39.78125 16.931641 L 43.289062 11.933594 A 1.0001 1.0001 0 0 0 43.177734 10.652344 L 39.287109 6.7636719 A 1.0001 1.0001 0 0 0 37.996094 6.6601562 L 33.072266 10.201172 C 32.023186 9.6248101 30.909713 9.1579916 29.738281 8.8125 L 28.691406 2.828125 A 1.0001 1.0001 0 0 0 27.705078 2 L 22.205078 2 z M 23.056641 4 L 26.865234 4 L 27.861328 9.6855469 A 1.0001 1.0001 0 0 0 28.603516 10.484375 C 30.066026 10.848832 31.439607 11.426549 32.693359 12.185547 A 1.0001 1.0001 0 0 0 33.794922 12.142578 L 38.474609 8.7792969 L 41.167969 11.472656 L 37.835938 16.220703 A 1.0001 1.0001 0 0 0 37.796875 17.310547 C 38.548366 18.561471 39.118333 19.926379 39.482422 21.380859 A 1.0001 1.0001 0 0 0 40.291016 22.125 L 45.998047 23.058594 L 45.998047 26.867188 L 40.279297 27.871094 A 1.0001 1.0001 0 0 0 39.482422 28.617188 C 39.122545 30.069817 38.552234 31.434687 37.800781 32.685547 A 1.0001 1.0001 0 0 0 37.845703 33.785156 L 41.224609 38.474609 L 38.53125 41.169922 L 33.791016 37.84375 A 1.0001 1.0001 0 0 0 32.697266 37.808594 C 31.44975 38.567585 30.074755 39.148028 28.617188 39.517578 A 1.0001 1.0001 0 0 0 27.876953 40.3125 L 26.867188 46 L 23.052734 46 L 22.111328 40.337891 A 1.0001 1.0001 0 0 0 21.365234 39.53125 C 19.90185 39.170557 18.522094 38.59371 17.259766 37.835938 A 1.0001 1.0001 0 0 0 16.171875 37.875 L 11.46875 41.169922 L 8.7734375 38.470703 L 12.097656 33.824219 A 1.0001 1.0001 0 0 0 12.138672 32.724609 C 11.372652 31.458855 10.793319 30.079213 10.427734 28.609375 A 1.0001 1.0001 0 0 0 9.6328125 27.867188 L 4.0019531 26.867188 L 4.0019531 23.052734 L 9.6289062 22.117188 A 1.0001 1.0001 0 0 0 10.435547 21.373047 C 10.804273 19.898143 11.383325 18.518729 12.146484 17.255859 A 1.0001 1.0001 0 0 0 12.111328 16.164062 L 8.8261719 11.46875 L 11.523438 8.7734375 L 16.185547 12.105469 A 1.0001 1.0001 0 0 0 17.28125 12.148438 C 18.536908 11.394293 19.919867 10.822081 21.384766 10.462891 A 1.0001 1.0001 0 0 0 22.132812 9.6523438 L 23.056641 4 z M 25 17 C 20.593567 17 17 20.593567 17 25 C 17 29.406433 20.593567 33 25 33 C 29.406433 33 33 29.406433 33 25 C 33 20.593567 29.406433 17 25 17 z M 25 19 C 28.325553 19 31 21.674447 31 25 C 31 28.325553 28.325553 31 25 31 C 21.674447 31 19 28.325553 19 25 C 19 21.674447 21.674447 19 25 19 z"></path>
+</svg>
\ No newline at end of file
diff --git a/images/siteicons/svg/mobile-menu/statistics.php b/images/siteicons/svg/mobile-menu/statistics.php
new file mode 100644
index 0000000..9430600
--- /dev/null
+++ b/images/siteicons/svg/mobile-menu/statistics.php
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="100" height="100" viewBox="0 0 50 50">
+ <path fill="currentColor" d="M 34 4 L 34 50 L 48 50 L 48 4 Z M 36 6 L 46 6 L 46 48 L 36 48 Z M 2 17 L 2 50 L 16 50 L 16 17 Z M 4 19 L 14 19 L 14 48 L 4 48 Z M 18 28 L 18 50 L 32 50 L 32 28 Z M 20 30 L 30 30 L 30 48 L 20 48 Z"></path>
+</svg>
\ No newline at end of file
diff --git a/includes/header.php b/includes/header.php
index d218655..9adfdbc 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -165,6 +165,8 @@ $mobileNavigation = $settings['mobile_nav'] ? "mobile-navivagtion" : "";
<span id="user" class="mobileNavigationHideOnMobile"><?= $username ?></span>
</button>
<div class="dropdown-content">
+ <a href="profile.php" class="mobileNavigationHideOnMobile"><i
+ class="fa-solid fa-user"></i><?= translate('profile', $i18n) ?></a>
<a href="." class="mobileNavigationHideOnMobile"><i
class="fa-solid fa-list"></i><?= translate('subscriptions', $i18n) ?></a>
<a href="calendar.php" class="mobileNavigationHideOnMobile"><i
@@ -198,39 +200,33 @@ $mobileNavigation = $settings['mobile_nav'] ? "mobile-navivagtion" : "";
$calendarClass = $page === 'calendar.php' ? 'active' : '';
$statsClass = $page === 'stats.php' ? 'active' : '';
$settingsClass = $page === 'settings.php' ? 'active' : '';
+ $profileClass = $page === 'profile.php' ? 'active' : '';
?>
<?php
if ($settings['mobile_nav'] == 1) {
?>
<nav class="mobile-nav">
- <a href="." class="nav-link <?= $subscriptionsClass ?>" title="<?= translate('subscriptions', $i18n) ?>">
- <i class="fas fa-solid fa-list"></i>
- </a>
- <a href="calendar.php" class="nav-link <?= $calendarClass ?>" title="<?= translate('calendar', $i18n) ?>">
- <i class="fas fa-solid fa-calendar"></i>
- </a>
- <?php
- if ($page === 'index.php') {
- ?>
- <button class="nav-link" title="<?= translate('add_subscription', $i18n) ?>" onClick="addSubscription()">
- <i class="fas fa-solid fa-plus"></i>
- </button>
- <?php
- } else {
- ?>
- <a href=".?add" class="nav-link secondary" title="<?= translate('add_subscription', $i18n) ?>">
- <i class="fas fa-solid fa-plus"></i>
+ <a href="." class="nav-link <?= $subscriptionsClass ?>" title="<?= translate('subscriptions', $i18n) ?>">
+ <?php include "images/siteicons/svg/mobile-menu/home.php"; ?>
+ Home
+ </a>
+ <a href="calendar.php" class="nav-link <?= $calendarClass ?>" title="<?= translate('calendar', $i18n) ?>">
+ <?php include "images/siteicons/svg/mobile-menu/calendar.php"; ?>
+ Calendar
+ </a>
+ <a href="stats.php" class="nav-link <?= $statsClass ?>" title="<?= translate('stats', $i18n) ?>">
+ <?php include "images/siteicons/svg/mobile-menu/statistics.php"; ?>
+ Statistics
+ </a>
+ <a href="settings.php" class="nav-link <?= $settingsClass ?>" title="<?= translate('settings', $i18n) ?>">
+ <?php include "images/siteicons/svg/mobile-menu/settings.php"; ?>
+ Settings
+ </a>
+ <a href="profile.php" class="nav-link <?= $profileClass ?>" title="<?= translate('profile', $i18n) ?>">
+ <?php include "images/siteicons/svg/mobile-menu/profile.php"; ?>
+ Profile
</a>
- <?php
- }
- ?>
- <a href="stats.php" class="nav-link <?= $statsClass ?>" title="<?= translate('stats', $i18n) ?>">
- <i class="fas fa-solid fa-chart-simple"></i>
- </a>
- <a href="settings.php" class="nav-link <?= $settingsClass ?>" title="<?= translate('settings', $i18n) ?>">
- <i class="fas fa-solid fa-cog"></i>
- </a>
</nav>
<?php
}
diff --git a/includes/i18n/de.php b/includes/i18n/de.php
index 97f9218..2fe140b 100644
--- a/includes/i18n/de.php
+++ b/includes/i18n/de.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Passwort zurücksetzen E-Mail wurde gesendet. Bitte überprüfen Sie Ihr Postfach.",
'password_reset_successful' => "Passwort erfolgreich zurückgesetzt",
// Header
+ 'profile' => "Profil",
'subscriptions' => "Abonnements",
'stats' => "Statistiken",
'settings' => "Einstellungen",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "Der Autor",
'icons' => "Icons",
'payment_icons' => "Zahlungsweisen Icons",
- // Settings page
+ // Profile page
'upload_avatar' => "Avatar hochladen",
'file_type_error' => "Dateityp nicht unterstützt",
'user_details' => "Benutzerdetails",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Speichern Sie diese Codes an einem sicheren Ort. Sie können sie verwenden, wenn Sie keinen Zugriff auf Ihre Authentifizierungs-App haben.",
"disable_two_factor_authentication" => "Zwei-Faktor-Authentifizierung deaktivieren",
"totp_code" => "TOTP-Code",
+ "api_key" => "API Key",
+ "regenerate" => "Neu generieren",
+ "api_key_info" => "Der API-Schlüssel wird für die Integration von Drittanbieter-Apps verwendet. Wenn Sie Ihren Schlüssel neu generieren, müssen Sie ihn in allen Apps aktualisieren, die ihn verwenden.",
+ // Settings page
"monthly_budget" => "Monatliches Budget",
"budget_info" => "Das monatliche Budget wird für die Berechnung der Statistiken verwendet.",
"household" => "Haushalt",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Finde die unterstützten Währungen und korrekten Währungscodes auf",
"currency_performance" => "Aus Gründen der Performance wähle bitte ausschließlich die genutzen Währungen.",
"fixer_api_key" => "Fixer API Key",
- "api_key" => "API Key",
"provider" => "Anbieter",
"fixer_info" => "Falls du mehrere Währungen nutzt und genaue Statistiken und die Sortierungsfunktion nutzen möchtest, wird ein kostenfreier API Key von Fixer benötigt.",
"get_key" => "Erhalte deinen key bei",
diff --git a/includes/i18n/el.php b/includes/i18n/el.php
index cec840c..de41bd6 100644
--- a/includes/i18n/el.php
+++ b/includes/i18n/el.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Ένα email με οδηγίες για την επαναφορά του κωδικού πρόσβασης σας έχει σταλεί. Παρακαλώ ελέγξτε το email σας.",
'password_reset_successful' => "Επιτυχής επαναφορά κωδικού πρόσβασης",
// Header
+ 'profile' => "Προφίλ",
'subscriptions' => "Συνδρομές",
'stats' => "Στατιστικές",
'settings' => "Ρυθμίσεις",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "Προγραμματιστής",
'icons' => "Εικονίδια",
'payment_icons' => "Εικονίδια Payment",
- // Settings page
+ // Profile page
'upload_avatar' => "μεταφόρτωση άβαταρ",
'file_type_error' => "Το αρχείο πρέπει να είναι τύπου jpg, jpeg, png, webp ή gif",
'user_details' => "Λεπτομέρειες χρήστη",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Αποθηκεύστε αυτούς τους κωδικούς ανάκτησης σε ένα ασφαλές μέρος. Θα χρειαστείτε έναν από αυτούς τους κωδικούς ανάκτησης για να αποκτήσετε πρόσβαση στο λογαριασμό σας σε περίπτωση που χάσετε τη συσκευή σας.",
"disable_two_factor_authentication" => "Απενεργοποίηση διπλής πιστοποίησης",
"totp_code" => "Κωδικός TOTP",
+ "api_key" => "API κλειδί",
+ "regenerate" => "Επαναδημιουργία",
+ "api_key_info" => "Το API κλειδί χρησιμοποιείται για την επικοινωνία με το API του Wallos. Μην αποκαλύπτετε το API κλειδί σας σε κανέναν.",
+ // Settings page
"monthly_budget" => "Μηνιαίος προϋπολογισμός",
"budget_info" => "Ο μηνιαίος προϋπολογισμός χρησιμοποιείται για τον υπολογισμό των στατιστικών",
"household" => "Νοικοκυριό",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Βρες τα υποστηριζόμενα νομίσματα και τους σωστούς κωδικούς νομίσματος στο",
"currency_performance" => "Για βελτιωμένη απόδοση κράτησε μόνο τα νομίσματα που χρησιμοποιείς.",
"fixer_api_key" => "Fixer API κλειδί",
- "api_key" => "API κλειδί",
"provider" => "Πάροχος",
"fixer_info" => "Εάν χρησιμοποιείς πολλαπλά νομίσματα και θέλεις ακριβή στατιστικά στοιχεία και ταξινόμηση των συνδρομών, είναι απαραίτητο ένα ΔΩΡΕΑΝ κλειδί API από το Fixer.",
"get_key" => "Απόκτησε το κλειδί στο",
diff --git a/includes/i18n/en.php b/includes/i18n/en.php
index 056bd4c..abeb064 100644
--- a/includes/i18n/en.php
+++ b/includes/i18n/en.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Reset email sent. Please check your email.",
'password_reset_successful' => "Password reset successful",
// Header
+ 'profile' => "Profile",
'subscriptions' => "Subscriptions",
'stats' => "Statistics",
'settings' => "Settings",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "The author",
'icons' => "Icons",
'payment_icons' => "Payment Icons",
- // Settings page
+ // Profile page
'upload_avatar' => "Upload Avatar",
'file_type_error' => "The file type supplied is not supported.",
'user_details' => "User Details",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "These codes can be used to login if you lose access to your authenticator app.",
"disable_two_factor_authentication" => "Disable Two Factor Authentication",
"totp_code" => "TOTP Code",
+ "api_key" => "API Key",
+ "regenerate" => "Regenerate",
+ "api_key_info" => "The API key is used to access the API. Keep it secret.",
+ // Settings page
"monthly_budget" => "Monthly Budget",
"budget_info" => "Monthly budget is used to calculate statistics",
"household" => "Household",
@@ -187,7 +192,6 @@ $i18n = [
"currency_info" => "Find the supported currencies and correct currency codes on",
"currency_performance" => "For improved performance keep only the currencies you use.",
"fixer_api_key" => "Fixer API Key",
- "api_key" => "API Key",
"provider" => "Provider",
"fixer_info" => "If you use multiple currencies, and want accurate statistics and sorting on the subscriptions, a FREE API Key from Fixer is necessary.",
"get_key" => "Get your key at",
diff --git a/includes/i18n/es.php b/includes/i18n/es.php
index 09b479f..e79e354 100644
--- a/includes/i18n/es.php
+++ b/includes/i18n/es.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Se ha enviado un correo electrónico con instrucciones para restablecer la contraseña. Por favor, compruebe su correo electrónico.",
'password_reset_successful' => "Contraseña restablecida con éxito",
// Header
+ 'profile' => "Perfil",
'subscriptions' => "Suscripciones",
'stats' => "Estadísticas",
'settings' => "Configuración",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "El autor",
'icons' => "Iconos",
'payment_icons' => "Iconos de Pago",
- // Settings page
+ // Profile page
'upload_avatar' => "Subir avatar",
'file_type_error' => "El archivo debe ser una imagen en formato PNG, JPG, WEBP o SVG",
'user_details' => "Detalles del Usuario",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Guarda estos códigos en un lugar seguro. Puedes usarlos si pierdes acceso a tu aplicación de autenticación.",
"disable_two_factor_authentication" => "Desactivar Autenticación de Dos Factores",
"totp_code" => "Código TOTP",
+ "api_key" => "Clave API",
+ "regenerate" => "Regenerar",
+ "api_key_info" => "La clave API se utiliza para acceder a la API de Wallos. No compartas esta clave con nadie.",
+ // Settings page
"monthly_budget" => "Presupuesto Mensual",
"budget_info" => "El presupuesto mensual se utiliza para calcular las estadísticas. Si no deseas utilizar esta función, déjalo en 0.",
"household" => "Hogar",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Encuentra las monedas admitidas y los códigos de moneda correctos en",
"currency_performance" => "Para un rendimiento mejorado, guarda solo las monedas que uses.",
"fixer_api_key" => "API Key de Fixer",
- "api_key" => "API Key",
"provider" => "Proveedor",
"fixer_info" => "Si usas varias monedas y deseas estadísticas y orden precisos en las suscripciones, es necesaria una API KEY gratuita de Fixer.",
"get_key" => "Obtén tu clave en",
diff --git a/includes/i18n/fr.php b/includes/i18n/fr.php
index 163339c..79a63f2 100644
--- a/includes/i18n/fr.php
+++ b/includes/i18n/fr.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Un courriel a été envoyé à l'adresse fournie. Vérifiez votre boîte de réception.",
'password_reset_successful' => "Réinitialisation du mot de passe réussie",
// En-tête
+ 'profile' => "Profil",
'subscriptions' => "Abonnements",
'stats' => "Statistiques",
'settings' => "Paramètres",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "L'auteur",
'icons' => "Icônes",
'payment_icons' => "Icônes de paiement",
- // Page de paramètres
+ // Page de profil
'upload_avatar' => "Télécharger un Avatar",
'file_type_error' => "Le type de fichier n'est pas pris en charge",
'user_details' => "Détails de l'utilisateur",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Conservez ces codes en lieu sûr. Vous ne pourrez pas les récupérer plus tard.",
"disable_two_factor_authentication" => "Désactiver l'authentification à deux facteurs",
"totp_code" => "Code TOTP",
+ "api_key" => "Clé API",
+ "regenerate" => "Régénérer",
+ "api_key_info" => "La clé API est utilisée pour les applications tierces et les intégrations. Ne la partagez pas.",
+ // Page de paramètres
"monthly_budget" => "Budget mensuel",
"budget_info" => "Le budget mensuel est utilisé pour calculer les statistiques. Laissez vide pour désactiver.",
"household" => "Ménage",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Trouvez les devises prises en charge et les codes de devise corrects sur",
"currency_performance" => "Pour des performances améliorées, ne conservez que les devises que vous utilisez.",
"fixer_api_key" => "Clé API de Fixer",
- "api_key" => "Clé API",
"provider" => "Fournisseur",
"fixer_info" => "Si vous utilisez plusieurs devises et souhaitez des statistiques et un tri précis sur les abonnements, une clé API GRATUITE de Fixer est nécessaire.",
"get_key" => "Obtenez votre clé sur",
diff --git a/includes/i18n/it.php b/includes/i18n/it.php
index bf71916..9f1b685 100644
--- a/includes/i18n/it.php
+++ b/includes/i18n/it.php
@@ -31,6 +31,7 @@ $i18n = [
'password_reset_successful' => "La password è stata reimpostata con successo",
// Header
+ 'profile' => 'Profilo',
'subscriptions' => 'Abbonamenti',
'stats' => 'Statistiche',
'settings' => 'Impostazioni',
@@ -124,7 +125,7 @@ $i18n = [
'icons' => 'Icone',
'payment_icons' => 'Icone di pagamento',
- // Settings
+ // Profile
'upload_avatar' => 'Carica avatar',
'file_type_error' => 'Il tipo di file fornito non è supportato.',
'user_details' => 'Dettagli utente',
@@ -140,6 +141,10 @@ $i18n = [
"totp_backup_codes_info" => "I codici di backup possono essere utilizzati per accedere al tuo account se non hai accesso al tuo dispositivo di autenticazione a due fattori.",
"disable_two_factor_authentication" => "Disabilita l'autenticazione a due fattori",
"totp_code" => "Codice TOTP",
+ "api_key" => "Chiave API",
+ "regenerate" => "Rigenera",
+ "api_key_info" => "La chiave API viene utilizzata per accedere ai dati tramite l'API di Wallos. Non condividere la tua chiave API con nessuno.",
+ // Settings
"monthly_budget" => "Budget mensile",
"budget_info" => "Il budget mensile viene utilizzato per calcolare le statistiche. Se non si desidera utilizzare questa funzionalità, impostare il budget su 0.",
'household' => 'Nucleo familiare',
@@ -193,7 +198,6 @@ $i18n = [
'currency_info' => 'Trova le valute supportate e i codici valuta corretti su',
'currency_performance' => 'Per garantire prestazioni migliori, tieni solo le valute che utilizzi.',
'fixer_api_key' => 'Chiave API di Fixer',
- 'api_key' => 'Chiave API',
'provider' => 'Fornitore',
'fixer_info' => 'Se utilizzi più valute e desideri visualizzare statistiche e ordinamenti accurati sugli abbonamenti, è necessaria una chiave API (Gratuita) da Fixer.',
'get_key' => 'Ottieni la tua chiave su',
diff --git a/includes/i18n/jp.php b/includes/i18n/jp.php
index e176d84..7ba8a37 100644
--- a/includes/i18n/jp.php
+++ b/includes/i18n/jp.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "パスワードリセットリンクが送信されました。メールを確認してください。",
'password_reset_successful' => "パスワードリセットに成功",
// Header
+ 'profile' => "プロフィール",
'subscriptions' => "定期購入",
'stats' => "統計",
'settings' => "設定",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "著者",
'icons' => "アイコン",
'payment_icons' => "支払いアイコン",
- // Settings page
+ // Profile page
'upload_avatar' => "アバターをアップロードする",
'file_type_error' => "ファイルタイプが許可されていません",
'user_details' => "ユーザー詳細",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "これらのコードは、2要素認証アプリが利用できない場合に使用します。コードは一度しか表示されません。",
"disable_two_factor_authentication" => "二要素認証を無効にする",
"totp_code" => "TOTPコード",
+ "api_key" => "APIキー",
+ "regenerate" => "再生成",
+ "api_key_info" => "APIキーは、WallosのAPIを使用するために必要です。APIキーを再生成すると、以前のキーは無効になります。",
+ // Settings page
"monthly_budget" => "月間予算",
"budget_info" => "予算を設定すると、統計ページで予算と実際の支出を比較できます。",
"household" => "世帯",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "サポートされている通貨と正しい通貨コードを見つける",
"currency_performance" => "Fパフォーマンスを向上させるには、使用する通貨のみを保持してください。",
"fixer_api_key" => "FixerのAPIキー",
- "api_key" => "APIキー",
"provider" => "プロバイダ",
"fixer_info" => "複数の通貨を使用し、定期購入に関する正確な統計と並べ替えが必要な場合は、Fixerからの無料APIキーが必要です。",
"get_key" => "キーを入手する",
diff --git a/includes/i18n/ko.php b/includes/i18n/ko.php
index ddf6728..3392119 100644
--- a/includes/i18n/ko.php
+++ b/includes/i18n/ko.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "비밀번호 재설정 이메일이 전송되었습니다. 이메일을 확인해 주세요.",
'password_reset_successful' => "비밀번호 재설정 성공",
// Header
+ 'profile' => "프로필",
'subscriptions' => "구독",
'stats' => "통계",
'settings' => "설정",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "제작자",
'icons' => "아이콘",
'payment_icons' => "지불 방식 아이콘",
- // Settings page
+ // Profile page
'upload_avatar' => "아바타 업로드",
'file_type_error' => "제공된 파일이 지원하지 않는 타입입니다.",
'user_details' => "유저 상세",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "이 코드는 계정에 대한 백업 코드입니다. 이 코드를 안전한 곳에 보관하세요. 이 코드는 한 번만 사용할 수 있습니다.",
"disable_two_factor_authentication" => "2단계 인증 비활성화",
"totp_code" => "TOTP 코드",
+ "api_key" => "API 키",
+ "regenerate" => "재생성",
+ "api_key_info" => "API 키는 외부 애플리케이션과 통신할 때 사용됩니다. API 키를 재생성하면 이전 키는 더 이상 유효하지 않습니다.",
+ // Settings page
"monthly_budget" => "월간 예산",
"budget_info" => "예산을 설정하면 통계 페이지에서 예산과 실제 지출을 비교할 수 있습니다.",
"household" => "가구",
@@ -187,7 +192,6 @@ $i18n = [
"currency_info" => "지원하는 통화와 정확한 통화 코드 찾기",
"currency_performance" => "성능을 향상시키기 위해서는 사용할 통화들만 유지하세요.",
"fixer_api_key" => "Fixer API 키",
- "api_key" => "API 키",
"provider" => "제공자",
"fixer_info" => "여러 통화를 사용하고, 정확한 통계와 구독별 정렬을 원하시느 경우에는, Fixer에서 발급받은 무료 API 키가 필요합니다.",
"get_key" => "키 얻기",
diff --git a/includes/i18n/pl.php b/includes/i18n/pl.php
index b854856..41d9684 100644
--- a/includes/i18n/pl.php
+++ b/includes/i18n/pl.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Link do zresetowania hasła został wysłany na Twój adres e-mail",
'password_reset_successful' => "Hasło zostało zresetowane pomyślnie",
// Header
+ 'profile' => "Profil",
'subscriptions' => "Subskrypcje",
'stats' => "Statystyki",
'settings' => "Ustawienia",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "Autor",
'icons' => "Ikony",
'payment_icons' => "Ikony płatności",
- // Settings page
+ // Profile page
'upload_avatar' => "Prześlij awatar",
'file_type_error' => "Podany typ pliku nie jest obsługiwany.",
'user_details' => "Szczegóły użytkownika",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Kody zapasowe są jednorazowe i można je użyć do zalogowania się, jeśli nie masz dostępu do aplikacji uwierzytelniającej.",
"disable_two_factor_authentication" => "Wyłącz uwierzytelnianie dwuskładnikowe",
"totp_code" => "Kod TOTP",
+ "api_key" => "Klucz API",
+ "regenerate" => "Wygeneruj ponownie",
+ "api_key_info" => "Klucz API jest używany do integracji z innymi aplikacjami. Nie udostępniaj go nikomu.",
+ // Settings page
"monthly_budget" => "Miesięczny budżet",
"budget_info" => "Jeśli ustawisz budżet, zobaczysz pasek postępu na stronie głównej.",
"household" => "Gospodarstwo domowe",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Znajdź obsługiwane waluty i prawidłowe kody walut na",
"currency_performance" => "W celu poprawy wydajności przechowuj tylko te waluty, których używasz.",
"fixer_api_key" => "Klucz API Fixer'a",
- "api_key" => "Klucz API",
"provider" => "Dostawca",
"fixer_info" => "Jeśli używasz wielu walut i chcesz dokładnych statystyk i sortowania subskrypcji, niezbędny jest DARMOWY klucz API z Fixer'a.",
"get_key" => "Zdobądź klucz na stronie",
diff --git a/includes/i18n/pt.php b/includes/i18n/pt.php
index c817e7a..eb2050f 100644
--- a/includes/i18n/pt.php
+++ b/includes/i18n/pt.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Pedido de reposição de password enviado. Verifique o seu email.",
'password_reset_successful' => "Password reposta com sucesso",
// Header
+ 'profile' => "Perfil",
'subscriptions' => "Subscrições",
'stats' => "Estatísticas",
'settings' => "Definições",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "O Autor",
'icons' => "Ícones",
'payment_icons' => "Ícones de Pagamentos",
- // Settings page
+ // Profile page
'upload_avatar' => "Enviar avatar",
'file_type_error' => "Tipo de ficheiro não permitido",
'user_details' => "Detalhes do utilizador",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Guarde estes códigos num local seguro. Pode usá-los para aceder à sua conta se perder o acesso ao seu dispositivo de autenticação.",
"disable_two_factor_authentication" => "Desactivar autenticação de dois factores",
"totp_code" => "Código TOTP",
+ "api_key" => "API Key",
+ "regenerate" => "Regenerar",
+ "api_key_info" => "A sua API Key é usada para aceder à API do Wallos. Não a partilhe com ninguém.",
+ // Settings page
"monthly_budget" => "Orçamento Mensal",
"budget_info" => "Ao definir um orçamento pode comparar com os gastos reais na página de estatísticas.",
"household" => "Agregado",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Encontre a lista de moedas e os respectivos códigos em",
"currency_performance" => "Por motivos de desempenho mantenha apenas as moedas que usa.",
"fixer_api_key" => "Fixer API Key",
- "api_key" => "API Key",
"provider" => "Fornecedor",
"fixer_info" => "Se usa multiplas moedas e deseja estatísticas correctas é necessário uma API Key grátis do Fixer.",
"get_key" => "Obtenha a sua API Key em",
diff --git a/includes/i18n/pt_br.php b/includes/i18n/pt_br.php
index 0b95019..63f7eac 100644
--- a/includes/i18n/pt_br.php
+++ b/includes/i18n/pt_br.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Redefinição de senha enviada. Por favor, verifique seu email",
'password_reset_successful' => "Senha redefinida com sucesso",
// Header
+ 'profile' => "Perfil",
'subscriptions' => "Assinaturas",
'stats' => "Estatísticas",
'settings' => "Configurações",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "O autor",
'icons' => "Ícones",
'payment_icons' => "Ícones de pagamento",
- // Settings page
+ // Profile page
'upload_avatar' => "Carregar avatar",
'file_type_error' => "Tipo de arquivo não permitido",
'user_details' => "Informações do Usuário",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Guarde esses códigos em um lugar seguro. Eles podem ser usados para acessar sua conta se você perder o acesso ao aplicativo de autenticação.",
"disable_two_factor_authentication" => "Desativar autenticação de dois fatores",
"totp_code" => "Código TOTP",
+ "api_key" => "Chave da API",
+ "regenerate" => "Regenerar",
+ "api_key_info" => "A chave da API é usada para acessar a API do Wallos. Não compartilhe sua chave com ninguém.",
+ // Settings page
"monthly_budget" => "Orçamento mensal",
"budget_info" => "O orçamento mensal é usado para calcular estatísticas",
"household" => "Membros",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Encontre as moedas suportadas e os códigos de moeda em",
"currency_performance" => "Para um melhor desempenho, mantenha apenas as moedas que você utiliza.",
"fixer_api_key" => "Chave da API do Fixer",
- "api_key" => "Chave da API",
"provider" => "Fornecedor",
"fixer_info" => "Se você utiliza múltiplas moedas e deseja ter estatísticas precisas e ordenação das assinaturas, uma chave GRATUÍTA da API do Fixer é necessária.",
"get_key" => "Obtenha a sua chave em",
diff --git a/includes/i18n/ru.php b/includes/i18n/ru.php
index b0af9db..7f00ce9 100644
--- a/includes/i18n/ru.php
+++ b/includes/i18n/ru.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Ссылка для сброса пароля отправлена на вашу электронную почту",
'password_reset_successful' => "Пароль успешно сброшен",
// Header
+ 'profile' => "Профиль",
'subscriptions' => "Подписки",
'stats' => "Статистика",
'settings' => "Настройки",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "Автор",
'icons' => "Значки",
'payment_icons' => "Значки способов оплаты",
- // Settings page
+ // Profile page
'upload_avatar' => "Загрузить аватар",
'file_type_error' => "Указанный тип файла не поддерживается.",
'user_details' => "Данные пользователя",
@@ -133,6 +134,10 @@ $i18n = [
"disable_two_factor_authentication" => "Отключить двухфакторную аутентификацию",
"totp_code" => "Код TOTP",
"monthly_budget" => "Ежемесячный бюджет",
+ "api_key" => "API ключ",
+ "regenerate" => "Сгенерировать",
+ "api_key_info" => "API ключ используется для доступа к вашим данным через API. Не передавайте его третьим лицам.",
+ // Settings page
"budget_info" => "Если вы укажете бюджет, Wallos будет отображать вашу текущую стоимость подписок в сравнении с вашим бюджетом.",
"household" => "Семья",
"save_member" => "Сохранить члена семьи",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Найдите поддерживаемые валюты и правильные коды валют на",
"currency_performance" => "Для повышения производительности сохраняйте только те валюты, которые вы используете.",
"fixer_api_key" => "Ключ Fixer API",
- "api_key" => "API ключ",
"provider" => "Провайдер",
"fixer_info" => "Если вы используете несколько валют и хотите получить точную статистику и сортировку подписок, вам необходим БЕСПЛАТНЫЙ ключ API от Fixer.",
"get_key" => "Получите ключ по адресу",
diff --git a/includes/i18n/sl.php b/includes/i18n/sl.php
index 0d17734..d4e05ab 100644
--- a/includes/i18n/sl.php
+++ b/includes/i18n/sl.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "E-pošta ponastavitev gesla je bila poslana. Prosim, preglejte vašo e-pošto.",
'password_reset_successful' => "Ponastavitev gesla je uspela",
// Header
+ 'profile' => "Profil",
'subscriptions' => "Naročnine",
'stats' => "Statistika",
'settings' => "Nastavitve",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "Avtor",
'icons' => "Ikone",
'payment_icons' => "Ikone plačil",
- // Settings page
+ // Profile page
'upload_avatar' => "Naloži avatar",
'file_type_error' => "Vrsta datoteke ni podprta.",
'user_details' => "Podrobnosti o uporabniku",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Shranite te rezervne kode na varno mesto. Uporabite jih lahko, če izgubite dostop do svoje aplikacije za preverjanje pristnosti.",
"disable_two_factor_authentication" => "Onemogoči dvostopenjsko preverjanje pristnosti",
"totp_code" => "TOTP koda",
+ "api_key" => "API ključ",
+ "regenerate" => "Ponovno generiraj",
+ "api_key_info" => "API ključ se uporablja za dostop do vaših podatkov prek API-ja. Če mislite, da je vaš ključ kompromitiran, ga lahko ponovno generirate.",
+ // Settings page
"monthly_budget" => "Mesečni proračun",
"budget_info" => "Mesečni proračun se uporablja za izračun statistike",
"household" => "Gospodinjstvo",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Poiščite podprte valute in pravilne kode valut na",
"currency_performance" => "Za izboljšano delovanje obdržite samo valute, ki jih uporabljate.",
"fixer_api_key" => "API ključ za Fixer",
- "api_key" => "Fixer API",
"provider" => "Ponudnik",
"fixer_info" => "Če uporabljate več valut in želite natančno statistiko in razvrščanje naročnin, potrebujete BREZPLAČNI API ključ od Fixerja.",
"get_key" => "Pridobite svoj ključ pri",
diff --git a/includes/i18n/sr.php b/includes/i18n/sr.php
index abc6cc5..775c2fa 100644
--- a/includes/i18n/sr.php
+++ b/includes/i18n/sr.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Ресетовање лозинке је послато на вашу е-пошту",
'password_reset_successful' => "Ресетовање лозинке је успешно",
// Header
+ 'profile' => "Профил",
'subscriptions' => "Претплате",
'stats' => "Статистике",
'settings' => "Подешавања",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "Аутор",
'icons' => "Иконе",
'payment_icons' => "Иконе плаћања",
- // Страница са подешавањима
+ // Profile page
'upload_avatar' => "Постави аватар",
'file_type_error' => "Датотека није у подржаном формату.",
'user_details' => "Кориснички детаљи",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Сачувајте ове кодове на безбедно место. Користићете их када изгубите приступ апликацији за аутентификацију.",
"disable_two_factor_authentication" => "Онемогући двофакторску аутентикацију",
"totp_code" => "ТОТП код",
+ "api_key" => "API кључ",
+ "regenerate" => "Генериши",
+ "api_key_info" => "API кључ је потребан за коришћење API-ја за приступ вашим подацима. Не делите овај кључ са другима.",
+ // Страница са подешавањима
"monthly_budget" => "Месечни буџет",
"budget_info" => "Унесите месечни буџет да бисте видели препоручену максималну цену претплате на почетној страници.",
"household" => "Домаћинство",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Пронађите подржане валуте и исправне кодове валута на",
"currency_performance" => "За побољшану перформансу, задржите само валуте које користите.",
"fixer_api_key" => "Fixer API кључ",
- "api_key" => "API кључ",
"provider" => "Провајдер",
"fixer_info" => "Ако користите више валута и желите тачне статистике и сортирање претплата, неопходан је БЕСПЛАТНИ API кључ од Fixer.",
"get_key" => "Добијте свој кључ на",
diff --git a/includes/i18n/sr_lat.php b/includes/i18n/sr_lat.php
index be91012..45ed458 100644
--- a/includes/i18n/sr_lat.php
+++ b/includes/i18n/sr_lat.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Poslali smo vam e-poštu sa uputstvima za resetovanje lozinke",
'password_reset_successful' => "Lozinka uspešno resetovana",
// Header
+ 'profile' => "Profil",
'subscriptions' => "Pretplate",
'stats' => "Statistike",
'settings' => "Podešavanja",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "Autor",
'icons' => "Ikone",
'payment_icons' => "Ikone za plaćanje",
- // Stranica sa podešavanjima
+ // Stranica sa profilom
'upload_avatar' => "Učitaj avatar",
'file_type_error' => "Tip datoteke koji ste priložili nije podržan.",
'user_details' => "Detalji korisnika",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Ovo su vaši rezervni kodovi za dvofaktorsku autentifikaciju. Sačuvajte ih na sigurnom mestu.",
"disable_two_factor_authentication" => "Onemogući dvofaktorsku autentifikaciju",
"totp_code" => "Kod za dvofaktorsku autentifikaciju",
+ "api_key" => "API ključ",
+ "regenerate" => "Regeneriši",
+ "api_key_info" => "API ključ se koristi za pristup Wallos API-ju. Ako mislite da je vaš ključ kompromitovan, možete ga regenerisati.",
+ // Stranica sa podešavanjima
"monthly_budget" => "Mesečni budžet",
"budget_info" => "Ovo je vaš mesečni budžet za sve pretplate. Ovo je samo informativno i ne ograničava vas.",
"household" => "Domaćinstvo",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Pronađite podržane valute i ispravne kodove valuta na",
"currency_performance" => "Za poboljšanu performansu, zadržite samo valute koje koristite.",
"fixer_api_key" => "Fixer API ključ",
- "api_key" => "API ključ",
"provider" => "Provajder",
"fixer_info" => "Ako koristite više valuta i želite tačne statistike i sortiranje pretplata, neophodan je BESPLATNI API ključ sa Fixer-a.",
"get_key" => "Pronađite svoj ključ na",
diff --git a/includes/i18n/tr.php b/includes/i18n/tr.php
index 8a47f8c..85facc8 100644
--- a/includes/i18n/tr.php
+++ b/includes/i18n/tr.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "Şifre sıfırlama bağlantısı e-posta adresinize gönderildi. Lütfen e-postanızı kontrol edin.",
'password_reset_successful' => "Şifre sıfırlama başarılı",
// Header
+ 'profile' => "Profil",
'subscriptions' => "Abonelikler",
'stats' => "İstatistikler",
'settings' => "Ayarlar",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "Yazar",
'icons' => "İkonlar",
'payment_icons' => "Ödeme İkonları",
- // Settings page
+ // Profile page
'upload_avatar' => "Avatarı yükle",
'file_type_error' => "Dosya türü izin verilmiyor",
'user_details' => "Kullanıcı Detayları",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "Yedek kodları güvenli bir yerde saklayın. Her biri yalnızca bir kez kullanılabilir.",
"disable_two_factor_authentication" => "İki Faktörlü Kimlik Doğrulamayı Devre Dışı Bırak",
"totp_code" => "TOTP Kodu",
+ "api_key" => "API Anahtarı",
+ "regenerate" => "Yeniden Oluştur",
+ "api_key_info" => "API Anahtarı, Wallos'un API'sine erişmek için kullanılır. Bu anahtarı kimseyle paylaşmayın.",
+ // Settings page
"monthly_budget" => "Aylık Bütçe",
"budget_info" => "Bir bütçe belirlemek, istatistik sayfasında bütçe ve gerçek harcamaları karşılaştırmanıza olanak tanır.",
"household" => "Hane",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "Desteklenen para birimlerini ve doğru para birimi kodlarını burada bulun",
"currency_performance" => "Performansı artırmak için sadece kullandığınız para birimlerini tutun.",
"fixer_api_key" => "Fixer API Anahtarı",
- "api_key" => "API Anahtarı",
"provider" => "Sağlayıcı",
"fixer_info" => "Birden fazla para birimi kullanıyorsanız ve aboneliklerde doğru istatistikler ve sıralama istiyorsanız, Fixer'dan ÜCRETSİZ bir API Anahtarı gereklidir.",
"get_key" => "Anahtarınızı şuradan alın",
diff --git a/includes/i18n/zh_cn.php b/includes/i18n/zh_cn.php
index 77cd395..08e1d60 100644
--- a/includes/i18n/zh_cn.php
+++ b/includes/i18n/zh_cn.php
@@ -31,6 +31,7 @@ $i18n = [
'password_reset_successful' => "密码重置成功",
// 页眉
+ 'profile' => "个人资料",
'subscriptions' => "订阅",
'stats' => "统计",
'settings' => "设置",
@@ -124,7 +125,7 @@ $i18n = [
'icons' => "图标",
'payment_icons' => "支付图标",
- // 设置页面
+ // Profile Page
'upload_avatar' => "上传头像",
'file_type_error' => "文件类型不允许",
'user_details' => "用户详情",
@@ -140,6 +141,10 @@ $i18n = [
"totp_backup_codes_info" => "请务必保存这些备份代码。如果您丢失了双因素身份验证设备,您将需要这些备份代码来登录。",
"disable_two_factor_authentication" => "禁用双因素身份验证",
"totp_code" => "TOTP 代码",
+ "api_key" => "API 密钥",
+ "regenerate" => "重新生成",
+ "api_key_info" => "API 密钥用于与 Wallos API 通信。请勿将此密钥分享给任何人。",
+ // 设置页面
"monthly_budget" => "每月预算",
"budget_info" => "设置预算后,您可以在统计页面上比较预算和实际支出。",
"household" => "家庭",
@@ -194,7 +199,6 @@ $i18n = [
"currency_info" => "如要查找支持的货币与对应代码,请前往",
"currency_performance" => "为提高性能,建议您只保留常用货币。",
"fixer_api_key" => "Fixer API 密钥",
- "api_key" => "API 密钥",
"provider" => "提供商",
"fixer_info" => "如果您使用多种货币,希望统计信息和订阅排序更精确,则需要 Fixer API 密钥来查询汇率(可免费申请)。",
"get_key" => "申请密钥",
diff --git a/includes/i18n/zh_tw.php b/includes/i18n/zh_tw.php
index b939408..54cc72b 100644
--- a/includes/i18n/zh_tw.php
+++ b/includes/i18n/zh_tw.php
@@ -28,6 +28,7 @@ $i18n = [
'reset_sent_check_email' => "重設密碼的電子郵件已發送,請檢查您的電子郵件",
'password_reset_successful' => "密碼重設成功",
// 頁首
+ 'profile' => "個人資料",
'subscriptions' => "訂閱",
'stats' => "統計",
'settings' => "設定",
@@ -116,7 +117,7 @@ $i18n = [
'the_author' => "作者",
'icons' => "圖示",
'payment_icons' => "付款圖示",
- // 設定頁面
+ // Profile page
'upload_avatar' => "上传头像",
'file_type_error' => "文件类型不允许",
'user_details' => "使用者詳細資訊",
@@ -132,6 +133,10 @@ $i18n = [
"totp_backup_codes_info" => "請妥善保管這些代碼。當您無法使用雙因素驗證應用程式時,您可以使用這些代碼來登入。",
"disable_two_factor_authentication" => "停用雙因素驗證",
"totp_code" => "TOTP 驗證碼",
+ "api_key" => "API 金鑰",
+ "regenerate" => "重新生成",
+ "api_key_info" => "API 金鑰用於與 Wallos API 進行通信。請勿將此金鑰分享給任何人。",
+ // 設定頁面
"monthly_budget" => "每月預算",
"budget_info" => "設定預算後,您可以在統計頁面上比較預算和實際支出。",
"household" => "家庭",
@@ -186,7 +191,6 @@ $i18n = [
"currency_info" => "如要查詢支援的貨幣與相對應的貨幣代碼,請前往",
"currency_performance" => "為提高效能,建議您只保留常用的貨幣。",
"fixer_api_key" => "Fixer API 金鑰",
- "api_key" => "API 金鑰",
"provider" => "提供者",
"fixer_info" => "如果您使用多種貨幣單位,且希望統計資訊和訂閱排序更加精確,則需要 Fixer API 金鑰來查詢匯率(可免費申請)。",
"get_key" => "申請金鑰",
diff --git a/includes/version.php b/includes/version.php
index cd3fb87..a9b2e79 100644
--- a/includes/version.php
+++ b/includes/version.php
@@ -1,3 +1,3 @@
<?php
-$version = "v2.26.0";
+$version = "v2.27.0";
?>
\ No newline at end of file
diff --git a/index.php b/index.php
index e673e07..7ce5690 100644
--- a/index.php
+++ b/index.php
@@ -155,7 +155,7 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden
?>
<header class="<?= $headerClass ?>" id="main-actions">
- <button class="button mobileNavigationHideOnMobile" onClick="addSubscription()">
+ <button class="button" onClick="addSubscription()">
<i class="fa-solid fa-circle-plus"></i>
<?= translate('new_subscription', $i18n) ?>
</button>
diff --git a/migrations/000029.php b/migrations/000029.php
new file mode 100644
index 0000000..658971d
--- /dev/null
+++ b/migrations/000029.php
@@ -0,0 +1,21 @@
+<?php
+
+// This migration adds a "api_key" column to the user table
+// It also generates an API key for each user
+
+/** @noinspection PhpUndefinedVariableInspection */
+$columnQuery = $db->query("SELECT * FROM pragma_table_info('user') where name='api_key'");
+$columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false;
+
+if ($columnRequired) {
+ $db->exec('ALTER TABLE user ADD COLUMN api_key TEXT');
+}
+
+/** @noinspection PhpUndefinedVariableInspection */
+$users = $db->query('SELECT * FROM user');
+while ($user = $users->fetchArray(SQLITE3_ASSOC)) {
+ if (empty($user['api_key'])) {
+ $apiKey = bin2hex(random_bytes(32));
+ $db->exec('UPDATE user SET api_key = "' . $apiKey . '" WHERE id = ' . $user['id']);
+ }
+}
diff --git a/profile.php b/profile.php
new file mode 100644
index 0000000..29e664a
--- /dev/null
+++ b/profile.php
@@ -0,0 +1,303 @@
+<?php
+// Show all errors
+ini_set('display_errors', 1);
+ini_set('display_startup_errors', 1);
+error_reporting(E_ALL);
+
+require_once 'includes/header.php';
+?>
+
+<script src="scripts/libs/sortable.min.js"></script>
+<script src="scripts/libs/qrcode.min.js"></script>
+<style>
+ .logo-preview:after {
+ content: '<?= translate('upload_logo', $i18n) ?>';
+ }
+</style>
+<section class="contain settings">
+ <section class="account-section">
+ <header>
+ <h2><?= translate('user_details', $i18n) ?></h2>
+ </header>
+ <form action="endpoints/user/saveuser.php" method="post" id="userForm" enctype="multipart/form-data">
+ <div class="user-form">
+ <div class="fields">
+ <div>
+ <div class="user-avatar">
+ <img src="<?= $userData['avatar'] ?>" alt="avatar" class="avatar" id="avatarImg"
+ onClick="toggleAvatarSelect()" />
+ <span class="edit-avatar" onClick="toggleAvatarSelect()" title="Change Avatar">
+ <i class="fa-solid fa-pencil"></i>
+ </span>
+ </div>
+
+ <input type="hidden" name="avatar" value="<?= $userData['avatar'] ?>" id="avatarUser" />
+ <div class="avatar-select" id="avatarSelect">
+ <div class="avatar-list">
+ <?php foreach (scandir('images/avatars') as $index => $image): ?>
+ <?php if (!str_starts_with($image, '.')): ?>
+ <img src="images/avatars/<?= $image ?>" alt="<?= $image ?>" class="avatar-option"
+ data-src="images/avatars/<?= $image ?>">
+ <?php endif ?>
+ <?php endforeach ?>
+ <?php foreach (scandir('images/uploads/logos/avatars') as $index => $image): ?>
+ <?php if (!str_starts_with($image, '.')): ?>
+ <div class="avatar-container" data-src="<?= $image ?>">
+ <img src="images/uploads/logos/avatars/<?= $image ?>" alt="<?= $image ?>"
+ class="avatar-option" data-src="images/uploads/logos/avatars/<?= $image ?>">
+ <div class="remove-avatar" onclick="deleteAvatar('<?= $image ?>')"
+ title="Delete avatar">
+ <i class="fa-solid fa-xmark"></i>
+ </div>
+ </div>
+ <?php endif ?>
+ <?php endforeach ?>
+ <label for="profile_pic" class="add-avatar"
+ title="<?= translate('upload_avatar', $i18n) ?>">
+ <i class="fa-solid fa-arrow-up-from-bracket"></i>
+ </label>
+ </div>
+ <input type="file" id="profile_pic" class="hidden-input" name="profile_pic"
+ accept="image/jpeg, image/png, image/gif, image/webp"
+ onChange="successfulUpload(this, '<?= addslashes(translate('file_type_error', $i18n)) ?>')" />
+ </div>
+ </div>
+ <div class="grow">
+ <div class="form-group">
+ <label for="username"><?= translate('username', $i18n) ?>:</label>
+ <input type="text" id="username" name="username" value="<?= $userData['username'] ?>"
+ disabled>
+ </div>
+ <div class="form-group">
+ <label for="email"><?= translate('email', $i18n) ?>:</label>
+ <input type="email" id="email" name="email" value="<?= $userData['email'] ?>" required>
+ </div>
+ <div class="form-group">
+ <label for="password"><?= translate('password', $i18n) ?>:</label>
+ <input type="password" id="password" name="password" <?= $demoMode ? 'disabled title="Not available on Demo Mode"' : '' ?>>
+ </div>
+ <div class="form-group">
+ <label for="confirm_password"><?= translate('confirm_password', $i18n) ?>:</label>
+ <input type="password" id="confirm_password" name="confirm_password" <?= $demoMode ? 'disabled title="Not available on Demo Mode"' : '' ?>>
+ </div>
+ <?php
+ $currencies = array();
+ $query = "SELECT * FROM currencies WHERE user_id = :userId";
+ $query = $db->prepare($query);
+ $query->bindValue(':userId', $userId, SQLITE3_INTEGER);
+ $result = $query->execute();
+ while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
+ $currencyId = $row['id'];
+ $currencies[$currencyId] = $row;
+ }
+ $userData['currency_symbol'] = "€";
+ ?>
+ <div class="form-group">
+ <label for="currency"><?= translate('main_currency', $i18n) ?>:</label>
+ <select id="currency" name="main_currency" placeholder="Currency">
+ <?php
+ foreach ($currencies as $currency) {
+ $selected = "";
+ if ($currency['id'] == $userData['main_currency']) {
+ $selected = "selected";
+ $userData['currency_symbol'] = $currency['symbol'];
+ }
+ ?>
+ <option value="<?= $currency['id'] ?>" <?= $selected ?>><?= $currency['name'] ?></option>
+ <?php
+ }
+ ?>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="language"><?= translate('language', $i18n) ?>:</label>
+ <select id="language" name="language" placeholder="Language">
+ <?php
+ foreach ($languages as $code => $language) {
+ $selected = ($code === $lang) ? 'selected' : '';
+ ?>
+ <option value="<?= $code ?>" <?= $selected ?>><?= $language['name'] ?></option>
+ <?php
+ }
+ ?>
+ </select>
+ </div>
+ </div>
+ </div>
+ <div class="buttons">
+ <input type="submit" value="<?= translate('save', $i18n) ?>" id="userSubmit"
+ class="thin mobile-grow" />
+ </div>
+ </div>
+ </form>
+ </section>
+
+ <?php
+ $sql = "SELECT login_disabled FROM admin";
+ $stmt = $db->prepare($sql);
+ $result = $stmt->execute();
+ $row = $result->fetchArray(SQLITE3_ASSOC);
+ $loginDisabled = $row['login_disabled'];
+
+ $showTotpSection = true;
+ if ($loginDisabled && !$userData['totp_enabled']) {
+ $showTotpSection = false;
+ }
+
+ if ($showTotpSection) {
+ ?>
+ <section class="account-section">
+ <header>
+ <h2><?= translate("two_factor_authentication", $i18n) ?></h2>
+ </header>
+ <div class="account-2fa">
+ <div class="buttons">
+ <?php
+ if (!$userData['totp_enabled']) {
+ ?>
+ <input type="button" value="<?= translate('enable_two_factor_authentication', $i18n) ?>" id="enableTotp"
+ onClick="enableTotp()" class="button thin mobile-grow"/>
+ <div class="totp-popup" id="totp-popup">
+ <header>
+ <h3><?= translate('enable_two_factor_authentication', $i18n) ?></h3>
+ <span class="fa-solid fa-xmark close-form" onclick="closeTotpPopup()"></span>
+ </header>
+ <div class="totp-popup-content">
+ <div class="totp-setup" id="totp-setup">
+ <div class="totp-qrcode-container">
+ <div id="totp-qr-code"></div>
+ </div>
+ <p class="totp-secret" id="totp-secret-code"></p>
+ <div class="form-group-inline">
+ <input type="hidden" name="totp-secret" id="totp-secret" value="" />
+ <input type="text" id="totp" name="totp"
+ placeholder="<?= translate("totp_code", $i18n) ?>" />
+ <input type="button" value="<?= translate('enable', $i18n) ?>" id="enableTotpButton"
+ onClick="submitTotp()" />
+ </div>
+ </div>
+ <div class="totp-setup hide" id="totp-backup-codes">
+ <h4><?= translate('backup_codes', $i18n) ?></h4>
+ <ul class="totp-backup-codes" id="backup-codes"></ul>
+ <div class="form-group-inline wrap">
+ <input type="button" class="button secondary-button grow"
+ value="<?= translate('copy_to_clipboard', $i18n) ?>" id="copyBackupCodes"
+ onClick="copyBackupCodes()" />
+ <input type="button" class="grow"
+ value="<?= translate('download_backup_codes', $i18n) ?>" id="downloadBackupCodes"
+ onClick="downloadBackupCodes()" />
+ </div>
+ <div class="settings-notes">
+ <p>
+ <i class="fa-solid fa-circle-info"></i>
+ <?= translate('totp_backup_codes_info', $i18n) ?>
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
+ <?php
+ } else {
+ ?>
+ <input type="button" class="button secondary-button thin mobile-grow"
+ value="<?= translate('disable_two_factor_authentication', $i18n) ?>" id="disableTotp"
+ onClick="disableTotp()" />
+ <div class="totp-popup" id="totp-disable-popup">
+ <header>
+ <h3><?= translate('disable_two_factor_authentication', $i18n) ?></h3>
+ <span class="fa-solid fa-xmark close-form" onclick="closeTotpDisablePopup()"></span>
+ </header>
+ <div class="totp-popup-content">
+ <div class="form-group-inline">
+ <input type="text" id="totp-disable" name="totp-disable" placeholder="totp" />
+ <input type="button" value="<?= translate('disable', $i18n) ?>" id="disableTotpButton"
+ onClick="submitDisableTotp()" />
+ </div>
+ </div>
+ </div>
+ <?php
+ }
+ ?>
+ </div>
+ <div class="settings-notes">
+ <p>
+ <i class="fa-solid fa-circle-info"></i>
+ <?php
+ if (!$userData['totp_enabled']) {
+ echo translate('two_factor_info', $i18n);
+ } else {
+ echo translate('two_factor_enabled_info', $i18n);
+ }
+ ?>
+ </p>
+ </div>
+ </div>
+ </section>
+ <?php
+ }
+
+ ?>
+
+ <section class="account-section">
+ <header>
+ <h2><?= translate('api_key', $i18n) ?></h2>
+ </header>
+ <div class="account-api-key">
+ <div class="form-group-inline">
+ <input type="text" id="apikey" name="apikey" value="<?= $userData['api_key'] ?>" placeholder="API Key" readonly>
+ <input type="submit" value="<?= translate('regenerate', $i18n) ?>" id="regenerateApiKey" onClick="regenerateApiKey()" />
+ </div>
+ <div class="settings-notes">
+ <p>
+ <i class="fa-solid fa-circle-info"></i> <?= translate('api_key_info', $i18n) ?>
+ </p>
+ </div>
+ </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 wrap">
+ <input type="button" value="<?= translate('export_as_json', $i18n) ?>" onClick="exportAsJson()"
+ class="secondary-button thin mobile-grow" id="export-json" <?= $demoMode ? 'disabled title="Not available on Demo Mode"' : '' ?>>
+ <input type="button" value="<?= translate('export_as_csv', $i18n) ?>" onClick="exportAsCsv()"
+ class="secondary-button thin mobile-grow" id="export-csv" <?= $demoMode ? 'disabled title="Not available on Demo Mode"' : '' ?>>
+ </div>
+ </div>
+ </div>
+ <div>
+ <?php
+ if ($userId != 1 && !$demoMode) {
+ ?>
+ <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/profile.js?<?= $version ?>"></script>
+<script src="scripts/theme.js?<?= $version ?>"></script>
+<script src="scripts/notifications.js?<?= $version ?>"></script>
+
+<?php
+require_once 'includes/footer.php';
+?>
\ No newline at end of file
diff --git a/scripts/profile.js b/scripts/profile.js
new file mode 100644
index 0000000..5ca60ba
--- /dev/null
+++ b/scripts/profile.js
@@ -0,0 +1,356 @@
+document.addEventListener('DOMContentLoaded', function () {
+
+ document.getElementById("userForm").addEventListener("submit", function (event) {
+ event.preventDefault();
+ document.getElementById("userSubmit").disabled = true;
+ const formData = new FormData(event.target);
+ fetch("endpoints/user/save_user.php", {
+ method: "POST",
+ body: formData
+ })
+ .then(response => response.json())
+ .then(data => {
+ if (data.success) {
+ document.getElementById("avatar").src = document.getElementById("avatarImg").src;
+ var newUsername = document.getElementById("username").value;
+ document.getElementById("user").textContent = newUsername;
+ showSuccessMessage(data.message);
+ if (data.reload) {
+ location.reload();
+ }
+ } else {
+ showErrorMessage(data.errorMessage);
+ }
+ document.getElementById("userSubmit").disabled = false;
+ })
+ .catch(error => {
+ showErrorMessage(translate('unknown_error'));
+ });
+ });
+
+});
+
+function toggleAvatarSelect() {
+ var avatarSelect = document.getElementById("avatarSelect");
+ if (avatarSelect.classList.contains("is-open")) {
+ avatarSelect.classList.remove("is-open");
+ } else {
+ avatarSelect.classList.add("is-open");
+ }
+}
+
+function closeAvatarSelect() {
+ var avatarSelect = document.getElementById("avatarSelect");
+ avatarSelect.classList.remove("is-open");
+}
+
+document.querySelectorAll('.avatar-option').forEach((avatar) => {
+ avatar.addEventListener("click", () => {
+ changeAvatar(avatar.src);
+ document.getElementById('avatarUser').value = avatar.getAttribute('data-src');
+ closeAvatarSelect();
+ })
+});
+
+function changeAvatar(src) {
+ document.getElementById("avatarImg").src = src;
+}
+
+function successfulUpload(field, msg) {
+ var reader = new FileReader();
+
+ if (field.files.length === 0) {
+ return;
+ }
+
+ if (!['image/jpeg', 'image/png', 'image/gif', 'image/jtif', 'image/webp'].includes(field.files[0]['type'])) {
+ showErrorMessage(msg);
+ return;
+ }
+
+ reader.onload = function () {
+ changeAvatar(reader.result);
+ };
+
+ reader.readAsDataURL(field.files[0]);
+ closeAvatarSelect();
+}
+
+function deleteAvatar(path) {
+ fetch('/endpoints/user/delete_avatar.php', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ avatar: path }),
+ })
+ .then(response => response.json())
+ .then(data => {
+ if (data.success) {
+ var avatarContainer = document.querySelector(`.avatar-container[data-src="${path}"]`);
+ if (avatarContainer) {
+ avatarContainer.remove();
+ }
+ showSuccessMessage();
+ } else {
+ showErrorMessage();
+ }
+ })
+ .catch((error) => {
+ console.error('Error:', error);
+ });
+}
+
+function enableTotp() {
+ const totpSecret = document.querySelector('#totp-secret');
+ const totpSecretCode = document.querySelector('#totp-secret-code');
+ const qrCode = document.getElementById('totp-qr-code');
+ totpSecret.value = '';
+ totpSecretCode.textContent = '';
+ qrCode.innerHTML = '';
+
+ fetch('endpoints/user/enable_totp.php?generate=true', {
+ method: 'GET'
+ })
+ .then(response => response.json())
+ .then(data => {
+ if (data.success) {
+ totpSecret.value = data.secret;
+ totpSecretCode.textContent = data.secret;
+ new QRCode(qrCode, data.qrCodeUrl);
+
+ openTotpPopup();
+ } else {
+ showErrorMessage(data.message);
+ }
+ })
+ .catch(error => {
+ showErrorMessage(error);
+ });
+}
+
+function openTotpPopup() {
+ const enableTotpButton = document.getElementById('enableTotp');
+ enableTotpButton.disabled = true;
+
+ const totpPopup = document.getElementById('totp-popup');
+ totpPopup.classList.add('is-open');
+}
+
+function closeTotpPopup() {
+ const enableTotpButton = document.getElementById('enableTotp');
+ enableTotpButton.disabled = false;
+ const totpPopup = document.getElementById('totp-popup');
+ totpPopup.classList.remove('is-open');
+
+ const totpBackupCodes = document.getElementById('totp-backup-codes');
+ if (!totpBackupCodes.classList.contains('hide')) {
+ location.reload();
+ }
+}
+
+function submitTotp() {
+ const totpCode = document.getElementById('totp').value;
+ const totpSecret = document.getElementById('totp-secret').value;
+
+ fetch('endpoints/user/enable_totp.php', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ totpCode: totpCode, totpSecret: totpSecret }),
+ })
+ .then(response => response.json())
+ .then(data => {
+ if (data.success) {
+ showSuccessMessage(data.message);
+ const backupCodes = data.backupCodes;
+ const backupCodesList = document.getElementById('backup-codes');
+ backupCodesList.innerHTML = '';
+ backupCodes.forEach(code => {
+ const li = document.createElement('li');
+ li.textContent = code;
+ backupCodesList.appendChild(li);
+ });
+
+ const totpSetup = document.getElementById('totp-setup');
+ const totpBackupCodes = document.getElementById('totp-backup-codes');
+
+ totpSetup.classList.add('hide');
+ totpBackupCodes.classList.remove('hide');
+ } else {
+ showErrorMessage(data.message);
+ console.log(error);
+ }
+ })
+ .catch(error => {
+ showErrorMessage(error);
+ console.log(error);
+ });
+}
+
+function copyBackupCodes() {
+ const backupCodes = document.querySelectorAll('#backup-codes li');
+ const codes = Array.from(backupCodes).map(code => code.textContent).join('\n');
+
+ navigator.clipboard.writeText(codes)
+ .then(() => {
+ showSuccessMessage(translate('copied_to_clipboard'));
+ })
+ .catch(() => {
+ showErrorMessage(translate('unknown_error'));
+ });
+}
+
+function downloadBackupCodes() {
+ const backupCodes = document.querySelectorAll('#backup-codes li');
+ const codes = Array.from(backupCodes).map(code => code.textContent).join('\n');
+ const element = document.createElement('a');
+
+ element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(codes));
+ element.setAttribute('download', 'wallos-backup-codes.txt');
+ element.style.display = 'none';
+ document.body.appendChild(element);
+
+ element.click();
+
+ document.body.removeChild(element);
+}
+
+function closeTotpDisablePopup() {
+ const totpPopup = document.getElementById('totp-disable-popup');
+ totpPopup.classList.remove('is-open');
+}
+
+function disableTotp() {
+ const totpPopup = document.getElementById('totp-disable-popup');
+ totpPopup.classList.add('is-open');
+}
+
+function submitDisableTotp() {
+ const totpCode = document.getElementById('totp-disable').value;
+
+ fetch('endpoints/user/disable_totp.php', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ totpCode: totpCode }),
+ })
+ .then(response => response.json())
+ .then(data => {
+ if (data.success) {
+ showSuccessMessage(data.message);
+ if (data.reload) {
+ location.reload();
+ }
+ } else {
+ showErrorMessage(data.message);
+ }
+ })
+ .catch(error => {
+ showErrorMessage(error);
+ });
+}
+
+function regenerateApiKey() {
+ const regenerateButton = document.getElementById('regenerateApiKey');
+ regenerateButton.disabled = true;
+
+ fetch('endpoints/user/regenerateapikey.php', {
+ method: 'POST',
+ })
+ .then(response => response.json())
+ .then(data => {
+ regenerateButton.disabled = false;
+ if (data.success) {
+ const newApiKey = data.apiKey;
+ document.getElementById('apikey').value = newApiKey;
+ showSuccessMessage(data.message);
+ } else {
+ showErrorMessage(data.message);
+ }
+ })
+ .catch(error => {
+ regenerateButton.disabled = false;
+ showErrorMessage(error);
+ });
+}
+
+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'));
+ });
+}
+
diff --git a/scripts/settings.js b/scripts/settings.js
index e482c81..bb42344 100644
--- a/scripts/settings.js
+++ b/scripts/settings.js
@@ -18,77 +18,6 @@ const editSvgContent = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" view
</g>
</svg>`;
-function toggleAvatarSelect() {
- var avatarSelect = document.getElementById("avatarSelect");
- if (avatarSelect.classList.contains("is-open")) {
- avatarSelect.classList.remove("is-open");
- } else {
- avatarSelect.classList.add("is-open");
- }
-}
-
-function closeAvatarSelect() {
- var avatarSelect = document.getElementById("avatarSelect");
- avatarSelect.classList.remove("is-open");
-}
-
-document.querySelectorAll('.avatar-option').forEach((avatar) => {
- avatar.addEventListener("click", () => {
- changeAvatar(avatar.src);
- document.getElementById('avatarUser').value = avatar.getAttribute('data-src');
- closeAvatarSelect();
- })
-});
-
-function changeAvatar(src) {
- document.getElementById("avatarImg").src = src;
-}
-
-function successfulUpload(field, msg) {
- var reader = new FileReader();
-
- if (field.files.length === 0) {
- return;
- }
-
- if (!['image/jpeg', 'image/png', 'image/gif', 'image/jtif', 'image/webp'].includes(field.files[0]['type'])) {
- showErrorMessage(msg);
- return;
- }
-
- reader.onload = function () {
- changeAvatar(reader.result);
- };
-
- reader.readAsDataURL(field.files[0]);
- closeAvatarSelect();
-}
-
-function deleteAvatar(path) {
- fetch('/endpoints/user/delete_avatar.php', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ avatar: path }),
- })
- .then(response => response.json())
- .then(data => {
- if (data.success) {
- var avatarContainer = document.querySelector(`.avatar-container[data-src="${path}"]`);
- if (avatarContainer) {
- avatarContainer.remove();
- }
- showSuccessMessage();
- } else {
- showErrorMessage();
- }
- })
- .catch((error) => {
- console.error('Error:', error);
- });
-}
-
function saveBudget() {
const button = document.getElementById("saveBudget");
button.disabled = true;
@@ -803,34 +732,6 @@ var sortable = Sortable.create(el, {
document.addEventListener('DOMContentLoaded', function () {
- document.getElementById("userForm").addEventListener("submit", function (event) {
- event.preventDefault();
- document.getElementById("userSubmit").disabled = true;
- const formData = new FormData(event.target);
- fetch("endpoints/user/save_user.php", {
- method: "POST",
- body: formData
- })
- .then(response => response.json())
- .then(data => {
- if (data.success) {
- document.getElementById("avatar").src = document.getElementById("avatarImg").src;
- var newUsername = document.getElementById("username").value;
- document.getElementById("user").textContent = newUsername;
- showSuccessMessage(data.message);
- if (data.reload) {
- location.reload();
- }
- } else {
- showErrorMessage(data.errorMessage);
- }
- document.getElementById("userSubmit").disabled = false;
- })
- .catch(error => {
- showErrorMessage(translate('unknown_error'));
- });
- });
-
var removePaymentButtons = document.querySelectorAll(".delete-payment-method");
removePaymentButtons.forEach(function (button) {
button.addEventListener('click', function (event) {
@@ -874,6 +775,7 @@ function addFixerKeyButton() {
document.getElementById("addFixerKey").disabled = false;
});
}
+
function storeSettingsOnDB(endpoint, value) {
fetch('endpoints/settings/' + endpoint + '.php', {
method: 'POST',
@@ -978,232 +880,3 @@ var sortable = Sortable.create(el, {
saveCategorySorting();
},
});
-
-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'));
- });
-}
-
-function enableTotp() {
- const totpSecret = document.querySelector('#totp-secret');
- const totpSecretCode = document.querySelector('#totp-secret-code');
- const qrCode = document.getElementById('totp-qr-code');
- totpSecret.value = '';
- totpSecretCode.textContent = '';
- qrCode.innerHTML = '';
-
- fetch('endpoints/user/enable_totp.php?generate=true', {
- method: 'GET'
- })
- .then(response => response.json())
- .then(data => {
- if (data.success) {
- totpSecret.value = data.secret;
- totpSecretCode.textContent = data.secret;
- new QRCode(qrCode, data.qrCodeUrl);
-
- openTotpPopup();
- } else {
- showErrorMessage(data.message);
- }
- })
- .catch(error => {
- showErrorMessage(error);
- });
-}
-
-function openTotpPopup() {
- const enableTotpButton = document.getElementById('enableTotp');
- enableTotpButton.disabled = true;
-
- const totpPopup = document.getElementById('totp-popup');
- totpPopup.classList.add('is-open');
-}
-
-function closeTotpPopup() {
- const enableTotpButton = document.getElementById('enableTotp');
- enableTotpButton.disabled = false;
- const totpPopup = document.getElementById('totp-popup');
- totpPopup.classList.remove('is-open');
-
- const totpBackupCodes = document.getElementById('totp-backup-codes');
- if (!totpBackupCodes.classList.contains('hide')) {
- location.reload();
- }
-}
-
-function submitTotp() {
- const totpCode = document.getElementById('totp').value;
- const totpSecret = document.getElementById('totp-secret').value;
-
- fetch('endpoints/user/enable_totp.php', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ totpCode: totpCode, totpSecret: totpSecret }),
- })
- .then(response => response.json())
- .then(data => {
- if (data.success) {
- showSuccessMessage(data.message);
- const backupCodes = data.backupCodes;
- const backupCodesList = document.getElementById('backup-codes');
- backupCodesList.innerHTML = '';
- backupCodes.forEach(code => {
- const li = document.createElement('li');
- li.textContent = code;
- backupCodesList.appendChild(li);
- });
-
- const totpSetup = document.getElementById('totp-setup');
- const totpBackupCodes = document.getElementById('totp-backup-codes');
-
- totpSetup.classList.add('hide');
- totpBackupCodes.classList.remove('hide');
- } else {
- showErrorMessage(data.message);
- console.log(error);
- }
- })
- .catch(error => {
- showErrorMessage(error);
- console.log(error);
- });
-}
-
-function copyBackupCodes() {
- const backupCodes = document.querySelectorAll('#backup-codes li');
- const codes = Array.from(backupCodes).map(code => code.textContent).join('\n');
-
- navigator.clipboard.writeText(codes)
- .then(() => {
- showSuccessMessage(translate('copied_to_clipboard'));
- })
- .catch(() => {
- showErrorMessage(translate('unknown_error'));
- });
-}
-
-function downloadBackupCodes() {
- const backupCodes = document.querySelectorAll('#backup-codes li');
- const codes = Array.from(backupCodes).map(code => code.textContent).join('\n');
- const element = document.createElement('a');
-
- element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(codes));
- element.setAttribute('download', 'wallos-backup-codes.txt');
- element.style.display = 'none';
- document.body.appendChild(element);
-
- element.click();
-
- document.body.removeChild(element);
-}
-
-function closeTotpDisablePopup() {
- const totpPopup = document.getElementById('totp-disable-popup');
- totpPopup.classList.remove('is-open');
-}
-
-function disableTotp() {
- const totpPopup = document.getElementById('totp-disable-popup');
- totpPopup.classList.add('is-open');
-}
-
-function submitDisableTotp() {
- const totpCode = document.getElementById('totp-disable').value;
-
- fetch('endpoints/user/disable_totp.php', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ totpCode: totpCode }),
- })
- .then(response => response.json())
- .then(data => {
- if (data.success) {
- showSuccessMessage(data.message);
- if (data.reload) {
- location.reload();
- }
- } else {
- showErrorMessage(data.message);
- }
- })
- .catch(error => {
- showErrorMessage(error);
- });
-}
\ No newline at end of file
diff --git a/settings.php b/settings.php
index 2c484a8..1b1a93f 100644
--- a/settings.php
+++ b/settings.php
@@ -1,10 +1,17 @@
<?php
-// Show all errors
-ini_set('display_errors', 1);
-ini_set('display_startup_errors', 1);
-error_reporting(E_ALL);
-
require_once 'includes/header.php';
+
+$currencies = array();
+$query = "SELECT * FROM currencies WHERE user_id = :userId";
+$query = $db->prepare($query);
+$query->bindValue(':userId', $userId, SQLITE3_INTEGER);
+$result = $query->execute();
+while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
+ $currencyId = $row['id'];
+ $currencies[$currencyId] = $row;
+}
+$userData['currency_symbol'] = "€";
+
?>
<script src="scripts/libs/sortable.min.js"></script>
@@ -15,229 +22,7 @@ require_once 'includes/header.php';
}
</style>
<section class="contain settings">
- <section class="account-section">
- <header>
- <h2><?= translate('user_details', $i18n) ?></h2>
- </header>
- <form action="endpoints/user/saveuser.php" method="post" id="userForm" enctype="multipart/form-data">
- <div class="user-form">
- <div class="fields">
- <div>
- <div class="user-avatar">
- <img src="<?= $userData['avatar'] ?>" alt="avatar" class="avatar" id="avatarImg"
- onClick="toggleAvatarSelect()" />
- <span class="edit-avatar" onClick="toggleAvatarSelect()" title="Change Avatar">
- <i class="fa-solid fa-pencil"></i>
- </span>
- </div>
-
- <input type="hidden" name="avatar" value="<?= $userData['avatar'] ?>" id="avatarUser" />
- <div class="avatar-select" id="avatarSelect">
- <div class="avatar-list">
- <?php foreach (scandir('images/avatars') as $index => $image): ?>
- <?php if (!str_starts_with($image, '.')): ?>
- <img src="images/avatars/<?= $image ?>" alt="<?= $image ?>" class="avatar-option"
- data-src="images/avatars/<?= $image ?>">
- <?php endif ?>
- <?php endforeach ?>
- <?php foreach (scandir('images/uploads/logos/avatars') as $index => $image): ?>
- <?php if (!str_starts_with($image, '.')): ?>
- <div class="avatar-container" data-src="<?= $image ?>">
- <img src="images/uploads/logos/avatars/<?= $image ?>" alt="<?= $image ?>"
- class="avatar-option" data-src="images/uploads/logos/avatars/<?= $image ?>">
- <div class="remove-avatar" onclick="deleteAvatar('<?= $image ?>')"
- title="Delete avatar">
- <i class="fa-solid fa-xmark"></i>
- </div>
- </div>
- <?php endif ?>
- <?php endforeach ?>
- <label for="profile_pic" class="add-avatar"
- title="<?= translate('upload_avatar', $i18n) ?>">
- <i class="fa-solid fa-arrow-up-from-bracket"></i>
- </label>
- </div>
- <input type="file" id="profile_pic" class="hidden-input" name="profile_pic"
- accept="image/jpeg, image/png, image/gif, image/webp"
- onChange="successfulUpload(this, '<?= addslashes(translate('file_type_error', $i18n)) ?>')" />
- </div>
- </div>
- <div class="grow">
- <div class="form-group">
- <label for="username"><?= translate('username', $i18n) ?>:</label>
- <input type="text" id="username" name="username" value="<?= $userData['username'] ?>"
- disabled>
- </div>
- <div class="form-group">
- <label for="email"><?= translate('email', $i18n) ?>:</label>
- <input type="email" id="email" name="email" value="<?= $userData['email'] ?>" required>
- </div>
- <div class="form-group">
- <label for="password"><?= translate('password', $i18n) ?>:</label>
- <input type="password" id="password" name="password" <?= $demoMode ? 'disabled title="Not available on Demo Mode"' : '' ?>>
- </div>
- <div class="form-group">
- <label for="confirm_password"><?= translate('confirm_password', $i18n) ?>:</label>
- <input type="password" id="confirm_password" name="confirm_password" <?= $demoMode ? 'disabled title="Not available on Demo Mode"' : '' ?>>
- </div>
- <?php
- $currencies = array();
- $query = "SELECT * FROM currencies WHERE user_id = :userId";
- $query = $db->prepare($query);
- $query->bindValue(':userId', $userId, SQLITE3_INTEGER);
- $result = $query->execute();
- while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
- $currencyId = $row['id'];
- $currencies[$currencyId] = $row;
- }
- $userData['currency_symbol'] = "€";
- ?>
- <div class="form-group">
- <label for="currency"><?= translate('main_currency', $i18n) ?>:</label>
- <select id="currency" name="main_currency" placeholder="Currency">
- <?php
- foreach ($currencies as $currency) {
- $selected = "";
- if ($currency['id'] == $userData['main_currency']) {
- $selected = "selected";
- $userData['currency_symbol'] = $currency['symbol'];
- }
- ?>
- <option value="<?= $currency['id'] ?>" <?= $selected ?>><?= $currency['name'] ?></option>
- <?php
- }
- ?>
- </select>
- </div>
- <div class="form-group">
- <label for="language"><?= translate('language', $i18n) ?>:</label>
- <select id="language" name="language" placeholder="Language">
- <?php
- foreach ($languages as $code => $language) {
- $selected = ($code === $lang) ? 'selected' : '';
- ?>
- <option value="<?= $code ?>" <?= $selected ?>><?= $language['name'] ?></option>
- <?php
- }
- ?>
- </select>
- </div>
- </div>
- </div>
- <div class="buttons">
- <input type="submit" value="<?= translate('save', $i18n) ?>" id="userSubmit"
- class="thin mobile-grow" />
- </div>
- </div>
- </form>
- </section>
-
- <?php
- $sql = "SELECT login_disabled FROM admin";
- $stmt = $db->prepare($sql);
- $result = $stmt->execute();
- $row = $result->fetchArray(SQLITE3_ASSOC);
- $loginDisabled = $row['login_disabled'];
-
- $showTotpSection = true;
- if ($loginDisabled && !$userData['totp_enabled']) {
- $showTotpSection = false;
- }
-
- if ($showTotpSection) {
- ?>
- <section class="account-section">
- <header>
- <h2><?= translate("two_factor_authentication", $i18n) ?></h2>
- </header>
- <div class="account-2fa">
- <div class="form-group">
- <?php
- if (!$userData['totp_enabled']) {
- ?>
- <input type="button" value="<?= translate('enable_two_factor_authentication', $i18n) ?>" id="enableTotp"
- onClick="enableTotp()" />
- <div class="totp-popup" id="totp-popup">
- <header>
- <h3><?= translate('enable_two_factor_authentication', $i18n) ?></h3>
- <span class="fa-solid fa-xmark close-form" onclick="closeTotpPopup()"></span>
- </header>
- <div class="totp-popup-content">
- <div class="totp-setup" id="totp-setup">
- <div class="totp-qrcode-container">
- <div id="totp-qr-code"></div>
- </div>
- <p class="totp-secret" id="totp-secret-code"></p>
- <div class="form-group-inline">
- <input type="hidden" name="totp-secret" id="totp-secret" value="" />
- <input type="text" id="totp" name="totp"
- placeholder="<?= translate("totp_code", $i18n) ?>" />
- <input type="button" value="<?= translate('enable', $i18n) ?>" id="enableTotpButton"
- onClick="submitTotp()" />
- </div>
- </div>
- <div class="totp-setup hide" id="totp-backup-codes">
- <h4><?= translate('backup_codes', $i18n) ?></h4>
- <ul class="totp-backup-codes" id="backup-codes"></ul>
- <div class="form-group-inline wrap">
- <input type="button" class="button secondary-button grow"
- value="<?= translate('copy_to_clipboard', $i18n) ?>" id="copyBackupCodes"
- onClick="copyBackupCodes()" />
- <input type="button" class="grow"
- value="<?= translate('download_backup_codes', $i18n) ?>" id="downloadBackupCodes"
- onClick="downloadBackupCodes()" />
- </div>
- <div class="settings-notes">
- <p>
- <i class="fa-solid fa-circle-info"></i>
- <?= translate('totp_backup_codes_info', $i18n) ?>
- </p>
- </div>
- </div>
- </div>
- </div>
- <?php
- } else {
- ?>
- <input type="button" class="button secondary-button"
- value="<?= translate('disable_two_factor_authentication', $i18n) ?>" id="disableTotp"
- onClick="disableTotp()" />
- <div class="totp-popup" id="totp-disable-popup">
- <header>
- <h3><?= translate('disable_two_factor_authentication', $i18n) ?></h3>
- <span class="fa-solid fa-xmark close-form" onclick="closeTotpDisablePopup()"></span>
- </header>
- <div class="totp-popup-content">
- <div class="form-group-inline">
- <input type="text" id="totp-disable" name="totp-disable" placeholder="totp" />
- <input type="button" value="<?= translate('disable', $i18n) ?>" id="disableTotpButton"
- onClick="submitDisableTotp()" />
- </div>
- </div>
- </div>
- <?php
- }
- ?>
- </div>
- <div class="settings-notes">
- <p>
- <i class="fa-solid fa-circle-info"></i>
- <?php
- if (!$userData['totp_enabled']) {
- echo translate('two_factor_info', $i18n);
- } else {
- echo translate('two_factor_enabled_info', $i18n);
- }
- ?>
- </p>
- </div>
- </div>
- </section>
- <?php
- }
-
- ?>
-
+
<section class="account-section">
<header>
<h2><?= translate('monthly_budget', $i18n) ?></h2>
@@ -1407,42 +1192,6 @@ 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 wrap">
- <input type="button" value="<?= translate('export_as_json', $i18n) ?>" onClick="exportAsJson()"
- class="secondary-button thin mobile-grow" id="export-json" <?= $demoMode ? 'disabled title="Not available on Demo Mode"' : '' ?>>
- <input type="button" value="<?= translate('export_as_csv', $i18n) ?>" onClick="exportAsCsv()"
- class="secondary-button thin mobile-grow" id="export-csv" <?= $demoMode ? 'disabled title="Not available on Demo Mode"' : '' ?>>
- </div>
- </div>
- </div>
- <div>
- <?php
- if ($userId != 1 && !$demoMode) {
- ?>
- <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>
diff --git a/styles/dark-theme.css b/styles/dark-theme.css
index 6a44c1b..e8b1e45 100644
--- a/styles/dark-theme.css
+++ b/styles/dark-theme.css
@@ -255,18 +255,13 @@ input {
background-color: #222;
border-top: #111;
box-shadow: 0 -2px 5px rgba(120, 120, 120, 0.1);
- ;
}
.mobile-nav>a {
- padding: 0px 10px;
+ color: #909090;
}
- .mobile-nav>a>i {
- color: #777;
- }
-
- .mobile-nav>a.active>i {
+ .mobile-nav>a.active {
color: #f0f0F0;
}
}
\ No newline at end of file
diff --git a/styles/styles.css b/styles/styles.css
index 2b4edae..cd0cb7e 100644
--- a/styles/styles.css
+++ b/styles/styles.css
@@ -846,13 +846,18 @@ header #avatar {
.account-fixer .buttons,
.account-categories .buttons,
.account-notifications .buttons,
-.admin-form .buttons {
+.admin-form .buttons,
+.account-2fa .buttons {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 20px;
}
+.account-2fa .buttons {
+ justify-content: flex-start;
+}
+
.admin-form hr {
margin: 20px 0px;
color: var(--main-color);
@@ -1677,11 +1682,15 @@ button.dark-theme-button i {
@media (max-width: 768px) {
.toast {
- bottom: 70px;
+ bottom: 0px;
right: 0px;
left: 0px;
width: 100%;
}
+
+ .mobile-navivagtion .toast {
+ bottom: 70px;
+ }
}
.toast.active {
@@ -2583,37 +2592,34 @@ input[type="radio"]:checked+label::after {
flex-direction: row;
justify-content: space-around;
z-index: 2;
- padding: 10px 0px 20px 0px;
- font-size: 28px;
+ padding: 7px 0px;
box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
box-sizing: border-box;
- align-items: baseline;
+ align-items: center;
}
-
- .mobile-nav>a>i {
+
+ .mobile-nav>a {
+ flex-grow: 1;
+ flex-shrink: 0;
+ text-align: center;
+ padding: 5px 0px 10px 0px;
color: #AAA;
- }
-
- .mobile-nav>a.active>i {
- color: #202020;
- }
-
- .mobile-nav>a.secondary,
- .mobile-nav>button {
- background-color: var(--main-color);
- border: none;
- border-radius: 35px;
- padding: 3px 8px;
+ font-size: 10px;
+ text-decoration: none;
+
+ display: flex;
+ flex-direction: column;
+ align-items: center;
}
- .mobile-nav>button {
- border: none;
- font-size: 28px;
+ .mobile-nav>a>svg {
+ width: 30px;
+ height: 30px;
+ max-width: 85%;
}
-
- .mobile-nav>a.secondary>i,
- .mobile-nav>button>i {
- color: #fff;
+
+ .mobile-nav>a.active{
+ color: #202020;
}
.mobile-navivagtion .mobileNavigationHideOnMobile {