forked from causefx/Organizr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax.php
executable file
·84 lines (71 loc) · 1.83 KB
/
ajax.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
// Include functions if not already included
require_once('functions.php');
// Upgrade environment
upgradeCheck();
// Define Version
define('INSTALLEDVERSION', '1.31');
// Lazyload settings
$databaseConfig = configLazy('config/config.php');
// Authorization
# Check if user is currently active and allowed to access resource
//require_once("user.php");
# ^^ I think adding this does that?
// Get Action
if (isset($_POST['submit'])) { $action = $_POST['submit']; }
if (isset($_POST['action'])) { $action = $_POST['action']; }
if (isset($_GET['action'])) { $action = $_GET['action']; }
if (isset($_GET['a'])) { $action = $_GET['a']; }
// No Action
if (!isset($action)) {
debug_out('No Action Specified!',1);
}
// Process Request
switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
switch ($action) {
case 'emby-image':
getEmbyImage();
break;
case 'plex-image':
getPlexImage();
break;
case 'emby-streams':
echo getEmbyStreams(12);
break;
case 'plex-streams':
echo getPlexStreams(12);
break;
case 'emby-recent':
echo getEmbyRecent($_GET['type'], 12);
break;
case 'plex-recent':
echo getPlexRecent($_GET['type'], 12);
break;
default:
debug_out('Unsupported Action!',1);
}
break;
case 'POST':
switch ($action) {
case 'upload-images':
uploadFiles('images/', array('jpg', 'png', 'svg', 'jpeg', 'bmp'));
break;
case 'remove-images':
removeFiles('images/'.(isset($_POST['file'])?$_POST['file']:''));
break;
case 'editCSS':
write_ini_file($_POST["css-show"], "custom.css");
echo '<script>window.top.location = window.top.location.href.split(\'#\')[0];</script>';
break;
default:
debug_out('Unsupported Action!',1);
}
break;
case 'PUT':
break;
case 'DELETE':
break;
default:
debug_out('Unknown Request Type!',1);
}