public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
data/web/resource.php
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
<?php
3
if (!isset($_GET['file']) ) {
4
http_response_code(404);
5
exit;
6
}
7
$pathinfo = pathinfo($_GET['file']);
9
if (!array_key_exists('extension', $pathinfo)) {
10
http_response_code(404);
11
exit;
12
}
13
$extension = strtolower($pathinfo['extension']);
15
$filepath = '/tmp/' . $pathinfo['basename'];
16
$content = '';
18
if (file_exists($filepath)) {
19
$secondsToCache = 31536000;
20
$expires = gmdate('D, d M Y H:i:s', time() + $secondsToCache) . ' GMT';
22
if ($extension === 'js') {
23
header('Content-Type: application/javascript');
24
} elseif ($extension === 'css') {
25
header('Content-Type: text/css');
26
} else {
27
//currently just css and js should be supported!
28
exit();
29
}
31
header("Expires: $expires");
32
header('Pragma: cache');
33
header('Cache-Control: max-age=' . $secondsToCache);
34
$content = file_get_contents($filepath);
35
}
37
echo $content;