DEV aus der Abgabe 1 #4

Merged
niklas.ortmann merged 55 commits from dev into main 2026-05-13 13:00:21 +02:00
4 changed files with 71 additions and 10 deletions
Showing only changes of commit 85158ba8e1 - Show all commits
+3 -3
View File
@@ -76,9 +76,9 @@
</main>
<footer>
<a href="legal/impressum.php">Impressum</a>
<a href="legal/datenschutz.php">Datenschutz</a>
<a href="legal/nutzungsbedingungen.php">Nutzungsbedingungen</a>
<a href="../legal/impressum.php">Impressum</a>
<a href="../legal/datenschutz.php">Datenschutz</a>
<a href="../legal/nutzungsbedingungen.php">Nutzungsbedingungen</a>
</footer>
</body>
+12 -5
View File
@@ -1,10 +1,12 @@
<!--
Globales Menü, wird via PHP später in alle Seiten eingebunden
-->
<nav>
<img src="../images/logo.png" style="height: 44px; ">
<a href = "../content/informatik.php" style = "color: white; padding: 5px; text-align: center; text-decoration: none; display: inline-block;"><b>Informatik</b></a>
<nav style="background:#808080;">
<div style="float:left">
<a href="../index.php">
<img src="../images/logo.png" style="height: 44px;">
</a>
<a href = "../content/informatik.php" style = "padding: 5px; text-align: center; text-decoration: none; display: inline-block;"><b>Informatik</b></a>
|
<a href = "../content/mathe.php" style = "padding: 5px; text-align: center; text-decoration: none; display: inline-block;"><b>Mathe</b></a>
|
@@ -12,11 +14,16 @@ Globales Menü, wird via PHP später in alle Seiten eingebunden
|
<a href = "../content/profile.php" style = "padding: 5px; text-align: center; text-decoration: none; display: inline-block;"><b>Dein Profil</b></a>
|
</div>
<div style="text-align: center;">
<?php
include_once '../includes/search.php';
include_once 'search.php';
?>
</div>
<div style="float:right">
|
<a href = "../auth/login.php" style = "background-color: #f44336; color: white; padding: 4px 20px; text-align: center; text-decoration: none; display: inline-block;"> Anmelden </a>
<a href = "../auth/register.php" style = "background-color: #f44336; color: white; padding: 4px 20px; text-align: center; text-decoration: none; display: inline-block;"> Registrieren </a>
</div>
</nav>
+1 -2
View File
@@ -22,8 +22,7 @@
include_once 'content/home.php';
?>
<footer>
<footer style="position:fixed;bottom:0;width:100%;background:#fff;text-align:center;">
<a href="legal/impressum.php">Impressum</a>
<a href="legal/datenschutz.php">Datenschutz</a>
<a href="legal/nutzungsbedingungen.php">Nutzungsbedingungen</a>
+55
View File
@@ -0,0 +1,55 @@
<?php
// Webhook: erfasst einen push auf dem dev (und aktualisiert das Webverzeichnis des Servers)
ini_set('error_log', __DIR__ . '/tmp.log');
$secret_key = '763489347';
// check for POST request
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
error_log('FAILED - not POST - '. $_SERVER['REQUEST_METHOD']);
exit();
}
// get content type
$content_type = isset($_SERVER['CONTENT_TYPE']) ? strtolower(trim($_SERVER['CONTENT_TYPE'])) : '';
if ($content_type != 'application/json') {
error_log('FAILED - not application/json - '. $content_type);
exit();
}
// get payload
$payload = trim(file_get_contents("php://input"));
if (empty($payload)) {
error_log('FAILED - no payload');
exit();
}
// get header signature
$header_signature = isset($_SERVER['HTTP_X_GITEA_SIGNATURE']) ? $_SERVER['HTTP_X_GITEA_SIGNATURE'] : '';
if (empty($header_signature)) {
error_log('FAILED - header signature missing');
exit();
}
// calculate payload signature
$payload_signature = hash_hmac('sha256', $payload, $secret_key, false);
// check payload signature against header signature
if ($header_signature !== $payload_signature) {
error_log('FAILED - payload signature');
exit();
}
// convert json to array
$decoded = json_decode($payload, true);
// check for json decode errors
if (json_last_error() !== JSON_ERROR_NONE) {
error_log('FAILED - json decode - '. json_last_error());
exit();
}
// success, do something
error_log('SUCCESS - Webhook hat funktioniert');