Skip to content

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

feat: add mobile menu navigation to experimental settings

Miguel Ribeiro1dbba18446ac
diff --git a/endpoints/settings/mobile_navigation.php b/endpoints/settings/mobile_navigation.php
new file mode 100644
index 0000000..4d9ee75
--- /dev/null
+++ b/endpoints/settings/mobile_navigation.php
@@ -0,0 +1,36 @@
+<?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);
+
+ $mobile_nav = $data['value'];
+
+ $stmt = $db->prepare('UPDATE settings SET mobile_nav = :mobile_nav WHERE user_id = :userId');
+ $stmt->bindParam(':mobile_nav', $mobile_nav, SQLITE3_INTEGER);
+ $stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);
+
+ if ($stmt->execute()) {
+ die(json_encode([
+ "success" => true,
+ "message" => translate("success", $i18n)
+ ]));
+ } else {
+ die(json_encode([
+ "success" => false,
+ "message" => translate("error", $i18n)
+ ]));
+ }
+}
+«
+
+?>
\ No newline at end of file
diff --git a/endpoints/subscriptions/get.php b/endpoints/subscriptions/get.php
index 4874907..2614f50 100644
--- a/endpoints/subscriptions/get.php
+++ b/endpoints/subscriptions/get.php
@@ -18,6 +18,13 @@ if (isset($settings['color_theme'])) {
$colorTheme = $settings['color_theme'];
}
+$locale = isset($_COOKIE['user_locale']) ? $_COOKIE['user_locale'] : 'en_US';
+$formatter = new IntlDateFormatter(
+ $locale,
+ IntlDateFormatter::MEDIUM,
+ IntlDateFormatter::NONE
+);
+
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
@@ -146,7 +153,9 @@ if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
$paymentMethodId = $subscription['payment_method_id'];
$print[$id]['currency_code'] = $currencies[$subscription['currency_id']]['code'];
$currencyId = $subscription['currency_id'];
- $print[$id]['next_payment'] = date('M d, Y', strtotime($subscription['next_payment']));
+ $next_payment_timestamp = strtotime($subscription['next_payment']);
+ $formatted_date = $formatter->format($next_payment_timestamp);
+ $print[$id]['next_payment'] = $formatted_date;
$paymentIconFolder = (strpos($payment_methods[$paymentMethodId]['icon'], 'images/uploads/icons/') !== false) ? "" : "images/uploads/logos/";
$print[$id]['payment_method_icon'] = $paymentIconFolder . $payment_methods[$paymentMethodId]['icon'];
$print[$id]['payment_method_name'] = $payment_methods[$paymentMethodId]['name'];
diff --git a/includes/footer.php b/includes/footer.php
index 0ef9f17..0684cf7 100644
--- a/includes/footer.php
+++ b/includes/footer.php
@@ -1,35 +1,35 @@
- </main>
+</main>
- <div class="toast" id="errorToast">
- <div class="toast-content">
- <i class="fas fa-solid fa-x toast-icon error"></i>
- <div class="message">
- <span class="text text-1"><?= translate("error", $i18n) ?></span>
- <span class="text text-2 errorMessage"></span>
- </div>
+<div class="toast" id="errorToast">
+ <div class="toast-content">
+ <i class="fas fa-solid fa-x toast-icon error"></i>
+ <div class="message">
+ <span class="text text-1"><?= translate("error", $i18n) ?></span>
+ <span class="text text-2 errorMessage"></span>
</div>
- <i class="fa-solid fa-xmark close close-error"></i>
- <div class="progress error"></div>
</div>
+ <i class="fa-solid fa-xmark close close-error"></i>
+ <div class="progress error"></div>
+</div>
- <div class="toast" id="successToast">
- <div class="toast-content">
- <i class="fas fa-solid fa-check toast-icon success"></i>
- <div class="message">
- <span class="text text-1"><?= translate("success", $i18n) ?></span>
- <span class="text text-2 successMessage"></span>
- </div>
+<div class="toast" id="successToast">
+ <div class="toast-content">
+ <i class="fas fa-solid fa-check toast-icon success"></i>
+ <div class="message">
+ <span class="text text-1"><?= translate("success", $i18n) ?></span>
+ <span class="text text-2 successMessage"></span>
</div>
- <i class="fa-solid fa-xmark close close-success"></i>
- <div class="progress success"></div>
</div>
+ <i class="fa-solid fa-xmark close close-success"></i>
+ <div class="progress success"></div>
+</div>
- <?php
- if (isset($db)) {
- $db->close();
- }
- ?>
+<?php
+if (isset($db)) {
+ $db->close();
+}
+?>
- </body>
+</body>
</html>
\ No newline at end of file
diff --git a/includes/header.php b/includes/header.php
index 0b4a0bf..d218655 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -1,78 +1,89 @@
<?php
- require_once 'connect.php';
- require_once 'checkuser.php';
- require_once 'checksession.php';
- require_once 'currency_formatter.php';
+require_once 'connect.php';
+require_once 'checkuser.php';
+require_once 'checksession.php';
+require_once 'currency_formatter.php';
- require_once 'i18n/languages.php';
- require_once 'i18n/getlang.php';
- require_once 'i18n/' . $lang . '.php';
+require_once 'i18n/languages.php';
+require_once 'i18n/getlang.php';
+require_once 'i18n/' . $lang . '.php';
- require_once 'getsettings.php';
+require_once 'getsettings.php';
- require_once 'version.php';
+require_once 'version.php';
- if ($userCount == 0) {
- $db->close();
- header("Location: registration.php");
- exit();
- }
+if ($userCount == 0) {
+ $db->close();
+ header("Location: registration.php");
+ exit();
+}
- $demoMode = getenv('DEMO_MODE');
+$demoMode = getenv('DEMO_MODE');
- $theme = "automatic";
- if (isset($settings['theme'])) {
- $theme = $settings['theme'];
- }
+$theme = "automatic";
+if (isset($settings['theme'])) {
+ $theme = $settings['theme'];
+}
- $updateThemeSettings = false;
- if (isset($settings['update_theme_setttings'])) {
- $updateThemeSettings = $settings['update_theme_setttings'];
- }
+$updateThemeSettings = false;
+if (isset($settings['update_theme_setttings'])) {
+ $updateThemeSettings = $settings['update_theme_setttings'];
+}
- $colorTheme = "blue";
- if (isset($settings['color_theme'])) {
- $colorTheme = $settings['color_theme'];
- }
+$colorTheme = "blue";
+if (isset($settings['color_theme'])) {
+ $colorTheme = $settings['color_theme'];
+}
- $customCss = "";
- if (isset($settings['customCss'])) {
- $customCss = $settings['customCss'];
- }
+$customCss = "";
+if (isset($settings['customCss'])) {
+ $customCss = $settings['customCss'];
+}
- if (isset($themeValue)) {
- $cookieExpire = time() + (30 * 24 * 60 * 60);
- setcookie('theme', $themeValue, [
- 'expires' => $cookieExpire,
- 'samesite' => 'Strict'
- ]);
- }
+if (isset($themeValue)) {
+ $cookieExpire = time() + (30 * 24 * 60 * 60);
+ setcookie('theme', $themeValue, [
+ 'expires' => $cookieExpire,
+ 'samesite' => 'Strict'
+ ]);
+}
+
+$isAdmin = $_SESSION['userId'] == 1;
- $isAdmin = $_SESSION['userId'] == 1;
-
- function hex2rgb($hex) {
- $hex = str_replace("#", "", $hex);
- if(strlen($hex) == 3) {
- $r = hexdec(substr($hex,0,1).substr($hex,0,1));
- $g = hexdec(substr($hex,1,1).substr($hex,1,1));
- $b = hexdec(substr($hex,2,1).substr($hex,2,1));
- } else {
- $r = hexdec(substr($hex,0,2));
- $g = hexdec(substr($hex,2,2));
- $b = hexdec(substr($hex,4,2));
- }
- return "$r, $g, $b";
+$locale = isset($_COOKIE['user_locale']) ? $_COOKIE['user_locale'] : 'en_US';
+$formatter = new IntlDateFormatter(
+ $locale,
+ IntlDateFormatter::MEDIUM,
+ IntlDateFormatter::NONE
+);
+
+function hex2rgb($hex)
+{
+ $hex = str_replace("#", "", $hex);
+ if (strlen($hex) == 3) {
+ $r = hexdec(substr($hex, 0, 1) . substr($hex, 0, 1));
+ $g = hexdec(substr($hex, 1, 1) . substr($hex, 1, 1));
+ $b = hexdec(substr($hex, 2, 1) . substr($hex, 2, 1));
+ } else {
+ $r = hexdec(substr($hex, 0, 2));
+ $g = hexdec(substr($hex, 2, 2));
+ $b = hexdec(substr($hex, 4, 2));
}
+ return "$r, $g, $b";
+}
+
+$mobileNavigation = $settings['mobile_nav'] ? "mobile-navivagtion" : "";
?>
<!DOCTYPE html>
<html dir="<?= $languages[$lang]['dir'] ?>">
+
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Wallos - Subscription Tracker</title>
<meta name="apple-mobile-web-app-title" content="Wallos">
- <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>" id="theme-color"/>
+ <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>" id="theme-color" />
<link rel="icon" type="image/png" href="images/icon/favicon.ico" sizes="16x16">
<link rel="apple-touch-icon" href="images/icon/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="152x152" href="images/icon/apple-touch-icon-152.png">
@@ -93,73 +104,136 @@
<script type="text/javascript">
window.theme = "<?= $theme ?>";
window.update_theme_settings = "<?= $updateThemeSettings ?>";
- window.lang = "<?=$lang ?>";
+ window.lang = "<?= $lang ?>";
window.colorTheme = "<?= $colorTheme ?>";
</script>
<style>
<?= htmlspecialchars($customCss, ENT_QUOTES, 'UTF-8') ?>
</style>
<?php
- if (isset($settings['customColors'])) {
- ?>
- <style id="custom_theme_colors">
- :root {
- <?php if (isset($settings['customColors']['main_color']) && !empty($settings['customColors']['main_color'])): ?>
- --main-color: <?= $settings['customColors']['main_color'] ?>;
- --main-color-rgb: <?= hex2rgb($settings['customColors']['main_color']) ?>;
- <?php endif; ?>
- <?php if (isset($settings['customColors']['accent_color']) && !empty($settings['customColors']['accent_color'])): ?>
- --accent-color: <?= $settings['customColors']['accent_color'] ?>;
- --accent-color-rgb: <?= hex2rgb($settings['customColors']['accent_color']) ?>;
- <?php endif; ?>
- <?php if (isset($settings['customColors']['hover_color']) && !empty($settings['customColors']['hover_color'])): ?>
- --hover-color: <?= $settings['customColors']['hover_color'] ?>;
- --hover-color-rgb: <?= hex2rgb($settings['customColors']['hover_color']) ?>;
- <?php endif; ?>
- }
- </style>
- <?php
- }
+ if (isset($settings['customColors'])) {
+ ?>
+ <style id="custom_theme_colors">
+ :root {
+ <?php if (isset($settings['customColors']['main_color']) && !empty($settings['customColors']['main_color'])): ?>
+ --main-color:
+ <?= $settings['customColors']['main_color'] ?>
+ ;
+ --main-color-rgb:
+ <?= hex2rgb($settings['customColors']['main_color']) ?>
+ ;
+ <?php endif; ?>
+ <?php if (isset($settings['customColors']['accent_color']) && !empty($settings['customColors']['accent_color'])): ?>
+ --accent-color:
+ <?= $settings['customColors']['accent_color'] ?>
+ ;
+ --accent-color-rgb:
+ <?= hex2rgb($settings['customColors']['accent_color']) ?>
+ ;
+ <?php endif; ?>
+ <?php if (isset($settings['customColors']['hover_color']) && !empty($settings['customColors']['hover_color'])): ?>
+ --hover-color:
+ <?= $settings['customColors']['hover_color'] ?>
+ ;
+ --hover-color-rgb:
+ <?= hex2rgb($settings['customColors']['hover_color']) ?>
+ ;
+ <?php endif; ?>
+ }
+ </style>
+ <?php
+ }
?>
<script type="text/javascript" src="scripts/i18n/<?= $lang ?>.js?<?= $version ?>"></script>
<script type="text/javascript" src="scripts/i18n/getlang.js?<?= $version ?>"></script>
</head>
-<body class="<?= $theme ?> <?= $languages[$lang]['dir'] ?>">
+
+<body class="<?= $theme ?> <?= $languages[$lang]['dir'] ?> <?= $mobileNavigation ?>">
<header>
<div class="contain">
<div class="logo">
- <a href=".">
- <div class="logo-image" title="Wallos - Subscription Tracker">
- <?php include "images/siteicons/svg/logo.php"; ?>
- </div>
- </a>
+ <a href=".">
+ <div class="logo-image" title="Wallos - Subscription Tracker">
+ <?php include "images/siteicons/svg/logo.php"; ?>
+ </div>
+ </a>
</div>
<nav>
<div class="dropdown">
<button class="dropbtn" onClick="toggleDropdown()">
<img src="<?= $userData['avatar'] ?>" alt="me" id="avatar">
- <span id="user"><?= $username ?></span>
+ <span id="user" class="mobileNavigationHideOnMobile"><?= $username ?></span>
</button>
<div class="dropdown-content">
- <a href="."><i class="fa-solid fa-list"></i><?= translate('subscriptions', $i18n) ?></a>
- <a href="calendar.php"><i class="fa-solid fa-calendar"></i><?= translate('calendar', $i18n) ?></a>
- <a href="stats.php"><i class="fa-solid fa-chart-simple"></i><?= translate('stats', $i18n) ?></a>
- <a href="settings.php"><i class="fa-solid fa-gear"></i><?= translate('settings', $i18n) ?></a>
+ <a href="." class="mobileNavigationHideOnMobile"><i
+ class="fa-solid fa-list"></i><?= translate('subscriptions', $i18n) ?></a>
+ <a href="calendar.php" class="mobileNavigationHideOnMobile"><i
+ class="fa-solid fa-calendar"></i><?= translate('calendar', $i18n) ?></a>
+ <a href="stats.php" class="mobileNavigationHideOnMobile"><i
+ class="fa-solid fa-chart-simple"></i><?= translate('stats', $i18n) ?></a>
+ <a href="settings.php" class="mobileNavigationHideOnMobile"><i
+ class="fa-solid fa-gear"></i><?= translate('settings', $i18n) ?></a>
<?php if ($isAdmin): ?>
<a href="admin.php"><i class="fa-solid fa-user-tie"></i><?= translate('admin', $i18n) ?></a>
<?php endif; ?>
<a href="about.php"><i class="fa-solid fa-info-circle"></i><?= translate('about', $i18n) ?></a>
<?php
- if ($settings['disableLogin'] == 0) {
- ?>
- <a href="logout.php"><i class="fa-solid fa-arrow-right-from-bracket"></i><?= translate('logout', $i18n) ?></a>
- <?php
- }
+ if ($settings['disableLogin'] == 0) {
+ ?>
+ <a href="logout.php"><i
+ class="fa-solid fa-arrow-right-from-bracket"></i><?= translate('logout', $i18n) ?></a>
+ <?php
+ }
?>
</div>
</div>
</nav>
</div>
</header>
- <main>
-
\ No newline at end of file
+
+ <?php
+ // find out which page is being viewed
+ $page = basename($_SERVER['PHP_SELF']);
+ $subscriptionsClass = $page === 'index.php' ? 'active' : '';
+ $calendarClass = $page === 'calendar.php' ? 'active' : '';
+ $statsClass = $page === 'stats.php' ? 'active' : '';
+ $settingsClass = $page === 'settings.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>
+ <?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
+ }
+ ?>
+
+ <main>
\ No newline at end of file
diff --git a/includes/i18n/de.php b/includes/i18n/de.php
index af3ddef..97f9218 100644
--- a/includes/i18n/de.php
+++ b/includes/i18n/de.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Deaktivierte Abonnements verstecken",
"show_disabled_subscriptions_at_the_bottom" => "Deaktivierte Abonnements am Ende anzeigen",
"experimental_settings" => "Experimentelle Einstellungen",
- "remove_background" => "Versuchen den Hintergrund von Logos aus der Bildersuche zu entfernen (experimentell)",
+ "remove_background" => "Versuchen den Hintergrund von Logos aus der Bildersuche zu entfernen",
+ "use_mobile_navigation_bar" => "Mobile Navigationsleiste verwenden",
"experimental_info" => "Experimentelle Einstellungen funktionieren möglicherweise nicht perfekt.",
"payment_methods" => "Zahlungsmethoden",
"payment_methods_info" => "Zahlungsmethode zum (de-)aktivieren anklicken.",
diff --git a/includes/i18n/el.php b/includes/i18n/el.php
index 95afd1e..cec840c 100644
--- a/includes/i18n/el.php
+++ b/includes/i18n/el.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Απόκρυψη απενεργοποιημένων συνδρομών",
"show_disabled_subscriptions_at_the_bottom" => "Εμφάνιση απενεργοποιημένων συνδρομών στο τέλος",
"experimental_settings" => "Πειραματικές ρυθμίσεις",
- "remove_background" => "Προσπάθεια αφαίρεσης του φόντου των λογότυπων από την αναζήτηση εικόνας (πειραματικά)",
+ "remove_background" => "Προσπάθεια αφαίρεσης του φόντου των λογότυπων από την αναζήτηση εικόνας",
+ "use_mobile_navigation_bar" => "Χρήση μπάρας πλοήγησης για κινητά",
"experimental_info" => "Οι πειραματικές ρυθμίσεις πιθανότατα δεν θα λειτουργούν τέλεια.",
"payment_methods" => "Τρόποι πληρωμής",
"payment_methods_info" => "Κάνε κλικ σε μια μέθοδο πληρωμής για να την απενεργοποιήσεις/ενεργοποιήσεις.",
diff --git a/includes/i18n/en.php b/includes/i18n/en.php
index c873fe5..056bd4c 100644
--- a/includes/i18n/en.php
+++ b/includes/i18n/en.php
@@ -215,7 +215,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Hide disabled subscriptions",
"show_disabled_subscriptions_at_the_bottom" => "Show disabled subscriptions at the bottom",
"experimental_settings" => "Experimental Settings",
- "remove_background" => "Attempt to remove background of logos from image search (experimental)",
+ "remove_background" => "Attempt to remove background of logos from image search",
+ "use_mobile_navigation_bar" => "Use mobile navigation bar",
"experimental_info" => "Experimental settings will probably not work perfectly.",
"payment_methods" => "Payment Methods",
"payment_methods_info" => "Click a payment method to disable / enable it.",
diff --git a/includes/i18n/es.php b/includes/i18n/es.php
index 947d5be..09b479f 100644
--- a/includes/i18n/es.php
+++ b/includes/i18n/es.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Ocultar suscripciones desactivadas",
"show_disabled_subscriptions_at_the_bottom" => "Mostrar suscripciones desactivadas al final",
"experimental_settings" => "Configuraciones Experimentales",
- "remove_background" => "Intentar quitar el fondo de los logotipos de la búsqueda de imágenes (experimental)",
+ "remove_background" => "Intentar quitar el fondo de los logotipos de la búsqueda de imágenes",
+ "use_mobile_navigation_bar" => "Usar barra de navegación móvil",
"experimental_info" => "Las configuraciones experimentales probablemente no funcionarán perfectamente.",
"payment_methods" => "Métodos de Pago",
"payment_methods_info" => "Haz clic en un método de pago para deshabilitarlo/habilitarlo.",
diff --git a/includes/i18n/fr.php b/includes/i18n/fr.php
index afb52a8..163339c 100644
--- a/includes/i18n/fr.php
+++ b/includes/i18n/fr.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Masquer les abonnements désactivés",
"show_disabled_subscriptions_at_the_bottom" => "Afficher les abonnements désactivés en bas",
"experimental_settings" => "Paramètres expérimentaux",
- "remove_background" => "Tenter de supprimer l'arrière-plan des logos de la recherche d'images (expérimental)",
+ "remove_background" => "Tenter de supprimer l'arrière-plan des logos de la recherche d'images",
+ "use_mobile_navigation_bar" => "Utiliser la barre de navigation mobile",
"experimental_info" => "Les paramètres expérimentaux ne fonctionneront probablement pas parfaitement.",
"payment_methods" => "Méthodes de paiement",
"payment_methods_info" => "Cliquez sur une méthode de paiement pour la désactiver / l'activer.",
diff --git a/includes/i18n/it.php b/includes/i18n/it.php
index e3eee79..bf71916 100644
--- a/includes/i18n/it.php
+++ b/includes/i18n/it.php
@@ -221,7 +221,8 @@ $i18n = [
"hide_disabled_subscriptions" => 'Nascondi gli abbonamenti disattivati',
"show_disabled_subscriptions_at_the_bottom" => 'Mostra gli abbonamenti disattivati in fondo',
'experimental_settings' => 'Impostazioni sperimentali',
- 'remove_background' => 'Prova a rimuovere lo sfondo dei loghi dalla ricerca delle immagini (sperimentale)',
+ 'remove_background' => 'Prova a rimuovere lo sfondo dei loghi dalla ricerca delle immagini',
+ "use_mobile_navigation_bar" => "Utilizza la barra di navigazione mobile",
'experimental_info' => 'Le impostazioni sperimentali potrebbero non funzioneranno perfettamente.',
'payment_methods' => 'Metodi di pagamento',
'payment_methods_info' => 'Fai clic su un metodo di pagamento per abilitarlo/disabilitarlo.',
diff --git a/includes/i18n/jp.php b/includes/i18n/jp.php
index 4abdce7..e176d84 100644
--- a/includes/i18n/jp.php
+++ b/includes/i18n/jp.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "無効な定期購入を非表示にする",
"show_disabled_subscriptions_at_the_bottom" => "無効な定期購入を一番下に表示する",
"experimental_settings" => "実験的な設定",
- "remove_background" => "画像検索からロゴの背景を削除する (実験)",
+ "remove_background" => "画像検索からロゴの背景を削除する",
+ "use_mobile_navigation_bar" => "モバイルナビゲーションバーを使用する",
"experimental_info" => "実験的な設定は、おそらく完全には機能しません。",
"payment_methods" => "支払い方法",
"payment_methods_info" => "支払い方法をクリックして無効/有効を切り替えます。",
diff --git a/includes/i18n/ko.php b/includes/i18n/ko.php
index b3e5909..ddf6728 100644
--- a/includes/i18n/ko.php
+++ b/includes/i18n/ko.php
@@ -215,7 +215,8 @@ $i18n = [
"hide_disabled_subscriptions" => "비활성화된 구독 숨기기",
"show_disabled_subscriptions_at_the_bottom" => "비활성화된 구독을 하단에 표시",
"experimental_settings" => "실험적 설정",
- "remove_background" => "로고 이미지 검색에서 배경 삭제 (실험적)",
+ "remove_background" => "로고 이미지 검색에서 배경 삭제",
+ "use_mobile_navigation_bar" => "모바일 네비게이션 바 사용",
"experimental_info" => "실험적 설정은 제대로 작동하지 않을 수 있습니다.",
"payment_methods" => "결제 수단",
"payment_methods_info" => "결제 수단을 클릭하여 활성화/비활성화 할 수 있습니다.",
diff --git a/includes/i18n/pl.php b/includes/i18n/pl.php
index 7619c77..b854856 100644
--- a/includes/i18n/pl.php
+++ b/includes/i18n/pl.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Ukryj wyłączone subskrypcje",
"show_disabled_subscriptions_at_the_bottom" => "Pokaż wyłączone subskrypcje na dole",
"experimental_settings" => "Ustawienia eksperymentalne",
- "remove_background" => "Próba usunięcia tła logo z wyszukiwania obrazów (eksperymentalnie)",
+ "remove_background" => "Próba usunięcia tła logo z wyszukiwania obrazów",
+ "use_mobile_navigation_bar" => "Użyj paska nawigacyjnego na urządzeniach mobilnych",
"experimental_info" => "Ustawienia eksperymentalne prawdopodobnie nie będą działać idealnie.",
"payment_methods" => "Metody płatności",
"payment_methods_info" => "Kliknij metodę płatności, aby ją wyłączyć/włączyć..",
diff --git a/includes/i18n/pt.php b/includes/i18n/pt.php
index 7608597..c817e7a 100644
--- a/includes/i18n/pt.php
+++ b/includes/i18n/pt.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Esconder subscrições desactivadas",
"show_disabled_subscriptions_at_the_bottom" => "Mostrar subscrições desactivadas no fundo da lista",
"experimental_settings" => "Definições Experimentais",
- "remove_background" => "Tentar remover o fundo dos logos na pesquisa de imagem (experimental)",
+ "remove_background" => "Tentar remover o fundo dos logos na pesquisa de imagem",
+ "use_mobile_navigation_bar" => "Usar barra de navegação móvel",
"experimental_info" => "Definições experimentais provavelmente não funcionarão correctamente.",
"payment_methods" => "Métodos de Pagamento",
"payment_methods_info" => "Clique num método de pagamento para o activar / desactivar.",
diff --git a/includes/i18n/pt_br.php b/includes/i18n/pt_br.php
index 211d332..0b95019 100644
--- a/includes/i18n/pt_br.php
+++ b/includes/i18n/pt_br.php
@@ -215,6 +215,7 @@ $i18n = [
"show_disabled_subscriptions_at_the_bottom" => "Mostre as assinaturas desativadas no final da lista",
"experimental_settings" => "Configurações experimentais",
"remove_background" => "Tentar remover o fundo de logos na pesquisa de imagem",
+ "use_mobile_navigation_bar" => "Usar barra de navegação móvel",
"experimental_info" => "As configurações experimentais provavelmente não funcionarão corretamente",
"payment_methods" => "Métodos de pagamento",
"payment_methods_info" => "Clique em um método de pagamento para ativá-lo ou desativá-lo",
diff --git a/includes/i18n/ru.php b/includes/i18n/ru.php
index 57e3522..b0af9db 100644
--- a/includes/i18n/ru.php
+++ b/includes/i18n/ru.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Скрыть отключенные подписки",
"show_disabled_subscriptions_at_the_bottom" => "Показать отключенные подписки внизу списка",
"experimental_settings" => "Экспериментальные настройки",
- "remove_background" => "Попытка удалить фон логотипов из поиска изображений (экспериментально).",
+ "remove_background" => "Попытка удалить фон логотипов из поиска изображений.",
+ "use_mobile_navigation_bar" => "Использовать мобильную панель навигации",
"experimental_info" => "Экспериментальные настройки, вероятно, не будут работать идеально.",
"payment_methods" => "Способы оплаты",
"payment_methods_info" => "Нажмите на способ оплаты, чтобы отключить/включить его.",
diff --git a/includes/i18n/sl.php b/includes/i18n/sl.php
index 1fbeda7..0d17734 100644
--- a/includes/i18n/sl.php
+++ b/includes/i18n/sl.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Skrij onemogočene naročnine",
"show_disabled_subscriptions_at_the_bottom" => "Prikaži onemogočene naročnine na dnu seznama",
"experimental_settings" => "Eksperimentalne nastavitve",
- "remove_background" => "Poskusi odstraniti ozadje logotipov iz iskanja slik (eksperimentalno)",
+ "remove_background" => "Poskusi odstraniti ozadje logotipov iz iskanja slik",
+ "use_mobile_navigation_bar" => "Uporabi mobilno navigacijsko vrstico",
"experimental_info" => "Poskusne nastavitve verjetno ne bodo popolnoma delovale.",
"payment_methods" => "Načini plačila",
"payment_methods_info" => "Kliknite način plačila, da ga onemogočite/omogočite.",
diff --git a/includes/i18n/sr.php b/includes/i18n/sr.php
index 7130869..abc6cc5 100644
--- a/includes/i18n/sr.php
+++ b/includes/i18n/sr.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Сакриј онемогућене претплате",
"show_disabled_subscriptions_at_the_bottom" => "Прикажи онемогућене претплате на дну",
"experimental_settings" => "Експериментална подешавања",
- "remove_background" => "Покушајте уклонити позадину логотипа са слика претраге (експериментално)",
+ "remove_background" => "Покушајте уклонити позадину логотипа са слика претраге",
+ "use_mobile_navigation_bar" => "Користите мобилну навигациону траку",
"experimental_info" => "Експериментална подешавања вероватно неће радити савршено.",
"payment_methods" => "Начини плаћања",
"payment_methods_info" => "Кликните на начин плаћања да бисте га онемогућили / омогућили.",
diff --git a/includes/i18n/sr_lat.php b/includes/i18n/sr_lat.php
index 6a5c89a..be91012 100644
--- a/includes/i18n/sr_lat.php
+++ b/includes/i18n/sr_lat.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Sakrij onemogućene pretplate",
"show_disabled_subscriptions_at_the_bottom" => "Prikaži onemogućene pretplate na dnu",
"experimental_settings" => "Eksperimentalna podešavanja",
- "remove_background" => "Pokušajte ukloniti pozadinu logotipa sa pretrage slika (eksperimentalno)",
+ "remove_background" => "Pokušajte ukloniti pozadinu logotipa sa pretrage slika",
+ "use_mobile_navigation_bar" => "Koristi navigacionu traku za mobilne uređaje",
"experimental_info" => "Eksperimentalna podešavanja verovatno neće savršeno funkcionisati.",
"payment_methods" => "Načini plaćanja",
"payment_methods_info" => "Kliknite na način plaćanja da biste ga onemogućili / omogućili.",
diff --git a/includes/i18n/tr.php b/includes/i18n/tr.php
index cf6b13d..8a47f8c 100644
--- a/includes/i18n/tr.php
+++ b/includes/i18n/tr.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "Devre dışı bırakılan abonelikleri gizle",
"show_disabled_subscriptions_at_the_bottom" => "Devre dışı bırakılan abonelikleri altta göster",
"experimental_settings" => "Deneysel Ayarlar",
- "remove_background" => "Görsel aramadan logoların arka planını kaldırmayı deneyin (deneysel)",
+ "remove_background" => "Görsel aramadan logoların arka planını kaldırmayı deneyin",
+ "use_mobile_navigation_bar" => "Mobil cihazlarda gezinme çubuğunu kullan",
"experimental_info" => "Deneysel ayarlar muhtemelen mükemmel çalışmayacak.",
"payment_methods" => "Ödeme Yöntemleri",
"payment_methods_info" => "Bir ödeme yöntemini devre dışı bırakmak / etkinleştirmek için tıklayın.",
diff --git a/includes/i18n/zh_cn.php b/includes/i18n/zh_cn.php
index 8bcf7eb..77cd395 100644
--- a/includes/i18n/zh_cn.php
+++ b/includes/i18n/zh_cn.php
@@ -222,7 +222,8 @@ $i18n = [
"hide_disabled_subscriptions" => "隐藏已停用的订阅",
"show_disabled_subscriptions_at_the_bottom" => "在订阅列表底部显示已停用的订阅",
"experimental_settings" => "实验性设置",
- "remove_background" => "尝试从图片搜索中移除标志的背景(实验性)",
+ "remove_background" => "尝试从图片搜索中移除标志的背景",
+ "use_mobile_navigation_bar" => "使用移动导航栏",
"experimental_info" => "实验性设置,可能存在问题。",
"payment_methods" => "支付方式",
"payment_methods_info" => "点击支付方式以禁用/启用。",
diff --git a/includes/i18n/zh_tw.php b/includes/i18n/zh_tw.php
index c94ab24..b939408 100644
--- a/includes/i18n/zh_tw.php
+++ b/includes/i18n/zh_tw.php
@@ -214,7 +214,8 @@ $i18n = [
"hide_disabled_subscriptions" => "隱藏已停用的訂閱",
"show_disabled_subscriptions_at_the_bottom" => "將已停用的訂閱顯示在底部",
"experimental_settings" => "實驗性設定",
- "remove_background" => "嘗試從圖片搜尋中移除圖示的背景顏色(實驗性)",
+ "remove_background" => "嘗試從圖片搜尋中移除圖示的背景顏色",
+ "use_mobile_navigation_bar" => "使用移動設備導航欄",
"experimental_info" => "實驗性設定,可能存在問題。",
"payment_methods" => "付款方式",
"payment_methods_info" => "點選付款方式以停用/啟用。",
diff --git a/includes/version.php b/includes/version.php
index 8e607f7..cd3fb87 100644
--- a/includes/version.php
+++ b/includes/version.php
@@ -1,3 +1,3 @@
<?php
-$version = "v2.25.0";
+$version = "v2.26.0";
?>
\ No newline at end of file
diff --git a/index.php b/index.php
index 3306025..e673e07 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" onClick="addSubscription()">
+ <button class="button mobileNavigationHideOnMobile" onClick="addSubscription()">
<i class="fa-solid fa-circle-plus"></i>
<?= translate('new_subscription', $i18n) ?>
</button>
@@ -334,7 +334,9 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden
$paymentMethodId = $subscription['payment_method_id'];
$print[$id]['currency_code'] = $currencies[$subscription['currency_id']]['code'];
$currencyId = $subscription['currency_id'];
- $print[$id]['next_payment'] = date('M d, Y', strtotime($subscription['next_payment']));
+ $next_payment_timestamp = strtotime($subscription['next_payment']);
+ $formatted_date = $formatter->format($next_payment_timestamp);
+ $print[$id]['next_payment'] = $formatted_date;
$paymentIconFolder = (strpos($payment_methods[$paymentMethodId]['icon'], 'images/uploads/icons/') !== false) ? "" : "images/uploads/logos/";
$print[$id]['payment_method_icon'] = $paymentIconFolder . $payment_methods[$paymentMethodId]['icon'];
$print[$id]['payment_method_name'] = $payment_methods[$paymentMethodId]['name'];
@@ -568,7 +570,14 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden
</form>
</section>
<script src="scripts/dashboard.js?<?= $version ?>"></script>
-
<?php
+if (isset($_GET['add'])) {
+ ?>
+ <script>
+ addSubscription();
+ </script>
+ <?php
+}
+
require_once 'includes/footer.php';
?>
\ No newline at end of file
diff --git a/migrations/000028.php b/migrations/000028.php
new file mode 100644
index 0000000..1c776d1
--- /dev/null
+++ b/migrations/000028.php
@@ -0,0 +1,11 @@
+<?php
+
+// This migration adds a "mobile_nav" column to the settings table
+
+/** @noinspection PhpUndefinedVariableInspection */
+$columnQuery = $db->query("SELECT * FROM pragma_table_info('settings') where name='mobile_nav'");
+$columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false;
+
+if ($columnRequired) {
+ $db->exec('ALTER TABLE settings ADD COLUMN mobile_nav BOOLEAN DEFAULT 0');
+}
\ No newline at end of file
diff --git a/scripts/common.js b/scripts/common.js
index f681dcb..35a0b5c 100644
--- a/scripts/common.js
+++ b/scripts/common.js
@@ -70,6 +70,9 @@ function showSuccessMessage(message) {
document.addEventListener('DOMContentLoaded', function () {
+ const userLocale = navigator.language || navigator.languages[0];
+ document.cookie = `user_locale=${userLocale}; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Strict`;
+
if (window.update_theme_settings) {
const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
const themePreference = prefersDarkMode ? 'dark' : 'light';
diff --git a/scripts/login.js b/scripts/login.js
index 2cf93b7..fddc7f5 100644
--- a/scripts/login.js
+++ b/scripts/login.js
@@ -1,13 +1,16 @@
document.addEventListener('DOMContentLoaded', function () {
- if (window.update_theme_settings) {
- const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
- const themePreference = prefersDarkMode ? 'dark' : 'light';
- const darkThemeCss = document.querySelector("#dark-theme");
- darkThemeCss.disabled = themePreference === 'light';
- document.body.className = themePreference;
- const themeColorMetaTag = document.querySelector('meta[name="theme-color"]');
- themeColorMetaTag.setAttribute('content', themePreference === 'dark' ? '#222222' : '#FFFFFF');
- }
+ const userLocale = navigator.language || navigator.languages[0];
+ document.cookie = `user_locale=${userLocale}; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Strict`;
+
+ if (window.update_theme_settings) {
+ const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
+ const themePreference = prefersDarkMode ? 'dark' : 'light';
+ const darkThemeCss = document.querySelector("#dark-theme");
+ darkThemeCss.disabled = themePreference === 'light';
+ document.body.className = themePreference;
+ const themeColorMetaTag = document.querySelector('meta[name="theme-color"]');
+ themeColorMetaTag.setAttribute('content', themePreference === 'dark' ? '#222222' : '#FFFFFF');
+ }
});
\ No newline at end of file
diff --git a/scripts/settings.js b/scripts/settings.js
index fd60b14..e482c81 100644
--- a/scripts/settings.js
+++ b/scripts/settings.js
@@ -934,6 +934,13 @@ function setShowOriginalPrice() {
storeSettingsOnDB('show_original_price', value);
}
+function setMobileNavigation() {
+ const mobileNavigationCheckbox = document.querySelector("#mobilenavigation");
+ const value = mobileNavigationCheckbox.checked;
+
+ storeSettingsOnDB('mobile_navigation', value);
+}
+
function saveCategorySorting() {
const categories = document.getElementById('categories');
const categoryIds = Array.from(categories.children).map(category => category.dataset.categoryid);
diff --git a/settings.php b/settings.php
index 33ae335..2c484a8 100644
--- a/settings.php
+++ b/settings.php
@@ -1390,6 +1390,14 @@ require_once 'includes/header.php';
<label for="removebackground"><?= translate('remove_background', $i18n) ?></label>
</div>
</div>
+ <div>
+ <div class="form-group-inline">
+ <input type="checkbox" id="mobilenavigation" name="mobilenavigation"
+ onChange="setMobileNavigation()" <?php if ($settings['mobile_nav'])
+ echo 'checked'; ?>>
+ <label for="mobilenavigation"><?= translate('use_mobile_navigation_bar', $i18n) ?></label>
+ </div>
+ </div>
</div>
<div class="settings-notes">
<p>
diff --git a/styles/dark-theme.css b/styles/dark-theme.css
index 1e7972c..6a44c1b 100644
--- a/styles/dark-theme.css
+++ b/styles/dark-theme.css
@@ -218,14 +218,14 @@ button.dark-theme-button:hover {
border: 1px solid #666;
}
-input[type="checkbox"] + label::before,
-input[type="radio"] + label::before {
+input[type="checkbox"]+label::before,
+input[type="radio"]+label::before {
background: #555;
border: 1px solid #666;
}
-input[type="checkbox"]:disabled + label::before,
-input[type="radio"]:disabled + label::before {
+input[type="checkbox"]:disabled+label::before,
+input[type="radio"]:disabled+label::before {
background-color: #333;
border-color: #222;
cursor: not-allowed;
@@ -248,4 +248,25 @@ input {
.totp-backup-codes {
background-color: #111;
border: 2px dashed #444;
+}
+
+@media (max-width: 768px) {
+ .mobile-nav {
+ background-color: #222;
+ border-top: #111;
+ box-shadow: 0 -2px 5px rgba(120, 120, 120, 0.1);
+ ;
+ }
+
+ .mobile-nav>a {
+ padding: 0px 10px;
+ }
+
+ .mobile-nav>a>i {
+ color: #777;
+ }
+
+ .mobile-nav>a.active>i {
+ color: #f0f0F0;
+ }
}
\ No newline at end of file
diff --git a/styles/styles.css b/styles/styles.css
index e9032a9..2b4edae 100644
--- a/styles/styles.css
+++ b/styles/styles.css
@@ -10,6 +10,12 @@ body.no-scroll {
overflow-y: hidden;
}
+@media (max-width: 768px) {
+ .mobile-navivagtion main {
+ margin-bottom: 70px;
+ }
+}
+
input,
button,
select,
@@ -121,6 +127,13 @@ header .logo .logo-image svg {
content: " ▼";
}
+@media (max-width: 768px) {
+ .mobile-navivagtion .dropbtn:after {
+ content: "";
+ display: none;
+ }
+}
+
.dropbtn {
display: flex;
flex-direction: row;
@@ -277,12 +290,12 @@ button:hover svg .main-color {
flex-grow: 1;
}
-.top-actions .search > input[type="text"] {
+.top-actions .search>input[type="text"] {
padding-right: 40px;
}
.top-actions>.search>.search-icon,
-.top-actions>.search>.clear-search {
+.top-actions>.search>.clear-search {
float: right;
right: 15px;
margin-top: -35px;
@@ -1664,7 +1677,7 @@ button.dark-theme-button i {
@media (max-width: 768px) {
.toast {
- bottom: 0px;
+ bottom: 70px;
right: 0px;
left: 0px;
width: 100%;
@@ -2471,7 +2484,7 @@ input[type="radio"]:checked+label::after {
color: #222;
}
-.update-banner > span {
+.update-banner>span {
font-weight: 500;
}
@@ -2553,4 +2566,57 @@ input[type="radio"]:checked+label::after {
list-style: none;
padding: 5px 10px;
font-weight: 500;
+}
+
+.mobile-nav {
+ display: none;
+}
+
+@media (max-width: 768px) {
+ .mobile-nav {
+ position: fixed;
+ bottom: 0px;
+ width: 100%;
+ background-color: #FFFFFF;
+ border-top: 1px solid #EEEEEE;
+ display: flex;
+ flex-direction: row;
+ justify-content: space-around;
+ z-index: 2;
+ padding: 10px 0px 20px 0px;
+ font-size: 28px;
+ box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
+ box-sizing: border-box;
+ align-items: baseline;
+ }
+
+ .mobile-nav>a>i {
+ 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;
+ }
+
+ .mobile-nav>button {
+ border: none;
+ font-size: 28px;
+ }
+
+ .mobile-nav>a.secondary>i,
+ .mobile-nav>button>i {
+ color: #fff;
+ }
+
+ .mobile-navivagtion .mobileNavigationHideOnMobile {
+ display: none !important;
+ }
}
\ No newline at end of file