Added OpenWebAnalytics

This commit is contained in:
Samuel Ortion 2021-04-16 19:14:52 +02:00
parent 3f5b42d306
commit 692ba38598
26 changed files with 113 additions and 9 deletions

View File

@ -8,6 +8,7 @@ server {
listen 443 ssl;
server_name chiro-canto;
root /var/www/chiro-canto/public;
client_max_body_size 20M;
location / {
}

View File

@ -38,6 +38,7 @@ $data = $req->fetch();
</head>
<?php
include("$root/analytics/matomo.php");
include("$root/analytics/owa.php");
?>
<body>
<?php include("$root/menu.php");?>

View File

@ -12,6 +12,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
</head>
<?php
include("$root/analytics/matomo.php");
include("$root/analytics/owa.php");
?>
<body>
<?php

View File

@ -12,6 +12,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
</head>
<?php
include("$root/analytics/matomo.php");
include("$root/analytics/owa.php");
?>
<body>
<?php include("$root/menu.php");?>

View File

@ -17,6 +17,7 @@ error_reporting(E_ALL);
</head>
<?php
include("$root/analytics/matomo.php");
include("$root/analytics/owa.php");
?>
<body>
<?php include("$root/menu.php");?>

View File

@ -18,6 +18,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
</head>
<?php
include("$root/analytics/matomo.php");
include("$root/analytics/owa.php");
?>
<body>
<?php include("$root/menu.php");?>

View File

@ -18,6 +18,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
</head>
<?php
include("$root/analytics/matomo.php");
include("$root/analytics/owa.php");
?>
<body>
<?php include("$root/menu.php");?>

View File

@ -11,6 +11,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<body>

View File

@ -1 +0,0 @@
,ortion,fedora,04.04.2021 12:34,file:///home/ortion/.config/libreoffice/4;

View File

@ -40,6 +40,7 @@ if ($data = $req->fetch()) {
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<body>

View File

@ -15,6 +15,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<body>

View File

@ -29,7 +29,10 @@ $result = $req->fetchAll();
<link rel="stylesheet" type="text/css" href="/styles/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<?php include("$root/analytics/matomo.php");?>
<?php
include("$root/analytics/matomo.php");
include("$root/analytics/owa.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -0,0 +1,74 @@
<?php
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
require "$root/database/credentials.php";
// Connect the database
try {
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
$user,
$password,
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
));
} catch (Exception $e) {
die("Error : ".$e->getMessage());
}
if (isset($_GET['id'])) {
$req = $db->prepare('SELECT * FROM `records` WHERE id=:id');
$req->execute(array(
"id"=>$_GET['id']
));
} else {
$req = $db->prepare('SELECT * FROM `records` ORDER BY date');
$req->execute();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
include("$root/analytics/owa.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>
<section>
<h3>Record</h3>
<?php
if ($data = $req->fetch()) {
?>
<div class="sound">
<h3><?=$data['file_name']?></h3>
<h4><em><?=$data['species']?></em></h4>
<p>Recorded on <?=$data['date']?> at <?=$data['time']?></p>
<?php
if (file_exists($root."/storage/spectrograms/".$data['file_name'].'.png'))
{
?>
<img id="spectrogram" src="<?="/storage/spectrograms/".$data['file_name'].'.png'?>" alt="bat sound spectrogram">
<?php
}
?>
<br>
<audio src="<?="/storage/records/".$data['file_name']?>" controls></audio>
<p><?=$data['license']?> <?=$data['recordist_name']?></p>
</div>
<?php
} else {
echo "Can't find the record associated with this id, please try again.";
}?>
</section>
<?php include("$root/footer.php");?>
</body>
<script src="/scripts/script.js"></script>
</html>

View File

@ -32,6 +32,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
</head>
<?php
include("$root/analytics/matomo.php");
include("$root/analytics/owa.php");
?>
<body>
<?php include("$root/menu.php");?>

View File

@ -37,6 +37,7 @@ $data = $req->fetch();
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<body>

View File

@ -30,6 +30,7 @@ $result = $req->fetchAll();
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<body>

View File

@ -31,6 +31,7 @@ $result = $req->fetchAll();
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<body>

View File

@ -17,6 +17,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<body>

View File

@ -18,6 +18,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
</head>
<?php
include("$root/analytics/matomo.php");
include("$root/analytics/owa.php");
?>
<body>
<?php include("$root/menu.php");?>

View File

@ -15,6 +15,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<body>

View File

@ -36,7 +36,10 @@ $data = $req->fetch();
<title>Larynx | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php include("$root/analytics/matomo.php");?>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<?php
include("$root/analytics/matomo.php");
?>

View File

@ -69,6 +69,7 @@ if (empty($result))
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<body>

View File

@ -353,12 +353,13 @@ table#replies td {
#larynx {
background-color: rgba(0, 0, 0, 0.8);
width: auto;
min-height: 100vh;
margin: 0;
color: white;
padding: 1em;
width: 1840px;
height: 500px;
overflow: auto;
}
#larynx h2 {

View File

@ -29,6 +29,7 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
crossorigin=""/>
</head>
<?php
include("$root/analytics/owa.php");
include("$root/analytics/matomo.php");
?>
<body>

View File

@ -142,9 +142,9 @@ if (isset($_POST['submit']))
if ($_SESSION['error_msg'] == "")
{
header('Location: '.'index.php?step=verify');
// header('Location: '.'index.php?step=verify');
} else{
$_SESSION['error_msg'] .= "Please try again.\n";
header('Location: '.'index.php?step=metadata');
// header('Location: '.'index.php?step=metadata');
}

View File

@ -82,6 +82,11 @@ try {
} catch (Exception $e) {
die("Error : ".$e->getMessage());
}
header('Location: '."/");
$req = $db->prepare('SELECT LAST_INSERT_ID() AS id;');
$req->execute();
if ($data = $req->fetch()) {
header('Location: '."/explore/record/?id=".$data['id']);
} else {
header('Location: '."/");
}
?>