Commit Graph
65 Commits
Author SHA1 Message Date
Hamza-AyedandClaude Opus 5 a0ab6c5155 Add broadcast notifications and transit route approvals
Broadcast: ride/firebase/send_fcm.php is an internal service guarded by a
shared secret, so the browser cannot call it — holding that key client-side
would expose it, and the endpoint cannot tell who the sender is. A new
Admin/notifications/broadcast.php sits in front of it: it runs behind
connect.php, requires super_admin, restricts the target to the two topics the
apps actually subscribe to ('drivers'/'passengers') so it cannot be used to
push to an arbitrary topic or a single device token, bounds the title and
body, writes an audit entry before dispatching, and only then forwards the
call internally with the shared secret.

The composer shows a live push preview and an explicit confirmation naming
the audience, since a broadcast cannot be recalled.

Route approvals: draft routes render with their stops, distance and stop
count, and approve/reject posts to transit/route/approve.php behind a
confirmation stating the consequence. Available to admins and super admins,
matching the endpoint's own role check.

Also render user-supplied text with unicode-bidi: plaintext — Arabic names,
addresses and messages were being laid out left-to-right inside the
English UI.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 02:15:02 +03:00
Hamza-AyedandClaude Opus 5 db4ca7dd7a Fix dashbord.php parse error; require super_admin on pricing and crypto tools
Hotfix: a comment added to the dashboard SQL contained double quotes inside
the double-quoted PHP string, terminating it and making dashbord.php fail to
parse. Production was returning a parse error for every dashboard request.

Authorisation gaps closed — connect.php only proves a token is valid, it does
not check what the caller is allowed to do:

- Admin/ggg.php decrypts any database field and was authorised solely by an
  admin phone number sent in the request body. Anyone who knew a listed
  number could decrypt platform data without signing in. It now runs behind
  connect.php, requires super_admin, keeps the phone list as a second factor,
  and records every use.
- ride/kazan/update.php, kazan/add.php and ride/promo/{add,update,delete}.php
  changed live pricing and discount codes with no role check at all, so any
  valid token — including a driver's or passenger's — could rewrite the fare
  table. All now require super_admin.

Staff/pending.php: adminUser has no `status` column in this deployment, so
the query failed with an opaque "unavailable". It now checks for the column
and reports the actual reason.

