-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.php
More file actions
37 lines (30 loc) · 998 Bytes
/
api.php
File metadata and controls
37 lines (30 loc) · 998 Bytes
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
<?php
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
header('Access-Control-Allow-Origin: *');
require_once('DerbyLogos.php');
$debug = 0;
$cmd = isset($_REQUEST['cmd'])?$_REQUEST['cmd']:'getimg';
$dir = isset($_REQUEST['dir'])?$_REQUEST['dir']:'';
$file = isset($_REQUEST['file'])?$_REQUEST['file']:'/au/Queensland/Cap Coast Derby Dolls/CCDD.png';
$logos = new Logos($dir);
// Sanity Check $dir
if (preg_match('/\.\./', $dir))
die; //FOAD
switch ($cmd) {
case 'list':
doOutput($logos->getStatus(), $logos->getAllUnderFolder());
break;
case 'getimg':
$img = $logos->getRawImage($file);
doOutput(null, base64_encode($img), null);
break;
default:
doOutput("error", null, "Unknown Command");
break;
}
function doOutput($status = null, $data = null, $message = null) {
$retarr = array('status' => $status, 'data' => $data, 'message' => $message);
print json_encode($retarr);
}