From e559c2bbfddcc84c380cb2e4007eb66954d95d24 Mon Sep 17 00:00:00 2001 From: Stricted Date: Mon, 27 Jul 2015 01:22:52 +0200 Subject: [PATCH] add lanDeviceOverview --- SpeedportHybrid.class.php | 2 ++ lib/trait/Network.class.php | 24 ++++++++++++++++++++++++ lib/trait/Phone.class.php | 6 ++---- 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 lib/trait/Network.class.php diff --git a/SpeedportHybrid.class.php b/SpeedportHybrid.class.php index 534d323..bbd9146 100644 --- a/SpeedportHybrid.class.php +++ b/SpeedportHybrid.class.php @@ -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/Network.class.php'); require_once('lib/trait/Phone.class.php'); require_once('lib/trait/System.class.php'); @@ -17,6 +18,7 @@ class SpeedportHybrid { use Connection; use CryptLib; use Login; + use Network; use Phone; use System; diff --git a/lib/trait/Network.class.php b/lib/trait/Network.class.php new file mode 100644 index 0000000..0c22a8d --- /dev/null +++ b/lib/trait/Network.class.php @@ -0,0 +1,24 @@ + + * @copyright 2015 Jan Altensen (Stricted) + */ +trait Network { + /** + * get all devices in network + * + * @return array + */ + public function lanDeviceOverview () { + $data = $this->getData('LAN'); + $data = $this->getValues($data); + + if (isset($data['addmdevice'])) { + return $data['addmdevice']; + } + else { + return array(); + } + } +} diff --git a/lib/trait/Phone.class.php b/lib/trait/Phone.class.php index 8799221..a30f940 100644 --- a/lib/trait/Phone.class.php +++ b/lib/trait/Phone.class.php @@ -38,8 +38,7 @@ trait Phone { $this->checkLogin(); $path = 'data/PhoneBook.json'; - $fields = array( - 'csrf_token' => $this->token, + $fields = array('csrf_token' => $this->token, 'id' => $id, 'search' => '', 'phonebook_name' => $name, @@ -87,8 +86,7 @@ trait Phone { $this->checkLogin(); $path = 'data/PhoneBook.json'; - $fields = array( - 'csrf_token' => $this->token, + $fields = array('csrf_token' => $this->token, 'id' => $id, 'deleteEntry' => 'delete' ); -- 2.20.1