"Bad request", "401"=>"Unauthorized", "403"=>"Forbidden", "404"=>"Not found", "405"=>"Method Not Allowed", "500"=>"Internal server error", "501"=>"Not Implemented", ]; $jsons=[ "api" ]; $code=$_GET["code"]; if (array_key_exists("FOX_REWRITE", $_SERVER) && $_SERVER["FOX_REWRITE"] != "yes") { $prefix = ($_SERVER["CONTEXT_PREFIX"]."index.php/"); } else { $prefix = ($_SERVER["CONTEXT_PREFIX"]); } $prefix = preg_replace(["![/]+!","![\.]+!"], ["\/","\."], $prefix); $req=(preg_replace("/".$prefix."/", '', $_SERVER["REQUEST_URI"])); $req = explode("/",explode("?", $req, 2)[0]); if (array_search($req[1], $jsons)!==false) { print '{"error":{"code":'.$code.',"message":"'.(array_key_exists($code, $codes)?$codes[$code]:"Server error").'"}}'; exit; } ?>