Revert "revert getMissedCalls, getTakenCalls and getDialedCalls for test reasons"
[GitHub/Stricted/speedport-hybrid-php-api.git] / SpeedportHybrid.class.php
index bbd91462c635aa203bc8338e5e2b505920d61ecd..f8d6a0d57c950ff5bc81e7dd54d2899bfb87003d 100644 (file)
@@ -5,6 +5,7 @@ require_once('CryptLib/CryptLib.php');
 require_once('lib/trait/Connection.class.php');
 require_once('lib/trait/CryptLib.class.php');
 require_once('lib/trait/Login.class.php');
+require_once('lib/trait/Firewall.class.php');
 require_once('lib/trait/Network.class.php');
 require_once('lib/trait/Phone.class.php');
 require_once('lib/trait/System.class.php');
@@ -17,6 +18,7 @@ require_once('lib/trait/System.class.php');
 class SpeedportHybrid {
        use Connection;
        use CryptLib;
+       use Firewall;
        use Login;
        use Network;
        use Phone;
@@ -52,6 +54,8 @@ class SpeedportHybrid {
        private function getValues($array) {
                $data = array();
                foreach ($array as $item) {
+                       if (!isset($item['vartype']) || !isset($item['varid']) || !isset($item['varvalue'])) continue;
+                       
                        // thank you telekom for this piece of shit
                        if ($item['vartype'] == 'template') {
                                if (is_array($item['varvalue'])) {
@@ -132,7 +136,11 @@ class SpeedportHybrid {
                
                // decode json
                if (strpos($url, '.json') !== false) {
-                       $body = json_decode($body, true);
+                       $json = json_decode($body, true);
+                       
+                       if (is_array($json)) {
+                               $body = $json;
+                       }
                }
                
                return array('header' => $this->parse_headers($header), 'body' => $body);