Skip to content

Commit

Permalink
version 1.0.3, API client version 1.0.7
Browse files Browse the repository at this point in the history
added ability to optionally configure multiple controllers in
`config.php`
general code and comments cleanup
added `stat_sites()` function to the API client class (supported on
UniFi controllers 5.2.9 and higher)
  • Loading branch information
malle-pietje committed Oct 4, 2016
1 parent ce2b6b4 commit d5c9fbd
Show file tree
Hide file tree
Showing 4 changed files with 889 additions and 738 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ Alternatively you may choose to download the zip file and unzip it in your direc

### Configuration
- credentials for access to the UniFi Controller API need to be configured in the file named `config.template.php` which should be copied/renamed to `config.php` before using the UniFi API browser tool
- please see the `config.template.php` file for further instructions
- starting with API Browser tool version 1.0.3 you can store **multiple controller configurations** in a single `config.php` file
- please refer to the comments in the `config.template.php` file for further instructions
- after following these steps, you can open the tool in your browser (assuming you installed it in the root folder of your web server as suggested above) by going to this url: `http://serverip/UniFi-API-browser/`

### Updates
Expand Down
96 changes: 70 additions & 26 deletions config.template.php
Original file line number Diff line number Diff line change
@@ -1,37 +1,81 @@
<?php
/*
The MIT License (MIT)
/**
* The MIT License (MIT)
*
* Copyright (c) 2016, Slooffmaster
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/

Copyright (c) 2016, Slooffmaster
/**
* Single controller configuration
* ===============================
* Update this section with your UniFi controller details and credentials
* Remove or comment out this section when using the Multi controller configuration method
*/
$controlleruser = ''; // the user name for access to the UniFi Controller
$controllerpassword = ''; // the password for access to the UniFi Controller
$controllerurl = ''; // full url to the UniFi Controller, eg. 'https://22.22.11.11:8443'
$controllerversion = ''; // the version of the Controller software, eg. '4.6.6' (must be at least 4.0.0)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
/**
* Multi controller configuration
* ==============================
* Only modify and uncomment this section when NOT using the above Single controller configuration method.
* The number of controllers that can be added is unlimited, just take care to correctly increment the
* index values (0,1,2 etc.)
*
* Please remember to only have one of either two methods active!
*/
/*
$controllers[0] = [
'user' => '', // the user name for access to the UniFi Controller
'password' => '', // the password for access to the UniFi Controller
'url' => '', // full url to the UniFi Controller, eg. 'https://22.22.11.11:8443'
'name' => '',
'version' => '' // the version of the Controller software, eg. '4.6.6' (must be at least 4.0.0)
];
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
$controllers[1] = [
'user' => '', // the user name for access to the UniFi Controller
'password' => '', // the password for access to the UniFi Controller
'url' => '', // full url to the UniFi Controller, eg. 'https://22.22.11.11:8443'
'name' => '',
'version' => '' // the version of the Controller software, eg. '4.6.6' (must be at least 4.0.0)
];
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
$controllers[2] = [
'user' => '', // the user name for access to the UniFi Controller
'password' => '', // the password for access to the UniFi Controller
'url' => '', // full url to the UniFi Controller, eg. 'https://22.22.11.11:8443'
'name' => '',
'version' => '' // the version of the Controller software, eg. '4.6.6' (must be at least 4.0.0)
];
*/

$controlleruser = ''; // the user name for access to the Unifi Controller
$controllerpassword = ''; // the password for access to the Unifi Controller
$controllerurl = ''; // full url to the Unifi Controller, eg. 'https://22.22.11.11:8443'
$controllerversion = ''; // the version of the Controller software, eg. '4.6.6' (must be at least 4.0.0)
$cookietimeout = '3600'; // time of inactivity in seconds, after which the PHP session cookie will be refreshed
// after the cookie refresh the site and data collection will need to be selected again
$theme = 'bootstrap'; /* your default theme of choice, pick one from the list below
bootstrap, cerulean, cosmo, cyborg, darkly, flatly, journal, lumen, paper
readable, sandstone, simplex, slate, spacelab, superhero, united, yeti
*/

$theme = 'bootstrap'; // your default theme of choice, pick one from the list below:
// bootstrap, cerulean, cosmo, cyborg, darkly, flatly, journal, lumen, paper
// readable, sandstone, simplex, slate, spacelab, superhero, united, yeti

$debug = false; // set to true (without quotes) to enable debug output to the browser and the PHP error log
?>
Loading

0 comments on commit d5c9fbd

Please sign in to comment.