zoneminder/web/ajax/controlcaps.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
730 B
PHP
Raw Permalink Normal View History

2020-09-27 01:09:41 +08:00
<?php
if ( !canEdit('Control') ) {
ZM\Warning('Need Control permissions to edit control capabilities');
return;
}
if ( empty($_REQUEST['action']) ) {
ajaxError('Action Not Provided');
return;
} else {
$action = $_REQUEST['action'];
}
if ( isset($_REQUEST['cids']) ) {
$cids = $_REQUEST['cids'];
} else {
ajaxError('At least one Control Id must be Provided.');
return;
}
if ( $action == 'delete' ) {
foreach( $cids as $cid ) {
dbQuery('UPDATE Monitors SET Controllable = 0, ControlId = 0 WHERE ControlId = ?', array($cid));
dbQuery('DELETE FROM Controls WHERE Id = ?', array($cid));
}
} else {
ajaxError('Unrecognised action ' .$_REQUEST['action']);
return;
}
ajaxResponse();
return;
?>