Giter VIP home page Giter VIP logo

Comments (9)

malle-pietje avatar malle-pietje commented on May 18, 2024 1

I checked the PHP docs and it turns out when using empty() there is no need to also use isset() as test.
http://php.net/manual/en/function.empty.php
Using empty() widens the scope of the test a bit to also test for "false" so it should do the trick.

from unifi-api-browser.

malle-pietje avatar malle-pietje commented on May 18, 2024

I have not seen this error before. Which PHP and cURL versions are you using?

from unifi-api-browser.

Demonslay335 avatar Demonslay335 commented on May 18, 2024

I was able to reproduce this. It is due to a bit of a session confusion.

I tried connecting to UBNT 3.2.10 at first (I know the comments say 4.0.0 minimum, but I had to try before going through that hassle :P). I started getting 401s from the API, which did not register with the code as being a failed request (it looks for 400, so must be difference from old controller versions), so it tries to continue. This allowed list_sites() to fail to get any sites, returning false, and storing it in the session.

I then upgraded the controller to 4.8.20, and refreshed the page. Since the session variable $_SESSION['sites'] was already set, and equaled false, it sets $sites = $_SESSION['sites'];, which is what ends up breaking the foreach loop.

My suggestion is the change this line. on index.php:182

if (isset($_SESSION['sites']) || $_SESSION['sites'] === '') {

To:

if (isset($_SESSION['sites']) || empty($_SESSION['sites'])){

This allowed the sites from my updated controller to be pulled in correctly.

from unifi-api-browser.

malle-pietje avatar malle-pietje commented on May 18, 2024

Thanks for the feedback: seems to make sense to do it like this. I will test this change and include if all goes well.

from unifi-api-browser.

facuxt avatar facuxt commented on May 18, 2024

Hello, i updated my unifi controller to 5.2.2 and suddenly it works... i put an .htpasswd simple http authorization on the app because it shows the ssh password of the aps and operator of hotspot...
@malle-pietje very nice job dude!!!! i want to collaborate with the project, would you be interested in an external app to do different stuff in unifi? i can help in angularJs frontend...

from unifi-api-browser.

malle-pietje avatar malle-pietje commented on May 18, 2024

There is popular demand for a reporting tool: where the API Browser tool is really a tool for developers there are quite a lot of non-technical users that want to have a tool that produces tabular reports (e.g. using DataTables) on the most relevant data collections/API endpoints. Such a tool should allow the user to select/deselect columns and a select a time range (e.g. using DataRangeSelector).

I have some idea's for this but just can't find the time to develop it.

from unifi-api-browser.

malle-pietje avatar malle-pietje commented on May 18, 2024

@facuxt Would be nice if you would be able to spend some time on that...:-)

from unifi-api-browser.

facuxt avatar facuxt commented on May 18, 2024

maybe we can form some kind of project... i need that kind of reporting tool... with the api you can get historical data? for example from the unifi controller you just can get only 30 days ago... There is any documentation of the api?
i'll look forward to it... @enzogro

from unifi-api-browser.

malle-pietje avatar malle-pietje commented on May 18, 2024

Would be nice project to work on. The API can report on historical data as long as it's available from the controller. There is no documentation but I have made an effort in providing a start by adding comments to the functions in the class.unifi.php file.

from unifi-api-browser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.