diff options
-rw-r--r-- | apis/debugrequest.inc.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/apis/debugrequest.inc.php b/apis/debugrequest.inc.php index d40ef1d1..5c1323ba 100644 --- a/apis/debugrequest.inc.php +++ b/apis/debugrequest.inc.php @@ -1,8 +1,10 @@ <?php function handleRequest() { - define("DEBUG_SETTINGS", Property::getRemoteDebugConfig()); - define("DEBUG_REQUEST", explode(":", file_get_contents("php://input"), 2)); + static $DEBUG_SETTINGS; + static $DEBUG_REQUEST; + $DEBUG_SETTINGS = Property::getRemoteDebugConfig(); + $DEBUG_REQUEST = explode(":", file_get_contents("php://input"), 2); if (!checkEnabled() || !checkValid()) { http_response_code(403); exit(1); @@ -20,7 +22,7 @@ function waitForRelay($task) { exit(1); } elseif ($status["listenPort"] != -1) { - echo "PORT=$status['listenPort']"; + echo "PORT={$status['listenPort']}"; Property::addToList("DispatchedRelay", $task["id"]); break; } @@ -28,17 +30,17 @@ function waitForRelay($task) { } function runRelayTask() { - $data = array("ip" => constant("DEBUG_SETTINGS")["debugServer"], "port" => constant("DEBUG_SETTINGS")["port"]); + $data = array("ip" => $DEBUG_SETTINGS["debugServer"], "port" => $DEBUG_SETTINGS["port"]); return Taskmanager::submit("RemoteDebug", $data); } function checkEnabled() { - return constant("DEBUG_SETTINGS")["enabled"]; + return $DEBUG_SETTINGS["enabled"]; } function checkValid() { return Database::queryFirst("SELECT machineuuid, clientip FROM machine WHERE machineuuid = :uuid AND clientip = :ip", - array(":uuid" => constant("DEBUG_REQUEST"[0], ":ip" => $_SERVER["REMOTE_ADDR"]))); + array(":uuid" => $DEBUG_REQUEST[0], ":ip" => $_SERVER["REMOTE_ADDR"])); } handleRequest(); |