Update: 2026-07-25 18:40:38

This commit is contained in:
Hamza-Ayed
2026-07-25 18:40:38 +03:00
parent 4bbc687c15
commit 8d3e63d1c7
9 changed files with 58 additions and 65 deletions
+1 -6
View File
@@ -43,10 +43,5 @@ foreach ($dailyRides as &$row) {
$row['current_month_rides_count'] = $monthRides['current_month_rides_count'];
}
// Return result
if ($dailyRides) {
jsonSuccess($dailyRides);
} else {
jsonError("No records found");
}
jsonSuccess($dailyRides ?: []);
?>
+28 -34
View File
@@ -3,46 +3,40 @@
require_once __DIR__ . '/../../connect.php';
$sql = "SELECT
COUNT(`car_locations`.driver_id) AS driver_count,
driver.id,
driver.phone,
driver.name_arabic,
MAX(dt.token) AS token
FROM
`car_locations`
LEFT JOIN driver ON driver.id = car_locations.driver_id
LEFT JOIN driverToken dt ON dt.captain_id = driver.id
WHERE
`car_locations`.created_at > TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY))
GROUP BY
driver.id
ORDER BY
driver_count DESC
LIMIT 19;
";
COUNT(r.id) AS driver_count,
d.id,
d.phone,
d.first_name,
d.last_name,
d.name_arabic
FROM driver d
LEFT JOIN ride r ON d.id = r.driver_id AND LOWER(r.status) IN ('finished','completed')
GROUP BY d.id, d.phone, d.first_name, d.last_name, d.name_arabic
ORDER BY driver_count DESC
LIMIT 20";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
// فك التشفير للحقول الحساسة
foreach ($rows as &$row) {
if (!empty($row['phone'])) {
$row['phone'] = $encryptionHelper->decryptData($row['phone']);
}
if (!empty($row['name_arabic'])) {
$row['name_arabic'] = $encryptionHelper->decryptData($row['name_arabic']);
}
if (!empty($row['token'])) {
$row['token'] = $encryptionHelper->decryptData($row['token']);
}
// فك التشفير للحقول الحساسة
foreach ($rows as &$row) {
if (!empty($row['phone'])) {
$row['phone'] = $encryptionHelper->decryptData($row['phone']) ?: $row['phone'];
}
if (!empty($row['first_name'])) {
$row['first_name'] = $encryptionHelper->decryptData($row['first_name']) ?: $row['first_name'];
}
if (!empty($row['last_name'])) {
$row['last_name'] = $encryptionHelper->decryptData($row['last_name']) ?: $row['last_name'];
}
if (!empty($row['name_arabic'])) {
$row['name_arabic'] = $encryptionHelper->decryptData($row['name_arabic']) ?: $row['name_arabic'];
}
jsonSuccess($rows);
} else {
jsonError($message = "No recent driver location activity found");
}
unset($row);
jsonSuccess($rows);
?>
+1 -8
View File
@@ -18,12 +18,5 @@ $stmt->execute();
// Fetch all records as an associative array
$employee_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Check if any records were retrieved
if ($employee_data) {
// If records were found, print the data as JSON
jsonSuccess($data = $employee_data);
} else {
// If no records were found, print a failure message
jsonError($message = "No employee records found");
}
jsonSuccess($employee_data ?: []);
?>
@@ -2,7 +2,6 @@
// Admin/v2/quality/blacklist_manager.php
require_once __DIR__ . '/../../../connect.php';
require_once __DIR__ . '/../../../encrypt_decrypt.php';
require_once __DIR__ . '/../security/audit_logs_helper.php'; // إذا كان متاحاً، وإلا سننفذ الإدخال مباشرة
if ($role !== 'admin' && $role !== 'super_admin') {
jsonError("Unauthorized", 403);
+16 -1
View File
@@ -10,7 +10,22 @@ if ($role !== 'admin' && $role !== 'super_admin') {
$driver_id = filterRequest('driver_id');
if (!$driver_id) {
jsonError("Missing driver_id", 400);
try {
$stmt = $con->prepare("SELECT id, first_name, last_name, phone, status FROM driver ORDER BY id DESC LIMIT 20");
$stmt->execute();
$drivers = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($drivers as &$d) {
if (!empty($d['first_name'])) $d['first_name'] = $encryptionHelper->decryptData($d['first_name']) ?: $d['first_name'];
if (!empty($d['last_name'])) $d['last_name'] = $encryptionHelper->decryptData($d['last_name']) ?: $d['last_name'];
if (!empty($d['phone'])) $d['phone'] = $encryptionHelper->decryptData($d['phone']) ?: $d['phone'];
}
unset($d);
jsonSuccess($drivers);
exit;
} catch (Throwable $e) {
jsonSuccess([]);
exit;
}
}
try {
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
require_once __DIR__ . '/../../../connect.php';
require_once __DIR__ . '/../../connect.php';
// 🔥 [Fix Broken Access Control] كان يتحقق من صلاحية التوكن فقط — أي مستخدم
// مسجّل دخول (راكب/سائق آخر) كان يقدر يجلب بيانات أي سائق مفكوكة التشفير
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
require_once __DIR__ . '/../../../connect.php';
require_once __DIR__ . '/../../connect.php';
// 🔥 [Fix Broken Access Control] كان يتحقق من صلاحية التوكن فقط بدون التحقق
// من الدور — أي توكن صالح (حتى راكب) كان يقدر يسحب قائمة السائقين المعلّقين
+1 -7
View File
@@ -8,11 +8,5 @@ $stmt = $con->prepare($sql);
$stmt->execute();
$passenger_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($passenger_data) {
// Print the passenger data as JSON
jsonSuccess($data = $passenger_data);
} else {
// Print a failure message
jsonError($message = "No passenger data found");
}
jsonSuccess($passenger_data ?: []);
?>
+9 -6
View File
@@ -507,13 +507,10 @@
'Contact': 'معلومات الاتصال',
'Click any row to open the full profile': 'اضغط على أي سطر لفتح الملف الشخصي الكامل',
'Search by passenger ID, phone or email': 'البحث برقم الراكب، الهاتف، أو البريد الإلكتروني',
'Search by captain ID, phone or email': 'البحث برقم الكابتن، الهاتف، أو البريد الإلكتروني',
'Search rides by phone number': 'البحث في الرحلات برقم الهاتف',
'Yes': 'نعم',
'No': 'لا',
'Click any row to open the full profile': 'اضغط على أي سطر لفتح الملف الشخصي الكامل',
'Search rides by phone number': 'بحث في الرحلات برقم الهاتف',
'Search by captain ID, phone or email': 'بحث بمعرّف الكابتن أو البريد الإلكتروني أو الهاتف',
'Search by passenger ID, phone or email': 'بحث بمعرّف الراكب أو البريد الإلكتروني أو الهاتف',
// API error messages
' — the endpoint returned HTML, check the API base URL': ' — الـ API أرجع HTML، تحقق من عنوان الخادم',
'Session rejected by the server': 'الخادم رفض الجلسة',
@@ -3389,12 +3386,18 @@
}
function humanize(key) {
const s = String(key)
if (!key) return '';
const rawKey = String(key).trim();
if (lang === 'ar' && AR[rawKey]) return AR[rawKey];
const s = rawKey
.replace(/[_-]+/g, ' ')
.replace(/([a-z])([A-Z])/g, '$1 $2')
.replace(/\b\w/g, (m) => m.toUpperCase())
.trim();
return t(key) || t(s) || s;
if (lang === 'ar' && AR[s]) return AR[s];
return s;
}
function msgNode(text) {