Fix deleting snapshots

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

View File

@ -8,8 +8,10 @@ $data = array();
// 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'])) {
$message = 'Must specify a task';
} else {
@ -17,9 +19,9 @@ if ( empty($_REQUEST['task']) ) {
}
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 {
$eids = $_REQUEST['ids'];
$ids = $_REQUEST['ids'];
}
if ($message) {
@ -99,6 +101,7 @@ function deleteRequest($id) {
//$message[] = array($id=>'Event is archived, cannot delete it.');
} else {
$snapshot->delete();
$message[] = array($id=>'Snapshot deleted.');
}
return $message;