diff --git a/admin/.php b/admin/.php deleted file mode 100644 index 5df5df3..0000000 --- a/admin/.php +++ /dev/null @@ -1,94 +0,0 @@ -utf8Glyphs($text); -} - -// --- Image Generation --- -header('Content-Type: image/png'); -$image = imagecreatefrompng($template_image); -imagealphablending($image, true); -imagesavealpha($image, true); - -// Colors -$text_color = imagecolorallocate($image, 0, 0, 0); // Black - -// --- Text Wrapping and Positioning --- -$lines = []; -if ($lang === 'ar') { - // Simple reverse for RTL line wrapping (basic) - $words = explode(' ', $text); - $line = ''; - foreach ($words as $word) { - $new_line = $line . ' ' . $word; - $bbox = imagettfbbox($font_size, 0, $font_file, $new_line); - $line_width = abs($bbox[2] - $bbox[0]); - if ($line_width > ($width - 80)) { // 40px margin - $lines[] = $line; - $line = $word; - } else { - $line = $new_line; - } - } - $lines[] = $line; -} else { - $words = explode(' ', $text); - $line = ''; - foreach ($words as $word) { - $new_line = $line . ($line ? ' ' : '') . $word; - $bbox = imagettfbbox($font_size, 0, $font_file, $new_line); - $line_width = abs($bbox[2] - $bbox[0]); - if ($line_width > ($width - 80)) { // 40px margin - $lines[] = $line; - $line = $word; - } else { - $line = $new_line; - } - } - $lines[] = $line; -} - - -// Calculate total text height -$total_text_height = count($lines) * ($font_size * 1.5); -$y_start = ($height - $total_text_height) / 2; - -// Draw text line by line -foreach ($lines as $i => $line) { - $line = trim($line); - $bbox = imagettfbbox($font_size, 0, $font_file, $line); - $line_width = abs($bbox[2] - $bbox[0]); - $x = ($width - $line_width) / 2; - $y = $y_start + ($i * $font_size * 1.5); - imagettftext($image, $font_size, 0, $x, $y, $text_color, $font_file, $line); -} - - -// --- Output --- -imagepng($image); -imagedestroy($image); diff --git a/admin/settings.php b/admin/settings.php index 210fad5..7b0df0d 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -199,15 +199,15 @@ $is_rtl = (get_current_lang() === 'ar');
-
-
- -
+
+ + +
diff --git a/checkout_log.txt b/checkout_log.txt index b58f510..6149fa2 100644 --- a/checkout_log.txt +++ b/checkout_log.txt @@ -1,5 +1,4 @@ db/config.php loaded -db/config.php loaded Checkout script started. db/config.php loaded db/thawani_config.php loaded @@ -8,7 +7,7 @@ POST data: Array [lang] => ar [is_gift] => 0 [case_id] => 2 - [amount] => 75 + [amount] => 50 [donor_name] => [donor_email] => [donor_phone] => 99359472 @@ -17,8 +16,6 @@ POST data: Array [gift_message] => ) -Donation created with ID: 19 +Donation created with ID: 20 Thawani simulation mode. db/config.php loaded -db/thawani_config.php loaded -db/config.php loaded diff --git a/index.php b/index.php index 57c8d89..6b19d0b 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,4 @@ - + + + + + + @@ -642,4 +649,5 @@ require_once 'includes/header.php'; } - \ No newline at end of file + +'' \ No newline at end of file diff --git a/mail/WablasService.php b/mail/WablasService.php index 0c15b10..566c5b2 100644 --- a/mail/WablasService.php +++ b/mail/WablasService.php @@ -7,9 +7,10 @@ class WablasService { $settings = $pdo->query("SELECT setting_key, setting_value FROM settings WHERE setting_key LIKE 'wablas_%'")->fetchAll(PDO::FETCH_KEY_PAIR); $token = $settings['wablas_api_token'] ?? ''; + $secret = $settings['wablas_api_secret'] ?? ''; $serverUrl = $settings['wablas_server_url'] ?? ''; - if (empty($token) || empty($serverUrl)) { + if (empty($token) || empty($serverUrl) || empty($secret)) { error_log("Wablas settings missing."); return ['success' => false, 'error' => 'Settings missing']; } @@ -19,7 +20,10 @@ class WablasService { $data = ['phone' => $to, 'message' => $message]; $curl = curl_init(); - curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: $token"]); + curl_setopt($curl, CURLOPT_HTTPHEADER, [ + "Authorization: $token", + "Secret: $secret" + ]); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); @@ -50,9 +54,10 @@ class WablasService { $settings = $pdo->query("SELECT setting_key, setting_value FROM settings WHERE setting_key LIKE 'wablas_%'")->fetchAll(PDO::FETCH_KEY_PAIR); $token = $settings['wablas_api_token'] ?? ''; + $secret = $settings['wablas_api_secret'] ?? ''; $serverUrl = $settings['wablas_server_url'] ?? ''; - if (empty($token) || empty($serverUrl)) { + if (empty($token) || empty($serverUrl) || empty($secret)) { error_log("Wablas settings missing."); return ['success' => false, 'error' => 'Settings missing']; } @@ -70,6 +75,7 @@ class WablasService { $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTPHEADER, [ "Authorization: $token", + "Secret: $secret", 'Content-Type: application/json', 'Content-Length: ' . strlen($jsonData) ]); @@ -209,4 +215,4 @@ class WablasService { return self::sendTemplatedMessage($case['contact_phone'], 'case_donation_notification', $vars, $lang); } -} +} \ No newline at end of file