diff --git a/homepage/views.php b/homepage/views.php
index f37426a..3bc74f1 100644
--- a/homepage/views.php
+++ b/homepage/views.php
@@ -104,6 +104,7 @@ if(isset($_GET['view'])){
if($_GET['view'] == "View Log"){echo "
";}
if($_GET['view'] == "Overview"){include('overview.php');}
if($_GET['view'] == "Today's Detections"){include('todays_detections.php');}
+ if($_GET['view'] == "Kiosk"){$kiosk = true;include('todays_detections.php');}
if($_GET['view'] == "Species Stats"){include('stats.php');}
if($_GET['view'] == "Weekly Report"){include('weekly_report.php');}
if($_GET['view'] == "Streamlit"){echo "";}
diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php
index b04445c..db87185 100644
--- a/scripts/todays_detections.php
+++ b/scripts/todays_detections.php
@@ -5,6 +5,23 @@ session_start();
error_reporting(E_ERROR);
ini_set('display_errors',1);
+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'];
+ }
+
+ if($kiosk == true) {
+ echo "
+$site_name
";
+ }
+
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
if($db == False){
echo "Database is busy";
@@ -63,6 +80,53 @@ $user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
$home = trim($home);
+// from https://stackoverflow.com/questions/2690504/php-producing-relative-date-time-from-timestamps
+function relativeTime($ts)
+{
+ if(!ctype_digit($ts))
+ $ts = strtotime($ts);
+
+ $diff = time() - $ts;
+ if($diff == 0)
+ return 'now';
+ elseif($diff > 0)
+ {
+ $day_diff = floor($diff / 86400);
+ if($day_diff == 0)
+ {
+ if($diff < 60) return 'just now';
+ if($diff < 120) return '1 minute ago';
+ if($diff < 3600) return floor($diff / 60) . ' minutes ago';
+ if($diff < 7200) return '1 hour ago';
+ if($diff < 86400) return floor($diff / 3600) . ' hours ago';
+ }
+ if($day_diff == 1) return 'Yesterday';
+ if($day_diff < 7) return $day_diff . ' days ago';
+ if($day_diff < 31) return ceil($day_diff / 7) . ' weeks ago';
+ if($day_diff < 60) return 'last month';
+ return date('F Y', $ts);
+ }
+ else
+ {
+ $diff = abs($diff);
+ $day_diff = floor($diff / 86400);
+ if($day_diff == 0)
+ {
+ if($diff < 120) return 'in a minute';
+ if($diff < 3600) return 'in ' . floor($diff / 60) . ' minutes';
+ if($diff < 7200) return 'in an hour';
+ if($diff < 86400) return 'in ' . floor($diff / 3600) . ' hours';
+ }
+ if($day_diff == 1) return 'Tomorrow';
+ if($day_diff < 4) return date('l', $ts);
+ if($day_diff < 7 + (7 - date('w'))) return 'next week';
+ if(ceil($day_diff / 7) < 4) return 'in ' . ceil($day_diff / 7) . ' weeks';
+ if(date('n', $ts) == date('n') + 1) return 'next month';
+ return date('F Y', $ts);
+ }
+}
+
+
if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {
if(isset($_GET['searchterm'])) {
if(strtolower(explode(" ", $_GET['searchterm'])[0]) == "not") {
@@ -110,6 +174,8 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {
$config = parse_ini_file('./scripts/firstrun.ini');
}
+
+
while($todaytable=$result0->fetchArray(SQLITE3_ASSOC))
{
$iterations++;
@@ -120,8 +186,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {
$sciname = preg_replace('/ /', '_', $todaytable['Sci_Name']);
$args = "&license=2%2C3%2C4%2C5%2C6%2C9&orientation=square,portrait";
$comnameprefix = "%20bird";
-
- if (!empty($config["FLICKR_API_KEY"]) && (isset($_GET['display_limit']) || isset($_GET['hard_limit']))) {
+ if (!empty($config["FLICKR_API_KEY"]) && (isset($_GET['display_limit']) || isset($_GET['hard_limit']) || $_GET['kiosk'] == true) ) {
if(!empty($config["FLICKR_FILTER_EMAIL"])) {
if(!isset($_SESSION["FLICKR_FILTER_EMAIL"])) {
@@ -179,16 +244,16 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {
-
|
+ |
|
- 0) { ?>
+ 0) { ?>
|
+ href="https://allaboutbirds.org/guide/" target="top">
+ href="https://wikipedia.org/wiki/" target="top">
Confidence:
|
@@ -231,7 +296,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {
@@ -264,31 +333,48 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {
|
|
- Today's Detections —
+
+ Today's Detections —
Loading...
+
+
+
+
+
+
+