Update: 2026-07-14 00:34:22

This commit is contained in:
Hamza-Ayed
2026-07-14 00:34:22 +03:00
parent c956f27230
commit a547b81b60
14 changed files with 123 additions and 81 deletions
+2 -6
View File
@@ -13,12 +13,8 @@ if (!$stopId || !$passengerId) {
jsonError('Missing parameters', 400);
}
// استخرج سجل السائق من JWT — لا نثق بأي معرّف سائق من العميل
$driverRow = $transit_con->prepare(
"SELECT id FROM transit_drivers WHERE main_driver_id=? AND status='active' LIMIT 1"
);
$driverRow->execute([(string)$transit_user_id]);
$driverRec = $driverRow->fetch();
// استخرج سجل السائق من JWT (Redis read-through) — لا نثق بأي معرّف سائق من العميل
$driverRec = transitResolveDriver((string)$transit_user_id);
if (!$driverRec) jsonError('Driver not found or not active', 403);
$transit_driver_id = (int)$driverRec['id'];
+2 -6
View File
@@ -10,12 +10,8 @@ $delay = min((int)filterRequest('delay_minutes'), 120);
$reason = filterRequest('reason');
if (!$tripId || $delay <= 0) jsonError('trip_id and delay_minutes are required', 400);
// استخرج سجل السائق من JWT
$driverRow = $transit_con->prepare(
"SELECT id FROM transit_drivers WHERE main_driver_id=? AND status='active' LIMIT 1"
);
$driverRow->execute([(string)$transit_user_id]);
$driverRec = $driverRow->fetch();
// استخرج سجل السائق من JWT (Redis read-through)
$driverRec = transitResolveDriver((string)$transit_user_id);
if (!$driverRec) jsonError('Driver not found or not active', 403);
$driverId = (int)$driverRec['id'];
+2 -6
View File
@@ -8,12 +8,8 @@ if ($transit_user_role !== 'driver') jsonError('Only drivers can access this end
$tripId = filterRequest('trip_id', 'int');
if (!$tripId) jsonError('trip_id is required', 400);
// استخرج سجل السائق من JWT
$driverRow = $transit_con->prepare(
"SELECT id FROM transit_drivers WHERE main_driver_id=? AND status='active' LIMIT 1"
);
$driverRow->execute([(string)$transit_user_id]);
$driverRec = $driverRow->fetch();
// استخرج سجل السائق من JWT (Redis read-through)
$driverRec = transitResolveDriver((string)$transit_user_id);
if (!$driverRec) jsonError('Driver not found or not active', 403);
$driverId = (int)$driverRec['id'];
+2 -6
View File
@@ -10,12 +10,8 @@ $tripId = filterRequest('trip_id', 'int');
$lat = (float)filterRequest('lat');
$lng = (float)filterRequest('lng');
// استخرج سجل السائق من JWT — تحقق أن الرحلة تخصه
$driverRow = $transit_con->prepare(
"SELECT id FROM transit_drivers WHERE main_driver_id=? AND status='active' LIMIT 1"
);
$driverRow->execute([(string)$transit_user_id]);
$driverRec = $driverRow->fetch();
// استخرج سجل السائق من JWT (Redis read-through) — تحقق أن الرحلة تخصه
$driverRec = transitResolveDriver((string)$transit_user_id);
if (!$driverRec) jsonError('Driver not found or not active', 403);
$driverId = (int)$driverRec['id'];
+2 -6
View File
@@ -9,12 +9,8 @@ if ($transit_user_role !== 'driver') jsonError('Only drivers can access this end
$stopId = (int)filterRequest('stop_id');
if (!$stopId) jsonError('Missing stop_id', 400);
// استخرج سجل السائق من JWT — لا نثق بأي معرّف سائق من العميل
$driverRow = $transit_con->prepare(
"SELECT id FROM transit_drivers WHERE main_driver_id=? AND status='active' LIMIT 1"
);
$driverRow->execute([(string)$transit_user_id]);
$driverRec = $driverRow->fetch();
// استخرج سجل السائق من JWT (Redis read-through) — لا نثق بأي معرّف سائق من العميل
$driverRec = transitResolveDriver((string)$transit_user_id);
if (!$driverRec) jsonError('Driver not found or not active', 403);
$transit_driver_id = (int)$driverRec['id'];
+2 -6
View File
@@ -5,12 +5,8 @@ require_once __DIR__ . '/../../transit/connect_app.php';
if ($transit_user_role !== 'driver') jsonError('Only drivers can access this endpoint', 403);
// استخرج سجل السائق من JWT — لا نثق بـ driver_transit_id من العميل
$chk = $transit_con->prepare(
"SELECT id, org_id FROM transit_drivers WHERE main_driver_id=? AND status='active' LIMIT 1"
);
$chk->execute([(string)$transit_user_id]);
$driver = $chk->fetch();
// استخرج سجل السائق من JWT (Redis read-through) — لا نثق بـ driver_transit_id من العميل
$driver = transitResolveDriver((string)$transit_user_id);
if (!$driver) jsonError('Driver not found or not active — activate your account first', 403);
$driverTransitId = (int)$driver['id'];