2024-09-04 22:06:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$action = $_REQUEST['action'] ?? '';
|
|
|
|
$agent = $_REQUEST['agent'] ?? '';
|
|
|
|
require '../app/classes/agent.php';
|
|
|
|
|
|
|
|
$agentObject = new Agent($dbWeb);
|
|
|
|
|
|
|
|
// if a form is submitted, it's from the edit page
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|
|
|
|
2024-09-23 18:39:32 +00:00
|
|
|
// FIXME code here
|
2024-09-30 08:09:01 +00:00
|
|
|
// header("Location: $app_root?platform=$platform_id&page=config");
|
|
|
|
// exit();
|
2024-09-04 22:06:38 +00:00
|
|
|
|
2024-09-29 07:07:04 +00:00
|
|
|
$force = isset($_POST['force']) && $_POST['force'] == 'true';
|
2024-09-30 08:09:01 +00:00
|
|
|
$agent_id = $_POST['agent'];
|
2024-09-29 07:07:04 +00:00
|
|
|
$result = fetchAgent($agent_id, $force);
|
|
|
|
|
|
|
|
if ($result !== false) {
|
|
|
|
echo $result; // Return the API response as JSON
|
|
|
|
} else {
|
|
|
|
echo json_encode(['error' => 'Failed to fetch API data']);
|
|
|
|
}
|
|
|
|
|
2024-09-04 22:06:38 +00:00
|
|
|
// no form submitted, show the templates
|
|
|
|
} else {
|
2024-09-23 18:39:32 +00:00
|
|
|
$agentDetails = $agentObject->getAgentDetails($platform_id);
|
|
|
|
include '../app/templates/agent-list.php';
|
2024-09-04 22:06:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|