|
|
@@ -72,68 +72,71 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|
|
}
|
|
|
break;
|
|
|
case 'POST':
|
|
|
- // Check if the user is an admin and is allowed to commit values
|
|
|
- qualifyUser('admin', true);
|
|
|
- switch ($action) {
|
|
|
- case 'search-plex':
|
|
|
- $response = searchPlex($_POST['searchtitle']);
|
|
|
- break;
|
|
|
- case 'check-url':
|
|
|
- sendResult(frameTest($_POST['checkurl']), "flask", $_POST['checkurl'], "IFRAME_CAN_BE_FRAMED", "IFRAME_CANNOT_BE_FRAMED");
|
|
|
- break;
|
|
|
- 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 '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 'deleteOrgLog':
|
|
|
- sendNotification(unlink("org.log"));
|
|
|
- break;
|
|
|
- case 'submit-tabs':
|
|
|
- $response['notify'] = sendNotification(updateTabs($_POST) , false, false);
|
|
|
- $response['show_apply'] = true;
|
|
|
- break;
|
|
|
- default:
|
|
|
- sendNotification(false, 'Unsupported Action!');
|
|
|
- }
|
|
|
- break;
|
|
|
+ // Check if the user is an admin and is allowed to commit values
|
|
|
+ switch ($action) {
|
|
|
+ case 'search-plex':
|
|
|
+ $response = searchPlex($_POST['searchtitle']);
|
|
|
+ break;
|
|
|
+ default: // Stuff that you need admin for
|
|
|
+ qualifyUser('admin', true);
|
|
|
+ switch ($action) {
|
|
|
+ case 'check-url':
|
|
|
+ sendResult(frameTest($_POST['checkurl']), "flask", $_POST['checkurl'], "IFRAME_CAN_BE_FRAMED", "IFRAME_CANNOT_BE_FRAMED");
|
|
|
+ break;
|
|
|
+ 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 '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 'deleteOrgLog':
|
|
|
+ sendNotification(unlink("org.log"));
|
|
|
+ break;
|
|
|
+ case 'submit-tabs':
|
|
|
+ $response['notify'] = sendNotification(updateTabs($_POST) , false, false);
|
|
|
+ $response['show_apply'] = true;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ sendNotification(false, 'Unsupported Action!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
case 'PUT':
|
|
|
sendNotification(false, 'Unsupported Action!');
|
|
|
break;
|