-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.php
44 lines (33 loc) · 930 Bytes
/
api.php
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
36
37
38
39
40
41
42
43
44
<?php
header ('Content-type: application/json');
$data = array (
'version' => 0.143
);
$base = 'ferwebProsirenje';
$extension = '.user.js';
$siteUrl = 'http://fly.srk.fer.hr/~mak/gm/fwProsirenje/index.php?download=';
//echo 'lala'
function genVersionFilename ($version) {
global $base, $extension;
$versionStr = str_replace ('.', '-', (float)$version);
$filename = $base . '-' . $versionStr . $extension;
return $filename;
}
if (!isset ($_GET['option']) || !isset ($_GET['callback'])) {
echo '""';
exit;
}
switch ($_GET['option']) {
case 'versionCheck':
echo $_GET['callback'] . '(' . json_encode ($data['version']) . ')';
break;
case 'getlink':
if (!isset ($_GET['version'])) {
echo '""';
exit;
}
echo $_GET['callback'] . '(' . json_encode (htmlspecialchars ($siteUrl . genVersionFilename ($_GET['version']), ENT_QUOTES)) . ')';
break;
default:
echo '""';
}