Console: Kazan tariff editor for super admins — sends only changed fields,
shows an old → new confirmation before saving, and stays read-only with an
explanatory notice for plain admins.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 02:00:14 +03:00
Hamza-AyedandClaude Opus 5 852c6ece5c Fix admin status handling for the current ride pipeline; extend console
The ride table holds two generations of status values: the legacy CamelCase
set ('Finished', 'CancelFromPassenger') and the lowercase set written by
backend/ride/rides/* today ('completed', 'cancelled_by_passenger'). Admin
queries only matched the legacy set, so on live data:

- get_rides_by_status.php returned nothing meaningful for every filter, and
  the "in progress" default masked it.
- dashbord.php reported total_driver_earnings as NULL, completed_rides as a
  fraction of the real count, and cancelled_rides as 0.
- driver_avg_duration averaged in negative durations, yielding "-00h 22m".

All three now match on LOWER(status) across both families.

Staff/pending.php ran with no authentication at all, exposing pending
admins' names and phone numbers to any caller; it now goes through
connect.php with a role check. It also returned HTTP 400 for everything when
the `users` table was absent — each source is queried independently and
reports its own availability.

Console:
- Render rides from either schema generation (price/date/time and
  start_location coordinates, or the older address/created_at columns).
- Null aggregates render as "—" rather than a measured 0.00.
- Add tariff/promo, WhatsApp send and encryption modules, all super-admin
  gated; pricing remains read-only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 01:47:55 +03:00
Hamza-Ayed 10f1154cc7 Update adminUser fingerprint and fingerprint_hash in database upon successful OTP verification 2026-07-25 00:30:14 +03:00
Hamza-Ayed 9d2a665d64 Restore WhatsApp OTP (Nabeh API) flow for Admin authentication 2026-07-25 00:25:53 +03:00
Hamza-Ayed 4c738e8f43 Remove legacy encrypt_decrypt.php - bootstrap.php already provides encryptionHelper 2026-07-25 00:23:27 +03:00
Hamza-Ayed 032e1edda5 Remove broken providers.php require_once - issue JWT directly on valid password 2026-07-24 23:59:27 +03:00
Hamza-Ayed 1ca2c5a5dd Fix require_once path in login.php using realpath 2026-07-24 23:51:28 +03:00
Hamza-Ayed f115292dd2 Refactor login.php with decryption lookup for encrypted fields and restore Nabeh OTP integration 2026-07-24 23:48:57 +03:00
Hamza-Ayed 60e344598b Fix Admin login path issue and issue direct JWT on valid credentials 2026-07-24 23:45:28 +03:00
Hamza-Ayed 8bc9290916 Safely initialize encryptionHelper and handle Throwable in Admin login.php 2026-07-24 23:42:39 +03:00
Hamza-Ayed 9e2964d307 Allow email and ID login in Admin auth login.php and bind web device fingerprint 2026-07-24 23:38:17 +03:00
Hamza-Ayed 1e785061ec Fix decryptData null type error and live analytics overflow 2026-07-23 20:42:48 +03:00
Hamza-Ayed 12e70f3d7e Fix status warning in admin login 2026-07-23 20:34:27 +03:00
Hamza-Ayed 653d73422f Update: 2026-07-12 18:53:59 2026-07-12 18:53:59 +03:00
Hamza-Ayed 24fb56f08f Update: 2026-07-12 05:40:28 2026-07-12 05:40:28 +03:00
Hamza-Ayed 04468dad08 Update: 2026-07-10 23:59:23 2026-07-10 23:59:23 +03:00
Hamza-Ayed 2152d34a8e fix: resolve stale price display in driver ratings and remove misleading discount UI in rider ratings 2026-07-09 04:48:19 +03:00
Hamza-Ayed ac0c343f18 Update: 2026-07-09 01:01:15 2026-07-09 01:01:16 +03:00
Hamza-Ayed 21877153eb feat: harden backend security with HMAC verification, SSL validation, and documentation updates while removing legacy scripts. 2026-07-08 22:10:01 +03:00
Hamza-Ayed 05d047d871 Update: 2026-07-02 05:27:04 2026-07-02 05:27:05 +03:00
Hamza-Ayed d2ce4bdb16 Update: 2026-06-30 23:32:14 2026-06-30 23:32:15 +03:00
Hamza-Ayed 1b5d6eae44 Simplify APNs payload for iOS visible notifications and fetch latest token 2026-06-30 22:13:45 +03:00
Hamza-Ayed d9dc124c3e Fix region_name fallback based on countryCode to prevent Damascus appearing for Jordan 2026-06-30 22:00:13 +03:00
Hamza-Ayed e7785c9b2d Log FCM errors in debug_info when push notification fails 2026-06-30 21:59:00 +03:00
Hamza-Ayed cf748dfd7c Decrypt token before FCM push and fallback to SMS on push fail, also decrypt names in campaigns log 2026-06-30 21:52:15 +03:00
Hamza-Ayed de06d1cd75 Add debug counts 2026-06-30 21:48:34 +03:00
Hamza-Ayed bd13cbb905 Update targeting logic in trigger_campaign.php to fallback to parsing phone prefixes instead of relying solely on passenger_opening_locations 2026-06-30 21:30:28 +03:00
Hamza-Ayed fdd09d8f35 Fix SQL group by and undefined function errors in admin APIs 2026-06-30 21:17:06 +03:00
Hamza-Ayed 1ae8acad7a Update: 2026-06-30 21:12:26 2026-06-30 21:12:26 +03:00
Hamza-Ayed 9cc14864a3 Update: 2026-06-29 00:26:08 2026-06-29 00:26:08 +03:00
Hamza-Ayed 03f26ce825 Update: 2026-06-29 00:12:38 2026-06-29 00:12:39 +03:00
Hamza-Ayed 1ff132cd07 Update: 2026-06-26 17:59:47 2026-06-26 17:59:47 +03:00
Hamza-Ayed 25d3237113 Update: 2026-06-26 17:58:12 2026-06-26 17:58:12 +03:00
Hamza-Ayed 060d9b08ae Update: 2026-06-26 17:42:07 2026-06-26 17:42:07 +03:00
Hamza-Ayed 953ef28ec7 Update: 2026-06-26 17:39:24 2026-06-26 17:39:24 +03:00
Hamza-Ayed ae21389240 Update: 2026-06-26 17:36:57 2026-06-26 17:36:57 +03:00
Hamza-Ayed 9ded734e38 Update: 2026-06-26 17:29:23 2026-06-26 17:29:23 +03:00
Hamza-Ayed a9e2ee1a58 Update: 2026-06-26 01:10:36 2026-06-26 01:10:36 +03:00
Hamza-Ayed 35e54ea433 Update: 2026-06-25 19:10:25 2026-06-25 19:10:25 +03:00
Hamza-Ayed b00b6a4cde Update: 2026-06-25 19:05:13 2026-06-25 19:05:13 +03:00
Hamza-Ayed 63eea81039 Update: 2026-06-25 19:04:05 2026-06-25 19:04:05 +03:00
Hamza-Ayed b57fd1cecb Update: 2026-06-25 18:59:57 2026-06-25 18:59:57 +03:00
Hamza-Ayed f3bafeb9e1 Update: 2026-06-25 18:57:58 2026-06-25 18:57:58 +03:00
Hamza-Ayed 7368feed11 Update: 2026-06-25 18:56:57 2026-06-25 18:56:57 +03:00
Hamza-Ayed 4a6b6d52a3 Update: 2026-06-25 18:53:08 2026-06-25 18:53:08 +03:00
Hamza-Ayed 85ff15cabe Update: 2026-06-25 18:41:32 2026-06-25 18:41:33 +03:00
Hamza-Ayed 9b61bd50c8 Update: 2026-06-25 18:39:01 2026-06-25 18:39:01 +03:00
Hamza-Ayed efe26c95be Update: 2026-06-22 00:31:28 2026-06-22 00:31:29 +03:00
Hamza-Ayed e73be65a72 Update: 2026-06-21 18:58:05 2026-06-21 18:58:13 +03:00