Fix deleting snapshots

This commit is contained in:
Isaac Connor 2021-08-06 13:11:04 -04:00
parent ad9ce720fd
commit 2f7c44dce2
1 changed files with 18 additions and 15 deletions

View File

@ -8,8 +8,10 @@ $data = array();
// INITIALIZE AND CHECK SANITY // INITIALIZE AND CHECK SANITY
// //
if ( !canView('Snapshots') ) $message = 'Insufficient permissions for user '.$user['Username']; if (!canView('Snapshots'))
$message = 'Insufficient permissions for user '.$user['Username'];
$task = '';
if (empty($_REQUEST['task'])) { if (empty($_REQUEST['task'])) {
$message = 'Must specify a task'; $message = 'Must specify a task';
} else { } else {
@ -17,9 +19,9 @@ if ( empty($_REQUEST['task']) ) {
} }
if (empty($_REQUEST['ids'])) { if (empty($_REQUEST['ids'])) {
if ( isset($_REQUEST['task']) && $_REQUEST['task'] != 'query' ) $message = 'No snapshot id(s) supplied'; if ($task != 'query') $message = 'No snapshot id(s) supplied';
} else { } else {
$eids = $_REQUEST['ids']; $ids = $_REQUEST['ids'];
} }
if ($message) { if ($message) {
@ -99,6 +101,7 @@ function deleteRequest($id) {
//$message[] = array($id=>'Event is archived, cannot delete it.'); //$message[] = array($id=>'Event is archived, cannot delete it.');
} else { } else {
$snapshot->delete(); $snapshot->delete();
$message[] = array($id=>'Snapshot deleted.');
} }
return $message; return $message;