Merge pull request #1666 from connortechnology/fix_whitespace

tabs to spaces
This commit is contained in:
Kyle Johnson 2016-11-04 12:55:14 -06:00 committed by GitHub
commit ae0afaed0c
11 changed files with 6175 additions and 6175 deletions

View File

@ -58,7 +58,7 @@ ZoneMinder::Base - Base perl module for ZoneMinder
=head1 SYNOPSIS =head1 SYNOPSIS
use ZoneMinder::Base; use ZoneMinder::Base;
=head1 DESCRIPTION =head1 DESCRIPTION

View File

@ -53,7 +53,7 @@ our %EXPORT_TAGS = (
constants => [ qw( constants => [ qw(
ZM_PID ZM_PID
) ] ) ]
); );
push( @{$EXPORT_TAGS{config}}, @EXPORT_CONFIG ); push( @{$EXPORT_TAGS{config}}, @EXPORT_CONFIG );
push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS; push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS;
@ -119,7 +119,7 @@ BEGIN
$Config{$config->{Name}} = $config->{Value}; $Config{$config->{Name}} = $config->{Value};
} }
$sth->finish(); $sth->finish();
#$dbh->disconnect(); #$dbh->disconnect();
if ( ! exists $Config{ZM_SERVER_ID} ) { if ( ! exists $Config{ZM_SERVER_ID} ) {
$Config{ZM_SERVER_ID} = undef; $Config{ZM_SERVER_ID} = undef;
$sth = $dbh->prepare_cached( 'SELECT * FROM Servers WHERE Name=?' ); $sth = $dbh->prepare_cached( 'SELECT * FROM Servers WHERE Name=?' );
@ -315,7 +315,7 @@ Copyright (C) 2001-2008 Philip Coombes
This library is free software; you can redistribute it and/or modify This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.3 or, it under the same terms as Perl itself, either Perl version 5.8.3 or,
at your option, any later version of Perl 5 you may have available. at your option, any later version of Perl 5 you may have available.
=cut =cut

View File

@ -41,12 +41,12 @@ our @ISA = qw(Exporter ZoneMinder::Base);
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory. # will save memory.
our %EXPORT_TAGS = ( our %EXPORT_TAGS = (
'data' => [ qw( data => [ qw(
%types %types
@options @options
%options_hash %options_hash
) ] ) ]
); );
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{'data'} } ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'data'} } );
@ -74,103 +74,103 @@ sub INIT
our %types = our %types =
( (
string => { string => {
db_type =>"string", db_type => "string",
hint =>"string", hint => "string",
pattern =>qr|^(.+)$|, pattern => qr|^(.+)$|,
format =>q( $1 ) format => q( $1 )
}, },
alphanum => { alphanum => {
db_type =>"string", db_type => "string",
hint =>"alphanumeric", hint => "alphanumeric",
pattern =>qr|^([a-zA-Z0-9-_]+)$|, pattern => qr|^([a-zA-Z0-9-_]+)$|,
format =>q( $1 ) format => q( $1 )
}, },
text => { text => {
db_type =>"text", db_type => "text",
hint =>"free text", hint => "free text",
pattern =>qr|^(.+)$|, pattern => qr|^(.+)$|,
format =>q( $1 ) format => q( $1 )
}, },
boolean => { boolean => {
db_type =>"boolean", db_type => "boolean",
hint =>"yes|no", hint => "yes|no",
pattern =>qr|^([yn])|i, pattern => qr|^([yn])|i,
check =>q( $1 ), check => q( $1 ),
format =>q( ($1 =~ /^y/) format => q( ($1 =~ /^y/)
? "yes" ? "yes"
: "no" : "no"
) )
}, },
integer => { integer => {
db_type =>"integer", db_type => "integer",
hint =>"integer", hint => "integer",
pattern =>qr|^(\d+)$|, pattern => qr|^(\d+)$|,
format =>q( $1 ) format => q( $1 )
}, },
decimal => { decimal => {
db_type =>"decimal", db_type => "decimal",
hint =>"decimal", hint => "decimal",
pattern =>qr|^(\d+(?:\.\d+)?)$|, pattern => qr|^(\d+(?:\.\d+)?)$|,
format =>q( $1 ) format => q( $1 )
}, },
hexadecimal => { hexadecimal => {
db_type =>"hexadecimal", db_type => "hexadecimal",
hint =>"hexadecimal", hint => "hexadecimal",
pattern =>qr|^(?:0x)?([0-9a-f]{1,8})$|, pattern => qr|^(?:0x)?([0-9a-f]{1,8})$|,
format =>q( "0x".$1 ) format => q( "0x".$1 )
}, },
tristate => { tristate => {
db_type =>"string", db_type => "string",
hint =>"auto|yes|no", hint => "auto|yes|no",
pattern =>qr|^([ayn])|i, check=>q( $1 ), pattern => qr|^([ayn])|i, check=>q( $1 ),
format =>q( ($1 =~ /^y/) format => q( ($1 =~ /^y/)
? "yes" ? "yes"
: ($1 =~ /^n/ ? "no" : "auto" ) : ($1 =~ /^n/ ? "no" : "auto" )
) )
}, },
abs_path => { abs_path => {
db_type =>"string", db_type => "string",
hint =>"/absolute/path/to/somewhere", hint => "/absolute/path/to/somewhere",
pattern =>qr|^((?:/[^/]*)+?)/?$|, pattern => qr|^((?:/[^/]*)+?)/?$|,
format =>q( $1 ) format => q( $1 )
}, },
rel_path => { rel_path => {
db_type =>"string", db_type => "string",
hint =>"relative/path/to/somewhere", hint => "relative/path/to/somewhere",
pattern =>qr|^((?:[^/].*)?)/?$|, pattern => qr|^((?:[^/].*)?)/?$|,
format =>q( $1 ) format => q( $1 )
}, },
directory => { directory => {
db_type =>"string", db_type => "string",
hint =>"directory", hint => "directory",
pattern =>qr|^([a-zA-Z0-9-_.]+)$|, pattern => qr|^([a-zA-Z0-9-_.]+)$|,
format =>q( $1 ) format => q( $1 )
}, },
file => { file => {
db_type =>"string", db_type => "string",
hint =>"filename", hint => "filename",
pattern =>qr|^([a-zA-Z0-9-_.]+)$|, pattern => qr|^([a-zA-Z0-9-_.]+)$|,
format =>q( $1 ) format => q( $1 )
}, },
hostname => { hostname => {
db_type =>"string", db_type => "string",
hint =>"host.your.domain", hint => "host.your.domain",
pattern =>qr|^([a-zA-Z0-9_.-]+)$|, pattern => qr|^([a-zA-Z0-9_.-]+)$|,
format =>q( $1 ) format => q( $1 )
}, },
url => { url => {
db_type =>"string", db_type => "string",
hint =>"http://host.your.domain/", hint => "http://host.your.domain/",
pattern =>qr|^(?:http://)?(.+)$|, pattern => qr|^(?:http://)?(.+)$|,
format =>q( "http://".$1 ) format => q( "http://".$1 )
}, },
email => { email => {
db_type =>"string", db_type => "string",
hint =>"your.name\@your.domain", hint => "your.name\@your.domain",
pattern =>qr|^([a-zA-Z0-9_.-]+)\@([a-zA-Z0-9_.-]+)$|, pattern => qr|^([a-zA-Z0-9_.-]+)\@([a-zA-Z0-9_.-]+)$|,
format =>q( $1\@$2 ) format => q( $1\@$2 )
}, },
); );
sub qqq { ## Un-pad paragraph of text. sub qqq { ## Un-pad paragraph of text.
local $_ = shift; local $_ = shift;
@ -255,10 +255,10 @@ our @options =
"), "),
requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" } ], requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" } ],
type => { type => {
db_type =>"string", db_type => "string",
hint =>"builtin|remote", hint => "builtin|remote",
pattern =>qr|^([br])|i, pattern => qr|^([br])|i,
format =>q( $1 =~ /^b/ ? "builtin" : "remote" ) format => q( $1 =~ /^b/ ? "builtin" : "remote" )
}, },
category => "system", category => "system",
}, },
@ -280,10 +280,10 @@ our @options =
"), "),
requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" } ], requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" } ],
type => { type => {
db_type =>"string", db_type => "string",
hint =>"hashed|plain|none", hint => "hashed|plain|none",
pattern =>qr|^([hpn])|i, pattern => qr|^([hpn])|i,
format =>q( ($1 =~ /^h/) format => q( ($1 =~ /^h/)
? "hashed" ? "hashed"
: ($1 =~ /^p/ ? "plain" : "none" ) : ($1 =~ /^p/ ? "plain" : "none" )
) )
@ -373,7 +373,7 @@ our @options =
type => $types{boolean}, type => $types{boolean},
category => "system", category => "system",
}, },
# PP - Google reCaptcha settings # PP - Google reCaptcha settings
{ {
name => "ZM_OPT_USE_GOOG_RECAPTCHA", name => "ZM_OPT_USE_GOOG_RECAPTCHA",
default => "no", default => "no",
@ -392,7 +392,7 @@ our @options =
requires => [ requires => [
{name=>"ZM_OPT_USE_AUTH", value=>"yes"} {name=>"ZM_OPT_USE_AUTH", value=>"yes"}
], ],
type => $types {boolean}, type => $types{boolean},
category => "system", category => "system",
}, },
@ -408,7 +408,7 @@ our @options =
requires => [ requires => [
{name=>"ZM_OPT_USE_GOOG_RECAPTCHA", value=>"yes"} {name=>"ZM_OPT_USE_GOOG_RECAPTCHA", value=>"yes"}
], ],
type => $types {string}, type => $types{string},
category => "system", category => "system",
}, },
{ {
@ -423,7 +423,7 @@ our @options =
requires => [ requires => [
{name=>"ZM_OPT_USE_GOOG_RECAPTCHA", value=>"yes"} {name=>"ZM_OPT_USE_GOOG_RECAPTCHA", value=>"yes"}
], ],
type => $types {string}, type => $types{string},
category => "system", category => "system",
}, },
@ -895,10 +895,10 @@ our @options =
HTTP/1.0 if necessary to resolve particular issues. HTTP/1.0 if necessary to resolve particular issues.
"), "),
type => { type => {
db_type =>"string", db_type => "string",
hint =>"1.1|1.0", hint => "1.1|1.0",
pattern =>qr|^(1\.[01])$|, pattern => qr|^(1\.[01])$|,
format =>q( $1?$1:"" ) format => q( $1?$1:"" )
}, },
category => "network", category => "network",
}, },
@ -1077,10 +1077,10 @@ our @options =
you will also need to set a level and component below you will also need to set a level and component below
"), "),
type => { type => {
db_type =>"integer", db_type => "integer",
hint =>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", hint => "None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1",
pattern =>qr|^(\d+)$|, pattern => qr|^(\d+)$|,
format =>q( $1 ) format => q( $1 )
}, },
category => "logging", category => "logging",
}, },
@ -1107,10 +1107,10 @@ our @options =
and component below and component below
"), "),
type => { type => {
db_type =>"integer", db_type => "integer",
hint =>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", hint => "None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1",
pattern =>qr|^(\d+)$|, pattern => qr|^(\d+)$|,
format =>q( $1 ) format => q( $1 )
}, },
category => "logging", category => "logging",
}, },
@ -1134,10 +1134,10 @@ our @options =
you will also need to set a level and component below you will also need to set a level and component below
"), "),
type => { type => {
db_type =>"integer", db_type => "integer",
hint =>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", hint => "None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1",
pattern =>qr|^(\d+)$|, pattern => qr|^(\d+)$|,
format =>q( $1 ) format => q( $1 )
}, },
category => "logging", category => "logging",
}, },
@ -1165,10 +1165,10 @@ our @options =
also need to set a level and component below also need to set a level and component below
"), "),
type => { type => {
db_type =>"integer", db_type => "integer",
hint =>"None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1", hint => "None=-5|Panic=-4|Fatal=-3|Error=-2|Warning=-1|Info=0|Debug=1",
pattern =>qr|^(\d+)$|, pattern => qr|^(\d+)$|,
format =>q( $1 ) format => q( $1 )
}, },
category => "logging", category => "logging",
}, },
@ -1248,10 +1248,10 @@ our @options =
"), "),
requires => [ { name => "ZM_LOG_DEBUG", value => "yes" } ], requires => [ { name => "ZM_LOG_DEBUG", value => "yes" } ],
type => { type => {
db_type =>"integer", db_type => "integer",
hint =>"1|2|3|4|5|6|7|8|9", hint => "1|2|3|4|5|6|7|8|9",
pattern =>qr|^(\d+)$|, pattern => qr|^(\d+)$|,
format =>q( $1 ) format => q( $1 )
}, },
category => "logging", category => "logging",
}, },
@ -2211,12 +2211,12 @@ our @options =
{ {
name => "ZM_EMAIL_TEXT", name => "ZM_EMAIL_TEXT",
default => 'subject = "ZoneMinder: Alarm - %MN%-%EI% (%ESM% - %ESA% %EFA%)" default => 'subject = "ZoneMinder: Alarm - %MN%-%EI% (%ESM% - %ESA% %EFA%)"
body = " body = "
Hello, Hello,
An alarm has been detected on your installation of the ZoneMinder. An alarm has been detected on your installation of the ZoneMinder.
The details are as follows :- The details are as follows :-
Monitor : %MN% Monitor : %MN%
Event Id : %EI% Event Id : %EI%
@ -2224,9 +2224,9 @@ The details are as follows :-
Frames : %EF% (%EFA%) Frames : %EF% (%EFA%)
Scores : t%EST% m%ESM% a%ESA% Scores : t%EST% m%ESM% a%ESA%
This alarm was matched by the %FN% filter and can be viewed at %EPS% This alarm was matched by the %FN% filter and can be viewed at %EPS%
ZoneMinder"', ZoneMinder"',
description => "The text of the email used to send matching event details", description => "The text of the email used to send matching event details",
requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ], requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ],
help => qqq(" help => qqq("
@ -2251,11 +2251,11 @@ ZoneMinder"',
{ {
name => "ZM_EMAIL_BODY", name => "ZM_EMAIL_BODY",
default => " default => "
Hello, Hello,
An alarm has been detected on your installation of the ZoneMinder. An alarm has been detected on your installation of the ZoneMinder.
The details are as follows :- The details are as follows :-
Monitor : %MN% Monitor : %MN%
Event Id : %EI% Event Id : %EI%
@ -2263,9 +2263,9 @@ The details are as follows :-
Frames : %EF% (%EFA%) Frames : %EF% (%EFA%)
Scores : t%EST% m%ESM% a%ESA% Scores : t%EST% m%ESM% a%ESA%
This alarm was matched by the %FN% filter and can be viewed at %EPS% This alarm was matched by the %FN% filter and can be viewed at %EPS%
ZoneMinder", ZoneMinder",
description => "The body of the email used to send matching event details", description => "The body of the email used to send matching event details",
requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ], requires => [ { name => "ZM_OPT_EMAIL", value => "yes" } ],
help => qqq(" help => qqq("
@ -2309,7 +2309,7 @@ ZoneMinder",
{ {
name => "ZM_MESSAGE_TEXT", name => "ZM_MESSAGE_TEXT",
default => 'subject = "ZoneMinder: Alarm - %MN%-%EI%" default => 'subject = "ZoneMinder: Alarm - %MN%-%EI%"
body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% score."', body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% score."',
description => "The text of the message used to send matching event details", description => "The text of the message used to send matching event details",
requires => [ { name => "ZM_OPT_MESSAGE", value => "yes" } ], requires => [ { name => "ZM_OPT_MESSAGE", value => "yes" } ],
help => qqq(" help => qqq("
@ -3896,7 +3896,7 @@ body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% s
type => $types{string}, type => $types{string},
category => "mail", category => "mail",
}, },
); );
our %options_hash = map { ( $_->{name}, $_ ) } @options; our %options_hash = map { ( $_->{name}, $_ ) } @options;
@ -3906,8 +3906,8 @@ sub initialiseConfig
{ {
return if ( $configInitialised ); return if ( $configInitialised );
# Do some initial data munging to finish the data structures # Do some initial data munging to finish the data structures
# Create option ids # Create option ids
my $option_id = 0; my $option_id = 0;
foreach my $option ( @options ) foreach my $option ( @options )
{ {
@ -3919,7 +3919,7 @@ sub initialiseConfig
{ {
$option->{value} = ''; $option->{value} = '';
} }
#next if ( $option->{category} eq 'hidden' ); #next if ( $option->{category} eq 'hidden' );
$option->{id} = $option_id++; $option->{id} = $option_id++;
} }
$configInitialised = 1; $configInitialised = 1;
@ -3934,11 +3934,11 @@ ZoneMinder::ConfigData - ZoneMinder Configuration Data module
=head1 SYNOPSIS =head1 SYNOPSIS
use ZoneMinder::ConfigData; use ZoneMinder::ConfigData;
use ZoneMinder::ConfigData qw(:all); use ZoneMinder::ConfigData qw(:all);
loadConfigFromDB(); loadConfigFromDB();
saveConfigToDB(); saveConfigToDB();
=head1 DESCRIPTION =head1 DESCRIPTION

View File

@ -104,7 +104,7 @@ sub loadMonitor
} }
if ( defined($self->{Monitor}->{AutoStopTimeout}) ) if ( defined($self->{Monitor}->{AutoStopTimeout}) )
{ {
# Convert to microseconds. # Convert to microseconds.
$self->{Monitor}->{AutoStopTimeout} = int(1000000*$self->{Monitor}->{AutoStopTimeout}); $self->{Monitor}->{AutoStopTimeout} = int(1000000*$self->{Monitor}->{AutoStopTimeout});
} }
} }
@ -138,10 +138,10 @@ sub executeCommand
my $command = $params->{command}; my $command = $params->{command};
delete $params->{command}; delete $params->{command};
#if ( !defined($self->{$command}) ) #if ( !defined($self->{$command}) )
#{ #{
#Fatal( "Unsupported command '$command'" ); #Fatal( "Unsupported command '$command'" );
#} #}
&{$self->{$command}}( $self, $params ); &{$self->{$command}}( $self, $params );
} }
@ -161,8 +161,8 @@ ZoneMinder::Database - Perl extension for blah blah blah
=head1 SYNOPSIS =head1 SYNOPSIS
use ZoneMinder::Database; use ZoneMinder::Database;
blah blah blah blah blah blah
=head1 DESCRIPTION =head1 DESCRIPTION

