From 16cb6e8b9f0ce1003426852cc7cb0b36bab7391c Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Tue, 24 Mar 2026 07:06:29 +0000 Subject: [PATCH] update arabic messages --- db/migrations/make_truck_fields_nullable.php | 26 ++++++++++++++++++++ includes/app.php | 26 +++++++++++++++++++- register.php | 24 +++++++++--------- 3 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 db/migrations/make_truck_fields_nullable.php diff --git a/db/migrations/make_truck_fields_nullable.php b/db/migrations/make_truck_fields_nullable.php new file mode 100644 index 0000000..abb7352 --- /dev/null +++ b/db/migrations/make_truck_fields_nullable.php @@ -0,0 +1,26 @@ +exec($sql); + echo "Executed: $sql\n"; + } + + echo "Migration completed successfully.\n"; +} catch (PDOException $e) { + echo "Migration failed: " . $e->getMessage() . "\n"; + exit(1); +} + diff --git a/includes/app.php b/includes/app.php index 3901c24..4c50355 100644 --- a/includes/app.php +++ b/includes/app.php @@ -367,6 +367,18 @@ $translations = [ 'terms_placeholder_ar' => 'Enter Terms of Service in Arabic...', 'privacy_placeholder_en' => 'Enter Privacy Policy in English...', 'privacy_placeholder_ar' => 'Enter Privacy Policy in Arabic...', + 'error_fullname_required' => 'Full name is required.', + 'error_email_invalid' => 'Please provide a valid email address.', + 'error_phone_required' => 'Phone number is required.', + 'error_location_required' => 'Please select country and city.', + 'error_city_mismatch' => 'Selected city does not belong to selected country.', + 'error_address_required' => 'Address is required.', + 'error_password_length' => 'Password must be at least 6 characters.', + 'error_company_required' => 'Company name is required for shipper registration.', + 'error_ctr_required' => 'CTR document is required for companies.', + 'error_id_required' => 'Please upload ID front and back.', + 'error_email_exists' => 'This email is already registered.', + 'error_registration_failed' => 'Registration failed. Please try again.', ), 'ar' => array ( 'app_name' => 'كارغو لينك', @@ -722,6 +734,18 @@ $translations = [ 'terms_placeholder_ar' => 'أدخل شروط الخدمة بالعربية...', 'privacy_placeholder_en' => 'أدخل سياسة الخصوصية بالإنجليزية...', 'privacy_placeholder_ar' => 'أدخل سياسة الخصوصية بالعربية...', + 'error_fullname_required' => 'الاسم الكامل مطلوب.', + 'error_email_invalid' => 'يرجى تقديم عنوان بريد إلكتروني صالح.', + 'error_phone_required' => 'رقم الهاتف مطلوب.', + 'error_location_required' => 'يرجى اختيار البلد والمدينة.', + 'error_city_mismatch' => 'المدينة المختارة لا تنتمي للبلد المختار.', + 'error_address_required' => 'العنوان مطلوب.', + 'error_password_length' => 'يجب أن تكون كلمة المرور 6 أحرف على الأقل.', + 'error_company_required' => 'اسم الشركة مطلوب لتسجيل الشاحن.', + 'error_ctr_required' => 'وثيقة السجل التجاري مطلوبة للشركات.', + 'error_id_required' => 'يرجى رفع صورة البطاقة الشخصية (أمام وخلف).', + 'error_email_exists' => 'هذا البريد الإلكتروني مسجل بالفعل.', + 'error_registration_failed' => 'فشل التسجيل. يرجى المحاولة مرة أخرى.', ) ]; @@ -985,4 +1009,4 @@ try { if ($tz && in_array($tz, DateTimeZone::listIdentifiers())) { date_default_timezone_set($tz); } -} catch (Throwable $e) {} \ No newline at end of file +} catch (Throwable $e) {} diff --git a/register.php b/register.php index 5a6df74..4c1526b 100644 --- a/register.php +++ b/register.php @@ -57,31 +57,31 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token(); ]; if ($fullName === '') { - $errors[] = 'Full name is required.'; + $errors[] = t('error_fullname_required'); } if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - $errors[] = 'Please provide a valid email address.'; + $errors[] = t('error_email_invalid'); } if ($phone === '') { - $errors[] = 'Phone number is required.'; + $errors[] = t('error_phone_required'); } if ($countryId <= 0 || $cityId <= 0) { - $errors[] = 'Please select country and city.'; + $errors[] = t('error_location_required'); } else { $cityCheck = db()->prepare("SELECT COUNT(*) FROM cities WHERE id = ? AND country_id = ?"); $cityCheck->execute([$cityId, $countryId]); if ((int)$cityCheck->fetchColumn() === 0) { - $errors[] = 'Selected city does not belong to selected country.'; + $errors[] = t('error_city_mismatch'); } } if ($addressLine === '') { - $errors[] = 'Address is required.'; + $errors[] = t('error_address_required'); } if (strlen($passwordRaw) < 6) { - $errors[] = 'Password must be at least 6 characters.'; + $errors[] = t('error_password_length'); } if ($role === 'shipper' && $companyName === '') { - $errors[] = 'Company name is required for shipper registration.'; + $errors[] = t('error_company_required'); } if (!$errors) { @@ -133,7 +133,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token(); if (is_uploaded_file($_FILES['ctr_document']['tmp_name'] ?? '')) { $ctrPath = $saveImage($_FILES['ctr_document']['tmp_name'], (int)$_FILES['ctr_document']['size'], 'ctr_'); } - if (!$ctrPath) $errors[] = 'CTR document is required for companies.'; + if (!$ctrPath) $errors[] = t('error_ctr_required'); } else { if (is_uploaded_file($_FILES['id_card_front']['tmp_name'] ?? '')) { $path = $saveImage($_FILES['id_card_front']['tmp_name'], (int)$_FILES['id_card_front']['size'], 'id_front_'); @@ -143,7 +143,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token(); $path = $saveImage($_FILES['id_card_back']['tmp_name'], (int)$_FILES['id_card_back']['size'], 'id_back_'); if ($path) $idCardPaths[] = $path; } - if (count($idCardPaths) < 2) $errors[] = 'Please upload ID front and back.'; + if (count($idCardPaths) < 2) $errors[] = t('error_id_required'); } if (!$errors) { @@ -195,9 +195,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { validate_csrf_token(); $pdo->rollBack(); } if (stripos($e->getMessage(), 'Duplicate entry') !== false) { - $errors[] = 'This email is already registered.'; + $errors[] = t('error_email_exists'); } else { - $errors[] = 'Registration failed. Please try again.'; + $errors[] = t('error_registration_failed'); } } }