From 595f1a1c17a45228e9dc833efbf134ee846f7ae4 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Mon, 29 Dec 2025 19:13:43 +0000 Subject: [PATCH] Password change. Mails utf-8 encoding fix --- admin/settings.php | 56 +++- debug_password_change.log | 5 + debug_price.log | 556 ++++++++++++++++++++++++++++++++++++++ includes/i18n.php | 26 +- includes/init.php | 2 +- mail/MailService.php | 3 + order_process.php | 10 +- profile.php | 50 +++- test.log | 1 + test.php | 3 + test_permissons.log | 0 11 files changed, 697 insertions(+), 15 deletions(-) create mode 100644 debug_password_change.log create mode 100644 test.log create mode 100644 test.php create mode 100644 test_permissons.log diff --git a/admin/settings.php b/admin/settings.php index eed4b5e..7b957ae 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -6,14 +6,22 @@ require_admin(); $db = db(); $rate = 0.23; // Default +$bank_name = ''; +$bank_account_number = ''; $message = ''; -// Fetch current rate -$stmt = $db->prepare("SELECT value FROM settings WHERE `key` = 'pln_to_eur_rate'"); -$stmt->execute(); -$result = $stmt->fetch(PDO::FETCH_ASSOC); -if ($result) { - $rate = (float)$result['value']; +// Fetch current settings +$stmt = $db->query("SELECT `key`, `value` FROM settings"); +$settings = $stmt->fetchAll(PDO::FETCH_KEY_PAIR); + +if (isset($settings['pln_to_eur_rate'])) { + $rate = (float)$settings['pln_to_eur_rate']; +} +if (isset($settings['bank_name'])) { + $bank_name = $settings['bank_name']; +} +if (isset($settings['bank_account_number'])) { + $bank_account_number = $settings['bank_account_number']; } // Handle form submission @@ -30,10 +38,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } else { $message = 'Wprowadź poprawną wartość kursu (liczba większa od 0).'; } + } elseif (isset($_POST['bank_name']) || isset($_POST['bank_account_number'])) { + $new_bank_name = filter_input(INPUT_POST, 'bank_name', FILTER_SANITIZE_STRING); + $new_bank_account_number = filter_input(INPUT_POST, 'bank_account_number', FILTER_SANITIZE_STRING); + + $stmt = $db->prepare("INSERT INTO settings (`key`, value) VALUES (:key, :value) ON DUPLICATE KEY UPDATE value = :value"); + + $stmt->execute([':key' => 'bank_name', ':value' => $new_bank_name]); + $bank_name = $new_bank_name; + + $stmt->execute([':key' => 'bank_account_number', ':value' => $new_bank_account_number]); + $bank_account_number = $new_bank_account_number; + + $message = 'Dane do przelewu zostały zaktualizowane.'; } } -$page_title = 'Ustawienia Walut'; +$page_title = 'Ustawienia'; ?> @@ -48,7 +69,7 @@ $page_title = 'Ustawienia Walut';

-
+
Kurs Wymiany Walut

Ustaw kurs wymiany PLN na EUR. Ten kurs będzie używany do wyświetlania cen w EUR dla klientów używających angielskiej wersji strony.

@@ -68,6 +89,25 @@ $page_title = 'Ustawienia Walut';
+ +
+
+
Dane do przelewu
+

Ustaw dane do przelewu, które będą wyświetlane w mailach i na stronie po złożeniu zamówienia.

