. */ namespace GnuBoat; require_once(__DIR__ ."/../autoloader.php"); class WebService { function __construct() { $this->_requests = array(); $this->_requests["data"] = "GnuBoat\ServiceData"; $this->_requests["shutdown"] = "GnuBoat\ServiceShutdown"; $this->_requests["logfiles"] = "GnuBoat\ServiceLogFiles"; $this->_requests["map"] = "GnuBoat\ServiceMap"; } public function process() { $debug = 0; if(is_array($_GET) && array_key_exists("debug", $_GET)) $debug = $_GET["debug"]; $request = array_keys($this->_requests)[0]; if(is_array($_GET) && array_key_exists("request", $_GET)){ $request = $_GET["request"]; } if(!array_key_exists($request, $this->_requests)){ $result["error"] = 1; $result["errormessage"] = "Request ". $request ." not implemented"; header('Content-Type: application/json'); echo json_encode($result) ."\n"; return; } call_user_func(array(new $this->_requests[$request], "process")); } private $_requests; } ?>