Files
Wallos/includes/getsettings.php
Miguel Ribeiro c43b08aa4c fix: typo on czech translation
fix: subscription progress above 100% for disabled subscriptions
fix: use gd if imagick is not available
fix: bug setting main currency for the first registered user
fix: deprecation message
fix: use first currency on the list of currencies if user has not selected a main currency
2025-02-05 12:45:15 +01:00

63 lines
2.6 KiB
PHP

<?php
$query = "SELECT * FROM settings WHERE user_id = :userId";
$stmt = $db->prepare($query);
$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);
$result = $stmt->execute();
$settings = $result->fetchArray(SQLITE3_ASSOC);
if ($settings !== false) {
$themeMapping = array(0 => 'light', 1 => 'dark', 2 => 'automatic');
$themeKey = isset($settings['dark_theme']) ? $settings['dark_theme'] : 2;
$themeValue = $themeMapping[$themeKey];
$settings['update_theme_setttings'] = false;
if (isset($_COOKIE['inUseTheme']) && $settings['dark_theme'] == 2) {
$inUseTheme = $_COOKIE['inUseTheme'];
$settings['theme'] = $inUseTheme;
} else {
$settings['theme'] = $themeValue;
}
if ($themeValue == "automatic") {
$settings['update_theme_setttings'] = true;
}
$settings['color_theme'] = $settings['color_theme'] ? $settings['color_theme'] : "blue";
$settings['showMonthlyPrice'] = $settings['monthly_price'] ? 'true': 'false';
$settings['convertCurrency'] = $settings['convert_currency'] ? 'true': 'false';
$settings['removeBackground'] = $settings['remove_background'] ? 'true': 'false';
$settings['hideDisabledSubscriptions'] = $settings['hide_disabled'] ? 'true': 'false';
$settings['disabledToBottom'] = $settings['disabled_to_bottom'] ? 'true': 'false';
$settings['showOriginalPrice'] = $settings['show_original_price'] ? 'true': 'false';
$settings['mobileNavigation'] = $settings['mobile_nav'] ? 'true': 'false';
$settings['showSubscriptionProgress'] = $settings['show_subscription_progress'] ? 'true': 'false';
}
$query = "SELECT * FROM custom_colors WHERE user_id = :userId";
$stmt = $db->prepare($query);
$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);
$result = $stmt->execute();
$customColors = $result->fetchArray(SQLITE3_ASSOC);
if ($customColors !== false) {
$settings['customColors'] = $customColors;
}
$query = "SELECT * FROM custom_css_style WHERE user_id = :userId";
$stmt = $db->prepare($query);
$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);
$result = $stmt->execute();
$customCss = $result->fetchArray(SQLITE3_ASSOC);
if ($customCss !== false) {
$settings['customCss'] = $customCss['css'];
}
$query = "SELECT * FROM admin";
$result = $db->query($query);
$adminSettings = $result->fetchArray(SQLITE3_ASSOC);
if ($adminSettings !== false) {
$settings['disableLogin'] = $adminSettings['login_disabled'];
$settings['update_notification'] = $adminSettings['update_notification'];
$settings['latest_version'] = $adminSettings['latest_version'];
}
?>