Merge branch 'master' into feature-h264-videostorage

This commit is contained in:
Isaac Connor 2017-03-22 09:02:02 -04:00
commit 3a8a04c213
16 changed files with 163 additions and 115 deletions

View File

@ -58,8 +58,10 @@ override_dh_auto_install:
override_dh_fixperms: override_dh_fixperms:
dh_fixperms dh_fixperms
## 637685 #
chmod -c o-r $(CURDIR)/debian/zoneminder/etc/zm/zm.conf # As requested by the Debian Webapps Policy Manual §3.2.1
chown root:www-data $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
chmod 640 $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
override_dh_installinit: override_dh_installinit:
dh_installinit --no-start dh_installinit --no-start

View File

@ -58,8 +58,10 @@ override_dh_auto_install:
override_dh_fixperms: override_dh_fixperms:
dh_fixperms dh_fixperms
## 637685 #
chmod -c o-r $(CURDIR)/debian/zoneminder/etc/zm/zm.conf # As requested by the Debian Webapps Policy Manual §3.2.1
chown root:www-data $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
chmod 640 $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
override_dh_installinit: override_dh_installinit:
dh_installinit --no-start dh_installinit --no-start

View File

@ -15,7 +15,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# ========================================================================== # ==========================================================================
# #

View File

@ -1,27 +1,34 @@
# ==========================================================================
#
# ZoneMinder SunEyes SP-P1802SWPTZ IP Control Protocol Module, $Date: 2017-03-19 23:00:00 +1000 (Sat, 19 March 2017) $, $Revision: 0002 $
# Copyright (C) 2001-2008 Philip Coombes
# Modified for use with Foscam FI8918W IP Camera by Dave Harris
# Modified Feb 2011 by Howard Durdle (http://durdl.es/x) to:
# fix horizontal panning, add presets and IR on/off
# use Control Device field to pass username and password
# Modified May 2014 by Arun Horne (http://arunhorne.co.uk) to:
# use HTTP basic auth as required by firmware 11.37.x.x upward
# Modified on Sep 28 2015 by Bobby Billingsley # Modified on Sep 28 2015 by Bobby Billingsley
# Changes made # Changes made
# - Copied FI8918W.pm to SPP1802SWPTZ.pm # - Copied FI8918W.pm to SPP1802SWPTZ.pm
# - modified to control a SunEyes SP-P1802SWPTZ # - modified to control a SunEyes SP-P1802SWPTZ
# Modified on 13 March 2017 by Steve Gilvarry
# ========================================================================== # -Address license and copyright issues
# ZoneMinder SunEyes SP-P1802SWPTZ IP Control Protocol Module
# #
# This program is free software; you can redistribute it and/or modify it under # This program is free software; you can redistribute it and/or
# the terms of the GNU General Public License as published by the Free Software # modify it under the terms of the GNU General Public License
# Foundation; either version 2 of the License, or (at your option) any later # as published by the Free Software Foundation; either version 2
# version. # of the License, or (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, but WITHOUT # This program is distributed in the hope that it will be useful,
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # but WITHOUT ANY WARRANTY; without even the implied warranty of
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
# ==========================================================================
#
# This module contains the implementation of the SunEyes SP-P1802SWPTZ IP # This module contains the implementation of the SunEyes SP-P1802SWPTZ IP
# camera control protocol # camera control protocol
# #

View File

