chore(cleanup): archive one-time migrations, secure telemetry endpoint, and purge temporary files

This commit is contained in:
Hamza-Ayed
2026-08-18 14:00:20 +03:00
parent cb384765fb
commit bab24892c7
13 changed files with 1927 additions and 102206 deletions
-9
View File
@@ -1,9 +0,0 @@
Downloading Syria map data...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
␍ 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0␍100 239 100 239 0 0 829 0 --:--:-- --:--:-- --:--:-- 829
Warning: Failed to open the file
Warning: /home/hamzadoctor/app/infrastructure/osm-data/syria-latest.osm.pbf:
Warning: No such file or directory
␍ 0 73.8M 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (23) Failure writing output to destination, passed 4096 returned 4294967295
+1597 -583
View File
File diff suppressed because it is too large Load Diff
+316 -359
View File
File diff suppressed because it is too large Load Diff
@@ -1,6 +1,7 @@
<?php <?php
/** /**
* Real-time Driver Location Tracker (Last 10 Days - Full Records) * Real-time Driver Location Tracker (Configurable Days - Full Records)
* Used by Intaleq PHP Core to export driver tracks to Map SaaS.
*/ */
include_once("../../jwtconnect.php"); include_once("../../jwtconnect.php");
@@ -8,8 +9,8 @@ include_once("../../jwtconnect.php");
header('Content-Type: application/json'); header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Origin: *');
// 2. API Key Validation // 1. API Key Validation (Strict environment check)
$expected_api_key = getenv('LOCATION_SERVER_API_KEY') ?: 'intaleq_secret_2026'; $expected_api_key = getenv('LOCATION_SERVER_API_KEY');
function get_api_key() function get_api_key()
{ {
@@ -25,29 +26,30 @@ function get_api_key()
$provided_api_key = get_api_key(); $provided_api_key = get_api_key();
if ($provided_api_key !== $expected_api_key) { if (empty($expected_api_key) || $provided_api_key !== $expected_api_key) {
http_response_code(401); http_response_code(401);
echo json_encode(['error' => 'Unauthorized access']); echo json_encode(['error' => 'Unauthorized access: Invalid or missing API key']);
exit; exit;
} }
// 3. API Input (Optional days parameter, default 1) // 2. API Input (Optional days parameter, default 1, max 100)
$days = isset($_GET['days']) ? (int)$_GET['days'] : 1; $days = isset($_GET['days']) ? (int)$_GET['days'] : 1;
if ($days < 1 || $days > 100) $days = 1; if ($days < 1) $days = 1;
if ($days > 100) $days = 100;
// SQL // 3. SQL Query with Parameterized Bound Values
$sql = " $sql = "
SELECT * SELECT *
FROM car_tracks FROM car_tracks
WHERE created_at >= NOW() - INTERVAL $days DAY WHERE created_at >= NOW() - INTERVAL :days DAY
ORDER BY created_at DESC ORDER BY created_at DESC
"; ";
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':days', $days, PDO::PARAM_INT);
$stmt->execute(); $stmt->execute();
// جلب كل النتائج دفعة واحدة
$records = $stmt->fetchAll(PDO::FETCH_ASSOC); $records = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode([ echo json_encode([
@@ -58,8 +60,7 @@ try {
'data' => $records 'data' => $records
], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); ], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
} } catch (PDOException $e) {
catch (PDOException $e) {
http_response_code(500); http_response_code(500);
echo json_encode([ echo json_encode([
'error' => 'Database error', 'error' => 'Database error',
File diff suppressed because it is too large Load Diff