feat: persist display and experimental settings on the db
feat: small styles changed
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
require_once '../../includes/connect_endpoint.php';
|
||||
session_start();
|
||||
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);
|
||||
|
||||
$convert_currency = $data['value'];
|
||||
|
||||
$stmt = $db->prepare('UPDATE settings SET convert_currency = :convert_currency');
|
||||
$stmt->bindParam(':convert_currency', $convert_currency, SQLITE3_INTEGER);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
die(json_encode([
|
||||
"success" => true,
|
||||
"message" => translate("success", $i18n)
|
||||
]));
|
||||
} else {
|
||||
die(json_encode([
|
||||
"success" => false,
|
||||
"message" => translate("error", $i18n)
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
require_once '../../includes/connect_endpoint.php';
|
||||
session_start();
|
||||
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);
|
||||
|
||||
$monthly_price = $data['value'];
|
||||
|
||||
$stmt = $db->prepare('UPDATE settings SET monthly_price = :monthly_price');
|
||||
$stmt->bindParam(':monthly_price', $monthly_price, SQLITE3_INTEGER);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
die(json_encode([
|
||||
"success" => true,
|
||||
"message" => translate("success", $i18n)
|
||||
]));
|
||||
} else {
|
||||
die(json_encode([
|
||||
"success" => false,
|
||||
"message" => translate("error", $i18n)
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
require_once '../../includes/connect_endpoint.php';
|
||||
session_start();
|
||||
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);
|
||||
|
||||
$remove_background = $data['value'];
|
||||
|
||||
$stmt = $db->prepare('UPDATE settings SET remove_background = :remove_background');
|
||||
$stmt->bindParam(':remove_background', $remove_background, SQLITE3_INTEGER);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
die(json_encode([
|
||||
"success" => true,
|
||||
"message" => translate("success", $i18n)
|
||||
]));
|
||||
} else {
|
||||
die(json_encode([
|
||||
"success" => false,
|
||||
"message" => translate("error", $i18n)
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
require_once '../../includes/connect_endpoint.php';
|
||||
session_start();
|
||||
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);
|
||||
|
||||
$theme = $data['theme'];
|
||||
|
||||
$stmt = $db->prepare('UPDATE settings SET dark_theme = :theme');
|
||||
$stmt->bindParam(':theme', $theme, SQLITE3_INTEGER);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
die(json_encode([
|
||||
"success" => true,
|
||||
"message" => translate("success", $i18n)
|
||||
]));
|
||||
} else {
|
||||
die(json_encode([
|
||||
"success" => false,
|
||||
"message" => translate("error", $i18n)
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -2,6 +2,7 @@
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
require_once '../../includes/connect_endpoint.php';
|
||||
require_once '../../includes/inputvalidation.php';
|
||||
require_once '../../includes/getsettings.php';
|
||||
|
||||
session_start();
|
||||
|
||||
@@ -40,7 +41,7 @@
|
||||
|
||||
function saveLogo($imageData, $uploadFile, $name) {
|
||||
$image = imagecreatefromstring($imageData);
|
||||
$removeBackground = isset($_COOKIE['removeBackground']) && $_COOKIE['removeBackground'] === 'true';
|
||||
$removeBackground = isset($settings['removeBackground']) && $settings['removeBackground'] === 'true';
|
||||
if ($image !== false) {
|
||||
$tempFile = tempnam(sys_get_temp_dir(), 'logo');
|
||||
imagepng($image, $tempFile);
|
||||
|
||||
@@ -7,9 +7,11 @@
|
||||
|
||||
include_once '../../includes/list_subscriptions.php';
|
||||
|
||||
require_once '../../includes/getsettings.php';
|
||||
|
||||
$theme = "light";
|
||||
if (isset($_COOKIE['theme'])) {
|
||||
$theme = $_COOKIE['theme'];
|
||||
if (isset($settings['theme'])) {
|
||||
$theme = $settings['theme'];
|
||||
}
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
||||
@@ -57,11 +59,11 @@
|
||||
$print[$id]['url'] = $subscription['url'];
|
||||
$print[$id]['notes'] = $subscription['notes'];
|
||||
|
||||
if (isset($_COOKIE['convertCurrency']) && $_COOKIE['convertCurrency'] === 'true' && $currencyId != $mainCurrencyId) {
|
||||
if (isset($settings['convertCurrency']) && $settings['convertCurrency'] === 'true' && $currencyId != $mainCurrencyId) {
|
||||
$print[$id]['price'] = getPriceConverted($print[$id]['price'], $currencyId, $db);
|
||||
$print[$id]['currency_code'] = $currencies[$mainCurrencyId]['code'];
|
||||
}
|
||||
if (isset($_COOKIE['showMonthlyPrice']) && $_COOKIE['showMonthlyPrice'] === 'true') {
|
||||
if (isset($settings['showMonthlyPrice']) && $settings['showMonthlyPrice'] === 'true') {
|
||||
$print[$id]['price'] = getPricePerMonth($cycle, $frequency, $print[$id]['price']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user