+ +
+
+ + +
+
+ + +
+ +
+
+
diff --git a/debug_password_change.log b/debug_password_change.log new file mode 100644 index 0000000..0220cc2 --- /dev/null +++ b/debug_password_change.log @@ -0,0 +1,5 @@ +Request method: GET +Array +( +) + diff --git a/debug_price.log b/debug_price.log index 1f3d444..9b1b8de 100644 --- a/debug_price.log +++ b/debug_price.log @@ -11543,3 +11543,559 @@ Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84 Found product price. Net: 233.2, Gross: 286.84 FINAL: Returning Net: 233.2, Gross: 286.84 --- +--- +START getEffectivePrice for product 1, client 1 +Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"} +Found client price. Net: 837.4, Gross: 1030 +FINAL: Returning Net: 837.4, Gross: 1030 +--- +--- +START getEffectivePrice for product 2, client 1 +Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"} +Found client price. Net: 1056.91, Gross: 1300 +FINAL: Returning Net: 1056.91, Gross: 1300 +--- +--- +START getEffectivePrice for product 3, client 1 +Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"} +Found client price. Net: 32.52, Gross: 40 +FINAL: Returning Net: 32.52, Gross: 40 +--- +--- +START getEffectivePrice for product 4, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- +--- +START getEffectivePrice for product 1, client 1 +Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"} +Found client price. Net: 837.4, Gross: 1030 +FINAL: Returning Net: 837.4, Gross: 1030 +--- +--- +START getEffectivePrice for product 1, client 1 +Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"} +Found client price. Net: 837.4, Gross: 1030 +FINAL: Returning Net: 837.4, Gross: 1030 +--- +--- +START getEffectivePrice for product 2, client 1 +Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"} +Found client price. Net: 1056.91, Gross: 1300 +FINAL: Returning Net: 1056.91, Gross: 1300 +--- +--- +START getEffectivePrice for product 3, client 1 +Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"} +Found client price. Net: 32.52, Gross: 40 +FINAL: Returning Net: 32.52, Gross: 40 +--- +--- +START getEffectivePrice for product 4, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- +--- +START getEffectivePrice for product 2, client 1 +Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"} +Found client price. Net: 1056.91, Gross: 1300 +FINAL: Returning Net: 1056.91, Gross: 1300 +--- +--- +START getEffectivePrice for product 1, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"} +Found product price. Net: 1111, Gross: 1366.53 +FINAL: Returning Net: 1111, Gross: 1366.53 +--- +--- +START getEffectivePrice for product 2, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"} +Found product price. Net: 1318.05, Gross: 1621.2 +FINAL: Returning Net: 1318.05, Gross: 1621.2 +--- +--- +START getEffectivePrice for product 3, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 4, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- +--- +START getEffectivePrice for product 1, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"} +Found product price. Net: 1111, Gross: 1366.53 +FINAL: Returning Net: 1111, Gross: 1366.53 +--- +--- +START getEffectivePrice for product 2, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"} +Found product price. Net: 1318.05, Gross: 1621.2 +FINAL: Returning Net: 1318.05, Gross: 1621.2 +--- +--- +START getEffectivePrice for product 3, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 4, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- +--- +START getEffectivePrice for product 1, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"} +Found product price. Net: 1111, Gross: 1366.53 +FINAL: Returning Net: 1111, Gross: 1366.53 +--- +--- +START getEffectivePrice for product 2, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"} +Found product price. Net: 1318.05, Gross: 1621.2 +FINAL: Returning Net: 1318.05, Gross: 1621.2 +--- +--- +START getEffectivePrice for product 3, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 4, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- +--- +START getEffectivePrice for product 1, client 1 +Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"} +Found client price. Net: 837.4, Gross: 1030 +FINAL: Returning Net: 837.4, Gross: 1030 +--- +--- +START getEffectivePrice for product 2, client 1 +Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"} +Found client price. Net: 1056.91, Gross: 1300 +FINAL: Returning Net: 1056.91, Gross: 1300 +--- +--- +START getEffectivePrice for product 3, client 1 +Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"} +Found client price. Net: 32.52, Gross: 40 +FINAL: Returning Net: 32.52, Gross: 40 +--- +--- +START getEffectivePrice for product 4, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- +--- +START getEffectivePrice for product 1, client 1 +Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"} +Found client price. Net: 837.4, Gross: 1030 +FINAL: Returning Net: 837.4, Gross: 1030 +--- +--- +START getEffectivePrice for product 2, client 1 +Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"} +Found client price. Net: 1056.91, Gross: 1300 +FINAL: Returning Net: 1056.91, Gross: 1300 +--- +--- +START getEffectivePrice for product 3, client 1 +Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"} +Found client price. Net: 32.52, Gross: 40 +FINAL: Returning Net: 32.52, Gross: 40 +--- +--- +START getEffectivePrice for product 4, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- +--- +START getEffectivePrice for product 1, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"} +Found product price. Net: 1111, Gross: 1366.53 +FINAL: Returning Net: 1111, Gross: 1366.53 +--- +--- +START getEffectivePrice for product 2, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"} +Found product price. Net: 1318.05, Gross: 1621.2 +FINAL: Returning Net: 1318.05, Gross: 1621.2 +--- +--- +START getEffectivePrice for product 3, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 4, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- +--- +START getEffectivePrice for product 1, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"} +Found product price. Net: 1111, Gross: 1366.53 +FINAL: Returning Net: 1111, Gross: 1366.53 +--- +--- +START getEffectivePrice for product 2, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"} +Found product price. Net: 1318.05, Gross: 1621.2 +FINAL: Returning Net: 1318.05, Gross: 1621.2 +--- +--- +START getEffectivePrice for product 3, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 4, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- +--- +START getEffectivePrice for product 1, client 1 +Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"} +Found client price. Net: 837.4, Gross: 1030 +FINAL: Returning Net: 837.4, Gross: 1030 +--- +--- +START getEffectivePrice for product 2, client 1 +Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"} +Found client price. Net: 1056.91, Gross: 1300 +FINAL: Returning Net: 1056.91, Gross: 1300 +--- +--- +START getEffectivePrice for product 3, client 1 +Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"} +Found client price. Net: 32.52, Gross: 40 +FINAL: Returning Net: 32.52, Gross: 40 +--- +--- +START getEffectivePrice for product 4, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client 1 +Client price query executed. Found: No +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- +--- +START getEffectivePrice for product 1, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"} +Found product price. Net: 1111, Gross: 1366.53 +FINAL: Returning Net: 1111, Gross: 1366.53 +--- +--- +START getEffectivePrice for product 2, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"} +Found product price. Net: 1318.05, Gross: 1621.2 +FINAL: Returning Net: 1318.05, Gross: 1621.2 +--- +--- +START getEffectivePrice for product 3, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 4, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"} +Found product price. Net: 9.95, Gross: 12.24 +FINAL: Returning Net: 9.95, Gross: 12.24 +--- +--- +START getEffectivePrice for product 5, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"} +Found product price. Net: 68, Gross: 83.64 +FINAL: Returning Net: 68, Gross: 83.64 +--- +--- +START getEffectivePrice for product 6, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"} +Found product price. Net: 171.6, Gross: 211.07 +FINAL: Returning Net: 171.6, Gross: 211.07 +--- +--- +START getEffectivePrice for product 7, client +Client price not found or not set, falling back to product price. +Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"} +Found product price. Net: 233.2, Gross: 286.84 +FINAL: Returning Net: 233.2, Gross: 286.84 +--- diff --git a/includes/i18n.php b/includes/i18n.php index aaff879..3e1feb1 100644 --- a/includes/i18n.php +++ b/includes/i18n.php @@ -185,6 +185,14 @@ $translations = [ 'chat_hello' => 'Cześć! W czym mogę dzisiaj pomóc?', 'chat_placeholder' => 'Wpisz swoją wiadomość...', 'chat_send_button' => 'Wyślij', + 'change_password' => 'Zmiana hasła', + 'current_password' => 'Aktualne hasło', + 'new_password' => 'Nowe hasło', + 'confirm_new_password' => 'Potwierdź nowe hasło', + 'change_password_btn' => 'Zmień hasło', + 'password_changed_successfully' => 'Hasło zostało zmienione pomyślnie.', + 'passwords_do_not_match' => 'Nowe hasła nie są zgodne.', + 'incorrect_current_password' => 'Nieprawidłowe aktualne hasło.', ], 'en' => [ 'login_header' => 'Login', @@ -367,9 +375,22 @@ $translations = [ 'chat_hello' => 'Hello! How can I help you today?', 'chat_placeholder' => 'Type your message...', 'chat_send_button' => 'Send', + 'change_password' => 'Change Password', + 'current_password' => 'Current Password', + 'new_password' => 'New Password', + 'confirm_new_password' => 'Confirm New Password', + 'change_password_btn' => 'Change Password', + 'password_changed_successfully' => 'Password changed successfully.', + 'passwords_do_not_match' => 'New passwords do not match.', + 'incorrect_current_password' => 'Incorrect current password.', ], ]; +function get_primary_language() { + global $supported_languages; + return $supported_languages[0] ?? 'en'; +} + function get_lang() { global $default_language; return $_SESSION['lang'] ?? $default_language; @@ -388,8 +409,9 @@ function t(string $key): string { if (isset($translations[$lang][$key])) { return $translations[$lang][$key]; } - if (isset($translations['pl'][$key])) { - return $translations['pl'][$key]; + $primary_lang = get_primary_language(); + if (isset($translations[$primary_lang][$key])) { + return $translations[$primary_lang][$key]; } return "[missing:$key]"; } diff --git a/includes/init.php b/includes/init.php index 0361711..b177425 100644 --- a/includes/init.php +++ b/includes/init.php @@ -9,7 +9,7 @@ require_once __DIR__ . '/../db/config.php'; require_once __DIR__ . '/helpers.php'; require_once __DIR__ . '/currency.php'; -if (isset($_GET['lang'])) { +if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['lang'])) { set_lang($_GET['lang']); $uri = $_SERVER['REQUEST_URI']; $url_parts = parse_url($uri); diff --git a/mail/MailService.php b/mail/MailService.php index 42c97ed..27bca77 100644 --- a/mail/MailService.php +++ b/mail/MailService.php @@ -88,6 +88,7 @@ class MailService $mail = new PHPMailer\PHPMailer\PHPMailer(true); try { + $mail->CharSet = 'UTF-8'; $mail->isSMTP(); $mail->Host = $cfg['smtp_host'] ?? ''; $mail->Port = (int)($cfg['smtp_port'] ?? 587); @@ -203,6 +204,7 @@ class MailService { $mail = new PHPMailer\PHPMailer\PHPMailer(true); try { + $mail->CharSet = 'UTF-8'; $mail->isSMTP(); $mail->Host = $cfg['smtp_host'] ?? ''; $mail->Port = (int)($cfg['smtp_port'] ?? 587); @@ -211,6 +213,7 @@ class MailService if ($secure === 'ssl') $mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS; elseif ($secure === 'tls') $mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS; $mail->SMTPSecure = false; + $mail->SMTPAuth = true; $mail->Username = $cfg['smtp_user'] ?? ''; $mail->Password = $cfg['smtp_pass'] ?? ''; diff --git a/order_process.php b/order_process.php index 1da7ea3..d9344c3 100644 --- a/order_process.php +++ b/order_process.php @@ -213,8 +213,14 @@ try { // 3. Client - Payment Instructions (Bank Transfer) if ($_POST['payment_method'] === 'bank_transfer') { - // TODO: Fetch bank details from a settings table or config - $bank_account_details = "Bank: Example Bank\nAccount Number: 123456789"; + // Fetch bank details from the settings table + $stmt = $pdo->query("SELECT `key`, `value` FROM settings WHERE `key` IN ('bank_name', 'bank_account_number')"); + $settings = $stmt->fetchAll(PDO::FETCH_KEY_PAIR); + + $bank_name = $settings['bank_name'] ?? ''; + $bank_account_number = $settings['bank_account_number'] ?? ''; + + $bank_account_details = "Bank: " . $bank_name . "\nAccount Number: " . $bank_account_number; $transfer_title = "Order #{$order_id}"; $payment_deadline = date('Y-m-d', strtotime('+7 days')); diff --git a/profile.php b/profile.php index d21751c..7cf6ea4 100644 --- a/profile.php +++ b/profile.php @@ -5,6 +5,32 @@ require_login(); $user_id = $_SESSION['user_id']; $db = db(); +$success_message = ''; +$error_message = ''; + +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['change_password'])) { + $current_password = $_POST['current_password']; + $new_password = $_POST['new_password']; + $confirm_password = $_POST['confirm_password']; + + $stmt = $db->prepare("SELECT password_hash FROM users WHERE id = ?"); + $stmt->execute([$user_id]); + $user = $stmt->fetch(PDO::FETCH_ASSOC); + + if ($user && password_verify($current_password, $user['password_hash'])) { + if ($new_password === $confirm_password) { + $hashed_password = password_hash($new_password, PASSWORD_DEFAULT); + $stmt = $db->prepare("UPDATE users SET password_hash = ? WHERE id = ?"); + $stmt->execute([$hashed_password, $user_id]); + $success_message = t('password_changed_successfully'); + } else { + $error_message = t('passwords_do_not_match'); + } + } else { + $error_message = t('incorrect_current_password'); + } +} + // Fetch user data $stmt = $db->prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$user_id]); @@ -29,6 +55,12 @@ require_once __DIR__ . '/includes/header.php';

+ +
+ + +
+
@@ -47,8 +79,22 @@ require_once __DIR__ . '/includes/header.php';
-

-

+

+
+
+ + +
+
+ + +
+
+ + +
+ +
diff --git a/test.log b/test.log new file mode 100644 index 0000000..061ee5c --- /dev/null +++ b/test.log @@ -0,0 +1 @@ +Hello from test.php \ No newline at end of file diff --git a/test.php b/test.php new file mode 100644 index 0000000..d924279 --- /dev/null +++ b/test.php @@ -0,0 +1,3 @@ +