Skip to content

Commit f13725a

Browse files
authored
Merge pull request #716 from causefx/develop
Develop
2 parents 3b3b3a7 + 8b1a822 commit f13725a

101 files changed

Lines changed: 9738 additions & 478 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<?php
22
// Include functions
33
require_once('user.php');
4-
$USER = new User('registration_callback');
4+
$USER = new User();
55
// Get Action
66
if (isset($_POST['a'])) { $action = $_POST['a']; }
77
if (isset($_POST['k'])) { $key = $_POST['k']; }
88
if (isset($_POST['v'])) { $values = $_POST['v']; }
99
if (isset($_GET['a'])) { $action = $_GET['a']; }
1010
if (isset($_GET['k'])) { $key = $_GET['k']; }
11-
if (isset($_GET['v'])) { $values = explode('|',$_GET['v']); }
11+
if (isset($_GET['v'])) {
12+
$values = (strpos($_GET['v'], '|') !== false ? explode('|',$_GET['v']) : $_GET['v']);
13+
}
1214
unset($_POST['a']);
1315
unset($_POST['k']);
1416
unset($_POST['v']);
@@ -35,15 +37,33 @@
3537
$email = $values[1];
3638
$server = $values[2];
3739
}
40+
//$USER = new User();
3841
$USER->invite_user("chris", "causefx@me.com", "plex");
3942
$result['data'] = "User has been invited";
4043
//$result['data'] = "user = $user | email = $email | server = $server";
4144
}else{
4245
$result['error'] = "No Values Were Set For Function";
4346
}
4447
break;
45-
case "2":
46-
$result = "other test";
48+
case "ombi":
49+
if($values){
50+
switch ($values) {
51+
case 'plex-update':
52+
$ombi = ombiAPI('plex-cache');
53+
if($ombi){
54+
$result['data'] = "Plex Content Cache Successful";
55+
}else{
56+
$result['error'] = "Plex Content Cache Error";
57+
}
58+
break;
59+
default:
60+
$result['error'] = "$values is not a valid Ombi function";
61+
break;
62+
}
63+
}else{
64+
$result['error'] = "No Ombi Action Supplied";
65+
}
66+
4767
break;
4868
default:
4969
$result = "$action Not Defined As API Function";
@@ -57,4 +77,4 @@
5777
}
5878
//return JSON array
5979
exit(json_encode($result));
60-
?>
80+
?>

auth.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
$USER = new User("registration_callback");
55
$ban = isset($_GET['ban']) ? strtoupper($_GET['ban']) : "";
66
$whitelist = isset($_GET['whitelist']) ? $_GET['whitelist'] : false;
7+
$blacklist = isset($_GET['blacklist']) ? $_GET['blacklist'] : false;
78
$currentIP = get_client_ip();
89

910
if ($whitelist) {
@@ -14,6 +15,11 @@
1415
$skipped = true;
1516
}
1617
}
18+
if ($blacklist) {
19+
if(in_array($currentIP, getWhitelist($blacklist))) {
20+
!$debug ? exit(http_response_code(401)) : die("$currentIP Blacklisted");
21+
}
22+
}
1723
if (isset($_GET['admin'])) {
1824
if($USER->authenticated && $USER->role == "admin" && !in_array(strtoupper($USER->username), getBannedUsers($ban))) {
1925
!$debug ? exit(http_response_code(200)) : die("$USER->username on $currentIP Authorized At Admin Level");
@@ -36,4 +42,4 @@
3642
!$debug ? exit(http_response_code(401)) : die("$USER->username on $currentIP Not Authorized Nor On Whitelist");
3743
}
3844

39-
?>
45+
?>

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"phpmailer/phpmailer": "^5.2",
77
"guzzlehttp/guzzle": "^6.2",
88
"php-http/guzzle6-adapter": "^1.1",
9-
"sparkpost/sparkpost": "^2.1"
9+
"sparkpost/sparkpost": "^2.1",
10+
"lcobucci/jwt": "^3.2"
1011
}
1112
}

composer.lock

Lines changed: 59 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/configDefaults.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,13 @@
9393
"smtpHostType" => "tls",
9494
"homepageNoticeTitle" => "",
9595
"homepageNoticeMessage" => "",
96+
"homepageNoticeTitleGuest" => "",
97+
"homepageNoticeMessageGuest" => "",
9698
"homepageNoticeType" => "success",
99+
"homepageNoticeTypeGuest" => "success",
97100
"homepageNoticeAuth" => "false",
98101
"homepageNoticeLayout" => "elegant",
102+
"homepageNoticeLayoutGuest" => "elegant",
99103
"ipInfoToken" => "ddd0c072ad5021",
100104
"historyRefresh" => "120000",
101105
"downloadRefresh" => "30000",
@@ -132,5 +136,6 @@
132136
"homepageOrderembyrecent" => '11',
133137
"homepageOrderombi" => '12',
134138
"homepageOrdercalendar" => '13',
139+
"homepageOrdernoticeguest" => '14',
135140
'requestedUserOnly' => 'true',
136141
);

error.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@
4141
//error stuff
4242
$requested = $_SERVER['REQUEST_URI'];
4343
$codes = array(
44-
400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy'),
45-
401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy'),
46-
403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy'),
47-
404 => array('Not Found', $requested . ' was not found on this server.', 'confused'),
48-
405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused'),
49-
408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy'),
50-
500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused'),
51-
502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused'),
52-
503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused'),
53-
504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused'),
44+
400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy','400'),
45+
401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy','401'),
46+
403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy','403'),
47+
404 => array('Not Found', $requested . ' was not found on this server.', 'confused','404'),
48+
405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused','405'),
49+
408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy','408'),
50+
500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused','500'),
51+
502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused','502'),
52+
503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused','503'),
53+
504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused','504'),
5454
999 => array('Not Logged In', 'You need to be logged in to access this page.', 'confused', '401'),
5555
);
5656
$errorTitle = ($codes[$status][0]) ? $codes[$status][0] : "Error";

0 commit comments

Comments
 (0)