Files
WrenchBoradWeb/www-api/app/Controllers/Agents.php
T
CHIEFSOFT\ameye f53fc76fa3 agent path
2024-02-12 12:44:10 -05:00

65 lines
2.4 KiB
PHP

<?php
namespace App\Controllers;
class Agents extends BaseController
{
public function index()
{
return '';
}
public function apigate()
{
log_message('critical', "Agent 0001");
header('Access-Control-Allow-Origin: *');
log_message('critical', "AgentApi Path GATE 001");
$call_backend = true;
header("Access-Control-Allow-Headers: Origin, X-API-KEY, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Authorization, observe, enctype, Content-Length, X-Csrf-Token");
log_message('critical', "0003");
header("Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Max-Age: 3600");
header('content-type: application/json; charset=utf-8');
$method = $_SERVER['REQUEST_METHOD'];
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip_loc = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip_loc = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip_loc = $_SERVER['REMOTE_ADDR'];
}
$current_env = $this->getSiteConfigurations("system.live");
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
$server_tag = $this->getSiteConfigurations("system.server_tag");
$final_out =[];
$final_out["environment"] = $current_env + 0;
$final_out["session_image_server"] = $primary_image_sever; //
$final_out["server_tag"] = $server_tag;
$final_out["language"] = "en";
$final_out["ip_loc"] = $ip_loc;
$final_out["family_types"] = $this->familyTypes();
$final_out["history_types"] = $this->historyTypes();
//return json_encode( ( new \App\Models\ResultFormatter() )->processOutJson($in, $out));
return json_encode( $final_out );
}
private function familyTypes(){
return [
array("ty"=>"Parent", "id"=>"PARENT", "tag"=>"fam_type_parent"),
array("ty"=>"Relatives", "id"=>"RELATIVES", "tag"=>"fam_type_relatives"),
array("ty"=>"Others", "id"=>"Others", "tag"=>"fam_type_others")
];
}
private function historyTypes(){
return [
array("ty"=>"Completed Jobs", "id"=>"COMPLETED_JOBS", "tag"=>"hist_type_completed_jobs"),
];
}
}