Skip to content

Commit

Permalink
Merge pull request #328 from causefx/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
causefx authored May 10, 2017
2 parents 232f8c7 + 8fcad38 commit e38fa91
Show file tree
Hide file tree
Showing 126 changed files with 2,850 additions and 3,448 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ _config.yml
test.php
users.db
config/config.php
config/config.bak.php
config/users/
config/users
config/users.db
config/users.bak.db


101 changes: 81 additions & 20 deletions ajax.php
Original file line number Diff line number Diff line change
@@ -1,84 +1,145 @@
<?php
// Include functions if not already included
// Include functions and user
require_once('functions.php');
require_once("user.php");
$GLOBALS['USER'] = new User('registration_callback');

// 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']; }
unset($_POST['action']);

// No Action
if (!isset($action)) {
debug_out('No Action Specified!',1);
sendNotification(false, 'No Action Specified!');
}

// Process Request
$response = array();
switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
switch ($action) {
case 'emby-image':
qualifyUser(EMBYHOMEAUTH, true);
getEmbyImage();
die();
break;
case 'plex-image':
qualifyUser(PLEXHOMEAUTH, true);
getPlexImage();
die();
break;
case 'emby-streams':
qualifyUser(EMBYHOMEAUTH, true);
echo getEmbyStreams(12);
die();
break;
case 'plex-streams':
qualifyUser(PLEXHOMEAUTH, true);
echo getPlexStreams(12);
die();
break;
case 'emby-recent':
qualifyUser(EMBYHOMEAUTH, true);
echo getEmbyRecent($_GET['type'], 12);
die();
break;
case 'plex-recent':
qualifyUser(PLEXHOMEAUTH, true);
echo getPlexRecent($_GET['type'], 12);
die();
break;
case 'sabnzbd-update':
qualifyUser(SABNZBDHOMEAUTH, true);
echo sabnzbdConnect($_GET['list'] ? $_GET['list'] : die('Error!'));
die();
break;
case 'nzbget-update':
qualifyUser(NZBGETHOMEAUTH, true);
echo nzbgetConnect($_GET['list'] ? $_GET['list'] : die('Error!'));
die();
break;

default:
debug_out('Unsupported Action!',1);
sendNotification(false, 'Unsupported Action!');
}
break;
case 'POST':
// Check if the user is an admin and is allowed to commit values
qualifyUser('admin', true);
switch ($action) {
case 'upload-images':
uploadFiles('images/', array('jpg', 'png', 'svg', 'jpeg', 'bmp'));
sendNotification(true);
break;
case 'remove-images':
removeFiles('images/'.(isset($_POST['file'])?$_POST['file']:''));
sendNotification(true);
break;
case 'update-config':
sendNotification(updateConfig($_POST));
break;
case 'update-appearance':
// Custom CSS Special Case START
if (isset($_POST['customCSS'])) {
if ($_POST['customCSS']) {
write_ini_file($_POST['customCSS'], 'custom.css');
} else {
unlink('custom.css');
}
$response['parent']['reload'] = true;
}
unset($_POST['customCSS']);
// Custom CSS Special Case END
$response['notify'] = sendNotification(updateDBOptions($_POST),false,false);
break;
case 'deleteDB':
deleteDatabase();
sendNotification(true, 'Database Deleted!');
break;
case 'editCSS':
write_ini_file($_POST["css-show"], "custom.css");
echo '<script>window.top.location = window.top.location.href.split(\'#\')[0];</script>';
case 'upgradeInstall':
upgradeInstall();
$response['notify'] = sendNotification(true, 'Performing Checks', false);
$response['tab']['goto'] = 'updatedb.php';
break;
case 'forceBranchInstall':
upgradeInstall(GIT_BRANCH);
$response['notify'] = sendNotification(true, 'Performing Checks', false);
$response['tab']['goto'] = 'updatedb.php';
break;
case 'deleteLog':
sendNotification(unlink(FAIL_LOG));
break;
case 'submit-tabs':
$response['notify'] = sendNotification(updateTabs($_POST) , false, false);
$response['show_apply'] = true;
break;
default:
debug_out('Unsupported Action!',1);
sendNotification(false, 'Unsupported Action!');
}
break;
case 'PUT':

sendNotification(false, 'Unsupported Action!');
break;
case 'DELETE':

sendNotification(false, 'Unsupported Action!');
break;
default:
debug_out('Unknown Request Type!',1);
sendNotification(false, 'Unknown Request Type!');
}


if ($response) {
header('Content-Type: application/json');
echo json_encode($response);
die();
} else {
sendNotification(false, 'Error: No Output Specified!');
}

2 changes: 2 additions & 0 deletions config/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
order deny,allow
deny from all
17 changes: 15 additions & 2 deletions config/configDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,33 @@
"plexRecentTV" => "false",
"plexRecentMusic" => "false",
"plexPlayingNow" => "false",
"plexHomeAuth" => false,
"embyURL" => "",
"embyToken" => "",
"embyRecentMovie" => "false",
"embyRecentTV" => "false",
"embyRecentMusic" => "false",
"embyPlayingNow" => "false",
"embyHomeAuth" => false,
"sonarrURL" => "",
"sonarrKey" => "",
"sonarrHomeAuth" => false,
"sickrageURL" => "",
"sickrageKey" => "",
"sickrageHomeAuth" => false,
"radarrURL" => "",
"radarrKey" => "",
"radarrHomeAuth" => false,
"nzbgetURL" => "",
"nzbgetUsername" => "",
"nzbgetPassword" => "",
"nzbgetHomeAuth" => false,
"sabnzbdURL" => "",
"sabnzbdKey" => "",
"sabnzbdHomeAuth" => false,
"headphonesURL" => "",
"headphonesKey" => "",
"headphonesHomeAuth" => false,
"calendarStart" => "0",
"calendarView" => "basicWeek",
"calendarStartDay" => "30",
Expand All @@ -36,7 +44,6 @@
"authBackend" => "",
"authBackendCreate" => "true",
"authBackendHost" => "",
"authBackendPort" => "",
"authBackendDomain" => "",
"plexUsername" => "",
"plexPassword" => "",
Expand All @@ -57,5 +64,11 @@
"loadingScreen" => "true",
"enableMail" => "false",
"slimBar" => "true",
"gravatar" => "true"
"gravatar" => "true",
"calTimeFormat" => "h(:mm)t",
"homePageAuthNeeded" => false,
"homepageCustomHTML1" => "",
"homepageCustomHTML1Auth" => false,
"git_branch" => "master",
"git_check" => true,
);
57 changes: 57 additions & 0 deletions css/settings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
div.colour-field {
border: 1px solid #cbd3d5;
border-radius: 5px;
padding-top: 10px;
padding-bottom: 10px;
margin-bottom: 15px;
}

div.colour-field input {
color: #000;
}

input.invalid {
background-color: #ffb5b5 !important;
}

input.invalid + p.help-text::after {
content: " - Does not match pattern!";
}


div.form-content input:not([type=radio]) {
width: 100% !important;
}

tab > div.row {
padding: 0px 10px 0px 10px;
}

tab > div.row > div {
padding: 1px 5px !important;
}

tab > div.row > div:first-child {
max-width: 42px;
}

tab > div.row > div:first-child .tabIconView {
width: 100% !important;
margin: 7px 0px !important;
}

tab > div.row button {
margin: 9px 0px !important;
}

tab > div.row div.custom-field {
margin: 8px 0px !important;
}

tab p.help-text {
margin: 0px !important;
}

#submitTabs ul > li {
padding: 0px 10px !important;
}
Loading

0 comments on commit e38fa91

Please sign in to comment.