This commit is contained in:
Flatlogic Bot 2025-11-22 14:20:01 +00:00
parent dc54701498
commit 893c62c0ac
13 changed files with 459 additions and 126 deletions

View File

@ -349,3 +349,62 @@ color: white;
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
} }
/* Language Switcher */
.lang-switcher {
margin-right: 1rem;
}
.lang-switcher a {
color: #6c757d;
text-decoration: none;
font-weight: 500;
}
.lang-switcher a.active {
color: #0d6efd;
font-weight: 700;
}
/* RTL Support */
[dir="rtl"] {
text-align: right;
}
[dir="rtl"] .header {
flex-direction: row-reverse;
}
[dir="rtl"] .nav-buttons .btn {
margin-left: 0;
margin-right: 1rem;
}
[dir="rtl"] .lang-switcher {
margin-right: 0;
margin-left: 1rem;
}
[dir="rtl"] .task-meta {
flex-direction: row-reverse;
}
[dir="rtl"] .search-form {
flex-direction: row-reverse;
}
[dir="rtl"] .form-group label {
text-align: right;
}
[dir="rtl"] .task-manage-card {
flex-direction: row-reverse;
}
[dir="rtl"] .task-actions {
flex-direction: row-reverse;
}
[dir="rtl"] .applicant-card {
flex-direction: row-reverse;
}

View File

