From c78b2088ebcf5fdba8b7b9bc9a8534fa3ef83773 Mon Sep 17 00:00:00 2001 From: Vlad Date: Thu, 7 Jul 2016 14:20:27 -0400 Subject: [PATCH] - Updates the check for invalid API endpoint --- lib/API/API.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/API/API.php b/lib/API/API.php index f141c74110..e1f768c838 100644 --- a/lib/API/API.php +++ b/lib/API/API.php @@ -29,19 +29,19 @@ class API { } function init() { + $endpoint = self::ENDPOINT_NAMESPACE . ucfirst($this->endpoint); if(!$this->api_request) return; - if(!$this->endpoint) { + if(!$this->endpoint || !class_exists($endpoint)) { $this->terminateRequest(self::API_RESPONSE_CODE_ERROR, __('Invalid API endpoint.')); } $this->callEndpoint( - $this->endpoint, + $endpoint, $this->action, $this->data ); } function callEndpoint($endpoint, $action, $data) { - $endpoint = self::ENDPOINT_NAMESPACE . ucfirst($endpoint); if(!method_exists($endpoint, $action)) { $this->terminateRequest(self::API_RESPONSE_CODE_ERROR, __('Invalid API action.')); }