zoneminder/web/zm_request_alarm.php

57 lines
1.1 KiB
PHP

<?php
if ( !canView( 'Stream' ) )
{
$view = "error";
return;
}
error_reporting( E_ALL );
define( "MSG_TIMEOUT", 2.0 );
define( "MSG_DATA_SIZE", 4+256 );
header("Content-type: text/plain" );
if ( canEdit( 'Monitors' ) )
{
$zmu_command = getZmuCommand( " -m ".$_REQUEST['id'] );
switch ( $_REQUEST['command'] )
{
case "disableAlarms" :
{
$zmu_command .= " -n";
break;
}
case "enableAlarms" :
{
$zmu_command .= " -c";
break;
}
case "forceAlarm" :
{
$zmu_command .= " -a";
break;
}
case "cancelForcedAlarm" :
{
$zmu_command .= " -c";
break;
}
default :
{
$response['result'] = 'Error';
$response['message'] = "Unexpected command '".$_REQUEST['command']."'";
echo jsValue( $response );
exit;
}
}
}
$response['result'] = 'Ok';
//error_log( $zmu_command );
$response['message'] = exec( escapeshellcmd( $zmu_command ) );
echo jsValue( $response );
?>