Quick test for the common.php directory and filepath resolver to ensure it's generating the correct paths
And small fix for incorrect firstrun.ini location (thanks test case :) )
Makes things a little tidier and easier to change in the future, a custom message can be passed to authenticateUser() and this is output if the authentication fails.
Added protection around Include and Exclude species pages as these still accessible & data can still be written to include and exclude species.txt even with a password.
Because saveSetting() checks each time to see that the user has authenticated, if the password is changed first then very next setting will cause a auth prompt (as the password changed) and if cancelled then the other setting won't save.
Putting it last will allow us to save all the other setting and then change the password, then the next attempt to execute a action or access a page that required auth will prompt the user the the password.
Wired in an additional check to verify user is authenticated before executing any code that makes changes to the system like saving settings or command execution.
This is a 2nd layer on top of the front end pages authenticating the user
Added in escaping of arguments for set date and change timezone just in case
Include and Exclude list updated to use the calculated path to their respective x_species_list.txt files
Move play.php over to also use the new calculated paths to disk_check_exclude
Spectrogram.php remove unused code & replace setting save code with new function
Stats.php removed old code, update paths to use calculated path.
Rename setSetting func to saveSetting
Remove old code from other pages
The Config and Advanced setting pages received changes to use the new setSetting() function which looks after creating or updated the setting in the required config files.
Optionally it also specification of a command to run after saving the settings.
Some variables like models, audio formats and frequency shift tools were also moved into common.php
Service Controls page received changes with the replacement of the actual command to execute with a sort of shorthand human friendly version e.g. service <action> <service_name> -- service restart livestream.service
These commands map to the original commands in serviceMaintenance() so this could be called through the API without needing the full-blown commend.
views.php was updated to accommodate this also
System Controls page received a small change to make the process checking for new git updates or getting the last commit hash a single function call.
Include and Exclude species updated to use getFilePath() to generate a path to the required file instead of the hard coded path
Views.php also received similar treatment with replacing some hard coded paths with generated paths, but logic changes to handle the change in running service commands
All SQL Queries were moved into their respective functions and parameterized, there were some slight logic changes in the front end pages to accommodate data being returned differently but existing functionality is maintained
A common function is used to execute the queries and looks after binding any parameterized values that have been supplied.
Other code for deleting / protecting detection's, frequency shift, Flickr API call etc have also been moved into common.php to be used later by the API
Two new functions getDirectory and getFilePath were introduced in aims and make it easier to relocate files. This will be worked into all existing php files to replace hardcoded paths
Update the saving of the LogLevel_ settings to create the setting in the config file if it doesn't exist at the time of saving, the setting is created with the chosen value.
Moves the RTSP javascript code into it's script tag and moved it be near the controls for the RTSP URL.