2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
if ( empty($_REQUEST['mid']) )
|
|
|
|
{
|
2008-10-17 00:12:23 +08:00
|
|
|
ajaxError( 'No monitor id supplied' );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
elseif ( !isset($_REQUEST['zid']) )
|
|
|
|
{
|
2008-10-17 00:12:23 +08:00
|
|
|
ajaxError( 'No zone id(s) supplied' );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2008-10-17 00:12:23 +08:00
|
|
|
if ( canView( 'Monitors' ) )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
2008-10-17 00:12:23 +08:00
|
|
|
switch ( $_REQUEST['action'] )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
2008-10-17 00:12:23 +08:00
|
|
|
case "zoneImage" :
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
2008-10-17 00:12:23 +08:00
|
|
|
$wd = getcwd();
|
|
|
|
chdir( ZM_DIR_IMAGES );
|
|
|
|
$hiColor = "0x00ff00";
|
|
|
|
|
|
|
|
$command = getZmuCommand( " -m ".$_REQUEST['mid']." -z" );
|
|
|
|
if ( !isset($_REQUEST['zid']) )
|
|
|
|
$_REQUEST['zid'] = 0;
|
|
|
|
$command .= "'".$_REQUEST['zid'].' '.$hiColor.' '.$_REQUEST['coords']."'";
|
|
|
|
$status = exec( escapeshellcmd($command) );
|
|
|
|
chdir( $wd );
|
|
|
|
|
2013-12-18 00:07:19 +08:00
|
|
|
$monitor = dbFetchOne( 'SELECT * FROM Monitors WHERE Id = ?', NULL, array($_REQUEST['mid']) );
|
2008-10-17 00:12:23 +08:00
|
|
|
$points = coordsToPoints( $_REQUEST['coords'] );
|
|
|
|
|
|
|
|
ajaxResponse( array(
|
|
|
|
'zoneImage' => ZM_DIR_IMAGES.'/Zones'.$monitor['Id'].'.jpg?'.time(),
|
|
|
|
'selfIntersecting' => isSelfIntersecting( $points ),
|
|
|
|
'area' => getPolyArea( $points )
|
|
|
|
) );
|
|
|
|
|
|
|
|
break;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-17 00:12:23 +08:00
|
|
|
ajaxError( 'Unrecognised action or insufficient permissions' );
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
?>
|