zoneminder/web/ajax/control.php

28 lines
670 B
PHP
Raw Normal View History

<?php
2019-09-20 22:36:38 +08:00
require_once('includes/control_functions.php');
require_once('includes/Monitor.php');
// Monitor control actions, require a monitor id and control view permissions for that monitor
if ( empty($_REQUEST['id']) )
2019-09-20 22:36:38 +08:00
ajaxError('No monitor id supplied');
2019-09-20 22:36:38 +08:00
if ( canView('Control', $_REQUEST['id']) ) {
$monitor = new ZM\Monitor($_REQUEST['id']);
2019-09-20 22:36:38 +08:00
$ctrlCommand = buildControlCommand($monitor);
2019-09-20 22:36:38 +08:00
if ( !$ctrlCommand ) {
ajaxError('No command received');
return;
}
if ( $monitor->sendControlCommand($ctrlCommand) ) {
ajaxResponse('Success');
2019-09-20 22:36:38 +08:00
} else {
ajaxError('Failed');
2019-09-20 22:36:38 +08:00
}
}
2019-09-20 22:36:38 +08:00
ajaxError('Unrecognised action or insufficient permissions');
?>