Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.
fix: typo on czech translation
Miguel Ribeiroc43b08aa4c45
diff --git a/endpoints/payments/add.php b/endpoints/payments/add.phpindex 2e301e6..e1dce09 100644--- a/endpoints/payments/add.php+++ b/endpoints/payments/add.php@@ -60,16 +60,31 @@ function saveLogo($imageData, $uploadFile, $name, $settings)imagepng($image, $tempFile);imagedestroy($image);- $imagick = new Imagick($tempFile);- if ($removeBackground) {- $fuzz = Imagick::getQuantum() * 0.1; // 10%- $imagick->transparentPaintImage("rgb(247, 247, 247)", 0, $fuzz, false);- }- $imagick->setImageFormat('png');- $imagick->writeImage($uploadFile);+ if (extension_loaded('imagick')) {+ $imagick = new Imagick($tempFile);+ if ($removeBackground) {+ $fuzz = Imagick::getQuantum() * 0.1; // 10%+ $imagick->transparentPaintImage("rgb(247, 247, 247)", 0, $fuzz, false);+ }+ $imagick->setImageFormat('png');+ $imagick->writeImage($uploadFile);- $imagick->clear();- $imagick->destroy();+ $imagick->clear();+ $imagick->destroy();+ } else {+ // Alternative method if Imagick is not available+ $newImage = imagecreatefrompng($tempFile);+ if ($removeBackground) {+ imagealphablending($newImage, false);+ imagesavealpha($newImage, true);+ $transparent = imagecolorallocatealpha($newImage, 0, 0, 0, 127);+ imagefill($newImage, 0, 0, $transparent); // Fill the entire image with transparency+ imagepng($newImage, $uploadFile);+ imagedestroy($newImage);+ }+ imagepng($newImage, $uploadFile);+ imagedestroy($newImage);+ }unlink($tempFile);return true;@@ -120,13 +135,13 @@ function resizeAndUploadLogo($uploadedFile, $uploadDir, $name)$newHeight = $height;if ($width > $targetWidth) {- $newWidth = (int)$targetWidth;- $newHeight = (int)(($targetWidth / $width) * $height);+ $newWidth = (int) $targetWidth;+ $newHeight = (int) (($targetWidth / $width) * $height);}if ($newHeight > $targetHeight) {- $newWidth = (int)(($targetHeight / $newHeight) * $newWidth);- $newHeight = (int)$targetHeight;+ $newWidth = (int) (($targetHeight / $newHeight) * $newWidth);+ $newHeight = (int) $targetHeight;}$resizedImage = imagecreatetruecolor($newWidth, $newHeight);diff --git a/endpoints/subscription/add.php b/endpoints/subscription/add.phpindex 66f7c36..348ac81 100644--- a/endpoints/subscription/add.php+++ b/endpoints/subscription/add.php@@ -61,16 +61,36 @@ function saveLogo($imageData, $uploadFile, $name, $settings)imagepng($image, $tempFile);imagedestroy($image);- $imagick = new Imagick($tempFile);- if ($removeBackground) {- $fuzz = Imagick::getQuantum() * 0.1; // 10%- $imagick->transparentPaintImage("rgb(247, 247, 247)", 0, $fuzz, false);- }- $imagick->setImageFormat('png');- $imagick->writeImage($uploadFile);+ if (extension_loaded('imagick')) {+ $imagick = new Imagick($tempFile);+ if ($removeBackground) {+ $fuzz = Imagick::getQuantum() * 0.1; // 10%+ $imagick->transparentPaintImage("rgb(247, 247, 247)", 0, $fuzz, false);+ }+ $imagick->setImageFormat('png');+ $imagick->writeImage($uploadFile);- $imagick->clear();- $imagick->destroy();+ $imagick->clear();+ $imagick->destroy();+ } else {+ // Alternative method if Imagick is not available+ $newImage = imagecreatefrompng($tempFile);+ if ($newImage !== false) {+ if ($removeBackground) {+ imagealphablending($newImage, false);+ imagesavealpha($newImage, true);+ $transparent = imagecolorallocatealpha($newImage, 0, 0, 0, 127);+ imagefill($newImage, 0, 0, $transparent); // Fill the entire image with transparency+ imagepng($newImage, $uploadFile);+ imagedestroy($newImage);+ }+ imagepng($newImage, $uploadFile);+ imagedestroy($newImage);+ } else {+ unlink($tempFile);+ return false;+ }+ }unlink($tempFile);return true;diff --git a/includes/getsettings.php b/includes/getsettings.phpindex 0f73c61..942dd1f 100644--- a/includes/getsettings.php+++ b/includes/getsettings.php@@ -6,7 +6,7 @@ $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);$result = $stmt->execute();$settings = $result->fetchArray(SQLITE3_ASSOC);-if ($settings) {+if ($settings !== false) {$themeMapping = array(0 => 'light', 1 => 'dark', 2 => 'automatic');$themeKey = isset($settings['dark_theme']) ? $settings['dark_theme'] : 2;$themeValue = $themeMapping[$themeKey];@@ -37,7 +37,7 @@ $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);$result = $stmt->execute();$customColors = $result->fetchArray(SQLITE3_ASSOC);-if ($customColors) {+if ($customColors !== false) {$settings['customColors'] = $customColors;}@@ -46,7 +46,7 @@ $stmt = $db->prepare($query);$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);$result = $stmt->execute();$customCss = $result->fetchArray(SQLITE3_ASSOC);-if ($customCss) {+if ($customCss !== false) {$settings['customCss'] = $customCss['css'];}@@ -54,7 +54,7 @@ $query = "SELECT * FROM admin";$result = $db->query($query);$adminSettings = $result->fetchArray(SQLITE3_ASSOC);-if ($adminSettings) {+if ($adminSettings !== false) {$settings['disableLogin'] = $adminSettings['login_disabled'];$settings['update_notification'] = $adminSettings['update_notification'];$settings['latest_version'] = $adminSettings['latest_version'];diff --git a/includes/list_subscriptions.php b/includes/list_subscriptions.phpindex 0249996..652cebb 100644--- a/includes/list_subscriptions.php+++ b/includes/list_subscriptions.php@@ -289,9 +289,10 @@ function printSubscriptions($subscriptions, $sort, $categories, $members, $i18n,</div><?phpif ($showSubscriptionProgress === 'true') {+ $progress = $subscription['progress'] > 100 ? 100 : $subscription['progress'];?><div class="subscription-progress-container">- <span class="subscription-progress" style="width: <?= $subscription['progress'] ?>%;"></span>+ <span class="subscription-progress" style="width: <?= $progress ?>%;"></span></div><?php}@@ -306,6 +307,10 @@ $stmt = $db->prepare($query);$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);$result = $stmt->execute();$row = $result->fetchArray(SQLITE3_ASSOC);-$mainCurrencyId = $row['main_currency'];+if ($row !== false) {+ $mainCurrencyId = $row['main_currency'];+} else {+ $mainCurrencyId = $currencies[1]['id'];+}?>\ No newline at end of filediff --git a/includes/version.php b/includes/version.phpindex df7c51c..c09e001 100644--- a/includes/version.php+++ b/includes/version.php@@ -1,3 +1,3 @@<?php-$version = "v2.45.1";+$version = "v2.45.2";?>\ No newline at end of filediff --git a/registration.php b/registration.phpindex 2488096..28d2988 100644--- a/registration.php+++ b/registration.php@@ -162,6 +162,8 @@ if (isset($_POST['username'])) {$password = $_POST['password'];$confirm_password = $_POST['confirm_password'];$main_currency = $_POST['main_currency'];+ $main_currency_index = array_search($main_currency, array_column($currencies, 'code'));+ $main_currency_id = $currencies[$main_currency_index]['id'];$language = $_POST['language'];$avatar = "images/avatars/0.svg";@@ -199,7 +201,7 @@ if (isset($_POST['username'])) {$stmt->bindValue(':username', $username, SQLITE3_TEXT);$stmt->bindValue(':email', $email, SQLITE3_TEXT);$stmt->bindValue(':password', $hashedPassword, SQLITE3_TEXT);- $stmt->bindValue(':main_currency', 1, SQLITE3_TEXT);+ $stmt->bindValue(':main_currency', $main_currency_id, SQLITE3_TEXT);$stmt->bindValue(':avatar', $avatar, SQLITE3_TEXT);$stmt->bindValue(':language', $language, SQLITE3_TEXT);$stmt->bindValue(':budget', 0, SQLITE3_INTEGER);