aboutsummaryrefslogtreecommitdiff
path: root/p/ext.php
blob: cff194343d7c2c61cb02113db90d2635e905cf52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
if (!isset($_GET['e'])) {
	header('HTTP/1.1 400 Bad Request');
	die();
}
$extension = substr($_GET['e'], 0, 64);
if (!ctype_alpha($extension)) {
	header('HTTP/1.1 400 Bad Request');
	die();
}

require('../constants.php');
$filename = FRESHRSS_PATH . '/extensions/' . $extension . '/';

if (isset($_GET['j'])) {
	header('Content-Type: application/javascript; charset=UTF-8');
	header('Content-Disposition: inline; filename="script.js"');
	$filename .= 'script.js';
} elseif (isset($_GET['c'])) {
	header('Content-Type: text/css; charset=UTF-8');
	header('Content-Disposition: inline; filename="style.css"');
	$filename .= 'style.css';
}

$mtime = @filemtime($filename);
if ($mtime == false) {
	header('HTTP/1.1 404 Not Found');
	die();
}

require(LIB_PATH . '/http-conditional.php');

if (!httpConditional($mtime, 604800, 2)) {
	readfile($filename);
}