@ -138,42 +138,42 @@ try {
<?php endif; ?> <?php endif; ?>
<div class="hero-section" style="text-align: center; padding: 4rem 0;"> <div class="hero-section" style="text-align: center; padding: 4rem 0;">
<h1 style="font-size: 3rem; font-weight: 700;">Get anything done, today.</h1> <h1 style="font-size: 3rem; font-weight: 700;"><?= __('hero_title') ?></h1>
<p style="font-size: 1.25rem; color: #6c757d; margin-bottom: 2rem;">The best place to find quick help for your daily tasks.</p> <p style="font-size: 1.25rem; color: #6c757d; margin-bottom: 2rem;"><?= __('hero_subtitle') ?></p>
<a href="/signup.php" class="btn btn-primary">Post a Task</a> <a href="/signup.php" class="btn btn-primary"><?= __('post_task') ?></a>
</div> </div>
<h2>Available Tasks</h2> <h2><?= __('available_tasks') ?></h2>
<form action="index.php" method="GET" class="search-form"> <form action="index.php" method="GET" class="search-form">
<input type="text" name="search" placeholder="Keywords..." value="<?= htmlspecialchars($_GET['search'] ?? '') ?>"> <input type="text" name="search" placeholder="<?= __('search_keywords') ?>" value="<?= htmlspecialchars($_GET['search'] ?? '') ?>">
<input type="text" name="category" placeholder="Category..." value="<?= htmlspecialchars($_GET['category'] ?? '') ?>"> <input type="text" name="category" placeholder="<?= __('search_category') ?>" value="<?= htmlspecialchars($_GET['category'] ?? '') ?>">
<input type="text" name="location" placeholder="Location..." value="<?= htmlspecialchars($_GET['location'] ?? '') ?>"> <input type="text" name="location" placeholder="<?= __('search_location') ?>" value="<?= htmlspecialchars($_GET['location'] ?? '') ?>">
<button type="submit" class="btn">Search</button> <button type="submit" class="btn"><?= __('search') ?></button>
</form> </form>
<div class="task-grid"> <div class="task-grid">
<?php if (empty($tasks)): ?> <?php if (empty($tasks)): ?>
<p>No tasks found matching your criteria. Try broadening your search!</p> <p><?= __('no_tasks_found_criteria') ?></p>
<?php else: ?> <?php else: ?>
<?php foreach ($tasks as $task): ?> <?php foreach ($tasks as $task): ?>
<div class="task-card"> <div class="task-card">
<h3><a href="task-details.php?id=<?= $task['id'] ?>"><?= htmlspecialchars($task['title']) ?></a></h3> <h3><a href="task-details.php?id=<?= $task['id'] ?>"><?= htmlspecialchars($task['title']) ?></a></h3>
<div class="task-meta"> <div class="task-meta">
<span><?= htmlspecialchars($task['category']) ?> &bull; <?= htmlspecialchars($task['location']) ?></span> <span><?= htmlspecialchars($task['category']) ?> &bull; <?= htmlspecialchars($task['location']) ?></span>
<span>Posted by: <a href="profile.php?id=<?= $task['user_id_poster'] ?>"><strong><?= htmlspecialchars($task['user_name']) ?></strong></a></span> <span><?= __('posted_by') ?>: <a href="profile.php?id=<?= $task['user_id_poster'] ?>"><strong><?= htmlspecialchars($task['user_name']) ?></strong></a></span>
</div> </div>
<div class="task-payout">$<?= htmlspecialchars((string)$task['payout']) ?></div> <div class="task-payout">$<?= htmlspecialchars((string)$task['payout']) ?></div>
<?php if (isset($_SESSION['user_id']) && $_SESSION['user_id'] != $task['user_id']): ?> <?php if (isset($_SESSION['user_id']) && $_SESSION['user_id'] != $task['user_id']): ?>
<form action="apply.php" method="POST" style="margin-top: 1rem;"> <form action="apply.php" method="POST" style="margin-top: 1rem;">
<input type="hidden" name="task_id" value="<?= $task['id'] ?>"> <input type="hidden" name="task_id" value="<?= $task['id'] ?>">
<button type="submit" class="btn btn-primary">Apply</button> <button type="submit" class="btn btn-primary"><?= __('apply') ?></button>
</form> </form>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php <?php
require_once __DIR__ . '/shared/footer.php'; require_once __DIR__ . '/shared/footer.php';

114
lang/ar.php Normal file
View File

@ -0,0 +1,114 @@
<?php
$translations = [
'app_title' => 'سوق قائم على المهام',
'home' => 'الرئيسية',
'post_task' => 'انشر مهمة',
'manage_tasks' => 'إدارة مهامك',
'my_applications' => 'طلباتي',
'my_profile' => 'ملفي الشخصي',
'logout' => 'تسجيل الخروج',
'login' => 'تسجيل الدخول',
'signup' => 'إنشاء حساب',
'search_tasks' => 'ابحث عن مهام...',
'search' => 'بحث',
'task_title' => 'العنوان',
'task_description' => 'الوصف',
'task_budget' => 'الميزانية',
'posted_by' => 'نشر بواسطة',
'apply' => 'قدم الآن',
'task_details' => 'تفاصيل المهمة',
'all_tasks' => 'كل المهام',
'delete' => 'حذف',
'whatsapp_number' => 'رقم الواتساب',
'submit_application' => 'إرسال الطلب',
'application_submitted' => 'تم إرسال الطلب',
'accept' => 'قبول',
'accepted' => 'مقبول',
'rejected' => 'مرفوض',
'pending' => 'قيد الانتظار',
'view_details' => 'عرض التفاصيل',
'no_tasks' => 'لم يتم العثور على مهام.',
'no_applications' => 'لم يتقدم أحد لهذه المهمة بعد.',
'no_tasks_posted' => 'لم تقم بنشر أي مهام بعد.',
'no_applications_submitted' => 'لم تتقدم لأي مهام بعد.',
'english' => 'English',
'arabic' => 'العربية',
'hero_title' => 'أنجز أي شيء، اليوم.',
'hero_subtitle' => 'أفضل مكان للعثور على مساعدة سريعة لمهامك اليومية.',
'available_tasks' => 'المهام المتاحة',
'search_keywords' => 'كلمات مفتاحية...',
'search_category' => 'فئة...',
'search_location' => 'موقع...',
'no_tasks_found_criteria' => 'لم يتم العثور على مهام تطابق معايير البحث. حاول توسيع نطاق البحث!',
'login_title' => 'تسجيل الدخول',
'email_label' => 'البريد الإلكتروني',
'password_label' => 'كلمة المرور',
'login_button' => 'تسجيل الدخول',
'no_account_prompt' => 'ليس لديك حساب؟',
'signup_link' => 'إنشاء حساب',
'error_all_fields' => 'يرجى ملء جميع الحقول.',
'error_invalid_credentials' => 'البريد الإلكتروني أو كلمة المرور غير صالحة.',
'signup_title' => 'إنشاء حساب',
'full_name_label' => 'الاسم الكامل',
'email_address_label' => 'عنوان البريد الإلكتروني',
'phone_number_label' => 'رقم الهاتف',
'confirm_password_label' => 'تأكيد كلمة المرور',
'signup_button' => 'إنشاء حساب',
'error_full_name_required' => 'الاسم الكامل مطلوب.',
'error_email_required' => 'البريد الإلكتروني مطلوب.',
'error_invalid_email' => 'صيغة البريد الإلكتروني غير صالحة.',
'error_phone_required' => 'رقم الهاتف مطلوب.',
'error_password_required' => 'كلمة المرور مطلوبة.',
'error_passwords_no_match' => 'كلمات المرور غير متطابقة.',
'error_email_exists' => 'مستخدم بهذا البريد الإلكتروني موجود بالفعل.',
'error_database' => 'خطأ في قاعدة البيانات. يرجى المحاولة مرة أخرى في وقت لاحق.',
'profile_title' => 'ملف %s الشخصي',
'member_since' => 'عضو منذ: %s',
'whatsapp_updated_success' => 'تم تحديث رقم الواتساب الخاص بك بنجاح.',
'whatsapp_update_failed' => 'فشل تحديث رقم الواتساب.',
'my_contact_info' => 'معلومات الاتصال الخاصة بي',
'whatsapp_number_label' => 'رقم الواتساب',
'whatsapp_placeholder' => 'أدخل رقم الواتساب الخاص بك...',
'whatsapp_help_text' => 'سيتم مشاركة هذا فقط مع المستخدمين الذين تقبل طلباتهم.',
'save_button' => 'حفظ',
'posted_tasks' => 'المهام المنشورة',
'no_posted_tasks' => 'لم يقم %s بنشر أي مهام بعد.',
'completed_tasks' => 'المهام المكتملة',
'no_completed_tasks' => 'لم يكمل %s أي مهام بعد.',
'task_status' => 'الحالة',
'task_payout' => 'المكافأة',
'post_new_task_title' => 'انشر مهمة جديدة',
'task_title_label' => 'عنوان المهمة',
'description_label' => 'الوصف',
'category_label' => 'الفئة',
'location_label' => 'الموقع',
'payout_label' => 'المكافأة',
'post_task_button' => 'انشر المهمة',
'error_task_required_fields' => 'العنوان والوصف والمكافأة حقول مطلوبة.',
'manage_tasks_title' => 'إدارة مهامك',
'manage_tasks_description' => 'هذه هي المهام التي قمت بنشرها. انقر على مهمة لعرض وإدارة الطلبات.',
'no_posted_tasks_link' => 'لم تقم بنشر أي مهام بعد. <a href="post-task.php">انشر واحدة الآن!</a>',
'task_status_label' => 'الحالة',
'delete_task_confirm' => 'هل أنت متأكد أنك تريد حذف هذه المهمة؟',
'my_applications_title' => 'طلباتي',
'my_applications_description' => 'هذه هي المهام التي تقدمت إليها وحالتها الحالية.',
'no_applications_yet' => 'لم تتقدم لأي مهام بعد.',
'posted_by_label' => 'نشر بواسطة',
'task_details_title' => 'تفاصيل المهمة',
'budget_label' => 'الميزانية',
'posted_on_label' => 'نشر في',
'applicants_title' => 'المتقدمون',
'add_whatsapp_prompt' => 'يرجى <a href="/profile.php?id={$_SESSION['user_id']}">إضافة رقم WhatsApp الخاص بك</a> إلى ملفك الشخصي قبل قبول الطلبات.',
'no_applicants_yet' => 'لا يوجد متقدمون بعد.',
'accept_button' => 'قبول',
'my_application_title' => 'طلبي',
'application_accepted_message' => 'تهانينا! تم قبول طلبك.',
'contact_owner_whatsapp' => 'تواصل مع صاحب المهمة على WhatsApp: <strong>%s</strong>',
'application_status_label' => 'حالة طلبك هي',
'apply_now_button' => 'قدم الآن',
'manage_task_title' => 'إدارة المهمة',
'reject_button' => 'رفض',
'back_to_my_tasks' => 'العودة إلى كل مهامي',
'application_rejected_message' => 'تم رفض الطلب.',
'applicant_awarded' => 'تم منح هذا المتقدم المهمة.',
];

114
lang/en.php Normal file
View File

@ -0,0 +1,114 @@
<?php
$translations = [
'app_title' => 'Task-Based Marketplace',
'home' => 'Home',
'post_task' => 'Post a Task',
'manage_tasks' => 'Manage Your Tasks',
'my_applications' => 'My Applications',
'my_profile' => 'My Profile',
'logout' => 'Logout',
'login' => 'Login',
'signup' => 'Sign Up',
'search_tasks' => 'Search for tasks...',
'search' => 'Search',
'task_title' => 'Title',
'task_description' => 'Description',
'task_budget' => 'Budget',
'posted_by' => 'Posted by',
'apply' => 'Apply',
'task_details' => 'Task Details',
'all_tasks' => 'All Tasks',
'delete' => 'Delete',
'whatsapp_number' => 'WhatsApp Number',
'submit_application' => 'Submit Application',
'application_submitted' => 'Application Submitted',
'accept' => 'Accept',
'accepted' => 'Accepted',
'rejected' => 'Rejected',
'pending' => 'Pending',
'view_details' => 'View Details',
'no_tasks' => 'No tasks found.',
'no_applications' => 'No one has applied to this task yet.',
'no_tasks_posted' => 'You have not posted any tasks yet.',
'no_applications_submitted' => 'You have not applied to any tasks yet.',
'english' => 'English',
'arabic' => 'Arabic',
'hero_title' => 'Get anything done, today.',
'hero_subtitle' => 'The best place to find quick help for your daily tasks.',
'available_tasks' => 'Available Tasks',
'search_keywords' => 'Keywords...',
'search_category' => 'Category...',
'search_location' => 'Location...',
'no_tasks_found_criteria' => 'No tasks found matching your criteria. Try broadening your search!',
'login_title' => 'Login',
'email_label' => 'Email',
'password_label' => 'Password',
'login_button' => 'Login',
'no_account_prompt' => "Don't have an account?",
'signup_link' => 'Sign up',
'error_all_fields' => 'Please fill in all fields.',
'error_invalid_credentials' => 'Invalid email or password.',
'signup_title' => 'Create an Account',
'full_name_label' => 'Full Name',
'email_address_label' => 'Email Address',
'phone_number_label' => 'Phone Number',
'confirm_password_label' => 'Confirm Password',
'signup_button' => 'Sign Up',
'error_full_name_required' => 'Full name is required.',
'error_email_required' => 'Email is required.',
'error_invalid_email' => 'Invalid email format.',
'error_phone_required' => 'Phone number is required.',
'error_password_required' => 'Password is required.',
'error_passwords_no_match' => 'Passwords do not match.',
'error_email_exists' => 'A user with this email already exists.',
'error_database' => 'Database error. Please try again later.',
'profile_title' => "%s's Profile",
'member_since' => 'Member Since: %s',
'whatsapp_updated_success' => 'Your WhatsApp number has been updated successfully.',
'whatsapp_update_failed' => 'Failed to update WhatsApp number.',
'my_contact_info' => 'My Contact Information',
'whatsapp_number_label' => 'WhatsApp Number',
'whatsapp_placeholder' => 'Enter your WhatsApp number...',
'whatsapp_help_text' => 'This will only be shared with users whose applications you accept.',
'save_button' => 'Save',
'posted_tasks' => 'Posted Tasks',
'no_posted_tasks' => '%s has not posted any tasks yet.',
'completed_tasks' => 'Completed Tasks',
'no_completed_tasks' => '%s has not completed any tasks yet.',
'task_status' => 'Status',
'task_payout' => 'Payout',
'post_new_task_title' => 'Post a New Task',
'task_title_label' => 'Task Title',
'description_label' => 'Description',
'category_label' => 'Category',
'location_label' => 'Location',
'payout_label' => 'Payout',
'post_task_button' => 'Post Task',
'error_task_required_fields' => 'Title, description, and payout are required.',
'manage_tasks_title' => 'Manage Your Tasks',
'manage_tasks_description' => "Here are the tasks you've posted. Click on a task to view and manage applications.",
'no_posted_tasks_link' => 'You have not posted any tasks yet. <a href="post-task.php">Post one now!</a>',
'task_status_label' => 'Status',
'delete_task_confirm' => 'Are you sure you want to delete this task?',
'my_applications_title' => 'My Applications',
'my_applications_description' => "Here are the tasks you've applied for and their current status.",
'no_applications_yet' => 'You have not applied for any tasks yet.',
'posted_by_label' => 'Posted by',
'task_details_title' => 'Task Details',
'budget_label' => 'Budget',
'posted_on_label' => 'Posted on',
'applicants_title' => 'Applicants',
'add_whatsapp_prompt' => 'Please <a href="/profile.php?id={$_SESSION['user_id']}">add your WhatsApp number</a> to your profile before accepting applications.',
'no_applicants_yet' => 'No applications yet.',
'accept_button' => 'Accept',
'my_application_title' => 'My Application',
'application_accepted_message' => 'Congratulations! Your application was accepted.',
'contact_owner_whatsapp' => 'Contact the task owner on WhatsApp: <strong>%s</strong>',
'application_status_label' => 'Your application status is',
'apply_now_button' => 'Apply Now',
'manage_task_title' => 'Manage Task',
'reject_button' => 'Reject',
'back_to_my_tasks' => 'Back to All My Tasks',
'application_rejected_message' => 'Application rejected.',
'applicant_awarded' => 'This applicant was awarded the task.',
];

View File

@ -1,5 +1,4 @@
<?php <?php
session_start();
require_once 'shared/header.php'; require_once 'shared/header.php';
require_once 'db/config.php'; require_once 'db/config.php';
@ -10,7 +9,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$password = $_POST['password'] ?? ''; $password = $_POST['password'] ?? '';
if (empty($email) || empty($password)) { if (empty($email) || empty($password)) {
$error = 'Please fill in all fields.'; $error = 'error_all_fields';
} else { } else {
try { try {
$pdo = db(); $pdo = db();
@ -24,7 +23,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
header("Location: index.php"); header("Location: index.php");
exit; exit;
} else { } else {
$error = 'Invalid email or password.'; $error = 'error_invalid_credentials';
} }
} catch (PDOException $e) { } catch (PDOException $e) {
$error = "Database error: " . $e->getMessage(); $error = "Database error: " . $e->getMessage();
@ -35,22 +34,22 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
<div class="container"> <div class="container">
<div class="card"> <div class="card">
<h2>Login</h2> <h2><?= __('login_title') ?></h2>
<form action="login.php" method="post"> <form action="login.php" method="post">
<?php if ($error): ?> <?php if ($error): ?>
<div class="alert error"><?php echo htmlspecialchars($error); ?></div> <div class="alert error"><?php echo htmlspecialchars(__($error)); ?></div>
<?php endif; ?> <?php endif; ?>
<div class="form-group"> <div class="form-group">
<label for="email">Email</label> <label for="email"><?= __('email_label') ?></label>
<input type="email" id="email" name="email" required> <input type="email" id="email" name="email" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="password">Password</label> <label for="password"><?= __('password_label') ?></label>
<input type="password" id="password" name="password" required> <input type="password" id="password" name="password" required>
</div> </div>
<button type="submit" class="btn">Login</button> <button type="submit" class="btn"><?= __('login_button') ?></button>
</form> </form>
<p class="switch-form">Don't have an account? <a href="signup.php">Sign up</a></p> <p class="switch-form"><?= __('no_account_prompt') ?> <a href="signup.php"><?= __('signup_link') ?></a></p>
</div> </div>
</div> </div>

View File

@ -24,18 +24,18 @@ try {
die("Database error: Could not retrieve your tasks."); die("Database error: Could not retrieve your tasks.");
} }
$pageTitle = "Manage Your Tasks"; $pageTitle = __('manage_tasks_title');
include 'shared/header.php'; include 'shared/header.php';
?> ?>
<div class="container"> <div class="container">
<div class="page-header"> <div class="page-header">
<h1>Manage Your Tasks</h1> <h1><?= __('manage_tasks_title') ?></h1>
<p>Here are the tasks you've posted. Click on a task to view and manage applications.</p> <p><?= __('manage_tasks_description') ?></p>
</div> </div>
<?php if (empty($tasks)): ?> <?php if (empty($tasks)): ?>
<div class="alert alert-info">You have not posted any tasks yet. <a href="post-task.php">Post one now!</a></div> <div class="alert alert-info"><?= __('no_posted_tasks_link') ?></div>
<?php else: ?> <?php else: ?>
<div class="tasks-list"> <div class="tasks-list">
<?php foreach ($tasks as $task): ?> <?php foreach ($tasks as $task): ?>
@ -45,10 +45,10 @@ include 'shared/header.php';
<p><?php echo htmlspecialchars(substr($task['description'], 0, 100)); ?>...</p> <p><?php echo htmlspecialchars(substr($task['description'], 0, 100)); ?>...</p>
</div> </div>
<div class="task-status-manage"> <div class="task-status-manage">
Status: <span class="status-badge status-<?php echo strtolower(htmlspecialchars($task['status'])); ?>"><?php echo htmlspecialchars($task['status']); ?></span> <?= __('task_status_label') ?>: <span class="status-badge status-<?php echo strtolower(htmlspecialchars($task['status'])); ?>"><?php echo htmlspecialchars($task['status']); ?></span>
</div> </div>
<div class="task-actions"> <div class="task-actions">
<a href="delete-task.php?id=<?php echo $task['id']; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete this task?');">Delete</a> <a href="delete-task.php?id=<?php echo $task['id']; ?>" class="btn btn-danger btn-sm" onclick="return confirm('<?= __('delete_task_confirm') ?>');"><?= __('delete') ?></a>
</div> </div>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -12,7 +12,7 @@ $userId = $_SESSION['user_id'];
try { try {
$pdo = db(); $pdo = db();
$stmt = $pdo->prepare( $stmt = $pdo->prepare(
'SELECT t.title, t.description, a.status, u.username AS poster_username 'SELECT t.title, t.description, a.status, u.full_name AS poster_username
FROM applications a FROM applications a
JOIN tasks t ON a.task_id = t.id JOIN tasks t ON a.task_id = t.id
JOIN users u ON t.user_id = u.id JOIN users u ON t.user_id = u.id
@ -27,27 +27,27 @@ try {
die("Database error: Could not retrieve your applications."); die("Database error: Could not retrieve your applications.");
} }
$pageTitle = "My Applications"; $pageTitle = __('my_applications_title');
include 'shared/header.php'; include 'shared/header.php';
?> ?>
<div class="container"> <div class="container">
<div class="page-header"> <div class="page-header">
<h1>My Applications</h1> <h1><?= __('my_applications_title') ?></h1>
<p>Here are the tasks you've applied for and their current status.</p> <p><?= __('my_applications_description') ?></p>
</div> </div>
<?php if (empty($applications)): ?> <?php if (empty($applications)): ?>
<div class="alert alert-info">You have not applied for any tasks yet.</div> <div class="alert alert-info"><?= __('no_applications_yet') ?></div>
<?php else: ?> <?php else: ?>
<div class="applications-list"> <div class="applications-list">
<?php foreach ($applications as $app): ?> <?php foreach ($applications as $app): ?>
<div class="application-card"> <div class="application-card">
<h2><?php echo htmlspecialchars($app['title']); ?></h2> <h2><?php echo htmlspecialchars($app['title']); ?></h2>
<p class="task-poster">Posted by: <strong><?php echo htmlspecialchars($app['poster_username']); ?></strong></p> <p class="task-poster"><?= __('posted_by_label') ?>: <strong><?php echo htmlspecialchars($app['poster_username']); ?></strong></p>
<p><?php echo nl2br(htmlspecialchars($app['description'])); ?></p> <p><?php echo nl2br(htmlspecialchars($app['description'])); ?></p>
<div class="application-status"> <div class="application-status">
Status: <span class="status-badge status-<?php echo strtolower(htmlspecialchars($app['status'])); ?>"><?php echo htmlspecialchars($app['status']); ?></span> <?= __('task_status_label') ?>: <span class="status-badge status-<?php echo strtolower(htmlspecialchars($app['status'])); ?>"><?php echo htmlspecialchars($app['status']); ?></span>
</div> </div>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -18,7 +18,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$user_id = $_SESSION['user_id']; $user_id = $_SESSION['user_id'];
if (empty($title) || empty($description) || empty($payout)) { if (empty($title) || empty($description) || empty($payout)) {
$error = 'Title, description, and payout are required.'; $error = 'error_task_required_fields';
} else { } else {
try { try {
$stmt = db()->prepare("INSERT INTO tasks (user_id, title, description, category, location, payout) VALUES (?, ?, ?, ?, ?, ?)"); $stmt = db()->prepare("INSERT INTO tasks (user_id, title, description, category, location, payout) VALUES (?, ?, ?, ?, ?, ?)");
@ -33,29 +33,32 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
?> ?>
<div class="container"> <div class="container">
<h1 class="text-center mt-5">Post a New Task</h1> <h1 class="text-center mt-5"><?= __('post_new_task_title') ?></h1>
<form action="post-task.php" method="POST" class="mt-4 p-4 border rounded bg-light"> <form action="post-task.php" method="POST" class="mt-4 p-4 border rounded bg-light">
<?php if ($error): ?>
<div class="alert alert-danger"><?= __($error) ?></div>
<?php endif; ?>
<div class="mb-3"> <div class="mb-3">
<label for="title" class="form-label">Task Title</label> <label for="title" class="form-label"><?= __('task_title_label') ?></label>
<input type="text" class="form-control" id="title" name="title" required> <input type="text" class="form-control" id="title" name="title" required>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="description" class="form-label">Description</label> <label for="description" class="form-label"><?= __('description_label') ?></label>
<textarea class="form-control" id="description" name="description" rows="3" required></textarea> <textarea class="form-control" id="description" name="description" rows="3" required></textarea>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="category" class="form-label">Category</label> <label for="category" class="form-label"><?= __('category_label') ?></label>
<input type="text" class="form-control" id="category" name="category"> <input type="text" class="form-control" id="category" name="category">
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="location" class="form-label">Location</label> <label for="location" class="form-label"><?= __('location_label') ?></label>
<input type="text" class="form-control" id="location" name="location"> <input type="text" class="form-control" id="location" name="location">
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="payout" class="form-label">Payout</label> <label for="payout" class="form-label"><?= __('payout_label') ?></label>
<input type="number" class="form-control" id="payout" name="payout" step="0.01" required> <input type="number" class="form-control" id="payout" name="payout" step="0.01" required>
</div> </div>
<button type="submit" class="btn btn-primary">Post Task</button> <button type="submit" class="btn btn-primary"><?= __('post_task_button') ?></button>
</form> </form>
</div> </div>

View File

@ -20,7 +20,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_SESSION['user_id']) && $_SE
header("Location: profile.php?id=$profileId&message=whatsapp_updated"); header("Location: profile.php?id=$profileId&message=whatsapp_updated");
exit(); exit();
} catch (PDOException $e) { } catch (PDOException $e) {
$update_error = "Failed to update WhatsApp number."; $update_error = "whatsapp_update_failed";
} }
} }
@ -60,35 +60,35 @@ try {
die("Database error: Could not retrieve completed tasks."); die("Database error: Could not retrieve completed tasks.");
} }
$pageTitle = htmlspecialchars($profileUser['full_name']) . "'s Profile"; $pageTitle = sprintf(__('profile_title'), htmlspecialchars($profileUser['full_name']));
include 'shared/header.php'; include 'shared/header.php';
?> ?>
<div class="container profile-page"> <div class="container profile-page">
<div class="page-header"> <div class="page-header">
<h1><?php echo htmlspecialchars($profileUser['full_name']); ?></h1> <h1><?php echo htmlspecialchars($profileUser['full_name']); ?></h1>
<p><strong>Member Since:</strong> <?php echo date('F j, Y', strtotime($profileUser['created_at'])); ?></p> <p><strong><?= sprintf(__('member_since'), date('F j, Y', strtotime($profileUser['created_at']))) ?></strong></p>
</div> </div>
<?php if (isset($_GET['message']) && $_GET['message'] === 'whatsapp_updated'): ?> <?php if (isset($_GET['message']) && $_GET['message'] === 'whatsapp_updated'): ?>
<div class="alert alert-success">Your WhatsApp number has been updated successfully.</div> <div class="alert alert-success"><?= __('whatsapp_updated_success') ?></div>
<?php endif; ?> <?php endif; ?>
<?php if (isset($update_error)): ?> <?php if (isset($update_error)): ?>
<div class="alert alert-danger"><?= htmlspecialchars($update_error) ?></div> <div class="alert alert-danger"><?= htmlspecialchars(__($update_error)) ?></div>
<?php endif; ?> <?php endif; ?>
<?php if (isset($_SESSION['user_id']) && $_SESSION['user_id'] == $profileUser['id']): ?> <?php if (isset($_SESSION['user_id']) && $_SESSION['user_id'] == $profileUser['id']): ?>
<div class="card mb-4" style="margin-bottom: 2rem; background-color: #fff; border: 1px solid #dee2e6; border-radius: 0.75rem; padding: 1.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05);"> <div class="card mb-4" style="margin-bottom: 2rem; background-color: #fff; border: 1px solid #dee2e6; border-radius: 0.75rem; padding: 1.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05);">
<div class="card-body"> <div class="card-body">
<h2 class="card-title" style="font-size: 1.75rem; margin-bottom: 1.5rem; border-bottom: 2px solid #dee2e6; padding-bottom: 0.5rem; color: #0d6efd;">My Contact Information</h2> <h2 class="card-title" style="font-size: 1.75rem; margin-bottom: 1.5rem; border-bottom: 2px solid #dee2e6; padding-bottom: 0.5rem; color: #0d6efd;"><?= __('my_contact_info') ?></h2>
<form action="profile.php?id=<?= $profileUser['id'] ?>" method="POST"> <form action="profile.php?id=<?= $profileUser['id'] ?>" method="POST">
<div class="form-group"> <div class="form-group">
<label for="whatsapp_number">WhatsApp Number</label> <label for="whatsapp_number"><?= __('whatsapp_number_label') ?></label>
<input type="text" class="form-control" id="whatsapp_number" name="whatsapp_number" value="<?= htmlspecialchars($profileUser['whatsapp_number'] ?? '') ?>" placeholder="Enter your WhatsApp number..."> <input type="text" class="form-control" id="whatsapp_number" name="whatsapp_number" value="<?= htmlspecialchars($profileUser['whatsapp_number'] ?? '') ?>" placeholder="<?= __('whatsapp_placeholder') ?>">
<small class="form-text text-muted">This will only be shared with users whose applications you accept.</small> <small class="form-text text-muted"><?= __('whatsapp_help_text') ?></small>
</div> </div>
<button type="submit" class="btn btn-primary" style="margin-top: 1rem;">Save</button> <button type="submit" class="btn btn-primary" style="margin-top: 1rem;"><?= __('save_button') ?></button>
</form> </form>
</div> </div>
</div> </div>
@ -96,9 +96,9 @@ include 'shared/header.php';
<div class="profile-section"> <div class="profile-section">
<h2>Posted Tasks</h2> <h2><?= __('posted_tasks') ?></h2>
<?php if (empty($postedTasks)): ?> <?php if (empty($postedTasks)): ?>
<p><?php echo htmlspecialchars($profileUser['full_name']); ?> has not posted any tasks yet.</p> <p><?= sprintf(__('no_posted_tasks'), htmlspecialchars($profileUser['full_name'])) ?></p>
<?php else: ?> <?php else: ?>
<div class="task-list"> <div class="task-list">
<?php foreach ($postedTasks as $task): <?php foreach ($postedTasks as $task):
@ -107,8 +107,8 @@ include 'shared/header.php';
?> ?>
<div class="task-card-profile"> <div class="task-card-profile">
<h4><a href="task-details.php?id=<?php echo $task['id']; ?>"><?php echo htmlspecialchars($task['title']); ?></a></h4> <h4><a href="task-details.php?id=<?php echo $task['id']; ?>"><?php echo htmlspecialchars($task['title']); ?></a></h4>
<p><strong>Status:</strong> <span class="status-badge status-<?php echo strtolower(htmlspecialchars($taskStatus)); ?>"><?php echo htmlspecialchars($taskStatus); ?></span></p> <p><strong><?= __('task_status') ?>:</strong> <span class="status-badge status-<?php echo strtolower(htmlspecialchars($taskStatus)); ?>"><?php echo htmlspecialchars($taskStatus); ?></span></p>
<p><strong>Payout:</strong> $<?php echo htmlspecialchars($task['payout']); ?></p> <p><strong><?= __('task_payout') ?>:</strong> $<?php echo htmlspecialchars($task['payout']); ?></p>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
@ -116,9 +116,9 @@ include 'shared/header.php';
</div> </div>
<div class="profile-section"> <div class="profile-section">
<h2>Completed Tasks</h2> <h2><?= __('completed_tasks') ?></h2>
<?php if (empty($completedTasks)): ?> <?php if (empty($completedTasks)): ?>
<p><?php echo htmlspecialchars($profileUser['full_name']); ?> has not completed any tasks yet.</p> <p><?= sprintf(__('no_completed_tasks'), htmlspecialchars($profileUser['full_name'])) ?></p>
<?php else: ?> <?php else: ?>
<div class="task-list"> <div class="task-list">
<?php foreach ($completedTasks as $task): <?php foreach ($completedTasks as $task):
@ -127,8 +127,8 @@ include 'shared/header.php';
?> ?>
<div class="task-card-profile"> <div class="task-card-profile">
<h4><?php echo htmlspecialchars($task['title']); ?></h4> <h4><?php echo htmlspecialchars($task['title']); ?></h4>
<p><strong>Status:</strong> <span class="status-badge status-<?php echo strtolower(htmlspecialchars($taskStatus)); ?>"><?php echo htmlspecialchars($taskStatus); ?></span></p> <p><strong><?= __('task_status') ?>:</strong> <span class="status-badge status-<?php echo strtolower(htmlspecialchars($taskStatus)); ?>"><?php echo htmlspecialchars($taskStatus); ?></span></p>
<p><strong>Payout:</strong> $<?php echo htmlspecialchars($task['payout']); ?></p> <p><strong><?= __('task_payout') ?>:</strong> $<?php echo htmlspecialchars($task['payout']); ?></p>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>

View File

@ -1,19 +1,20 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
session_start();
ini_set('display_errors', '1'); ini_set('display_errors', '1');
error_reporting(E_ALL); error_reporting(E_ALL);
require_once __DIR__ . '/i18n.php';
// Read project preview data from environment // Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? ''; $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?> ?>
<!doctype html> <!doctype html>
<html lang="en"> <html lang="<?= get_lang() ?>" dir="<?= get_dir() ?>">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?= htmlspecialchars($pageTitle ?? 'CashTask') ?></title> <title><?= htmlspecialchars($pageTitle ?? __('app_title')) ?></title>
<?php if ($projectDescription): ?> <?php if ($projectDescription): ?>
<!-- Meta description --> <!-- Meta description -->
@ -37,18 +38,22 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
</head> </head>
<body> <body>
<header class="header"> <header class="header">
<a href="/" class="logo">CashTask</a> <a href="/" class="logo"><?= __('app_title') ?></a>
<div class="nav-buttons"> <div class="nav-buttons">
<div class="lang-switcher">
<a href="?lang=en" class="<?= get_lang() === 'en' ? 'active' : '' ?>"><?= __('english') ?></a>
|
<a href="?lang=ar" class="<?= get_lang() === 'ar' ? 'active' : '' ?>"><?= __('arabic') ?></a>
</div>
<?php if (isset($_SESSION['user_id'])): ?> <?php if (isset($_SESSION['user_id'])): ?>
<span class="welcome-message">Welcome, <?php echo htmlspecialchars($_SESSION['user_name']); ?>!</span> <a href="/profile.php?id=<?php echo $_SESSION['user_id']; ?>" class="btn btn-secondary"><?= __('my_profile') ?></a>
<a href="/profile.php?id=<?php echo $_SESSION['user_id']; ?>" class="btn btn-secondary">My Profile</a> <a href="/my-applications.php" class="btn btn-secondary"><?= __('my_applications') ?></a>
<a href="/my-applications.php" class="btn btn-secondary">My Applications</a> <a href="/manage-tasks.php" class="btn btn-secondary"><?= __('manage_tasks') ?></a>
<a href="/manage-tasks.php" class="btn btn-secondary">Manage Tasks</a> <a href="/post-task.php" class="btn btn-primary"><?= __('post_task') ?></a>
<a href="/post-task.php" class="btn btn-primary">Post a Task</a> <a href="/logout.php" class="btn btn-secondary"><?= __('logout') ?></a>
<a href="/logout.php" class="btn btn-secondary">Log Out</a>
<?php else: ?> <?php else: ?>
<a href="/login.php" class="btn btn-secondary">Log In</a> <a href="/login.php" class="btn btn-secondary"><?= __('login') ?></a>
<a href="/signup.php" class="btn btn-primary">Sign Up</a> <a href="/signup.php" class="btn btn-primary"><?= __('signup') ?></a>
<?php endif; ?> <?php endif; ?>
</div> </div>
</header> </header>

41
shared/i18n.php Normal file
View File

@ -0,0 +1,41 @@
<?php
// Start session if not already started
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
// Determine language
$supported_langs = ['en', 'ar'];
$default_lang = 'en';
$lang = $default_lang;
if (isset($_GET['lang']) && in_array($_GET['lang'], $supported_langs)) {
$_SESSION['lang'] = $_GET['lang'];
$lang = $_GET['lang'];
} elseif (isset($_SESSION['lang'])) {
$lang = $_SESSION['lang'];
}
// Load translations
$translations = [];
$lang_file = __DIR__ . '/../lang/' . $lang . '.php';
if (file_exists($lang_file)) {
require $lang_file;
}
// Translation function
function __($key) {
global $translations;
return $translations[$key] ?? $key;
}
// Get current language
function get_lang() {
global $lang;
return $lang;
}
// Get page direction
function get_dir() {
return (get_lang() === 'ar') ? 'rtl' : 'ltr';
}

View File

@ -1,5 +1,5 @@
<?php <?php
session_start(); require_once __DIR__ . '/shared/header.php';
require_once __DIR__ . '/db/config.php'; require_once __DIR__ . '/db/config.php';
$errors = []; $errors = [];
@ -15,25 +15,25 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$confirm_password = $_POST['confirm_password']; $confirm_password = $_POST['confirm_password'];
if (empty($full_name)) { if (empty($full_name)) {
$errors[] = 'Full name is required.'; $errors[] = 'error_full_name_required';
} }
if (empty($email)) { if (empty($email)) {
$errors[] = 'Email is required.'; $errors[] = 'error_email_required';
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$errors[] = 'Invalid email format.'; $errors[] = 'error_invalid_email';
} }
if (empty($phone)) { if (empty($phone)) {
$errors[] = 'Phone number is required.'; $errors[] = 'error_phone_required';
} }
if (empty($password)) { if (empty($password)) {
$errors[] = 'Password is required.'; $errors[] = 'error_password_required';
} }
if ($password !== $confirm_password) { if ($password !== $confirm_password) {
$errors[] = 'Passwords do not match.'; $errors[] = 'error_passwords_no_match';
} }
if (empty($errors)) { if (empty($errors)) {
@ -45,7 +45,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$existing_user = $stmt->fetch(); $existing_user = $stmt->fetch();
if ($existing_user) { if ($existing_user) {
$errors[] = 'A user with this email already exists.'; $errors[] = 'error_email_exists';
} else { } else {
$hashed_password = password_hash($password, PASSWORD_DEFAULT); $hashed_password = password_hash($password, PASSWORD_DEFAULT);
@ -56,50 +56,48 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
exit; exit;
} }
} catch (PDOException $e) { } catch (PDOException $e) {
// In a real app, you would log this error, not show it to the user. $errors[] = "error_database";
$errors[] = "Database error. Please try again later.";
} }
} }
} }
$pageTitle = 'Sign Up'; $pageTitle = __('signup_title');
require_once __DIR__ . '/shared/header.php';
?> ?>
<div class="form-container"> <div class="form-container">
<h1>Create an Account</h1> <h1><?= __('signup_title') ?></h1>
<?php if (!empty($errors)): ?> <?php if (!empty($errors)): ?>
<div class="errors"> <div class="errors">
<?php foreach ($errors as $error): ?> <?php foreach ($errors as $error): ?>
<p><?php echo htmlspecialchars($error); ?></p> <p><?php echo htmlspecialchars(__($error)); ?></p>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<form action="signup.php" method="post"> <form action="signup.php" method="post">
<div class="form-group"> <div class="form-group">
<label for="full_name">Full Name</label> <label for="full_name"><?= __('full_name_label') ?></label>
<input type="text" id="full_name" name="full_name" required value="<?php echo htmlspecialchars($full_name); ?>"> <input type="text" id="full_name" name="full_name" required value="<?php echo htmlspecialchars($full_name); ?>">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="email">Email Address</label> <label for="email"><?= __('email_address_label') ?></label>
<input type="email" id="email" name="email" required value="<?php echo htmlspecialchars($email); ?>"> <input type="email" id="email" name="email" required value="<?php echo htmlspecialchars($email); ?>">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="phone">Phone Number</label> <label for="phone"><?= __('phone_number_label') ?></label>
<input type="tel" id="phone" name="phone" required value="<?php echo htmlspecialchars($phone); ?>"> <input type="tel" id="phone" name="phone" required value="<?php echo htmlspecialchars($phone); ?>">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="password">Password</label> <label for="password"><?= __('password_label') ?></label>
<input type="password" id="password" name="password" required> <input type="password" id="password" name="password" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="confirm_password">Confirm Password</label> <label for="confirm_password"><?= __('confirm_password_label') ?></label>
<input type="password" id="confirm_password" name="confirm_password" required> <input type="password" id="confirm_password" name="confirm_password" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<button type="submit" class="btn btn-primary" style="width: 100%;">Sign Up</button> <button type="submit" class="btn btn-primary" style="width: 100%;"><?= __('signup_button') ?></button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -38,7 +38,7 @@ if (isset($_SESSION['user_id']) && !$is_owner) {
$user_application = $stmt->fetch(PDO::FETCH_ASSOC); $user_application = $stmt->fetch(PDO::FETCH_ASSOC);
} }
$pageTitle = htmlspecialchars($task['title']); $pageTitle = __('task_details_title');
require_once 'shared/header.php'; require_once 'shared/header.php';
?> ?>
@ -48,28 +48,28 @@ require_once 'shared/header.php';
<h1 class="card-title h3"><?php echo htmlspecialchars($task['title']); ?></h1> <h1 class="card-title h3"><?php echo htmlspecialchars($task['title']); ?></h1>
</div> </div>
<div class="card-body"> <div class="card-body">
<p><strong>Posted by:</strong> <a href="profile.php?id=<?php echo $task['user_id']; ?>"><?php echo htmlspecialchars($task['full_name']); ?></a></p> <p><strong><?= __('posted_by_label') ?>:</strong> <a href="profile.php?id=<?php echo $task['user_id']; ?>"><?php echo htmlspecialchars($task['full_name']); ?></a></p>
<p><strong>Budget:</strong> $<?php echo htmlspecialchars(number_format((float)$task['budget'], 2)); ?></p> <p><strong><?= __('budget_label') ?>:</strong> $<?php echo htmlspecialchars(number_format((float)$task['budget'], 2)); ?></p>
<hr> <hr>
<p class="card-text"><?php echo nl2br(htmlspecialchars($task['description'])); ?></p> <p class="card-text"><?php echo nl2br(htmlspecialchars($task['description'])); ?></p>
</div> </div>
<div class="card-footer text-muted"> <div class="card-footer text-muted">
Posted on: <?php echo date('F j, Y, g:i a', strtotime($task['created_at'])); ?> <?= __('posted_on_label') ?>: <?php echo date('F j, Y, g:i a', strtotime($task['created_at'])); ?>
</div> </div>
</div> </div>
<?php if ($is_owner): ?> <?php if ($is_owner): ?>
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3>Applicants</h3> <h3><?= __('applicants_title') ?></h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<?php if (empty($task['whatsapp_number'])): ?> <?php if (empty($task['whatsapp_number'])): ?>
<div class="alert alert-warning">Please <a href="/profile.php?id=<?= $_SESSION['user_id'] ?>">add your WhatsApp number</a> to your profile before accepting applications.</div> <div class="alert alert-warning"><?= __('add_whatsapp_prompt') ?></div>
<?php endif; ?> <?php endif; ?>
<?php if (empty($applications)): ?> <?php if (empty($applications)): ?>
<p>No applications yet.</p> <p><?= __('no_applicants_yet') ?></p>
<?php else: ?> <?php else: ?>
<ul class="list-group"> <ul class="list-group">
<?php foreach ($applications as $application): ?> <?php foreach ($applications as $application): ?>
@ -79,7 +79,7 @@ require_once 'shared/header.php';
<span class="badge status-<?= htmlspecialchars($application['status']) ?>"><?= htmlspecialchars($application['status']) ?></span> <span class="badge status-<?= htmlspecialchars($application['status']) ?>"><?= htmlspecialchars($application['status']) ?></span>
</div> </div>
<?php if ($application['status'] === 'pending' && !empty($task['whatsapp_number'])): ?> <?php if ($application['status'] === 'pending' && !empty($task['whatsapp_number'])): ?>
<a href="accept-application.php?id=<?= $application['id'] ?>" class="btn btn-success btn-sm">Accept</a> <a href="accept-application.php?id=<?= $application['id'] ?>" class="btn btn-success btn-sm"><?= __('accept_button') ?></a>
<?php endif; ?> <?php endif; ?>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
@ -90,22 +90,22 @@ require_once 'shared/header.php';
<?php elseif (isset($_SESSION['user_id'])): ?> <?php elseif (isset($_SESSION['user_id'])): ?>
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3>My Application</h3> <h3><?= __('my_application_title') ?></h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<?php if ($user_application): ?> <?php if ($user_application): ?>
<?php if ($user_application['status'] === 'accepted'): ?> <?php if ($user_application['status'] === 'accepted'): ?>
<div class="alert alert-success"> <div class="alert alert-success">
<h4>Congratulations! Your application was accepted.</h4> <h4><?= __('application_accepted_message') ?></h4>
<p>Contact the task owner on WhatsApp: <strong><?= htmlspecialchars($task['whatsapp_number']) ?></strong></p> <p><?= sprintf(__('contact_owner_whatsapp'), htmlspecialchars($task['whatsapp_number'])) ?></p>
</div> </div>
<?php else: ?> <?php else: ?>
<p>Your application status is: <span class="badge status-<?= htmlspecialchars($user_application['status']) ?>"><?= htmlspecialchars($user_application['status']) ?></span></p> <p><?= __('application_status_label') ?>: <span class="badge status-<?= htmlspecialchars($user_application['status']) ?>"><?= htmlspecialchars($user_application['status']) ?></span></p>
<?php endif; ?> <?php endif; ?>
<?php else: ?> <?php else: ?>
<form action="apply.php" method="POST"> <form action="apply.php" method="POST">
<input type="hidden" name="task_id" value="<?= $task['id'] ?>"> <input type="hidden" name="task_id" value="<?= $task['id'] ?>">
<button type="submit" class="btn btn-primary">Apply Now</button> <button type="submit" class="btn btn-primary"><?= __('apply_now_button') ?></button>
</form> </form>
<?php endif; ?> <?php endif; ?>
</div> </div>