Merge branch 'master' into rate_dropdown
commit
d0003215b1
|
@ -0,0 +1,5 @@
|
|||
--
|
||||
-- This updates a 1.33.16 database to 1.34.0
|
||||
--
|
||||
-- No changes required
|
||||
--
|
|
@ -28,7 +28,7 @@
|
|||
%global _hardened_build 1
|
||||
|
||||
Name: zoneminder
|
||||
Version: 1.33.16
|
||||
Version: 1.34.0
|
||||
Release: 1%{?dist}
|
||||
Summary: A camera monitoring and analysis tool
|
||||
Group: System Environment/Daemons
|
||||
|
|
|
@ -6,6 +6,7 @@ ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
|
|||
Require all granted
|
||||
</Directory>
|
||||
|
||||
|
||||
# Order matters. This alias must come first.
|
||||
Alias /zm/cache /var/cache/zoneminder/cache
|
||||
<Directory /var/cache/zoneminder/cache>
|
||||
|
|
|
@ -61,7 +61,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}
|
|||
,libjson-maybexs-perl
|
||||
,libsys-mmap-perl [!hurd-any]
|
||||
,liburi-encode-perl
|
||||
,libwww-perl
|
||||
,libwww-perl, liburi-perl
|
||||
,libdata-dump-perl
|
||||
,libdatetime-perl
|
||||
,libclass-std-fast-perl
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# ==========================================================================
|
||||
#
|
||||
# ZoneMinder Axis version 2 API Control Protocol Module, $Date$, $Revision$
|
||||
# ZoneMinder Axis version 2 API Control Protocol Module
|
||||
# Copyright (C) 2001-2008 Philip Coombes
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
|
@ -43,349 +43,359 @@ use ZoneMinder::Logger qw(:all);
|
|||
use ZoneMinder::Config qw(:all);
|
||||
|
||||
use Time::HiRes qw( usleep );
|
||||
use URI;
|
||||
|
||||
sub open
|
||||
{
|
||||
my $self = shift;
|
||||
our $ADDRESS;
|
||||
|
||||
$self->loadMonitor();
|
||||
sub open {
|
||||
my $self = shift;
|
||||
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
$self->loadMonitor();
|
||||
if ( $self->{Monitor}->{ControlAddress} !~ /^\w+:\/\// ) {
|
||||
# Has no scheme at the beginning, so won't parse as a URI
|
||||
$self->{Monitor}->{ControlAddress} = 'http://'.$self->{Monitor}->{ControlAddress};
|
||||
}
|
||||
my $uri = URI->new($self->{Monitor}->{ControlAddress});
|
||||
$ADDRESS = $uri->scheme.'://'.$uri->authority().$uri->path().($uri->port()?':'.$uri->port():'');
|
||||
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->cookie_jar( {} );
|
||||
$self->{ua}->agent('ZoneMinder Control Agent/'.ZoneMinder::Base::ZM_VERSION);
|
||||
$self->{state} = 'closed';
|
||||
|
||||
my ( $username, $password, $host ) = ( $uri->authority() =~ /^([^:]+):([^@]*)@(.+)$/ );
|
||||
my $realm = $self->{Monitor}->{ControlDevice};
|
||||
|
||||
$self->{ua}->credentials($ADDRESS, $realm, $username, $password);
|
||||
|
||||
# test auth
|
||||
my $res = $self->{ua}->get($ADDRESS.'/cgi/ptdc.cgi');
|
||||
|
||||
if ( $res->is_success ) {
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub printMsg
|
||||
{
|
||||
my $self = shift;
|
||||
my $msg = shift;
|
||||
my $msg_len = length($msg);
|
||||
if ( $res->status_line() eq '401 Unauthorized' ) {
|
||||
|
||||
Debug( $msg."[".$msg_len."]" );
|
||||
}
|
||||
|
||||
sub sendCmd
|
||||
{
|
||||
my $self = shift;
|
||||
my $cmd = shift;
|
||||
|
||||
my $result = undef;
|
||||
|
||||
printMsg( $cmd, "Tx" );
|
||||
|
||||
#print( "http://$address/$cmd\n" );
|
||||
my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" );
|
||||
my $res = $self->{ua}->request($req);
|
||||
|
||||
if ( $res->is_success )
|
||||
{
|
||||
$result = !undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
Error( "Error check failed: '".$res->status_line()."'" );
|
||||
my $headers = $res->headers();
|
||||
foreach my $k ( keys %$headers ) {
|
||||
Debug("Initial Header $k => $$headers{$k}");
|
||||
}
|
||||
|
||||
return( $result );
|
||||
if ( $$headers{'www-authenticate'} ) {
|
||||
Debug('Authenticating');
|
||||
my ( $auth, $tokens ) = $$headers{'www-authenticate'} =~ /^(\w+)\s+(.*)$/;
|
||||
if ( $tokens =~ /\w+="([^"]+)"/i ) {
|
||||
if ( $realm ne $1 ) {
|
||||
$realm = $1;
|
||||
Debug("Changing REALM to $realm");
|
||||
$self->{ua}->credentials($host, $realm, $username, $password);
|
||||
$res = $self->{ua}->get($ADDRESS);
|
||||
if ( $res->is_success() ) {
|
||||
$self->{state} = 'open';
|
||||
return;
|
||||
}
|
||||
Error('Authentication still failed after updating REALM'.$res->status_line);
|
||||
$headers = $res->headers();
|
||||
foreach my $k ( keys %$headers ) {
|
||||
Debug("Initial Header $k => $$headers{$k}");
|
||||
} # end foreach
|
||||
} else {
|
||||
Error('Authentication failed, not a REALM problem');
|
||||
}
|
||||
} else {
|
||||
Error('Failed to match realm in tokens');
|
||||
} # end if
|
||||
} else {
|
||||
Debug('No headers line');
|
||||
} # end if headers
|
||||
} # end if $res->status_line() eq '401 Unauthorized'
|
||||
} # end sub open
|
||||
|
||||
sub sendCmd {
|
||||
my $self = shift;
|
||||
my $cmd = shift;
|
||||
|
||||
$self->printMsg($cmd, 'Tx');
|
||||
|
||||
my $url = $ADDRESS.$cmd;
|
||||
my $res = $self->{ua}->get($url);
|
||||
|
||||
if ( $res->is_success ) {
|
||||
Debug('sndCmd command: ' . $url . ' content: '.$res->content);
|
||||
return !undef;
|
||||
}
|
||||
|
||||
Error("Error cmd $url failed: '".$res->status_line()."'");
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub cameraReset
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Camera Reset" );
|
||||
my $cmd = "/axis-cgi/admin/restart.cgi";
|
||||
$self->sendCmd( $cmd );
|
||||
sub cameraReset {
|
||||
my $self = shift;
|
||||
Debug('Camera Reset');
|
||||
my $cmd = '/axis-cgi/admin/restart.cgi';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveConUp
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Up" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?move=up";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveConUp {
|
||||
my $self = shift;
|
||||
Debug('Move Up');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?move=up';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveConDown
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Down" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?move=down";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveConDown {
|
||||
my $self = shift;
|
||||
Debug('Move Down');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?move=down';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveConLeft
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Left" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?move=left";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveConLeft {
|
||||
my $self = shift;
|
||||
Debug('Move Left');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?move=left';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveConRight
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Right" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?move=right";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveConRight {
|
||||
my $self = shift;
|
||||
Debug('Move Right');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?move=right';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveConUpRight
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Up/Right" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?move=upright";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveConUpRight {
|
||||
my $self = shift;
|
||||
Debug('Move Up/Right');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?move=upright';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveConUpLeft
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Up/Left" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?move=upleft";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveConUpLeft {
|
||||
my $self = shift;
|
||||
Debug('Move Up/Left');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?move=upleft';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveConDownRight
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Down/Right" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?move=downright";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveConDownRight {
|
||||
my $self = shift;
|
||||
Debug('Move Down/Right');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?move=downright';
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub moveConDownLeft
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Down/Left" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?move=downleft";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveConDownLeft {
|
||||
my $self = shift;
|
||||
Debug('Move Down/Left');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?move=downleft';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveMap
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $xcoord = $self->getParam( $params, 'xcoord' );
|
||||
my $ycoord = $self->getParam( $params, 'ycoord' );
|
||||
Debug( "Move Map to $xcoord,$ycoord" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?center=$xcoord,$ycoord&imagewidth=".$self->{Monitor}->{Width}."&imageheight=".$self->{Monitor}->{Height};
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveMap {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $xcoord = $self->getParam($params, 'xcoord');
|
||||
my $ycoord = $self->getParam($params, 'ycoord');
|
||||
Debug("Move Map to $xcoord,$ycoord");
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?center=$xcoord,$ycoord&imagewidth=".$self->{Monitor}->{Width}.'&imageheight='.$self->{Monitor}->{Height};
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveRelUp
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'tiltstep' );
|
||||
Debug( "Step Up $step" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rtilt=$step";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveRelUp {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam($params, 'tiltstep');
|
||||
Debug("Step Up $step");
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?rtilt='.$step;
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveRelDown
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'tiltstep' );
|
||||
Debug( "Step Down $step" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rtilt=-$step";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveRelDown {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam($params, 'tiltstep');
|
||||
Debug("Step Down $step");
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?rtilt=-'.$step;
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveRelLeft
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'panstep' );
|
||||
Debug( "Step Left $step" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rpan=-$step";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveRelLeft {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam($params, 'panstep');
|
||||
Debug("Step Left $step");
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?rpan=-'.$step;
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveRelRight
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'panstep' );
|
||||
Debug( "Step Right $step" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rpan=$step";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveRelRight {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam($params, 'panstep');
|
||||
Debug("Step Right $step");
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?rpan='.$step;
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveRelUpRight
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $panstep = $self->getParam( $params, 'panstep' );
|
||||
my $tiltstep = $self->getParam( $params, 'tiltstep' );
|
||||
Debug( "Step Up/Right $tiltstep/$panstep" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rpan=$panstep&rtilt=$tiltstep";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveRelUpRight {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $panstep = $self->getParam($params, 'panstep');
|
||||
my $tiltstep = $self->getParam($params, 'tiltstep');
|
||||
Debug("Step Up/Right $tiltstep/$panstep");
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rpan=$panstep&rtilt=$tiltstep";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveRelUpLeft
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $panstep = $self->getParam( $params, 'panstep' );
|
||||
my $tiltstep = $self->getParam( $params, 'tiltstep' );
|
||||
Debug( "Step Up/Left $tiltstep/$panstep" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rpan=-$panstep&rtilt=$tiltstep";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveRelUpLeft {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $panstep = $self->getParam($params, 'panstep');
|
||||
my $tiltstep = $self->getParam($params, 'tiltstep');
|
||||
Debug("Step Up/Left $tiltstep/$panstep");
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rpan=-$panstep&rtilt=$tiltstep";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveRelDownRight
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $panstep = $self->getParam( $params, 'panstep' );
|
||||
my $tiltstep = $self->getParam( $params, 'tiltstep' );
|
||||
Debug( "Step Down/Right $tiltstep/$panstep" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rpan=$panstep&rtilt=-$tiltstep";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveRelDownRight {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $panstep = $self->getParam($params, 'panstep');
|
||||
my $tiltstep = $self->getParam($params, 'tiltstep');
|
||||
Debug("Step Down/Right $tiltstep/$panstep");
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rpan=$panstep&rtilt=-$tiltstep";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub moveRelDownLeft
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $panstep = $self->getParam( $params, 'panstep' );
|
||||
my $tiltstep = $self->getParam( $params, 'tiltstep' );
|
||||
Debug( "Step Down/Left $tiltstep/$panstep" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rpan=-$panstep&rtilt=-$tiltstep";
|
||||
$self->sendCmd( $cmd );
|
||||
sub moveRelDownLeft {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $panstep = $self->getParam($params, 'panstep');
|
||||
my $tiltstep = $self->getParam($params, 'tiltstep');
|
||||
Debug("Step Down/Left $tiltstep/$panstep");
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rpan=-$panstep&rtilt=-$tiltstep";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub zoomRelTele
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
Debug( "Zoom Tele" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rzoom=$step";
|
||||
$self->sendCmd( $cmd );
|
||||
sub zoomRelTele {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam($params, 'step');
|
||||
Debug('Zoom Tele');
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rzoom=$step";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub zoomRelWide
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
Debug( "Zoom Wide" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rzoom=-$step";
|
||||
$self->sendCmd( $cmd );
|
||||
sub zoomRelWide {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam($params, 'step');
|
||||
Debug('Zoom Wide');
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rzoom=-$step";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub focusRelNear
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
Debug( "Focus Near" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rfocus=-$step";
|
||||
$self->sendCmd( $cmd );
|
||||
sub focusRelNear {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam($params, 'step');
|
||||
Debug('Focus Near');
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rfocus=-$step";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub focusRelFar
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
Debug( "Focus Far" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rfocus=$step";
|
||||
$self->sendCmd( $cmd );
|
||||
sub focusRelFar {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam($params, 'step');
|
||||
Debug('Focus Far');
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?rfocus=$step";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub focusAuto
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Focus Auto" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?autofocus=on";
|
||||
$self->sendCmd( $cmd );
|
||||
sub focusAuto {
|
||||
my $self = shift;
|
||||
Debug('Focus Auto');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?autofocus=on';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub focusMan
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Focus Manual" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?autofocus=off";
|
||||
$self->sendCmd( $cmd );
|
||||
sub focusMan {
|
||||
my $self = shift;
|
||||
Debug('Focus Manual');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?autofocus=off';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub irisRelOpen
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
Debug( "Iris Open" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?riris=$step";
|
||||
$self->sendCmd( $cmd );
|
||||
sub irisRelOpen {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam($params, 'step');
|
||||
Debug('Iris Open');
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?riris=$step";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub irisRelClose
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
Debug( "Iris Close" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?riris=-$step";
|
||||
$self->sendCmd( $cmd );
|
||||
sub irisRelClose {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam($params, 'step');
|
||||
Debug('Iris Close');
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?riris=-$step";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub irisAuto
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Iris Auto" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?autoiris=on";
|
||||
$self->sendCmd( $cmd );
|
||||
sub irisAuto {
|
||||
my $self = shift;
|
||||
Debug('Iris Auto');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?autoiris=on';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub irisMan
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Iris Manual" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?autoiris=off";
|
||||
$self->sendCmd( $cmd );
|
||||
sub irisMan {
|
||||
my $self = shift;
|
||||
Debug('Iris Manual');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?autoiris=off';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub presetClear
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam( $params, 'preset' );
|
||||
Debug( "Clear Preset $preset" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?removeserverpresetno=$preset";
|
||||
$self->sendCmd( $cmd );
|
||||
sub presetClear {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam($params, 'preset');
|
||||
Debug("Clear Preset $preset");
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?removeserverpresetno=$preset";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub presetSet
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam( $params, 'preset' );
|
||||
Debug( "Set Preset $preset" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?setserverpresetno=$preset";
|
||||
$self->sendCmd( $cmd );
|
||||
sub presetSet {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam($params, 'preset');
|
||||
Debug("Set Preset $preset");
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?setserverpresetno=$preset";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub presetGoto
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam( $params, 'preset' );
|
||||
Debug( "Goto Preset $preset" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?gotoserverpresetno=$preset";
|
||||
$self->sendCmd( $cmd );
|
||||
sub presetGoto {
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam($params, 'preset');
|
||||
Debug("Goto Preset $preset");
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?gotoserverpresetno=$preset";
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
sub presetHome
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Home Preset" );
|
||||
my $cmd = "/axis-cgi/com/ptz.cgi?move=home";
|
||||
$self->sendCmd( $cmd );
|
||||
sub presetHome {
|
||||
my $self = shift;
|
||||
Debug('Home Preset');
|
||||
my $cmd = '/axis-cgi/com/ptz.cgi?move=home';
|
||||
$self->sendCmd($cmd);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -36,9 +36,172 @@ require ZoneMinder::Server;
|
|||
#our @ISA = qw(Exporter ZoneMinder::Base);
|
||||
use parent qw(ZoneMinder::Object);
|
||||
|
||||
use vars qw/ $table $primary_key /;
|
||||
use vars qw/ $table $primary_key %fields $serial %defaults $debug/;
|
||||
$table = 'Monitors';
|
||||
$primary_key = 'Id';
|
||||
$serial = $primary_key = 'Id';
|
||||
%fields = map { $_ => $_ } qw(
|
||||
Id
|
||||
Name
|
||||
Notes
|
||||
ServerId
|
||||
StorageId
|
||||
Type
|
||||
Function
|
||||
Enabled
|
||||
LinkedMonitors
|
||||
Triggers
|
||||
Device
|
||||
Channel
|
||||
Format
|
||||
V4LMultiBuffer
|
||||
V4LCapturesPerFrame
|
||||
Protocol
|
||||
Method
|
||||
Host
|
||||
Port
|
||||
SubPath
|
||||
Path
|
||||
Options
|
||||
User
|
||||
Pass
|
||||
Width
|
||||
Height
|
||||
Colours
|
||||
Palette
|
||||
Orientation
|
||||
Deinterlacing
|
||||
DecoderHWAccelName
|
||||
DecoderHWAccelDevice
|
||||
SaveJPEGs
|
||||
VideoWriter
|
||||
OutputCodec
|
||||
OutputContainer
|
||||
EncoderParameters
|
||||
RecordAudio
|
||||
RTSPDescribe
|
||||
Brightness
|
||||
Contrast
|
||||
Hue
|
||||
Colour
|
||||
EventPrefix
|
||||
LabelFormat
|
||||
LabelX
|
||||
LabelY
|
||||
LabelSize
|
||||
ImageBufferCount
|
||||
WarmupCount
|
||||
PreEventCount
|
||||
PostEventCount
|
||||
StreamReplayBuffer
|
||||
AlarmFrameCount
|
||||
SectionLength
|
||||
MinSectionLength
|
||||
FrameSkip
|
||||
MotionFrameSkip
|
||||
AnalysisFPSLimit
|
||||
AnalysisUpdateDelay
|
||||
MaxFPS
|
||||
AlarmMaxFPS
|
||||
FPSReportInterval
|
||||
RefBlendPerc
|
||||
AlarmRefBlendPerc
|
||||
Controllable
|
||||
ControlId
|
||||
ControlDevice
|
||||
ControlAddress
|
||||
AutoStopTimeout
|
||||
TrackMotion
|
||||
TrackDelay
|
||||
ReturnLocation
|
||||
ReturnDelay
|
||||
DefaultRate
|
||||
DefaultScale
|
||||
SignalCheckPoints
|
||||
SignalCheckColour
|
||||
WebColour
|
||||
Exif
|
||||
Sequence
|
||||
);
|
||||
|
||||
%defaults = (
|
||||
ServerId => 0,
|
||||
StorageId => 0,
|
||||
Type => 'Ffmpeg',
|
||||
Function => 'Mocord',
|
||||
Enabled => 1,
|
||||
LinkedMonitors => undef,
|
||||
Device => '',
|
||||
Channel => 0,
|
||||
Format => 0,
|
||||
V4LMultiBuffer => undef,
|
||||
V4LCapturesPerFrame => 1,
|
||||
Protocol => undef,
|
||||
Method => '',
|
||||
Host => undef,
|
||||
Port => '',
|
||||
SubPath => '',
|
||||
Path => undef,
|
||||
Options => undef,
|
||||
User => undef,
|
||||
Pass => undef,
|
||||
Width => undef,
|
||||
Height => undef,
|
||||
Colours => 4,
|
||||
Palette => 0,
|
||||
Orientation => undef,
|
||||
Deinterlacing => 0,
|
||||
DecoderHWAccelName => undef,
|
||||
DecoderHWAccelDevice => undef,
|
||||
SaveJPEGs => 3,
|
||||
VideoWriter => 0,
|
||||
OutputCodec => undef,
|
||||
OutputContainer => undef,
|
||||
EncoderParameters => "# Lines beginning with # are a comment \n# For changing quality, use the crf option\n# 1 is best, 51 is worst quality\n#crf=23\n",
|
||||
RecordAudio=>0,
|
||||
RTSPDescribe=>0,
|
||||
Brightness => -1,
|
||||
Contrast => -1,
|
||||
Hue => -1,
|
||||
Colour => -1,
|
||||
EventPrefix => 'Event-',
|
||||
LabelFormat => '%N - %d/%m/%y %H:%M:%S',
|
||||
LabelX => 0,
|
||||
LabelY => 0,
|
||||
LabelSize => 1,
|
||||
ImageBufferCount => 20,
|
||||
WarmupCount => 0,
|
||||
PreEventCount => 5,
|
||||
PostEventCount => 5,
|
||||
StreamReplayBuffer => 0,
|
||||
AlarmFrameCount => 1,
|
||||
SectionLength => 600,
|
||||
MinSectionLength => 10,
|
||||
FrameSkip => 0,
|
||||
MotionFrameSkip => 0,
|
||||
AnalysisFPSLimit => undef,
|
||||
AnalysisUpdateDelay => 0,
|
||||
MaxFPS => undef,
|
||||
AlarmMaxFPS => undef,
|
||||
FPSReportInterval => 100,
|
||||
RefBlendPerc => 6,
|
||||
AlarmRefBlendPerc => 6,
|
||||
Controllable => 0,
|
||||
ControlId => undef,
|
||||
ControlDevice => undef,
|
||||
ControlAddress => undef,
|
||||
AutoStopTimeout => undef,
|
||||
TrackMotion => 0,
|
||||
TrackDelay => undef,
|
||||
ReturnLocation => -1,
|
||||
ReturnDelay => undef,
|
||||
DefaultRate => 100,
|
||||
DefaultScale => 100,
|
||||
SignalCheckPoints => 0,
|
||||
SignalCheckColour => '#0000BE',
|
||||
WebColour => '#ff0000',
|
||||
Exif => 0,
|
||||
Sequence => undef,
|
||||
);
|
||||
|
||||
sub Server {
|
||||
return new ZoneMinder::Server( $_[0]{ServerId} );
|
||||
|
|
|
@ -108,6 +108,9 @@ if ( $options{command} ) {
|
|||
Fatal("Unable to load control data for monitor $id");
|
||||
}
|
||||
my $protocol = $monitor->{Protocol};
|
||||
if ( !$protocol ) {
|
||||
Fatal('No protocol is set in monitor. Please edit the monitor, edit control type, select the control capability and fill in the Protocol field');
|
||||
}
|
||||
|
||||
if ( -x $protocol ) {
|
||||
# Protocol is actually a script!
|
||||
|
|
|
@ -156,6 +156,7 @@ void Logger::initialise(const std::string &id, const Options &options) {
|
|||
if ( options.mTerminalLevel != NOOPT )
|
||||
tempTerminalLevel = options.mTerminalLevel;
|
||||
|
||||
// DEBUG1 == 1. So >= DEBUG1, we set to DEBUG9?! Why?
|
||||
if ( options.mDatabaseLevel != NOOPT )
|
||||
tempDatabaseLevel = options.mDatabaseLevel;
|
||||
else
|
||||
|
@ -359,7 +360,7 @@ Logger::Level Logger::databaseLevel(Logger::Level databaseLevel) {
|
|||
if ( databaseLevel > NOOPT ) {
|
||||
databaseLevel = limit(databaseLevel);
|
||||
if ( mDatabaseLevel != databaseLevel ) {
|
||||
if ( databaseLevel > NOLOG && mDatabaseLevel <= NOLOG ) {
|
||||
if ( (databaseLevel > NOLOG) && (mDatabaseLevel <= NOLOG) ) { // <= NOLOG would be NOOPT
|
||||
if ( !zmDbConnect() ) {
|
||||
databaseLevel = NOLOG;
|
||||
}
|
||||
|
|
|
@ -1060,7 +1060,6 @@ int RemoteCameraHttp::PreCapture() {
|
|||
if ( sd < 0 ) {
|
||||
Connect();
|
||||
if ( sd < 0 ) {
|
||||
Error("Unable to connect to camera");
|
||||
return -1;
|
||||
}
|
||||
mode = SINGLE_IMAGE;
|
||||
|
|
|
@ -350,7 +350,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
if ( result < 0 ) {
|
||||
// Failure, try reconnecting
|
||||
sleep(1);
|
||||
sleep(5);
|
||||
break;
|
||||
}
|
||||
} // end while ! zm_terminate
|
||||
|
|
|
@ -119,13 +119,11 @@ if ( sem_acquire($semaphore,1) !== false ) {
|
|||
switch ( $data['type'] ) {
|
||||
case MSG_DATA_WATCH :
|
||||
$data = unpack('ltype/imonitor/istate/dfps/ilevel/irate/ddelay/izoom/Cdelayed/Cpaused/Cenabled/Cforced', $msg);
|
||||
ZM\Logger::Debug('FPS: ' . $data['fps']);
|
||||
$data['fps'] = round( $data['fps'], 2 );
|
||||
ZM\Logger::Debug('FPS: ' . $data['fps'] );
|
||||
$data['rate'] /= RATE_BASE;
|
||||
$data['delay'] = round( $data['delay'], 2 );
|
||||
$data['zoom'] = round( $data['zoom']/SCALE_BASE, 1 );
|
||||
if ( ZM_OPT_USE_AUTH && ZM_AUTH_RELAY == 'hashed' ) {
|
||||
if ( ZM_OPT_USE_AUTH && (ZM_AUTH_RELAY == 'hashed') ) {
|
||||
$time = time();
|
||||
// Regenerate auth hash after half the lifetime of the hash
|
||||
if ( (!isset($_SESSION['AuthHashGeneratedAt'])) or ( $_SESSION['AuthHashGeneratedAt'] < $time - (ZM_AUTH_HASH_TTL * 1800) ) ) {
|
||||
|
@ -144,7 +142,7 @@ if ( sem_acquire($semaphore,1) !== false ) {
|
|||
}
|
||||
$data['rate'] /= RATE_BASE;
|
||||
$data['zoom'] = round( $data['zoom']/SCALE_BASE, 1 );
|
||||
if ( ZM_OPT_USE_AUTH && ZM_AUTH_RELAY == 'hashed' ) {
|
||||
if ( ZM_OPT_USE_AUTH && (ZM_AUTH_RELAY == 'hashed') ) {
|
||||
$time = time();
|
||||
// Regenerate auth hash after half the lifetime of the hash
|
||||
if ( (!isset($_SESSION['AuthHashGeneratedAt'])) or ( $_SESSION['AuthHashGeneratedAt'] < $time - (ZM_AUTH_HASH_TTL * 1800) ) ) {
|
||||
|
|
|
@ -61,7 +61,8 @@ class MonitorsController extends AppController {
|
|||
'Groups_Monitors.MonitorId = Monitor.Id',
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
'group' => '`Monitor`.`Id`',
|
||||
);
|
||||
$monitors = $this->Monitor->find('all',$find_array);
|
||||
$this->set(array(
|
||||
|
|
|
@ -47,6 +47,10 @@ class Event extends ZM_Object {
|
|||
return ZM_Object::_find_one(get_class(), $parameters, $options);
|
||||
}
|
||||
|
||||
public static function clear_cache() {
|
||||
return ZM_Object::_clear_cache(get_class());
|
||||
}
|
||||
|
||||
public function Storage( $new = null ) {
|
||||
if ( $new ) {
|
||||
$this->{'Storage'} = $new;
|
||||
|
|
|
@ -115,13 +115,17 @@ class Filter extends ZM_Object {
|
|||
|
||||
public function control($command, $server_id=null) {
|
||||
$Servers = $server_id ? Server::find(array('Id'=>$server_id)) : Server::find(array('Status'=>'Running'));
|
||||
if ( !count($Servers) and !$server_id ) {
|
||||
# This will be the non-multi-server case
|
||||
$Servers = array(new Server());
|
||||
if ( !count($Servers) ) {
|
||||
if ( !$server_id ) {
|
||||
# This will be the non-multi-server case
|
||||
$Servers = array(new Server());
|
||||
} else {
|
||||
Warning("Server not found for id $server_id");
|
||||
}
|
||||
}
|
||||
foreach ( $Servers as $Server ) {
|
||||
|
||||
if ( !defined('ZM_SERVER_ID') or !$Server->Id() or ZM_SERVER_ID==$Server->Id() ) {
|
||||
if ( (!defined('ZM_SERVER_ID')) or (!$Server->Id()) or (ZM_SERVER_ID==$Server->Id()) ) {
|
||||
# Local
|
||||
Logger::Debug("Controlling filter locally $command for server ".$Server->Id());
|
||||
daemonControl($command, 'zmfilter.pl', '--filter_id='.$this->{'Id'}.' --daemon');
|
||||
|
@ -139,7 +143,7 @@ class Filter extends ZM_Object {
|
|||
$url = '?user='.$_SESSION['username'];
|
||||
}
|
||||
}
|
||||
$url .= '&view=filter&action=control&command='.$command.'&Id='.$this->Id().'&ServerId='.$Server->Id();
|
||||
$url .= '&view=filter&object=filter&action=control&command='.$command.'&Id='.$this->Id().'&ServerId='.$Server->Id();
|
||||
Logger::Debug("sending command to $url");
|
||||
$data = array();
|
||||
if ( defined('ZM_ENABLE_CSRF_MAGIC') ) {
|
||||
|
|
|
@ -128,7 +128,14 @@ class Monitor extends ZM_Object {
|
|||
}
|
||||
|
||||
public function Server() {
|
||||
return new Server($this->{'ServerId'});
|
||||
if ( !property_exists($this, 'Server') ) {
|
||||
if ( $this->ServerId() )
|
||||
$this->{'Server'} = Server::find_one(array('Id'=>$this->{'ServerId'}));
|
||||
if ( !property_exists($this, 'Server') ) {
|
||||
$this->{'Server'} = new Server();
|
||||
}
|
||||
}
|
||||
return $this->{'Server'};
|
||||
}
|
||||
|
||||
public function __call($fn, array $args){
|
||||
|
|
|
@ -110,8 +110,9 @@ class ZM_Object {
|
|||
|
||||
public static function _find_one($class, $parameters = array(), $options = array() ) {
|
||||
global $object_cache;
|
||||
if ( ! isset($object_cache[$class]) )
|
||||
if ( ! isset($object_cache[$class]) ) {
|
||||
$object_cache[$class] = array();
|
||||
}
|
||||
$cache = &$object_cache[$class];
|
||||
if (
|
||||
( count($parameters) == 1 ) and
|
||||
|
@ -127,6 +128,11 @@ class ZM_Object {
|
|||
return $results[0];
|
||||
}
|
||||
|
||||
public static function _clear_cache($class) {
|
||||
global $object_cache;
|
||||
$object_cache[$class] = array();
|
||||
}
|
||||
|
||||
public static function Objects_Indexed_By_Id($class) {
|
||||
$results = array();
|
||||
foreach ( ZM_Object::_find($class, null, array('order'=>'lower(Name)')) as $Object ) {
|
||||
|
@ -290,6 +296,18 @@ Logger::Debug("$k => Have default for $v: ");
|
|||
$this->set($new_values);
|
||||
}
|
||||
|
||||
# Set defaults. Note that we only replace "" with null, not other values
|
||||
# because for example if we want to clear TimestampFormat, we clear it, but the default is a string value
|
||||
foreach ( $this->defaults as $field => $default ) {
|
||||
if ( (!array_key_exists($field, $this)) or ($this->{$field} == '') ) {
|
||||
if ( is_array($default) ) {
|
||||
$this->{$field} = $default['default'];
|
||||
} else if ( $default == null ) {
|
||||
$this->{$field} = $default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$fields = array_filter(
|
||||
$this->defaults,
|
||||
function($v) {
|
||||
|
|
|
@ -58,6 +58,13 @@ class Storage extends ZM_Object {
|
|||
return $this->{'Events'};
|
||||
}
|
||||
|
||||
public function EventCount() {
|
||||
if ( (! property_exists($this, 'EventCount')) or (!$this->{'EventCount'}) ) {
|
||||
$this->{'EventCount'} = dbFetchOne('SELECT COUNT(*) AS EventCount FROM Events WHERE StorageId=?', 'EventCount', array($this->Id()));
|
||||
}
|
||||
return $this->{'EventCount'};
|
||||
}
|
||||
|
||||
public function disk_usage_percent() {
|
||||
$path = $this->Path();
|
||||
if ( ! $path ) {
|
||||
|
@ -116,13 +123,14 @@ class Storage extends ZM_Object {
|
|||
$used = dbFetchOne('SELECT SUM(DiskSpace) AS DiskSpace FROM Events WHERE StorageId=? AND DiskSpace IS NOT NULL', 'DiskSpace', array($this->Id()));
|
||||
|
||||
do {
|
||||
# Do in batches of 1000 so as to not useup all ram
|
||||
# Do in batches of 1000 so as to not useup all ram, Event will do caching though...
|
||||
$events = Event::find(array('StorageId'=>$this->Id(), 'DiskSpace'=>null), array('limit'=>1000));
|
||||
foreach ( $events as $Event ) {
|
||||
$Event->Storage($this); // Prevent further db hit
|
||||
# DiskSpace will update the event
|
||||
$used += $Event->DiskSpace();
|
||||
} #end foreach
|
||||
Event::clear_cache();
|
||||
} while ( count($events) == 1000 );
|
||||
$this->{'DiskSpace'} = $used;
|
||||
}
|
||||
|
|
|
@ -64,35 +64,12 @@ if ( isset($_REQUEST['object']) and ( $_REQUEST['object'] == 'filter' ) ) {
|
|||
$_REQUEST['filter']['Background'] = empty($_REQUEST['filter']['Background']) ? 0 : 1;
|
||||
$_REQUEST['filter']['Concurrent'] = empty($_REQUEST['filter']['Concurrent']) ? 0 : 1;
|
||||
$changes = $filter->changes($_REQUEST['filter']);
|
||||
ZM\Logger::Debug("Changes: " . print_r($changes,true));
|
||||
|
||||
if ( 0 ) {
|
||||
$sql .= ', Query = '.dbEscape(jsonEncode($_REQUEST['filter']['Query']));
|
||||
$sql .= ', AutoArchive = '.(!empty($_REQUEST['filter']['AutoArchive']) ? 1 : 0);
|
||||
$sql .= ', AutoVideo = '. ( !empty($_REQUEST['filter']['AutoVideo']) ? 1 : 0);
|
||||
$sql .= ', AutoUpload = '. ( !empty($_REQUEST['filter']['AutoUpload']) ? 1 : 0);
|
||||
$sql .= ', AutoEmail = '. ( !empty($_REQUEST['filter']['AutoEmail']) ? 1 : 0);
|
||||
$sql .= ', AutoMessage = '. ( !empty($_REQUEST['filter']['AutoMessage']) ? 1 : 0);
|
||||
$sql .= ', AutoExecute = '. ( !empty($_REQUEST['filter']['AutoExecute']) ? 1 : 0);
|
||||
$sql .= ', AutoExecuteCmd = '.dbEscape($_REQUEST['filter']['AutoExecuteCmd']);
|
||||
$sql .= ', AutoDelete = '. ( !empty($_REQUEST['filter']['AutoDelete']) ? 1 : 0);
|
||||
if ( !empty($_REQUEST['filter']['AutoMove']) ? 1 : 0) {
|
||||
$sql .= ', AutoMove = 1, AutoMoveTo='. validInt($_REQUEST['filter']['AutoMoveTo']);
|
||||
} else {
|
||||
$sql .= ', AutoMove = 0';
|
||||
}
|
||||
$sql .= ', UpdateDiskSpace = '. ( !empty($_REQUEST['filter']['UpdateDiskSpace']) ? 1 : 0);
|
||||
$sql .= ', Background = '. ( !empty($_REQUEST['filter']['Background']) ? 1 : 0);
|
||||
$sql .= ', Concurrent = '. ( !empty($_REQUEST['filter']['Concurrent']) ? 1 : 0);
|
||||
}
|
||||
ZM\Logger::Debug('Changes: ' . print_r($changes,true));
|
||||
|
||||
if ( $_REQUEST['Id'] and ( $action == 'Save' ) ) {
|
||||
if ( 0 ) {
|
||||
dbQuery('UPDATE Filters SET '.$sql.' WHERE Id=?', array($_REQUEST['Id']));
|
||||
}
|
||||
$filter->save($changes);
|
||||
if ( $filter->Background() )
|
||||
$filter->control('stop');
|
||||
$filter->save($changes);
|
||||
} else {
|
||||
|
||||
if ( $action == 'execute' ) {
|
||||
|
|
|
@ -219,7 +219,6 @@ if ( $action == 'monitor' ) {
|
|||
|
||||
} else {
|
||||
ZM\Error('Error saving new Monitor.');
|
||||
$error_message = dbError($sql);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ class Logger {
|
|||
}
|
||||
}
|
||||
}
|
||||
return( $this->databaseLevel );
|
||||
return $this->databaseLevel;
|
||||
}
|
||||
|
||||
public function fileLevel( $fileLevel ) {
|
||||
|
@ -288,7 +288,7 @@ class Logger {
|
|||
$this->openFile();
|
||||
}
|
||||
}
|
||||
return( $this->fileLevel );
|
||||
return $this->fileLevel;
|
||||
}
|
||||
|
||||
public function weblogLevel( $weblogLevel ) {
|
||||
|
@ -303,7 +303,7 @@ class Logger {
|
|||
$this->weblogLevel = $weblogLevel;
|
||||
}
|
||||
}
|
||||
return( $this->weblogLevel );
|
||||
return $this->weblogLevel;
|
||||
}
|
||||
|
||||
public function syslogLevel( $syslogLevel ) {
|
||||
|
@ -317,30 +317,31 @@ class Logger {
|
|||
$this->openSyslog();
|
||||
}
|
||||
}
|
||||
return( $this->syslogLevel );
|
||||
return $this->syslogLevel;
|
||||
}
|
||||
|
||||
private function openSyslog() {
|
||||
openlog( $this->id, LOG_PID|LOG_NDELAY, LOG_LOCAL1 );
|
||||
openlog($this->id, LOG_PID|LOG_NDELAY, LOG_LOCAL1);
|
||||
}
|
||||
|
||||
private function closeSyslog() {
|
||||
closelog();
|
||||
}
|
||||
|
||||
private function logFile( $logFile ) {
|
||||
if ( preg_match( '/^(.+)\+$/', $logFile, $matches ) )
|
||||
private function logFile($logFile) {
|
||||
if ( preg_match('/^(.+)\+$/', $logFile, $matches) ) {
|
||||
$this->logFile = $matches[1].'.'.getmypid();
|
||||
else
|
||||
} else {
|
||||
$this->logFile = $logFile;
|
||||
}
|
||||
}
|
||||
|
||||
private function openFile() {
|
||||
if ( !$this->useErrorLog ) {
|
||||
if ( $this->logFd = fopen( $this->logFile, 'a+' ) ) {
|
||||
if ( strnatcmp( phpversion(), '5.2.0' ) >= 0 ) {
|
||||
if ( $this->logFd = fopen($this->logFile, 'a+') ) {
|
||||
if ( strnatcmp(phpversion(), '5.2.0') >= 0 ) {
|
||||
$error = error_get_last();
|
||||
trigger_error( "Can't open log file '$logFile': ".$error['message'].' @ '.$error['file'].'/'.$error['line'], E_USER_ERROR );
|
||||
trigger_error("Can't open log file '$logFile': ".$error['message'].' @ '.$error['file'].'/'.$error['line'], E_USER_ERROR);
|
||||
}
|
||||
$this->fileLevel = self::NOLOG;
|
||||
}
|
||||
|
@ -349,73 +350,83 @@ class Logger {
|
|||
|
||||
private function closeFile() {
|
||||
if ( $this->logFd )
|
||||
fclose( $this->logFd );
|
||||
fclose($this->logFd);
|
||||
}
|
||||
|
||||
public function logPrint( $level, $string, $file=NULL, $line=NULL ) {
|
||||
if ( $level <= $this->effectiveLevel ) {
|
||||
$string = preg_replace( '/[\r\n]+$/', '', $string );
|
||||
$code = self::$codes[$level];
|
||||
if ( $level > $this->effectiveLevel ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$time = gettimeofday();
|
||||
$message = sprintf( '%s.%06d %s[%d].%s [%s]', strftime( '%x %H:%M:%S', $time['sec'] ), $time['usec'], $this->id, getmypid(), $code, $string );
|
||||
$string = preg_replace('/[\r\n]+$/', '', $string);
|
||||
$code = self::$codes[$level];
|
||||
|
||||
if ( is_null($file) ) {
|
||||
if ( $this->useErrorLog || $this->databaseLevel > self::NOLOG ) {
|
||||
$backTrace = debug_backtrace();
|
||||
$file = $backTrace[1]['file'];
|
||||
$line = $backTrace[1]['line'];
|
||||
if ( $this->hasTerm )
|
||||
$rootPath = getcwd();
|
||||
else
|
||||
$rootPath = $_SERVER['DOCUMENT_ROOT'];
|
||||
$file = preg_replace( '/^'.addcslashes($rootPath,'/').'\/?/', '', $file );
|
||||
}
|
||||
}
|
||||
$time = gettimeofday();
|
||||
$message = sprintf('%s.%06d %s[%d].%s [%s] [%s]',
|
||||
strftime('%x %H:%M:%S', $time['sec']), $time['usec'],
|
||||
$this->id, getmypid(), $code, $_SERVER['REMOTE_ADDR'], $string);
|
||||
|
||||
if ( $this->useErrorLog )
|
||||
$message .= ' at '.$file.' line '.$line;
|
||||
else
|
||||
$message = $message;
|
||||
|
||||
if ( $level <= $this->termLevel )
|
||||
if ( is_null($file) ) {
|
||||
if ( $this->useErrorLog || ($this->databaseLevel > self::NOLOG) ) {
|
||||
$backTrace = debug_backtrace();
|
||||
$file = $backTrace[1]['file'];
|
||||
$line = $backTrace[1]['line'];
|
||||
if ( $this->hasTerm )
|
||||
print( $message."\n" );
|
||||
$rootPath = getcwd();
|
||||
else
|
||||
print( preg_replace( "/\n/", '<br/>', htmlspecialchars($message) ).'<br/>' );
|
||||
|
||||
if ( $level <= $this->fileLevel )
|
||||
if ( $this->useErrorLog ) {
|
||||
if ( !error_log( $message."\n", 3, $this->logFile ) ) {
|
||||
if ( strnatcmp( phpversion(), '5.2.0' ) >= 0 ) {
|
||||
$error = error_get_last();
|
||||
trigger_error( "Can't write to log file '".$this->logFile."': ".$error['message'].' @ '.$error['file'].'/'.$error['line'], E_USER_ERROR );
|
||||
}
|
||||
}
|
||||
} elseif ( $this->logFd ) {
|
||||
fprintf( $this->logFd, $message."\n" );
|
||||
}
|
||||
|
||||
$message = $code.' ['.$string.']';
|
||||
if ( $level <= $this->syslogLevel )
|
||||
syslog( self::$syslogPriorities[$level], $message );
|
||||
if ( $level <= $this->databaseLevel ) {
|
||||
try {
|
||||
global $dbConn;
|
||||
$sql = 'INSERT INTO Logs ( TimeKey, Component, Pid, Level, Code, Message, File, Line ) values ( ?, ?, ?, ?, ?, ?, ?, ? )';
|
||||
$stmt = $dbConn->prepare( $sql );
|
||||
$result = $stmt->execute( array( sprintf( '%d.%06d', $time['sec'], $time['usec'] ), $this->id, getmypid(), $level, $code, $string, $file, $line ) );
|
||||
} catch(PDOException $ex) {
|
||||
$this->databaseLevel = self::NOLOG;
|
||||
Error("Can't write log entry '$sql': ". $ex->getMessage());
|
||||
}
|
||||
$rootPath = $_SERVER['DOCUMENT_ROOT'];
|
||||
$file = preg_replace('/^'.addcslashes($rootPath,'/').'\/?/', '', $file);
|
||||
}
|
||||
// This has to be last as trigger_error can be fatal
|
||||
if ( $level <= $this->weblogLevel ) {
|
||||
if ( $this->useErrorLog )
|
||||
error_log( $message, 0 );
|
||||
else
|
||||
trigger_error( $message, self::$phpErrorLevels[$level] );
|
||||
}
|
||||
|
||||
if ( $this->useErrorLog ) {
|
||||
$message .= ' at '.$file.' line '.$line;
|
||||
} else {
|
||||
$message = $message;
|
||||
}
|
||||
|
||||
if ( $level <= $this->termLevel ) {
|
||||
if ( $this->hasTerm )
|
||||
print($message."\n");
|
||||
else
|
||||
print(preg_replace("/\n/", '<br/>', htmlspecialchars($message)).'<br/>');
|
||||
}
|
||||
|
||||
if ( $level <= $this->fileLevel ) {
|
||||
if ( $this->useErrorLog ) {
|
||||
if ( !error_log($message."\n", 3, $this->logFile) ) {
|
||||
if ( strnatcmp(phpversion(), '5.2.0') >= 0 ) {
|
||||
$error = error_get_last();
|
||||
trigger_error("Can't write to log file '".$this->logFile."': ".$error['message'].' @ '.$error['file'].'/'.$error['line'], E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
} else if ( $this->logFd ) {
|
||||
fprintf($this->logFd, $message."\n");
|
||||
}
|
||||
}
|
||||
|
||||
$message = $code.' ['.$string.']';
|
||||
if ( $level <= $this->syslogLevel )
|
||||
syslog( self::$syslogPriorities[$level], $message );
|
||||
|
||||
if ( $level <= $this->databaseLevel ) {
|
||||
try {
|
||||
global $dbConn;
|
||||
$sql = 'INSERT INTO `Logs` ( `TimeKey`, `Component`, `ServerId`, `Pid`, `Level`, `Code`, `Message`, `File`, `Line` ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )';
|
||||
$stmt = $dbConn->prepare($sql);
|
||||
$result = $stmt->execute(array(sprintf('%d.%06d', $time['sec'], $time['usec']), $this->id,
|
||||
(defined('ZM_SERVER_ID') ? ZM_SERVER_ID : null), getmypid(), $level, $code, $string, $file, $line));
|
||||
} catch(PDOException $ex) {
|
||||
$this->databaseLevel = self::NOLOG;
|
||||
Error("Can't write log entry '$sql': ". $ex->getMessage());
|
||||
}
|
||||
}
|
||||
// This has to be last as trigger_error can be fatal
|
||||
if ( $level <= $this->weblogLevel ) {
|
||||
if ( $this->useErrorLog ) {
|
||||
error_log($message, 0);
|
||||
} else {
|
||||
trigger_error($message, self::$phpErrorLevels[$level]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -981,6 +981,14 @@ $OLANG = array(
|
|||
"loglevel=debug" Set verbosity of FFmpeg (quiet, panic, fatal, error, warning, info, verbose, debug)
|
||||
'
|
||||
),
|
||||
'OPTIONS_DECODERHWACCELNAME' => array(
|
||||
'Help' => '
|
||||
This is equivalent to the ffmpeg -hwaccel command line option. With intel graphics support, use "vaapi". For NVIDIA cuda support use "cuda". To check for support, run ffmpeg -hwaccels on the command line.'
|
||||
),
|
||||
'OPTIONS_DECODERHWACCELDEVICE' => array(
|
||||
'Help' => '
|
||||
This is equivalent to the ffmpeg -hwaccel_device command line option. You should only have to specify this if you have multiple GPUs. A typical value for Intel VAAPI would be /dev/dri/renderD128.'
|
||||
),
|
||||
'OPTIONS_RTSPTrans' => array(
|
||||
'Help' => '
|
||||
This sets the RTSP Transport Protocol for FFmpeg.~~
|
||||
|
|
|
@ -940,6 +940,8 @@ function exportEvents(
|
|||
$archive = '';
|
||||
if ( $exportFormat == 'tar' ) {
|
||||
$archive = ZM_DIR_EXPORTS.'/'.$export_root.($connkey?'_'.$connkey:'').'.tar';
|
||||
$version = shell_exec('tar -v');
|
||||
|
||||
$command = 'tar --create --dereference';
|
||||
if ( $exportCompressed ) {
|
||||
$archive .= '.gz';
|
||||
|
@ -947,8 +949,11 @@ function exportEvents(
|
|||
$exportFormat .= '.gz';
|
||||
}
|
||||
if ( $exportStructure == 'flat' ) {
|
||||
//strip file paths if we
|
||||
$command .= " --xform='s#^.+/##x'";
|
||||
if (preg_match("/BSD/i", $version)) {
|
||||
$command .= " -s '#^.*/##'";
|
||||
} else {
|
||||
$command .= " --xform='s#^.+/##x'";
|
||||
}
|
||||
}
|
||||
$command .= ' --file='.escapeshellarg($archive);
|
||||
} elseif ( $exportFormat == 'zip' ) {
|
||||
|
|
|
@ -217,7 +217,7 @@ for ( $i=0; $i < count($terms); $i++ ) {
|
|||
}
|
||||
?>
|
||||
<td><?php if ( count($terms) > 2 ) { echo htmlSelect("filter[Query][terms][$i][obr]", $obracketTypes, $term['obr']); } else { ?> <?php } ?></td>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][attr]", $attrTypes, $term['attr'], 'checkValue(this);'); ?></td>
|
||||
<td><?php echo htmlSelect("filter[Query][terms][$i][attr]", $attrTypes, $term['attr'], array('data-on-change-this'=>'checkValue')); ?></td>
|
||||
<?php
|
||||
if ( isset($term['attr']) ) {
|
||||
if ( $term['attr'] == 'Archived' ) {
|
||||
|
|
|
@ -30,7 +30,6 @@ function validateForm( form ) {
|
|||
|
||||
function updateButtons(element) {
|
||||
var form = element.form;
|
||||
console.log(element);
|
||||
if ( element.type == 'checkbox' && element.checked ) {
|
||||
form.elements['executeButton'].disabled = false;
|
||||
} else {
|
||||
|
@ -105,6 +104,7 @@ function submitToEvents( element ) {
|
|||
form.action = thisUrl + '?view=events';
|
||||
history.replaceState(null, null, '?view=filter&' + $j(form).serialize());
|
||||
}
|
||||
|
||||
function submitToMontageReview( element ) {
|
||||
var form = element.form;
|
||||
form.action = thisUrl + '?view=montagereview';
|
||||
|
@ -143,12 +143,12 @@ function deleteFilter( element ) {
|
|||
}
|
||||
|
||||
function parseRows(rows) {
|
||||
for (var rowNum = 0; rowNum < rows.length; rowNum++) { //Each row is a term
|
||||
for ( var rowNum = 0; rowNum < rows.length; rowNum++ ) { //Each row is a term
|
||||
var queryPrefix = 'filter[Query][terms][';
|
||||
var inputTds = rows.eq(rowNum).children();
|
||||
|
||||
if (rowNum == 0) inputTds.eq(0).html(' '); //Remove and from first term
|
||||
if (rowNum > 0) { //add and/or to 1+
|
||||
if ( rowNum == 0 ) inputTds.eq(0).html(' '); //Remove and from first term
|
||||
if ( rowNum > 0 ) { //add and/or to 1+
|
||||
var cnjVal = inputTds.eq(0).children().val();
|
||||
var conjSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][cnj]').attr('id', queryPrefix + rowNum + '][cnj]');
|
||||
$j.each(conjTypes, function(i) {
|
||||
|
@ -172,19 +172,19 @@ function parseRows(rows) {
|
|||
inputTds.eq(1).html(obrSelect).children().val(obrVal); //Set bracket contents and assign saved value
|
||||
inputTds.eq(5).html(cbrSelect).children().val(cbrVal);
|
||||
} else {
|
||||
inputTds.eq(1).html(' '); //Blank if there aren't enough terms for brackets
|
||||
inputTds.eq(1).html(' '); // Blank if there aren't enough terms for brackets
|
||||
inputTds.eq(5).html(' ');
|
||||
}
|
||||
|
||||
if (rows.length == 1) {
|
||||
inputTds.eq(6).find(':input[value="-"]').prop('disabled', true); //enable/disable remove row button
|
||||
if ( rows.length == 1 ) {
|
||||
inputTds.eq(6).find('button[data-on-click-this="delTerm"]').prop('disabled', true); //enable/disable remove row button
|
||||
} else {
|
||||
inputTds.eq(6).find(':input[value="-"]').prop('disabled', false);
|
||||
inputTds.eq(6).find('button[data-on-click-this="delTerm"]').prop('disabled', false);
|
||||
}
|
||||
|
||||
var attr = inputTds.eq(2).children().val();
|
||||
|
||||
if ( attr == "Archived") { //Archived types
|
||||
if ( attr == "Archived" ) { //Archived types
|
||||
inputTds.eq(3).html('equal to<input type="hidden" name="filter[Query][terms][' + rowNum + '][op]" value="=">');
|
||||
var archiveSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
|
||||
for (var i = 0; i < archiveTypes.length; i++) {
|
||||
|
@ -253,7 +253,7 @@ function parseRows(rows) {
|
|||
term[2] = rowNum;
|
||||
inputTds.eq(2).children().eq(0).attr('name', 'filter'+stringFilter(term));
|
||||
inputTds.eq(2).children().eq(0).attr('id', 'filter'+stringFilter(term));
|
||||
}//End for each term/row
|
||||
} // End for each term/row
|
||||
history.replaceState(null, null, '?view=filter&' + $j('#contentForm').serialize());
|
||||
}
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ function tlZoomBounds( minTime, maxTime ) {
|
|||
}
|
||||
|
||||
function tlZoomOut() {
|
||||
location.replace('?view='+currentView+filterQuery+'&midTime='+midTime+'&range='+zoom_range);
|
||||
location.replace('?view='+currentView+filterQuery+'&midTime='+midTime+'&range='+zoomout_range);
|
||||
}
|
||||
|
||||
function tlPanLeft() {
|
||||
|
|
|
@ -229,12 +229,18 @@ function getStreamCmdResponse(respObj, respText) {
|
|||
} // end if canEditMonitors
|
||||
|
||||
if ( streamStatus.auth ) {
|
||||
auth_hash = streamStatus.auth;
|
||||
console.log("Have a new auth hash" + streamStatus.auth);
|
||||
// Try to reload the image stream.
|
||||
var streamImg = $('liveStream');
|
||||
if ( streamImg ) {
|
||||
streamImg.src = streamImg.src.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
|
||||
}
|
||||
streamCmdParms = streamCmdParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
|
||||
statusCmdParms = statusCmdParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
|
||||
eventCmdParms = eventCmdParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
|
||||
actParms = actParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
|
||||
controlParms = controlParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
|
||||
} // end if have a new auth hash
|
||||
} // end if respObj.status
|
||||
} else {
|
||||
|
@ -473,6 +479,9 @@ function getActResponse( respObj, respText ) {
|
|||
|
||||
function deleteEvent( event, eventId ) {
|
||||
var actParms = "view=request&request=event&action=delete&id="+eventId;
|
||||
if ( auth_hash ) {
|
||||
actParms += '&auth='+auth_hash;
|
||||
}
|
||||
var actReq = new Request.JSON( {
|
||||
url: thisUrl,
|
||||
method: 'post',
|
||||
|
|
|
@ -831,13 +831,13 @@ include('_monitor_source_nvsocket.php');
|
|||
?>
|
||||
<tr class="DecoderHWAccelName">
|
||||
<td><?php echo translate('DecoderHWAccelName') ?>
|
||||
(<?php echo makePopupLink('?view=optionhelp&option=DECODERHWACCELNAME', 'zmOptionHelp', 'optionhelp', '?') ?>)
|
||||
(<?php echo makePopupLink('?view=optionhelp&option=OPTIONS_DECODERHWACCELNAME', 'zmOptionHelp', 'optionhelp', '?') ?>)
|
||||
</td>
|
||||
<td><input type="text" name="newMonitor[DecoderHWAccelName]" value="<?php echo validHtmlStr($monitor->DecoderHWAccelName()) ?>"/></td>
|
||||
</tr>
|
||||
<tr class="DecoderHWAccelDevice">
|
||||
<td><?php echo translate('DecoderHWAccelDevice') ?>
|
||||
(<?php echo makePopupLink('?view=optionhelp&option=DECODERHWACCELDEVIC', 'zmOptionHelp', 'optionhelp', '?') ?>)
|
||||
(<?php echo makePopupLink('?view=optionhelp&option=OPTIONS_DECODERHWACCELDEVICE', 'zmOptionHelp', 'optionhelp', '?') ?>)
|
||||
</td>
|
||||
<td><input type="text" name="newMonitor[DecoderHWAccelDevice]" value="<?php echo validHtmlStr($monitor->DecoderHWAccelDevice()) ?>"/></td>
|
||||
</tr>
|
||||
|
@ -872,6 +872,7 @@ if ( $monitor->Type() != 'NVSocket' && $monitor->Type() != 'WebSite' ) {
|
|||
'1920x1080'=>'1920x1080 1080p',
|
||||
'2048x1536'=>'2048x1536 3MP',
|
||||
'2592x1944'=>'2592x1944 5MP',
|
||||
'3840x2160'=>'3840x2160 4K UHD',
|
||||
), $monitor->Width().'x'.$monitor->Height()
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -247,18 +247,18 @@ function probeNetwork() {
|
|||
$arp_command = ZM_PATH_ARP;
|
||||
$result = explode(' ', $arp_command);
|
||||
if ( !is_executable($result[0]) ) {
|
||||
ZM\Error("ARP compatible binary not found or not executable by the web user account. Verify ZM_PATH_ARP points to a valid arp tool.");
|
||||
return;
|
||||
ZM\Error('ARP compatible binary not found or not executable by the web user account. Verify ZM_PATH_ARP points to a valid arp tool.');
|
||||
return $cameras;
|
||||
}
|
||||
|
||||
$result = exec(escapeshellcmd($arp_command), $output, $status);
|
||||
if ( $status ) {
|
||||
ZM\Error("Unable to probe network cameras, status is '$status'");
|
||||
return;
|
||||
return $cameras;
|
||||
}
|
||||
|
||||
$monitors = array();
|
||||
foreach ( dbFetchAll("SELECT Id, Name, Host FROM Monitors WHERE Type = 'Remote' ORDER BY Host") as $monitor ) {
|
||||
foreach ( dbFetchAll("SELECT `Id`, `Name`, `Host` FROM `Monitors` WHERE `Type` = 'Remote' ORDER BY `Host`") as $monitor ) {
|
||||
if ( preg_match('/^(.+)@(.+)$/', $monitor['Host'], $matches) ) {
|
||||
//echo "1: ".$matches[2]." = ".gethostbyname($matches[2])."<br/>";
|
||||
$monitors[gethostbyname($matches[2])] = $monitor;
|
||||
|
@ -277,29 +277,29 @@ function probeNetwork() {
|
|||
'78:a5:dd' => array('type'=>'Wansview','probeFunc'=>'probeWansview')
|
||||
);
|
||||
|
||||
foreach ( $output as $line ) {
|
||||
if ( !preg_match('/(\d+\.\d+\.\d+\.\d+).*(([0-9a-f]{2}:){5})/', $line, $matches) )
|
||||
continue;
|
||||
$ip = $matches[1];
|
||||
$host = $ip;
|
||||
$mac = $matches[2];
|
||||
//echo "I:$ip, H:$host, M:$mac<br/>";
|
||||
$macRoot = substr($mac,0,8);
|
||||
if ( isset($macBases[$macRoot]) ) {
|
||||
$macBase = $macBases[$macRoot];
|
||||
$camera = call_user_func($macBase['probeFunc'], $ip);
|
||||
$sourceDesc = base64_encode(serialize($camera['monitor']));
|
||||
$sourceString = $camera['model'].' @ '.$host;
|
||||
if ( isset($monitors[$ip]) ) {
|
||||
$monitor = $monitors[$ip];
|
||||
$sourceString .= ' ('.$monitor['Name'].')';
|
||||
} else {
|
||||
$sourceString .= ' - '.translate('Available');
|
||||
}
|
||||
$cameras[$sourceDesc] = $sourceString;
|
||||
foreach ( $output as $line ) {
|
||||
if ( !preg_match('/(\d+\.\d+\.\d+\.\d+).*(([0-9a-f]{2}:){5})/', $line, $matches) )
|
||||
continue;
|
||||
$ip = $matches[1];
|
||||
$host = $ip;
|
||||
$mac = $matches[2];
|
||||
//echo "I:$ip, H:$host, M:$mac<br/>";
|
||||
$macRoot = substr($mac,0,8);
|
||||
if ( isset($macBases[$macRoot]) ) {
|
||||
$macBase = $macBases[$macRoot];
|
||||
$camera = call_user_func($macBase['probeFunc'], $ip);
|
||||
$sourceDesc = base64_encode(serialize($camera['monitor']));
|
||||
$sourceString = $camera['model'].' @ '.$host;
|
||||
if ( isset($monitors[$ip]) ) {
|
||||
$monitor = $monitors[$ip];
|
||||
$sourceString .= ' ('.$monitor['Name'].')';
|
||||
} else {
|
||||
$sourceString .= ' - '.translate('Available');
|
||||
}
|
||||
} # end foreach output line
|
||||
return $cameras;
|
||||
$cameras[$sourceDesc] = $sourceString;
|
||||
}
|
||||
} # end foreach output line
|
||||
return $cameras;
|
||||
} # end function probeNetwork()
|
||||
|
||||
$cameras = array();
|
||||
|
|
|
@ -278,8 +278,8 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*',GLOB_ONLYDIR)) as $
|
|||
<td class="colScheme"><?php echo makePopupLink('?view=storage&id='.$Storage->Id(), 'zmStorage', 'storage', validHtmlStr($Storage->Scheme()), $canEdit ) ?></td>
|
||||
<td class="colServer"><?php echo makePopupLink('?view=storage&id='.$Storage->Id(), 'zmStorage', 'storage', validHtmlStr($Storage->Server()->Name()), $canEdit ) ?></td>
|
||||
<td class="colDiskSpace"><?php echo human_filesize($Storage->disk_used_space()) . ' of ' . human_filesize($Storage->disk_total_space()) ?></td>
|
||||
<td class="ColEvents"><?php echo count($Storage->Events()).' using '.human_filesize($Storage->event_disk_space()) ?></td>
|
||||
<td class="colMark"><input type="checkbox" name="markIds[]" value="<?php echo $Storage->Id() ?>" data-on-click-this="configureDeleteButton"<?php if ( count($Storage->Events()) or !$canEdit ) { ?> disabled="disabled"<?php } ?><?php echo count($Storage->Events()) ? ' title="Can\'t delete as long as there are events stored here."' : ''?>/></td>
|
||||
<td class="ColEvents"><?php echo $Storage->EventCount().' using '.human_filesize($Storage->event_disk_space()) ?></td>
|
||||
<td class="colMark"><input type="checkbox" name="markIds[]" value="<?php echo $Storage->Id() ?>" data-on-click-this="configureDeleteButton"<?php if ( $Storage->EventCount() or !$canEdit ) { ?> disabled="disabled"<?php } ?><?php echo $Storage->EventCount() ? ' title="Can\'t delete as long as there are events stored here."' : ''?>/></td>
|
||||
</tr>
|
||||
<?php } #end foreach Server ?>
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue