function getMonitorObject($mid = null) { if ($mid !== null) { $monitor = dbFetchMonitor($mid); } else { $monitor = array('Id' => 0, 'Name' => "willbereplaced", 'Function' => "Monitor", 'Enabled' => true, 'LinkedMonitors' => "", 'Type' => "", 'Device' => "/dev/video0", 'Channel' => "0", 'Format' => 0xff, 'Protocol' => "", 'Method' => "", 'Host' => "", 'Path' => "", 'Options' => "", 'Port' => "80", 'User' => "", 'Pass' => "", 'Colours' => 3, 'Palette' => 0, 'Width' => "320", 'Height' => "240", 'Orientation' => "0", 'Deinterlacing' => 0, 'RTSPDescribe' => 0, 'LabelFormat' => '%N - %d/%m/%y %H:%M:%S', 'LabelX' => 0, 'LabelY' => 0, 'LabelSize' => 1, 'ImageBufferCount' => 50, 'WarmupCount' => 25, 'PreEventCount' => 25, 'PostEventCount' => 25, 'StreamReplayBuffer' => 1000, 'AlarmFrameCount' => 1, 'Controllable' => 0, 'ControlId' => "", 'ControlType' => 0, 'ControlDevice' => "", 'ControlAddress' => "", 'AutoStopTimeout' => "", 'TrackMotion' => 0, 'TrackDelay' => "", 'ReturnLocation' => -1, 'ReturnDelay' => "", 'SectionLength' => 600, 'FrameSkip' => 0, 'MotionFrameSkip' => 0, 'EventPrefix' => 'Event-', 'AnalysisFPS' => "", 'AnalysisUpdateDelay' => 0, 'MaxFPS' => "", 'AlarmMaxFPS' => "", 'FPSReportInterval' => 1000, 'RefBlendPerc' => 6, 'AlarmRefBlendPerc' => 6, 'DefaultView' => 'Events', 'DefaultRate' => '100', 'DefaultScale' => '100', 'SignalCheckColour' => '#0000c0', 'WebColour' => 'red', 'Exif' => '0', 'Triggers' => "", 'V4LMultiBuffer' => '', 'V4LCapturesPerFrame' => 1, 'ServerId' => $Server['Id']); } return $monitor; }
header('Cache-control: private'); header('Expires: -1'); echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <response> <?php function make_tag($name, $value) { return "<{$name}>" . $value . "</{$name}>"; } if ($_REQUEST['action'] == "zone_info") { if (!canView("Monitors")) { ajaxError('Unrecognised action or insufficient permissions'); } $mid = validInt($_REQUEST['mid']); $monitor = dbFetchMonitor($mid); $sql = "select * from Zones where MonitorId = '" . $mid . "' order by Area desc"; foreach (dbFetchAll($sql) as $zone) { $zone_str = ""; $zone_str .= make_tag("id", $zone['Id']); $zone_str .= make_tag("name", $zone['Name']); $zone_str .= make_tag("method", $zone['CheckMethod']); $zone_str .= make_tag("color", ($zone['AlarmRGB'] >> 16 & 0xff) . "," . ($zone['AlarmRGB'] >> 8 & 0xff) . "," . ($zone['AlarmRGB'] & 0xff)); $zone_str .= make_tag("MinPixelThreshold", $zone['MinPixelThreshold']); $zone_str .= make_tag("MaxPixelThreshold", $zone['MaxPixelThreshold']); $zone_str .= make_tag("MinAlarmPixels", $zone['MinAlarmPixels']); $zone_str .= make_tag("MaxAlarmPixels", $zone['MaxAlarmPixels']); $zone_str .= make_tag("MinFilterPixels", $zone['MinFilterPixels']); $zone_str .= make_tag("MaxFilterPixels", $zone['MaxFilterPixels']); $zone_str .= make_tag("MinBlobPixels", $zone['MinBlobPixels']); $zone_str .= make_tag("MaxBlobPixels", $zone['MaxBlobPixels']);
if (ZM_OPT_X10) { $tabs["x10"] = translate('X10'); } $tabs["misc"] = translate('Misc'); if (isset($_REQUEST['tab'])) { $tab = validHtmlStr($_REQUEST['tab']); } else { $tab = "general"; } if (defined(ZM_SERVER_ID)) { $Server = dbFetchOne('SELECT * FROM Servers WHERE Id=?', NULL, array(ZM_SERVER_ID)); } else { $Server = array(); } if (!empty($_REQUEST['mid'])) { $monitor = dbFetchMonitor($_REQUEST['mid']); if (ZM_OPT_X10) { $x10Monitor = dbFetchOne('SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['mid'])); } } else { $nextId = getTableAutoInc('Monitors'); $monitor = array('Id' => 0, 'Name' => translate('Monitor') . '-' . $nextId, 'Function' => "Monitor", 'Enabled' => true, 'LinkedMonitors' => "", 'Type' => "", 'Device' => "/dev/video0", 'Channel' => "0", 'Format' => 0xff, 'Protocol' => "", 'Method' => "", 'Host' => "", 'Path' => "", 'Options' => "", 'Port' => "80", 'User' => "", 'Pass' => "", 'Colours' => 3, 'Palette' => 0, 'Width' => "320", 'Height' => "240", 'Orientation' => "0", 'Deinterlacing' => 0, 'LabelFormat' => '%N - %d/%m/%y %H:%M:%S', 'LabelX' => 0, 'LabelY' => 0, 'ImageBufferCount' => 50, 'WarmupCount' => 25, 'PreEventCount' => 25, 'PostEventCount' => 25, 'StreamReplayBuffer' => 1000, 'AlarmFrameCount' => 1, 'Controllable' => 0, 'ControlId' => "", 'ControlType' => 0, 'ControlDevice' => "", 'ControlAddress' => "", 'AutoStopTimeout' => "", 'TrackMotion' => 0, 'TrackDelay' => "", 'ReturnLocation' => -1, 'ReturnDelay' => "", 'SectionLength' => 600, 'FrameSkip' => 0, 'MotionFrameSkip' => 0, 'EventPrefix' => 'Event-', 'MaxFPS' => "", 'AlarmMaxFPS' => "", 'FPSReportInterval' => 1000, 'RefBlendPerc' => 6, 'AlarmRefBlendPerc' => 6, 'DefaultView' => 'Events', 'DefaultRate' => '100', 'DefaultScale' => '100', 'SignalCheckColour' => '#0000c0', 'WebColour' => 'red', 'Triggers' => "", 'V4LMultiBuffer' => '', 'V4LCapturesPerFrame' => 1, 'ServerId' => $Server['Id']); } if (ZM_OPT_X10 && empty($x10Monitor)) { $x10Monitor = array('Activation' => '', 'AlarmInput' => '', 'AlarmOutput' => ''); } function fourcc($a, $b, $c, $d) { return ord($a) | ord($b) << 8 | ord($c) << 16 | ord($d) << 24; } if (isset($_REQUEST['newMonitor'])) {