c53bf39ad6b267a9fcc82127ed6893c6b96abc45
[minimedit.git] / login / commits / index.php
1 <?php
2 if (!$User->admin('edit')) {
3         require '403.inc.html';
4         return;
5 }
6
7 $hash = ltrim($Page->path, '/');
8 if (!$hash) {
9         return TRUE;
10 }
11
12 print "<h2>Wijzigingen in $hash</h2>\n";
13
14 $gitcmd = "git show ".$hash;
15 $log = popen($gitcmd, 'r');
16 if (!$log or strpos(fgets($log), "commit $hash") !== 0) {
17         $Page->place['warn'] = "Kon inhoud niet ophalen met <code>$gitcmd</code>";
18         return;
19 }
20
21 print '<pre>';
22 while ( $line = fgets($log) ) {
23         print htmlspecialchars($line);
24 }
25 print "</pre>\n";
26
27 pclose($log);
28 return;