forked from Adleraci/adlerka.top
Do something
This commit is contained in:
@@ -24,11 +24,24 @@ function getEndpoint($endpoint_name): string
|
||||
$endpoint_file = $routerConfig["endpoint_dir"] . $endpoint_name . ".php";
|
||||
|
||||
if (file_exists($endpoint_file)){
|
||||
$output = runEndpoint($endpoint_file);
|
||||
$output_tmp = runEndpoint($endpoint_file);
|
||||
$output["Endpoint"] = $endpoint_name;
|
||||
switch (gettype($output)) {
|
||||
case 'string':
|
||||
$output = $output_tmp;
|
||||
$output['Status'] = 'Success';
|
||||
break;
|
||||
case 'bool':
|
||||
$output['Status'] = $output ? 'Success' : 'Fail';
|
||||
break;
|
||||
default:
|
||||
$output['Status'] = 'Fail';
|
||||
$output["Error"] = "Endpoint error";
|
||||
http_response_code(500);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$output["Error"] = "Not found";
|
||||
$output["Endpoint"] = $endpoint_name;
|
||||
http_response_code(404);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user