- Rebases master

- Updates PubliAPI's logic dealing with request data
This commit is contained in:
Vlad
2016-04-15 12:02:22 -04:00
parent a4c1b24c35
commit bfde34eb8d

View File

@ -23,11 +23,9 @@ class PublicAPI {
$this->action = isset($_GET['action']) ? $this->action = isset($_GET['action']) ?
Helpers::underscoreToCamelCase($_GET['action']) : Helpers::underscoreToCamelCase($_GET['action']) :
false; false;
$this->data = ( $this->data = isset($_GET['data']) ?
(isset($_GET['data'])) $_GET['data'] :
? unserialize(base64_decode($_GET['data'])) false;
: array()
);
} }
function init() { function init() {
@ -37,7 +35,7 @@ class PublicAPI {
function queue() { function queue() {
try { try {
$queue = new Daemon($this->data); $queue = new Daemon($this->_decodeData());
$this->_checkAndCallMethod($queue, $this->action); $this->_checkAndCallMethod($queue, $this->action);
} catch(\Exception $e) { } catch(\Exception $e) {
} }
@ -45,7 +43,7 @@ class PublicAPI {
function subscription() { function subscription() {
try { try {
$subscription = new Subscription\Pages($this->action, $this->data); $subscription = new Subscription\Pages($this->action, $this->_decodeData());
$this->_checkAndCallMethod($subscription, $this->action); $this->_checkAndCallMethod($subscription, $this->action);
} catch(\Exception $e) { } 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));
}
} }