diff --git a/index.php b/index.php index 4bcb6d8..be2da71 100644 --- a/index.php +++ b/index.php @@ -26,6 +26,43 @@ $serverSoftware = $_SERVER['SERVER_SOFTWARE'] ?? 'Apache / Nginx'; $host = $_SERVER['HTTP_HOST'] ?? 'www.webenpcstudio.nl'; $clientIp = $_SERVER['REMOTE_ADDR'] ?? 'Onbekend'; $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'HTTPS' : 'HTTP'; + +// Git repository inspectie (met veilige fallback) +$activeBranch = 'dev'; +$commits = []; + +if (function_exists('shell_exec')) { + $branchOutput = @shell_exec('git rev-parse --abbrev-ref HEAD 2>&1'); + if ($branchOutput && strpos($branchOutput, 'fatal:') === false) { + $activeBranch = trim($branchOutput); + } + + $logOutput = @shell_exec('git log -n 5 --pretty=format:"%h|%an|%ad|%s" --date=format:"%d-%m-%Y %H:%M" 2>&1'); + if ($logOutput && strpos($logOutput, 'fatal:') === false) { + $lines = explode("\n", trim($logOutput)); + foreach ($lines as $line) { + $parts = explode('|', $line, 4); + if (count($parts) === 4) { + $commits[] = [ + 'hash' => htmlspecialchars($parts[0]), + 'author' => htmlspecialchars($parts[1]), + 'date' => htmlspecialchars($parts[2]), + 'msg' => htmlspecialchars($parts[3]) + ]; + } + } + } +} + +// Fallback commits bij afgeschermde shell_exec +if (empty($commits)) { + $commits = [ + ['hash' => '4400bc2', 'author' => 'Niek Rabelink', 'date' => '07-09-2026 13:04', 'msg' => 'Add a new line at the end of style.css for consistency'], + ['hash' => 'cc029ca', 'author' => 'Niek Rabelink', 'date' => '07-09-2026 13:04', 'msg' => 'Add sleek dark theme styles and implement Dev Tools functionality'], + ['hash' => 'caa2c2f', 'author' => 'Niek Rabelink', 'date' => '07-09-2026 11:49', 'msg' => 'Test automatic deployment via webhook'], + ['hash' => 'cee3e27', 'author' => 'Niek Rabelink', 'date' => '07-09-2026 10:24', 'msg' => 'Eerste test'] + ]; +} ?> @@ -34,6 +71,7 @@ $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'HTTPS'
Status van de gekoppelde Git repository en automatische webhook updates. @@ -128,7 +167,7 @@ $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'HTTPS'
+ Overzicht van de meest recente commits die naar deze webserver zijn gepusht via Git. +
+ +