@ -44,7 +44,7 @@ our @ISA = qw(Exporter ZoneMinder::Base);
our %EXPORT_TAGS = ( our %EXPORT_TAGS = (
'functions' => [ qw( 'functions' => [ qw(
) ] ) ]
); );
push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS; push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS;
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
@ -130,6 +130,8 @@ sub find {
my $filter = new ZoneMinder::Filter( $$db_filter{Id}, $db_filter ); my $filter = new ZoneMinder::Filter( $$db_filter{Id}, $db_filter );
push @results, $filter; push @results, $filter;
} # end while } # end while
$sth->finish();
return @results; return @results;
} }
@ -176,78 +178,74 @@ sub Sql {
my $self = $_[0]; my $self = $_[0];
if ( ! $$self{Sql} ) { if ( ! $$self{Sql} ) {
my $filter_expr = ZoneMinder::General::jsonDecode( $self->{Query} ); my $filter_expr = ZoneMinder::General::jsonDecode( $self->{Query} );
my $sql = "SELECT E.Id, my $sql = "SELECT E.*,
E.MonitorId, unix_timestamp(E.StartTime) as Time,
M.Name as MonitorName, M.Name as MonitorName,
M.DefaultRate, M.DefaultRate,
M.DefaultScale, M.DefaultScale
E.Name,
E.Cause,
E.Notes,
E.StartTime,
unix_timestamp(E.StartTime) as Time,
E.Length,
E.Frames,
E.AlarmFrames,
E.TotScore,
E.AvgScore,
E.MaxScore,
E.Archived,
E.Videoed,
E.Uploaded,
E.Emailed,
E.Messaged,
E.Executed
FROM Events as E FROM Events as E
INNER JOIN Monitors as M on M.Id = E.MonitorId INNER JOIN Monitors as M on M.Id = E.MonitorId
"; ";
$self->{Sql} = ''; $self->{Sql} = '';
if ( $filter_expr->{terms} ) { if ( $filter_expr->{terms} ) {
for ( my $i = 0; $i < @{$filter_expr->{terms}}; $i++ ) { foreach my $term ( @{$filter_expr->{terms}} ) {
if ( exists($filter_expr->{terms}[$i]->{cnj}) ) {
$self->{Sql} .= " ".$filter_expr->{terms}[$i]->{cnj}." "; if ( exists($term->{cnj}) ) {
$self->{Sql} .= " ".$term->{cnj}." ";
} }
if ( exists($filter_expr->{terms}[$i]->{obr}) ) { if ( exists($term->{obr}) ) {
$self->{Sql} .= " ".str_repeat( "(", $filter_expr->{terms}[$i]->{obr} )." "; $self->{Sql} .= " ".str_repeat( "(", $term->{obr} )." ";
} }
my $value = $filter_expr->{terms}[$i]->{val}; my $value = $term->{val};
my @value_list; my @value_list;
if ( $filter_expr->{terms}[$i]->{attr} ) { if ( $term->{attr} ) {
if ( $filter_expr->{terms}[$i]->{attr} =~ /^Monitor/ ) { if ( $term->{attr} =~ /^Monitor/ ) {
my ( $temp_attr_name ) = $filter_expr->{terms}[$i]->{attr} =~ /^Monitor(.+)$/; my ( $temp_attr_name ) = $term->{attr} =~ /^Monitor(.+)$/;
$self->{Sql} .= "M.".$temp_attr_name; $self->{Sql} .= "M.".$temp_attr_name;
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'DateTime' ) { } elsif ( $term->{attr} =~ /^Server/ ) {
$self->{Sql} .= "M.".$term->{attr};
} elsif ( $term->{attr} eq 'DateTime' ) {
$self->{Sql} .= "E.StartTime"; $self->{Sql} .= "E.StartTime";
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'Date' ) { } elsif ( $term->{attr} eq 'Date' ) {
$self->{Sql} .= "to_days( E.StartTime )"; $self->{Sql} .= "to_days( E.StartTime )";
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'Time' ) { } elsif ( $term->{attr} eq 'Time' ) {
$self->{Sql} .= "extract( hour_second from E.StartTime )"; $self->{Sql} .= "extract( hour_second from E.StartTime )";
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'Weekday' ) { } elsif ( $term->{attr} eq 'Weekday' ) {
$self->{Sql} .= "weekday( E.StartTime )"; $self->{Sql} .= "weekday( E.StartTime )";
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'DiskPercent' ) { } elsif ( $term->{attr} eq 'DiskPercent' ) {
$self->{Sql} .= "zmDiskPercent"; $self->{Sql} .= "zmDiskPercent";
$self->{HasDiskPercent} = !undef; $self->{HasDiskPercent} = !undef;
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'DiskBlocks' ) { } elsif ( $term->{attr} eq 'DiskBlocks' ) {
$self->{Sql} .= "zmDiskBlocks"; $self->{Sql} .= "zmDiskBlocks";
$self->{HasDiskBlocks} = !undef; $self->{HasDiskBlocks} = !undef;
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'SystemLoad' ) { } elsif ( $term->{attr} eq 'SystemLoad' ) {
$self->{Sql} .= "zmSystemLoad"; $self->{Sql} .= "zmSystemLoad";
$self->{HasSystemLoad} = !undef; $self->{HasSystemLoad} = !undef;
} else { } else {
$self->{Sql} .= "E.".$filter_expr->{terms}[$i]->{attr}; $self->{Sql} .= "E.".$term->{attr};
} }
( my $stripped_value = $value ) =~ s/^["\']+?(.+)["\']+?$/$1/; ( my $stripped_value = $value ) =~ s/^["\']+?(.+)["\']+?$/$1/;
foreach my $temp_value ( split( /["'\s]*?,["'\s]*?/, $stripped_value ) ) { foreach my $temp_value ( split( /["'\s]*?,["'\s]*?/, $stripped_value ) ) {
if ( $filter_expr->{terms}[$i]->{attr} =~ /^Monitor/ ) { if ( $term->{attr} =~ /^Monitor/ ) {
$value = "'$temp_value'"; $value = "'$temp_value'";
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'Name' } elsif ( $term->{attr} eq 'ServerId' ) {
|| $filter_expr->{terms}[$i]->{attr} eq 'Cause' if ( $temp_value eq 'ZM_SERVER_ID' ) {
|| $filter_expr->{terms}[$i]->{attr} eq 'Notes' $value = "'$Config{ZM_SERVER_ID}'";
# This gets used later, I forget for what
$$self{Server} = new ZoneMinder::Server( $Config{ZM_SERVER_ID} );
} else {
$value = "'$temp_value'";
# This gets used later, I forget for what
$$self{Server} = new ZoneMinder::Server( $temp_value );
}
} elsif ( $term->{attr} eq 'Name'
|| $term->{attr} eq 'Cause'
|| $term->{attr} eq 'Notes'
) { ) {
$value = "'$temp_value'"; $value = "'$temp_value'";
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'DateTime' ) { } elsif ( $term->{attr} eq 'DateTime' ) {
$value = DateTimeToSQL( $temp_value ); $value = DateTimeToSQL( $temp_value );
if ( !$value ) { if ( !$value ) {
Error( "Error parsing date/time '$temp_value', " Error( "Error parsing date/time '$temp_value', "
@ -255,7 +253,7 @@ sub Sql {
return; return;
} }
$value = "'$value'"; $value = "'$value'";
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'Date' ) { } elsif ( $term->{attr} eq 'Date' ) {
$value = DateTimeToSQL( $temp_value ); $value = DateTimeToSQL( $temp_value );
if ( !$value ) { if ( !$value ) {
Error( "Error parsing date/time '$temp_value', " Error( "Error parsing date/time '$temp_value', "
@ -263,7 +261,7 @@ sub Sql {
return; return;
} }
$value = "to_days( '$value' )"; $value = "to_days( '$value' )";
} elsif ( $filter_expr->{terms}[$i]->{attr} eq 'Time' ) { } elsif ( $term->{attr} eq 'Time' ) {
$value = DateTimeToSQL( $temp_value ); $value = DateTimeToSQL( $temp_value );
if ( !$value ) { if ( !$value ) {
Error( "Error parsing date/time '$temp_value', " Error( "Error parsing date/time '$temp_value', "
@ -277,21 +275,21 @@ sub Sql {
push( @value_list, $value ); push( @value_list, $value );
} # end foreach temp_value } # end foreach temp_value
} # end if has an attr } # end if has an attr
if ( $filter_expr->{terms}[$i]->{op} ) { if ( $term->{op} ) {
if ( $filter_expr->{terms}[$i]->{op} eq '=~' ) { if ( $term->{op} eq '=~' ) {
$self->{Sql} .= " regexp $value"; $self->{Sql} .= " regexp $value";
} elsif ( $filter_expr->{terms}[$i]->{op} eq '!~' ) { } elsif ( $term->{op} eq '!~' ) {
$self->{Sql} .= " not regexp $value"; $self->{Sql} .= " not regexp $value";
} elsif ( $filter_expr->{terms}[$i]->{op} eq '=[]' ) { } elsif ( $term->{op} eq '=[]' ) {
$self->{Sql} .= " in (".join( ",", @value_list ).")"; $self->{Sql} .= " in (".join( ",", @value_list ).")";
} elsif ( $filter_expr->{terms}[$i]->{op} eq '!~' ) { } elsif ( $term->{op} eq '!~' ) {
$self->{Sql} .= " not in (".join( ",", @value_list ).")"; $self->{Sql} .= " not in (".join( ",", @value_list ).")";
} else { } else {
$self->{Sql} .= " ".$filter_expr->{terms}[$i]->{op}." $value"; $self->{Sql} .= " ".$term->{op}." $value";
} }
} # end if has an operator } # end if has an operator
if ( exists($filter_expr->{terms}[$i]->{cbr}) ) { if ( exists($term->{cbr}) ) {
$self->{Sql} .= " ".str_repeat( ")", $filter_expr->{terms}[$i]->{cbr} )." "; $self->{Sql} .= " ".str_repeat( ")", $term->{cbr} )." ";
} }
} # end foreach term } # end foreach term
} # end if terms } # end if terms
@ -308,22 +306,22 @@ sub Sql {
} }
my @auto_terms; my @auto_terms;
if ( $self->{AutoArchive} ) { if ( $self->{AutoArchive} ) {
push( @auto_terms, "E.Archived = 0" ) push @auto_terms, "E.Archived = 0";
} }
if ( $self->{AutoVideo} ) { if ( $self->{AutoVideo} ) {
push( @auto_terms, "E.Videoed = 0" ) push @auto_terms, "E.Videoed = 0";
} }
if ( $self->{AutoUpload} ) { if ( $self->{AutoUpload} ) {
push( @auto_terms, "E.Uploaded = 0" ) push @auto_terms, "E.Uploaded = 0";
} }
if ( $self->{AutoEmail} ) { if ( $self->{AutoEmail} ) {
push( @auto_terms, "E.Emailed = 0" ) push @auto_terms, "E.Emailed = 0";
} }
if ( $self->{AutoMessage} ) { if ( $self->{AutoMessage} ) {
push( @auto_terms, "E.Messaged = 0" ) push @auto_terms, "E.Messaged = 0";
} }
if ( $self->{AutoExecute} ) { if ( $self->{AutoExecute} ) {
push( @auto_terms, "E.Executed = 0" ) push @auto_terms, "E.Executed = 0";
} }
if ( @auto_terms ) { if ( @auto_terms ) {
$sql .= " and ( ".join( " or ", @auto_terms )." )"; $sql .= " and ( ".join( " or ", @auto_terms )." )";

View File

@ -1768,7 +1768,7 @@ const Coord Image::centreCoord( const char *text ) const
line = text+index; line = text+index;
line_no++; line_no++;
} }
int x = (width - (max_line_len * CHAR_WIDTH) ) / 2; int x = (width - (max_line_len * ZM_CHAR_WIDTH) ) / 2;
int y = (height - (line_no * LINE_HEIGHT) ) / 2; int y = (height - (line_no * LINE_HEIGHT) ) / 2;
return( Coord( x, y ) ); return( Coord( x, y ) );
} }
@ -1858,7 +1858,7 @@ void Image::Annotate( const char *p_text, const Coord &coord, const unsigned int
while ( (index < text_len) && (line_len = strcspn( line, "\n" )) ) while ( (index < text_len) && (line_len = strcspn( line, "\n" )) )
{ {
unsigned int line_width = line_len * CHAR_WIDTH * size; unsigned int line_width = line_len * ZM_CHAR_WIDTH * size;
unsigned int lo_line_x = coord.X(); unsigned int lo_line_x = coord.X();
unsigned int lo_line_y = coord.Y() + (line_no * LINE_HEIGHT * size); unsigned int lo_line_y = coord.Y() + (line_no * LINE_HEIGHT * size);
@ -1889,17 +1889,17 @@ void Image::Annotate( const char *p_text, const Coord &coord, const unsigned int
if ( colours == ZM_COLOUR_GRAY8 ) if ( colours == ZM_COLOUR_GRAY8 )
{ {
unsigned char *ptr = &buffer[(lo_line_y*width)+lo_line_x]; unsigned char *ptr = &buffer[(lo_line_y*width)+lo_line_x];
for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < (CHAR_HEIGHT * size); y++, r++, ptr += width ) for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < (ZM_CHAR_HEIGHT * size); y++, r++, ptr += width )
{ {
unsigned char *temp_ptr = ptr; unsigned char *temp_ptr = ptr;
for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ ) for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
{ {
int f; int f;
if (size == 2) if (size == 2)
f = bigfontdata[(line[c] * CHAR_HEIGHT * size) + r]; f = bigfontdata[(line[c] * ZM_CHAR_HEIGHT * size) + r];
else else
f = fontdata[(line[c] * CHAR_HEIGHT) + r]; f = fontdata[(line[c] * ZM_CHAR_HEIGHT) + r];
for ( unsigned int i = 0; i < (CHAR_WIDTH * size) && x < hi_line_x; i++, x++, temp_ptr++ ) for ( unsigned int i = 0; i < (ZM_CHAR_WIDTH * size) && x < hi_line_x; i++, x++, temp_ptr++ )
{ {
if ( f & (zm_text_bitmask >> i) ) if ( f & (zm_text_bitmask >> i) )
{ {
@ -1919,17 +1919,17 @@ void Image::Annotate( const char *p_text, const Coord &coord, const unsigned int
unsigned int wc = width * colours; unsigned int wc = width * colours;
unsigned char *ptr = &buffer[((lo_line_y*width)+lo_line_x)*colours]; unsigned char *ptr = &buffer[((lo_line_y*width)+lo_line_x)*colours];
for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < (CHAR_HEIGHT * size); y++, r++, ptr += wc ) for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < (ZM_CHAR_HEIGHT * size); y++, r++, ptr += wc )
{ {
unsigned char *temp_ptr = ptr; unsigned char *temp_ptr = ptr;
for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ ) for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
{ {
int f; int f;
if (size == 2) if (size == 2)
f = bigfontdata[(line[c] * CHAR_HEIGHT * size) + r]; f = bigfontdata[(line[c] * ZM_CHAR_HEIGHT * size) + r];
else else
f = fontdata[(line[c] * CHAR_HEIGHT) + r]; f = fontdata[(line[c] * ZM_CHAR_HEIGHT) + r];
for ( unsigned int i = 0; i < (CHAR_WIDTH * size) && x < hi_line_x; i++, x++, temp_ptr += colours ) for ( unsigned int i = 0; i < (ZM_CHAR_WIDTH * size) && x < hi_line_x; i++, x++, temp_ptr += colours )
{ {
if ( f & (zm_text_bitmask >> i) ) if ( f & (zm_text_bitmask >> i) )
{ {
@ -1955,17 +1955,17 @@ void Image::Annotate( const char *p_text, const Coord &coord, const unsigned int
unsigned int wc = width * colours; unsigned int wc = width * colours;
uint8_t *ptr = &buffer[((lo_line_y*width)+lo_line_x)<<2]; uint8_t *ptr = &buffer[((lo_line_y*width)+lo_line_x)<<2];
for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < (CHAR_HEIGHT * size); y++, r++, ptr += wc ) for ( unsigned int y = lo_line_y, r = 0; y < hi_line_y && r < (ZM_CHAR_HEIGHT * size); y++, r++, ptr += wc )
{ {
Rgb* temp_ptr = (Rgb*)ptr; Rgb* temp_ptr = (Rgb*)ptr;
for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ ) for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
{ {
int f; int f;
if (size == 2) if (size == 2)
f = bigfontdata[(line[c] * CHAR_HEIGHT * size) + r]; f = bigfontdata[(line[c] * ZM_CHAR_HEIGHT * size) + r];
else else
f = fontdata[(line[c] * CHAR_HEIGHT) + r]; f = fontdata[(line[c] * ZM_CHAR_HEIGHT) + r];
for ( unsigned int i = 0; i < (CHAR_WIDTH * size) && x < hi_line_x; i++, x++, temp_ptr++ ) for ( unsigned int i = 0; i < (ZM_CHAR_WIDTH * size) && x < hi_line_x; i++, x++, temp_ptr++ )
{ {
if ( f & (zm_text_bitmask >> i) ) if ( f & (zm_text_bitmask >> i) )
{ {

View File

@ -122,8 +122,8 @@ protected:
} }
public: public:
enum { CHAR_HEIGHT=11, CHAR_WIDTH=6 }; enum { ZM_CHAR_HEIGHT=11, ZM_CHAR_WIDTH=6 };
enum { LINE_HEIGHT=CHAR_HEIGHT+0 }; enum { LINE_HEIGHT=ZM_CHAR_HEIGHT+0 };
protected: protected:
static bool initialised; static bool initialised;

View File

@ -990,12 +990,14 @@ int Zone::Load( Monitor *monitor, Zone **&zones )
Polygon polygon; Polygon polygon;
if ( !ParsePolygonString( Coords, polygon ) ) { if ( !ParsePolygonString( Coords, polygon ) ) {
Error( "Unable to parse polygon string '%s' for zone %d/%s for monitor %s, ignoring", Coords, Id, Name, monitor->Name() ); Error( "Unable to parse polygon string '%s' for zone %d/%s for monitor %s, ignoring", Coords, Id, Name, monitor->Name() );
n_zones -= 1;
continue; continue;
} }
if ( polygon.LoX() < 0 || polygon.HiX() >= (int)monitor->Width() if ( polygon.LoX() < 0 || polygon.HiX() >= (int)monitor->Width()
|| polygon.LoY() < 0 || polygon.HiY() >= (int)monitor->Height() ) { || polygon.LoY() < 0 || polygon.HiY() >= (int)monitor->Height() ) {
Error( "Zone %d/%s for monitor %s extends outside of image dimensions, (%d,%d), (%d,%d), ignoring", Id, Name, monitor->Name(), polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY() ); Error( "Zone %d/%s for monitor %s extends outside of image dimensions, (%d,%d), (%d,%d), ignoring", Id, Name, monitor->Name(), polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY() );
n_zones -= 1;
continue; continue;
} }

View File

@ -91,7 +91,7 @@ class AppController extends Controller {
if( ! $this->Session->Read('user.Username') ) { if( ! $this->Session->Read('user.Username') ) {
throw new UnauthorizedException(__('Not Authenticated')); throw new UnauthorizedException(__('Not Authenticated'));
return; return;
} else if ( ! $this->Session->Read('user.Username') ) { } else if ( ! $this->Session->Read('user.Enabled') ) {
throw new UnauthorizedException(__('User is not enabled')); throw new UnauthorizedException(__('User is not enabled'));
return; return;
} }

View File

@ -835,9 +835,9 @@ function packageControl( $command ) {
function daemonControl( $command, $daemon=false, $args=false ) { function daemonControl( $command, $daemon=false, $args=false ) {
$string = ZM_PATH_BIN."/zmdc.pl $command"; $string = ZM_PATH_BIN."/zmdc.pl $command";
if ( $daemon ) { if ( $daemon ) {
$string .= " $daemon"; $string .= escapeshellarg(" $daemon");
if ( $args ) { if ( $args ) {
$string .= " $args"; $string .= escapeshellarg(" $args");
} }
} }
$string .= " 2>/dev/null >&- <&- >/dev/null"; $string .= " 2>/dev/null >&- <&- >/dev/null";
@ -947,9 +947,9 @@ function zmaStatus( $monitor ) {
function daemonCheck( $daemon=false, $args=false ) { function daemonCheck( $daemon=false, $args=false ) {
$string = ZM_PATH_BIN."/zmdc.pl check"; $string = ZM_PATH_BIN."/zmdc.pl check";
if ( $daemon ) { if ( $daemon ) {
$string .= " $daemon"; $string .= escapeshellarg(" $daemon");
if ( $args ) if ( $args )
$string .= " $args"; $string .= escapeshellarg(" $args");
} }
$result = exec( $string ); $result = exec( $string );
return( preg_match( '/running/', $result ) ); return( preg_match( '/running/', $result ) );
@ -1232,6 +1232,9 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&amp;' ) {
case 'MonitorName': case 'MonitorName':
$filter['sql'] .= 'M.'.preg_replace( '/^Monitor/', '', $filter['terms'][$i]['attr'] ); $filter['sql'] .= 'M.'.preg_replace( '/^Monitor/', '', $filter['terms'][$i]['attr'] );
break; break;
case 'ServerId':
$filter['sql'] .= 'M.ServerId';
break;
case 'DateTime': case 'DateTime':
$filter['sql'] .= "E.StartTime"; $filter['sql'] .= "E.StartTime";
break; break;
@ -1277,6 +1280,13 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&amp;' ) {
case 'Notes': case 'Notes':
$value = dbEscape($value); $value = dbEscape($value);
break; break;
case 'ServerId':
if ( $value == 'ZM_SERVER_ID' ) {
$value = ZM_SERVER_ID;
} else {
$value = dbEscape($value);
}
break;
case 'DateTime': case 'DateTime':
$value = "'".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."'"; $value = "'".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."'";
break; break;
@ -1461,7 +1471,7 @@ function getDiskPercent($path = ZM_DIR_EVENTS) {
} }
function getDiskBlocks() { function getDiskBlocks() {
$df = shell_exec( 'df '.ZM_DIR_EVENTS ); $df = shell_exec( 'df '.escapeshellarg(ZM_DIR_EVENTS) );
$space = -1; $space = -1;
if ( preg_match( '/\s(\d+)\s+\d+\s+\d+%/ms', $df, $matches ) ) if ( preg_match( '/\s(\d+)\s+\d+\s+\d+%/ms', $df, $matches ) )
$space = $matches[1]; $space = $matches[1];

View File

@ -125,8 +125,7 @@ $SLANG = array(
'AttrMaxScore' => 'Max. Score', 'AttrMaxScore' => 'Max. Score',
'AttrMonitorId' => 'Monitor Id', 'AttrMonitorId' => 'Monitor Id',
'AttrMonitorName' => 'Monitor Name', 'AttrMonitorName' => 'Monitor Name',
'AttrServerId' => 'Server Id', 'AttrServer' => 'Server',
'AttrServerName' => 'Server Name',
'AttrName' => 'Name', 'AttrName' => 'Name',
'AttrNotes' => 'Notes', 'AttrNotes' => 'Notes',
'AttrSystemLoad' => 'System Load', 'AttrSystemLoad' => 'System Load',
@ -616,6 +615,7 @@ $SLANG = array(
'Rewind' => 'Rewind', 'Rewind' => 'Rewind',
'RotateLeft' => 'Rotate Left', 'RotateLeft' => 'Rotate Left',
'RotateRight' => 'Rotate Right', 'RotateRight' => 'Rotate Right',
'RTSPTransport' => 'RTSP Transport Protocol',
'RunLocalUpdate' => 'Please run zmupdate.pl to update', 'RunLocalUpdate' => 'Please run zmupdate.pl to update',
'RunMode' => 'Run Mode', 'RunMode' => 'Run Mode',
'Running' => 'Running', 'Running' => 'Running',
@ -907,6 +907,13 @@ $OLANG = array(
"\"reorder_queue_size=nnn\" Set number of packets to buffer for handling of reordered packets~~~~". "\"reorder_queue_size=nnn\" Set number of packets to buffer for handling of reordered packets~~~~".
"\"loglevel=debug\" Set verbosity of FFmpeg (quiet, panic, fatal, error, warning, info, verbose, debug)" "\"loglevel=debug\" Set verbosity of FFmpeg (quiet, panic, fatal, error, warning, info, verbose, debug)"
), ),
'OPTIONS_RTSPTrans' => array(
'Help' => "This sets the RTSP Transport Protocol for FFmpeg.~~ ".
"TCP - Use TCP (interleaving within the RTSP control channel) as transport protocol.~~".
"UDP - Use UDP as transport protocol. Higher resolution cameras have experienced some 'smearing' while using UDP, if so try TCP~~".
"UDP Multicast - Use UDP Multicast as transport protocol~~".
"HTTP - Use HTTP tunneling as transport protocol, which is useful for passing proxies.~~"
),
'OPTIONS_LIBVLC' => array( 'OPTIONS_LIBVLC' => array(
'Help' => "Parameters in this field are passed on to libVLC. Multiple parameters can be separated by ,~~ ". 'Help' => "Parameters in this field are passed on to libVLC. Multiple parameters can be separated by ,~~ ".
"Examples (do not enter quotes)~~~~". "Examples (do not enter quotes)~~~~".

View File

@ -24,7 +24,7 @@
// Javascript window sizes // Javascript window sizes
var popupSizes = { var popupSizes = {
'bandwidth': { 'width': 300, 'height': 120 }, 'bandwidth': { 'width': 300, 'height': 140 },
'console': { 'width': 750, 'height': 312 }, 'console': { 'width': 750, 'height': 312 },
'control': { 'width': 380, 'height': 480 }, 'control': { 'width': 380, 'height': 480 },
'controlcaps': { 'width': 780, 'height': 320 }, 'controlcaps': { 'width': 780, 'height': 320 },
@ -49,20 +49,20 @@ var popupSizes = {
'login': { 'width': 720, 'height': 480 }, 'login': { 'width': 720, 'height': 480 },
'logout': { 'width': 260, 'height': 150 }, 'logout': { 'width': 260, 'height': 150 },
'monitor': { 'width': 550, 'height': 700 }, 'monitor': { 'width': 550, 'height': 700 },
'monitorpreset':{ 'width': 440, 'height': 200 }, 'monitorpreset':{ 'width': 440, 'height': 210 },
'monitorprobe': { 'width': 500, 'height': 240 }, 'monitorprobe': { 'width': 500, 'height': 275 },
'monitorselect':{ 'width': 160, 'height': 200 }, 'monitorselect':{ 'width': 160, 'height': 200 },
'montage': { 'width': -1, 'height': -1 }, 'montage': { 'width': -1, 'height': -1 },
'onvifprobe': { 'width': 500, 'height': 300 }, 'onvifprobe': { 'width': 500, 'height': 300 },
'optionhelp': { 'width': 400, 'height': 320 }, 'optionhelp': { 'width': 400, 'height': 320 },
'options': { 'width': 1000, 'height': 660 }, 'options': { 'width': 1000, 'height': 660 },
'preset': { 'width': 300, 'height': 120 }, 'preset': { 'width': 300, 'height': 120 },
'settings': { 'width': 220, 'height': 225 }, 'settings': { 'width': 220, 'height': 235 },
'state': { 'width': 400, 'height': 170 }, 'state': { 'width': 400, 'height': 170 },
'stats': { 'width': 840, 'height': 200 }, 'stats': { 'width': 840, 'height': 200 },
'timeline': { 'width': 760, 'height': 540 }, 'timeline': { 'width': 760, 'height': 540 },
'user': { 'width': 360, 'height': 420 }, 'user': { 'width': 360, 'height': 420 },
'version': { 'width': 360, 'height': 140 }, 'version': { 'width': 360, 'height': 185 },
'video': { 'width': 420, 'height': 360 }, 'video': { 'width': 420, 'height': 360 },
'videoview': { 'addWidth': 48, 'addHeight': 80 }, 'videoview': { 'addWidth': 48, 'addHeight': 80 },
'watch': { 'addWidth': 96, 'minWidth': 420, 'addHeight': 384 }, 'watch': { 'addWidth': 96, 'minWidth': 420, 'addHeight': 384 },

View File

@ -97,8 +97,7 @@ $attrTypes = array(
'DiskPercent' => translate('AttrDiskPercent'), 'DiskPercent' => translate('AttrDiskPercent'),
'DiskBlocks' => translate('AttrDiskBlocks'), 'DiskBlocks' => translate('AttrDiskBlocks'),
'SystemLoad' => translate('AttrSystemLoad'), 'SystemLoad' => translate('AttrSystemLoad'),
'ServerId' => translate('AttrServerId'), 'ServerId' => translate('AttrServer'),
'ServerName' => translate('AttrServerName'),
); );
$opTypes = array( $opTypes = array(
'=' => translate('OpEq'), '=' => translate('OpEq'),
@ -239,6 +238,18 @@ for ( $i = 0; isset($_REQUEST['filter']) && $i < count($_REQUEST['filter']['term
?> ?>
<td><?php echo buildSelect( "filter[terms][$i][op]", $opTypes ); ?></td> <td><?php echo buildSelect( "filter[terms][$i][op]", $opTypes ); ?></td>
<td><?php echo buildSelect( "filter[terms][$i][val]", $monitors ); ?></td> <td><?php echo buildSelect( "filter[terms][$i][val]", $monitors ); ?></td>
<?php
}
elseif ( $_REQUEST['filter']['terms'][$i]['attr'] == "ServerId" )
{
$servers = array();
$servers['ZM_SERVER_ID'] = 'Current Server';
foreach ( dbFetchAll( "SELECT Id,Name FROM Servers ORDER BY lower(Name) ASC" ) as $server ) {
$servers[$server['Id']] = $server['Name'];
}
?>
<td><?php echo buildSelect( "filter[terms][$i][op]", $opTypes ); ?></td>
<td><?php echo buildSelect( "filter[terms][$i][val]", $servers ); ?></td>
<?php <?php
} }
else else

View File

@ -13,8 +13,10 @@
{ {
// Append '?(GET query)' to URL if the GET query is not empty. // Append '?(GET query)' to URL if the GET query is not empty.
var querySuffix = "<?php var querySuffix = "<?php
if (!empty($_POST["postLoginQuery"])) if (!empty($_POST["postLoginQuery"])) {
echo "?".$_POST["postLoginQuery"]; parse_str($_POST["postLoginQuery"], $queryParams);
echo "?" . http_build_query($queryParams);
}
?>"; ?>";
var newUrl = thisUrl + querySuffix; var newUrl = thisUrl + querySuffix;

View File

@ -6,7 +6,7 @@ xhtmlHeaders(__FILE__, translate('Login') );
<form class="center-block" name="loginForm" id="loginForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> <form class="center-block" name="loginForm" id="loginForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="action" value="login"/> <input type="hidden" name="action" value="login"/>
<input type="hidden" name="view" value="postlogin"/> <input type="hidden" name="view" value="postlogin"/>
<input type="hidden" name="postLoginQuery" value="<?php echo $_SERVER['QUERY_STRING'] ?>"> <input type="hidden" name="postLoginQuery" value="<?php echo htmlspecialchars($_SERVER['QUERY_STRING']) ?>">
<div id="loginError" class="hidden alarm" role="alert"> <div id="loginError" class="hidden alarm" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>

View File

@ -247,6 +247,13 @@ $rtspMethods = array(
"rtpRtspHttp" => "RTP/RTSP/HTTP" "rtpRtspHttp" => "RTP/RTSP/HTTP"
); );
$rtspFFMpegMethods = array(
"rtpRtsp" => "TCP",
"rtpUni" => "UDP",
"rtpMulti" => "UDP Multicast",
"rtpRtspHttp" => "HTTP Tunnel"
);
$httpMethods = array( $httpMethods = array(
"simple" => "Simple", "simple" => "Simple",
"regexp" => "Regexp", "regexp" => "Regexp",
@ -886,7 +893,7 @@ switch ( $tab )
{ {
?> ?>
<tr><td><?php echo translate('SourcePath') ?></td><td><input type="text" name="newMonitor[Path]" value="<?php echo validHtmlStr($newMonitor['Path']) ?>" size="36"/></td></tr> <tr><td><?php echo translate('SourcePath') ?></td><td><input type="text" name="newMonitor[Path]" value="<?php echo validHtmlStr($newMonitor['Path']) ?>" size="36"/></td></tr>
<tr><td><?php echo translate('RemoteMethod') ?></td><td><?php echo buildSelect( "newMonitor[Method]", $rtspMethods ); ?></td></tr> <tr><td><?php echo translate('RemoteMethod') ?>&nbsp;(<?php echo makePopupLink('?view=optionhelp&amp;option=OPTIONS_RTSPTrans', 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td><td><?php echo buildSelect( "newMonitor[Method]", $rtspFFMpegMethods ); ?></td></tr>
<tr><td><?php echo translate('Options') ?>&nbsp;(<?php echo makePopupLink( '?view=optionhelp&amp;option=OPTIONS_'.strtoupper($newMonitor['Type']), 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td><td><input type="text" name="newMonitor[Options]" value="<?php echo validHtmlStr($newMonitor['Options']) ?>" size="36"/></td></tr> <tr><td><?php echo translate('Options') ?>&nbsp;(<?php echo makePopupLink( '?view=optionhelp&amp;option=OPTIONS_'.strtoupper($newMonitor['Type']), 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td><td><input type="text" name="newMonitor[Options]" value="<?php echo validHtmlStr($newMonitor['Options']) ?>" size="36"/></td></tr>
<?php <?php
} }