diff --git a/examples/block_list.php b/examples/block_list.php index 1eeb58a..f8c4ecb 100755 --- a/examples/block_list.php +++ b/examples/block_list.php @@ -24,12 +24,12 @@ require_once('vendor/autoload.php'); * see the config.template.php file for an example */ require_once('config.php'); - $debug = false; + /** * the MAC address(es) of the device(s) to block */ -$macs_to_block = explode(',',$argv[1]); +$macs_to_block = explode(',', $argv[1]); /** * The site to authorize the device with @@ -49,7 +49,7 @@ $loginresults = $unifi_connection->login(); // always true regardless of sit foreach ($macs_to_block as &$mac) { // block_result is always true even if mac address does not exist :( - $block_result = $unifi_connection->block_sta($mac); + $block_result = $unifi_connection->block_sta($mac); /** * NOTE: @@ -61,7 +61,7 @@ foreach ($macs_to_block as &$mac) { */ sleep(1); - $getid_result = $unifi_connection->stat_client($mac); + $getid_result = $unifi_connection->stat_client($mac); if (property_exists($getid_result[0], "oui")) { // this field(manufacturer) seems to exist on valid mac addresses diff --git a/examples/change_super_mgmt.php b/examples/change_super_mgmt.php index 31d4a69..95347e1 100755 --- a/examples/change_super_mgmt.php +++ b/examples/change_super_mgmt.php @@ -33,10 +33,10 @@ $site_settings = $unifi_connection->list_settings(); $super_mgmt_settings = []; $super_mgmt_settings_id = ''; -if(!empty($site_settings)) { +if (!empty($site_settings)) { foreach($site_settings as $section) { echo 'section key: ' . $section->key . PHP_EOL; - if($section->key === 'super_mgmt') { + if ($section->key === 'super_mgmt') { $super_mgmt_settings = $section; $super_mgmt_settings_id = $section->_id; } diff --git a/examples/extend_guest_auth.php b/examples/extend_guest_auth.php index a49d017..dec301e 100755 --- a/examples/extend_guest_auth.php +++ b/examples/extend_guest_auth.php @@ -17,7 +17,9 @@ require_once('vendor/autoload.php'); */ require_once('config.php'); -// must be adapted to your site! +/** + * must be adapted to your site! + */ $site_id = "default"; $site_name = "*enter your site name*"; @@ -29,18 +31,39 @@ if ($loginresults === 400) { print "UniFi controller login failure, please check your credentials in config.php.\n"; } else { $guestlist = $unifi_connection->list_guests(); - // loop thru all known guests + + /** + * loop thru all known guests + */ foreach ($guestlist as $guest) { print "
" . $guest->_id . " (" . $guest->mac . "), valid until " . date(DATE_ATOM, $guest->end) . " (" . $guest->end . ")
"; - // just a sample: only extend validity of guests which have end date after 2017-04-02 + /** + * just a sample: only extend validity of guests which have end date after 2017-04-02 + */ if ($guest->end > 1491166482) { - // extend clients five times = five days - if (!$unifi_connection->extend_guest_validity($guest->_id)) print "Extend failed for guest with id " . $guest->_id . "\n"; - if (!$unifi_connection->extend_guest_validity($guest->_id)) print "Extend failed for guest with id " . $guest->_id . "\n"; - if (!$unifi_connection->extend_guest_validity($guest->_id)) print "Extend failed for guest with id " . $guest->_id . "\n"; - if (!$unifi_connection->extend_guest_validity($guest->_id)) print "Extend failed for guest with id " . $guest->_id . "\n"; - if (!$unifi_connection->extend_guest_validity($guest->_id)) print "Extend failed for guest with id " . $guest->_id . "\n"; + /** + * extend clients five times = five days + */ + if (!$unifi_connection->extend_guest_validity($guest->_id)) { + print "Extend failed for guest with id " . $guest->_id . "\n"; + } + + if (!$unifi_connection->extend_guest_validity($guest->_id)) { + print "Extend failed for guest with id " . $guest->_id . "\n"; + } + + if (!$unifi_connection->extend_guest_validity($guest->_id)) { + print "Extend failed for guest with id " . $guest->_id . "\n"; + } + + if (!$unifi_connection->extend_guest_validity($guest->_id)) { + print "Extend failed for guest with id " . $guest->_id . "\n"; + } + + if (!$unifi_connection->extend_guest_validity($guest->_id)) { + {print "Extend failed for guest with id " . $guest->_id . "\n"; + } } } diff --git a/examples/unblock_list.php b/examples/unblock_list.php index 0b04a0e..eef89d1 100755 --- a/examples/unblock_list.php +++ b/examples/unblock_list.php @@ -24,8 +24,8 @@ require_once('vendor/autoload.php'); * see the config.template.php file for an example */ require_once('config.php'); +$debug = false; -$debug=false; /** * the MAC addresses of the device(s) to unblock */