From 596bdef0a3e727161de72be0c7d2d1ab2711cf6e Mon Sep 17 00:00:00 2001
From: Jonas Leder <jonas@jonasled.de>
Date: Sat, 2 Jan 2021 00:48:38 +0100
Subject: [PATCH] use .onion address also for tracking on 404 page

---
 public/.htaccess             |  2 +-
 public/{404.html => 404.php} | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
 rename public/{404.html => 404.php} (86%)

diff --git a/public/.htaccess b/public/.htaccess
index 48960e7..ac9484a 100644
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -1,4 +1,4 @@
-ErrorDocument 404 /404.html
+ErrorDocument 404 /404.php
 
 <FilesMatch "\.(sql)$">
     Order Deny,Allow
diff --git a/public/404.html b/public/404.php
similarity index 86%
rename from public/404.html
rename to public/404.php
index b93d1d8..332ebda 100644
--- a/public/404.html
+++ b/public/404.php
@@ -1,3 +1,13 @@
+<?php
+include "internal/config.php";
+
+if (strpos($_SERVER['HTTP_HOST'], '.onion') !== false) {
+    $trackURL = $trackURLTor;
+} else {
+    $trackURL = $trackURLNormal;
+}
+?>
+
 <!DOCTYPE html>
 <html lang="en">
 <head>
@@ -9,7 +19,7 @@
 </head>
 <body>
 <!-- Matomo Image Tracker-->
-<img src="https://matomo.jonasled.de/matomo.php?idsite=1&amp;rec=1" style="border:0" alt="" />
+<img src="<?php echo($trackURL); ?>" style="border:0" alt="" />
 <!-- End Matomo -->
 <div id="particles-js"></div>
 <div class="terminal-window">
-- 
GitLab