From bfde34eb8da0a92ffb3b023b918c8353db4daced Mon Sep 17 00:00:00 2001 From: Vlad Date: Fri, 15 Apr 2016 12:02:22 -0400 Subject: [PATCH] - Rebases master - Updates PubliAPI's logic dealing with request data --- lib/Config/PublicAPI.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/Config/PublicAPI.php b/lib/Config/PublicAPI.php index 826ecc5325..5e7a71fb67 100644 --- a/lib/Config/PublicAPI.php +++ b/lib/Config/PublicAPI.php @@ -23,11 +23,9 @@ class PublicAPI { $this->action = isset($_GET['action']) ? Helpers::underscoreToCamelCase($_GET['action']) : false; - $this->data = ( - (isset($_GET['data'])) - ? unserialize(base64_decode($_GET['data'])) - : array() - ); + $this->data = isset($_GET['data']) ? + $_GET['data'] : + false; } function init() { @@ -37,7 +35,7 @@ class PublicAPI { function queue() { try { - $queue = new Daemon($this->data); + $queue = new Daemon($this->_decodeData()); $this->_checkAndCallMethod($queue, $this->action); } catch(\Exception $e) { } @@ -45,7 +43,7 @@ class PublicAPI { function subscription() { try { - $subscription = new Subscription\Pages($this->action, $this->data); + $subscription = new Subscription\Pages($this->action, $this->_decodeData()); $this->_checkAndCallMethod($subscription, $this->action); } catch(\Exception $e) { } @@ -75,4 +73,10 @@ class PublicAPI { ) ); } + + private function _decodeData($data) { + $data = ($data) ? $data : $this->data; + if (!$data) return false; + return unserialize(base64_decode($data)); + } } \ No newline at end of file