Skip to content

A live bird collage card for your Home Assistant dashboard.

convert history.php todays_detections.php

frederikff58215ebe27
diff --git a/scripts/history.php b/scripts/history.php
index 1f3f3bce..dd21a3c6 100644
--- a/scripts/history.php
+++ b/scripts/history.php
@@ -8,12 +8,7 @@ error_reporting(E_ALL);
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
require_once 'scripts/common.php';
-
-if (file_exists('./scripts/thisrun.txt')) {
- $config = parse_ini_file('./scripts/thisrun.txt');
-} elseif (file_exists('./scripts/firstrun.ini')) {
- $config = parse_ini_file('./scripts/firstrun.ini');
-}
+$config = get_config();
if(isset($_GET['date'])){
$theDate = $_GET['date'];
@@ -38,14 +33,6 @@ if(isset($_GET['blocation']) ) {
header("Pragma: no-cache");
header("Expires: 0");
-
- $user = trim(shell_exec("awk -F: '/1000/{print $1}' /etc/passwd"));
- $home = trim(shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"));
-
-
- //$sunrise = date_sunrise(time(), SUNFUNCS_RET_TIMESTAMP, $config["LATITUDE"], $config["LONGITUDE"]);
- //$sunset = date_sunset(time(), SUNFUNCS_RET_TIMESTAMP, $config["LATITUDE"], $config["LONGITUDE"]);
-
$list = array ();
//$hrsinday = intval(($sunset-$sunrise)/60/60);
diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php
index 0aaabc0b..7cb7dc2c 100644
--- a/scripts/todays_detections.php
+++ b/scripts/todays_detections.php
@@ -11,18 +11,9 @@ session_start();
error_reporting(E_ERROR);
ini_set('display_errors',1);
require_once 'scripts/common.php';
-
-if (file_exists('./scripts/thisrun.txt')) {
- $config = parse_ini_file('./scripts/thisrun.txt');
- } elseif (file_exists('./scripts/firstrun.ini')) {
- $config = parse_ini_file('./scripts/firstrun.ini');
- }
-
- if($config["SITE_NAME"] == "") {
- $site_name = "BirdNET-Pi";
- } else {
- $site_name = $config['SITE_NAME'];
- }
+$home = get_home();
+$config = get_config();
+$site_name = get_sitename();
if(isset($kiosk) && $kiosk == true) {
echo "<div style='margin-top:20px' class=\"centered\"><h1><a><img class=\"topimage\" src=\"images/bnp.png\"></a></h1></div>
@@ -64,10 +55,6 @@ ensure_db_ok($statement6);
$result6 = $statement6->execute();
$totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC);
-$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
-$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
-$home = trim($home);
-
if(isset($_GET['comname'])) {
$birdName = $_GET['comname'];
$birdName = str_replace("_", " ", $birdName);
@@ -200,13 +187,6 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {
$lines=null;
$licenses_urls = array();
- if (file_exists('./scripts/thisrun.txt')) {
- $config = parse_ini_file('./scripts/thisrun.txt');
- } elseif (file_exists('./scripts/firstrun.ini')) {
- $config = parse_ini_file('./scripts/firstrun.ini');
- }
-
-
while($todaytable=$result0->fetchArray(SQLITE3_ASSOC))
{
$iterations++;