View File

@ -48,7 +48,7 @@ our %EXPORT_TAGS = (
zmDbGetMonitor zmDbGetMonitor
zmDbGetMonitorAndControl zmDbGetMonitorAndControl
) ] ) ]
); );
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'} } );
@ -217,8 +217,8 @@ ZoneMinder::Database - Perl extension for blah blah blah
=head1 SYNOPSIS =head1 SYNOPSIS
use ZoneMinder::Database; use ZoneMinder::Database;
blah blah blah blah blah blah
=head1 DESCRIPTION =head1 DESCRIPTION

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'} } );
@ -286,8 +286,8 @@ ZoneMinder::Database - Perl extension for blah blah blah
=head1 SYNOPSIS =head1 SYNOPSIS
use ZoneMinder::Event; use ZoneMinder::Event;
blah blah blah blah blah blah
=head1 DESCRIPTION =head1 DESCRIPTION

View File

@ -304,13 +304,13 @@ sub Sql {
{ {
if ( $self->{AutoMessage} ) if ( $self->{AutoMessage} )
{ {
# Include all events, including events that are still ongoing # Include all events, including events that are still ongoing
# and have no EndTime yet # and have no EndTime yet
$sql .= " and ( ".$self->{Sql}." )"; $sql .= " and ( ".$self->{Sql}." )";
} }
else else
{ {
# Only include closed events (events with valid EndTime) # Only include closed events (events with valid EndTime)
$sql .= " where not isnull(E.EndTime) and ( ".$self->{Sql}." )"; $sql .= " where not isnull(E.EndTime) and ( ".$self->{Sql}." )";
} }
} }
@ -482,8 +482,8 @@ ZoneMinder::Database - Perl extension for blah blah blah
=head1 SYNOPSIS =head1 SYNOPSIS
use ZoneMinder::Filter; use ZoneMinder::Filter;
blah blah blah blah blah blah
=head1 DESCRIPTION =head1 DESCRIPTION

View File

@ -54,7 +54,7 @@ our %EXPORT_TAGS = (
jsonEncode jsonEncode
jsonDecode jsonDecode
) ] ) ]
); );
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'} } );
@ -165,7 +165,7 @@ sub runCommand
{ {
if ( !$testedShellSyntax ) if ( !$testedShellSyntax )
{ {
# Determine the appropriate syntax for the su command # Determine the appropriate syntax for the su command
( $cmdPrefix, $cmdSuffix ) = getCmdFormat(); ( $cmdPrefix, $cmdSuffix ) = getCmdFormat();
$testedShellSyntax = !undef; $testedShellSyntax = !undef;
} }
@ -227,9 +227,9 @@ sub getEventPath
sub createEventPath sub createEventPath
{ {
# #
# WARNING assumes running from events directory # WARNING assumes running from events directory
# #
my $event = shift; my $event = shift;
my $eventRootPath = ($Config{ZM_DIR_EVENTS}=~m|/|) my $eventRootPath = ($Config{ZM_DIR_EVENTS}=~m|/|)
? $Config{ZM_DIR_EVENTS} ? $Config{ZM_DIR_EVENTS}
@ -254,7 +254,7 @@ sub createEventPath
makePath( $datePath, $eventPath ); makePath( $datePath, $eventPath );
$eventPath .= '/'.$datePath; $eventPath .= '/'.$datePath;
# Create event id symlink # Create event id symlink
my $idFile = sprintf( "%s/.%d", $eventPath, $event->{Id} ); my $idFile = sprintf( "%s/.%d", $eventPath, $event->{Id} );
symlink( $timePath, $idFile ) symlink( $timePath, $idFile )
or Fatal( "Can't symlink $idFile -> $eventPath: $!" ); or Fatal( "Can't symlink $idFile -> $eventPath: $!" );
@ -263,7 +263,7 @@ sub createEventPath
$eventPath .= '/'.$timePath; $eventPath .= '/'.$timePath;
setFileOwner( $idFile ); # Must come after directory has been created setFileOwner( $idFile ); # Must come after directory has been created
# Create empty id tag file # Create empty id tag file
$idFile = sprintf( "%s/.%d", $eventPath, $event->{Id} ); $idFile = sprintf( "%s/.%d", $eventPath, $event->{Id} );
open( my $ID_FP, ">", $idFile ) open( my $ID_FP, ">", $idFile )
or Fatal( "Can't open $idFile: $!" ); or Fatal( "Can't open $idFile: $!" );
@ -296,8 +296,8 @@ sub _checkProcessOwner
my ( $processOwner ) = getpwuid( $> ); my ( $processOwner ) = getpwuid( $> );
if ( $processOwner ne $Config{ZM_WEB_USER} ) if ( $processOwner ne $Config{ZM_WEB_USER} )
{ {
# Not running as web user, so should be root in which case chown # Not running as web user, so should be root in which case chown
# the temporary directory # the temporary directory
( my $ownerName, my $ownerPass, $_ownerUid, $_ownerGid ) ( my $ownerName, my $ownerPass, $_ownerUid, $_ownerGid )
= getpwnam( $Config{ZM_WEB_USER} ) = getpwnam( $Config{ZM_WEB_USER} )
or Fatal( "Can't get user details for web user '" or Fatal( "Can't get user details for web user '"
@ -347,7 +347,7 @@ sub createEvent
my $event = shift; my $event = shift;
Debug( "Creating event" ); Debug( "Creating event" );
#print( Dumper( $event )."\n" ); #print( Dumper( $event )."\n" );
_checkForImageInfo(); _checkForImageInfo();
@ -474,7 +474,7 @@ sub createEvent
or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() ); or Fatal( "Can't prepare sql '$sql': ".$dbh->errstr() );
my $res = $sth->execute( @values ) my $res = $sth->execute( @values )
or Fatal( "Can't execute sql '$sql': ".$sth->errstr() ); or Fatal( "Can't execute sql '$sql': ".$sth->errstr() );
#$frame->{FrameId} = $dbh->{mysql_insertid}; #$frame->{FrameId} = $dbh->{mysql_insertid};
if ( $frame->{imagePath} ) if ( $frame->{imagePath} )
{ {
$frame->{capturePath} = sprintf( $frame->{capturePath} = sprintf(
@ -511,7 +511,7 @@ sub addEventImage
my $event = shift; my $event = shift;
my $frame = shift; my $frame = shift;
# TBD # TBD
} }
sub updateEvent sub updateEvent
@ -552,9 +552,9 @@ sub updateEvent
sub deleteEventFiles sub deleteEventFiles
{ {
# #
# WARNING assumes running from events directory # WARNING assumes running from events directory
# #
my $event_id = shift; my $event_id = shift;
my $monitor_id = shift; my $monitor_id = shift;
$monitor_id = '*' if ( !defined($monitor_id) ); $monitor_id = '*' if ( !defined($monitor_id) );
@ -562,21 +562,21 @@ sub deleteEventFiles
if ( $Config{ZM_USE_DEEP_STORAGE} ) if ( $Config{ZM_USE_DEEP_STORAGE} )
{ {
my $link_path = $monitor_id."/*/*/*/.".$event_id; my $link_path = $monitor_id."/*/*/*/.".$event_id;
#Debug( "LP1:$link_path" ); #Debug( "LP1:$link_path" );
my @links = glob($link_path); my @links = glob($link_path);
#Debug( "L:".$links[0].": $!" ); #Debug( "L:".$links[0].": $!" );
if ( @links ) if ( @links )
{ {
( $link_path ) = ( $links[0] =~ /^(.*)$/ ); # De-taint ( $link_path ) = ( $links[0] =~ /^(.*)$/ ); # De-taint
#Debug( "LP2:$link_path" ); #Debug( "LP2:$link_path" );
( my $day_path = $link_path ) =~ s/\.\d+//; ( my $day_path = $link_path ) =~ s/\.\d+//;
#Debug( "DP:$day_path" ); #Debug( "DP:$day_path" );
my $event_path = $day_path.readlink( $link_path ); my $event_path = $day_path.readlink( $link_path );
( $event_path ) = ( $event_path =~ /^(.*)$/ ); # De-taint ( $event_path ) = ( $event_path =~ /^(.*)$/ ); # De-taint
#Debug( "EP:$event_path" ); #Debug( "EP:$event_path" );
my $command = "/bin/rm -rf ".$event_path; my $command = "/bin/rm -rf ".$event_path;
#Debug( "C:$command" ); #Debug( "C:$command" );
executeShellCommand( $command ); executeShellCommand( $command );
unlink( $link_path ) or Error( "Unable to unlink '$link_path': $!" ); unlink( $link_path ) or Error( "Unable to unlink '$link_path': $!" );
@ -584,12 +584,12 @@ sub deleteEventFiles
for ( my $i = int(@path_parts)-2; $i >= 1; $i-- ) for ( my $i = int(@path_parts)-2; $i >= 1; $i-- )
{ {
my $delete_path = join( '/', @path_parts[0..$i] ); my $delete_path = join( '/', @path_parts[0..$i] );
#Debug( "DP$i:$delete_path" ); #Debug( "DP$i:$delete_path" );
my @has_files = glob( $delete_path."/*" ); my @has_files = glob( $delete_path."/*" );
#Debug( "HF1:".$has_files[0] ) if ( @has_files ); #Debug( "HF1:".$has_files[0] ) if ( @has_files );
last if ( @has_files ); last if ( @has_files );
@has_files = glob( $delete_path."/.[0-9]*" ); @has_files = glob( $delete_path."/.[0-9]*" );
#Debug( "HF2:".$has_files[0] ) if ( @has_files ); #Debug( "HF2:".$has_files[0] ) if ( @has_files );
last if ( @has_files ); last if ( @has_files );
my $command = "/bin/rm -rf ".$delete_path; my $command = "/bin/rm -rf ".$delete_path;
executeShellCommand( $command ); executeShellCommand( $command );
@ -786,8 +786,8 @@ ZoneMinder::Database - Perl extension for blah blah blah
=head1 SYNOPSIS =head1 SYNOPSIS
use ZoneMinder::Database; use ZoneMinder::Database;
blah blah blah blah blah blah
=head1 DESCRIPTION =head1 DESCRIPTION

View File

@ -71,14 +71,14 @@ our %EXPORT_TAGS = (
Fatal Fatal
Panic Panic
) ] ) ]
); );
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'} } );
our @EXPORT = qw(); our @EXPORT = qw();
our $VERSION = $ZoneMinder::Base::VERSION; our $VERSION = $ZoneMinder::Base::VERSION;
# ========================================================================== # ==========================================================================
# #
@ -86,17 +86,17 @@ our $VERSION = $ZoneMinder::Base::VERSION;
# #
# ========================================================================== # ==========================================================================
use ZoneMinder::Config qw(:all); use ZoneMinder::Config qw(:all);
use DBI; use DBI;
use Carp; use Carp;
use POSIX; use POSIX;
use IO::Handle; use IO::Handle;
use Data::Dumper; use Data::Dumper;
use Time::HiRes qw/gettimeofday/; use Time::HiRes qw/gettimeofday/;
use Sys::Syslog; use Sys::Syslog;
use constant { use constant {
DEBUG => 1, DEBUG => 1,
INFO => 0, INFO => 0,
WARNING => -1, WARNING => -1,
@ -104,7 +104,7 @@ use constant {
FATAL => -3, FATAL => -3,
PANIC => -4, PANIC => -4,
NOLOG => -5 NOLOG => -5
}; };
our %codes = ( our %codes = (
&DEBUG => "DBG", &DEBUG => "DBG",
@ -114,7 +114,7 @@ our %codes = (
&FATAL => "FAT", &FATAL => "FAT",
&PANIC => "PNC", &PANIC => "PNC",
&NOLOG => "OFF" &NOLOG => "OFF"
); );
our %priorities = ( our %priorities = (
&DEBUG => "debug", &DEBUG => "debug",
@ -123,7 +123,7 @@ our %priorities = (
&ERROR => "err", &ERROR => "err",
&FATAL => "err", &FATAL => "err",
&PANIC => "err" &PANIC => "err"
); );
our $logger; our $logger;
our $LOGFILE; our $LOGFILE;
@ -135,7 +135,7 @@ sub new
$this->{initialised} = undef; $this->{initialised} = undef;
#$this->{id} = "zmundef"; #$this->{id} = "zmundef";
( $this->{id} ) = $0 =~ m|^(?:.*/)?([^/]+?)(?:\.[^/.]+)?$|; ( $this->{id} ) = $0 =~ m|^(?:.*/)?([^/]+?)(?:\.[^/.]+)?$|;
$this->{idRoot} = $this->{id}; $this->{idRoot} = $this->{id};
$this->{idArgs} = ""; $this->{idArgs} = "";
@ -162,8 +162,8 @@ sub new
sub BEGIN sub BEGIN
{ {
# Fake the config variables that are used in case they are not defined yet # Fake the config variables that are used in case they are not defined yet
# Only really necessary to support upgrade from previous version # Only really necessary to support upgrade from previous version
if ( !eval('defined($Config{ZM_LOG_DEBUG})') ) if ( !eval('defined($Config{ZM_LOG_DEBUG})') )
{ {
no strict 'subs'; no strict 'subs';
@ -319,7 +319,7 @@ sub reinitialise
return unless ( $this->{initialised} ); return unless ( $this->{initialised} );
# Bit of a nasty hack to reopen connections to log files and the DB # Bit of a nasty hack to reopen connections to log files and the DB
my $syslogLevel = $this->syslogLevel(); my $syslogLevel = $this->syslogLevel();
$this->syslogLevel( NOLOG ); $this->syslogLevel( NOLOG );
my $logfileLevel = $this->fileLevel(); my $logfileLevel = $this->fileLevel();
@ -383,9 +383,9 @@ sub id
my $id = shift; my $id = shift;
if ( defined($id) && $this->{id} ne $id ) if ( defined($id) && $this->{id} ne $id )
{ {
# Remove whitespace # Remove whitespace
$id =~ s/\S//g; $id =~ s/\S//g;
# Replace non-alphanum with underscore # Replace non-alphanum with underscore
$id =~ s/[^a-zA-Z_]/_/g; $id =~ s/[^a-zA-Z_]/_/g;
if ( $this->{id} ne $id ) if ( $this->{id} ne $id )
@ -562,7 +562,7 @@ sub openSyslog
sub closeSyslog sub closeSyslog
{ {
my $this = shift; my $this = shift;
#closelog(); #closelog();
} }
sub logFile sub logFile
@ -796,17 +796,17 @@ ZoneMinder::Logger - ZoneMinder Logger module
=head1 SYNOPSIS =head1 SYNOPSIS
use ZoneMinder::Logger; use ZoneMinder::Logger;
use ZoneMinder::Logger qw(:all); use ZoneMinder::Logger qw(:all);
logInit( "myproc", DEBUG ); logInit( "myproc", DEBUG );
Debug( "This is what is happening" ); Debug( "This is what is happening" );
Info( "Something interesting is happening" ); Info( "Something interesting is happening" );
Warning( "Something might be going wrong." ); Warning( "Something might be going wrong." );
Error( "Something has gone wrong!!" ); Error( "Something has gone wrong!!" );
Fatal( "Something has gone badly wrong, gotta stop!!" ); Fatal( "Something has gone badly wrong, gotta stop!!" );
Panic( "Something fundamental has gone wrong, die with stack trace ); Panic( "Something fundamental has gone wrong, die with stack trace );
=head1 DESCRIPTION =head1 DESCRIPTION
@ -837,14 +837,14 @@ compulsory arguments are $id which must be a string that will identify
debug coming from this script in mixed logs. Other options may be provided debug coming from this script in mixed logs. Other options may be provided
as below, as below,
Option Default Description Option Default Description
--------- --------- ----------- --------- --------- -----------
level INFO The initial debug level which defines which statements are output and which are ignored level INFO The initial debug level which defines which statements are output and which are ignored
trace 0 Whether to use the Carp::shortmess format in debug statements to identify where the debug was emitted from trace 0 Whether to use the Carp::shortmess format in debug statements to identify where the debug was emitted from
termLevel NOLOG At what level debug is written to terminal standard error, 0 is no, 1 is yes, 2 is write only if terminal termLevel NOLOG At what level debug is written to terminal standard error, 0 is no, 1 is yes, 2 is write only if terminal
databaseLevel INFO At what level debug is written to the Log table in the database; databaseLevel INFO At what level debug is written to the Log table in the database;
fileLevel NOLOG At what level debug is written to a log file of the format of <id>.log in the standard log directory. fileLevel NOLOG At what level debug is written to a log file of the format of <id>.log in the standard log directory.
syslogLevel INFO At what level debug is written to syslog. syslogLevel INFO At what level debug is written to syslog.
To disable any of these action entirely set to NOLOG To disable any of these action entirely set to NOLOG

View File

@ -79,7 +79,7 @@ our %EXPORT_TAGS = (
zmTriggerEventCancel zmTriggerEventCancel
zmTriggerShowtext zmTriggerShowtext
) ], ) ],
); );
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'} } );
@ -373,12 +373,12 @@ sub zmMemRead
} }
elsif ( $type eq "int64" || $type eq "time_t64" ) elsif ( $type eq "int64" || $type eq "time_t64" )
{ {
# The "q" type is only available on 64bit platforms, so use native. # The "q" type is only available on 64bit platforms, so use native.
( $value ) = unpack( "l!", $data ); ( $value ) = unpack( "l!", $data );
} }
elsif ( $type eq "uint64" ) elsif ( $type eq "uint64" )
{ {
# The "q" type is only available on 64bit platforms, so use native. # The "q" type is only available on 64bit platforms, so use native.
( $value ) = unpack( "L!", $data ); ( $value ) = unpack( "L!", $data );
} }
elsif ( $type eq "int32" ) elsif ( $type eq "int32" )
@ -474,12 +474,12 @@ sub zmMemWrite
} }
elsif ( $type eq "int64" || $type eq "time_t64" ) elsif ( $type eq "int64" || $type eq "time_t64" )
{ {
# The "q" type is only available on 64bit platforms, so use native. # The "q" type is only available on 64bit platforms, so use native.
$data = pack( "l!", $value ); $data = pack( "l!", $value );
} }
elsif ( $type eq "uint64" ) elsif ( $type eq "uint64" )
{ {
# The "q" type is only available on 64bit platforms, so use native. # The "q" type is only available on 64bit platforms, so use native.
$data = pack( "L!", $value ); $data = pack( "L!", $value );
} }
elsif ( $type eq "int32" ) elsif ( $type eq "int32" )
@ -755,23 +755,23 @@ ZoneMinder::MappedMem - ZoneMinder Mapped Memory access module
=head1 SYNOPSIS =head1 SYNOPSIS
use ZoneMinder::MappedMem; use ZoneMinder::MappedMem;
use ZoneMinder::MappedMem qw(:all); use ZoneMinder::MappedMem qw(:all);
if ( zmMemVerify( $monitor ) ) if ( zmMemVerify( $monitor ) )
{ {
$state = zmGetMonitorState( $monitor ); $state = zmGetMonitorState( $monitor );
if ( $state == STATE_ALARM ) if ( $state == STATE_ALARM )
{ {
... ...
} }
} }
( $lri, $lwi ) = zmMemRead( $monitor, [ "shared_data:last_read_index", ( $lri, $lwi ) = zmMemRead( $monitor, [ "shared_data:last_read_index",
"shared_data:last_write_index" "shared_data:last_write_index"
] ]
); );
zmMemWrite( $monitor, { "trigger_data:trigger_showtext" => "Some Text" } ); zmMemWrite( $monitor, { "trigger_data:trigger_showtext" => "Some Text" } );
=head1 DESCRIPTION =head1 DESCRIPTION
@ -921,32 +921,32 @@ harmless, extreme care must be taken when writing to mapped memory,
especially in the shared_data section as this is normally written to only especially in the shared_data section as this is normally written to only
by monitor capture and analysis processes. by monitor capture and analysis processes.
shared_data The general mapped memory section shared_data The general mapped memory section
size The size, in bytes, of this section size The size, in bytes, of this section
valid Flag indicating whether this section has been initialised valid Flag indicating whether this section has been initialised
active Flag indicating whether this monitor is active (enabled/disabled) active Flag indicating whether this monitor is active (enabled/disabled)
signal Flag indicating whether this monitor is reciving a valid signal signal Flag indicating whether this monitor is reciving a valid signal
state The current monitor state, see the STATE constants below state The current monitor state, see the STATE constants below
last_write_index The last index, in the image buffer, that an image has been saved to last_write_index The last index, in the image buffer, that an image has been saved to
last_read_index The last index, in the image buffer, that an image has been analysed from last_read_index The last index, in the image buffer, that an image has been analysed from
last_write_time The time (in utc seconds) when the last image was captured last_write_time The time (in utc seconds) when the last image was captured
last_read_time The time (in utc seconds) when the last image was analysed last_read_time The time (in utc seconds) when the last image was analysed
last_event The id of the last event generated by the monitor analysis process, 0 if none last_event The id of the last event generated by the monitor analysis process, 0 if none
action The monitor actions bitmask, see the ACTION constants below action The monitor actions bitmask, see the ACTION constants below
brightness Read/write location for the current monitor brightness brightness Read/write location for the current monitor brightness
hue Read/write location for the current monitor hue hue Read/write location for the current monitor hue
colour Read/write location for the current monitor colour colour Read/write location for the current monitor colour
contrast Read/write location for the current monitor contrast contrast Read/write location for the current monitor contrast
alarm_x Image x co-ordinate (from left) of the centre of the last motion event, -1 if none alarm_x Image x co-ordinate (from left) of the centre of the last motion event, -1 if none
alarm_y Image y co-ordinate (from top) of the centre of the last motion event, -1 if none alarm_y Image y co-ordinate (from top) of the centre of the last motion event, -1 if none
trigger_data The triggered event mapped memory section trigger_data The triggered event mapped memory section
size The size, in bytes of this section size The size, in bytes of this section
trigger_state The current trigger state, see the TRIGGER constants below trigger_state The current trigger state, see the TRIGGER constants below
trigger_score The current triggered event score trigger_score The current triggered event score
trigger_cause The current triggered event cause string trigger_cause The current triggered event cause string
trigger_text The current triggered event descriptive text string trigger_text The current triggered event descriptive text string
trigger_showtext The triggered text that will be displayed on captured image timestamps trigger_showtext The triggered text that will be displayed on captured image timestamps
=head1 CONSTANTS =head1 CONSTANTS

View File

@ -43,7 +43,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'} } );
@ -117,8 +117,8 @@ ZoneMinder::Database - Perl extension for blah blah blah
=head1 SYNOPSIS =head1 SYNOPSIS
use ZoneMinder::Server; use ZoneMinder::Server;
blah blah blah blah blah blah
=head1 DESCRIPTION =head1 DESCRIPTION