Merge branch 'master' of github.com:zoneminder/ZoneMinder into onvif_updated_to_upstream
This commit is contained in:
commit
1f3cf266a2
|
@ -339,6 +339,7 @@ sub profiles {
|
|||
#
|
||||
# use message parser without schema validation ???
|
||||
#
|
||||
return @profiles;
|
||||
|
||||
} # end sub profiles
|
||||
|
||||
|
|
|
@ -102,7 +102,19 @@ if ( $action eq 'probe' ) {
|
|||
$client->create_services();
|
||||
|
||||
if ( $action eq 'profiles' ) {
|
||||
ZoneMinder::ONVIF::profiles($client);
|
||||
my @profiles = ZoneMinder::ONVIF::profiles($client);
|
||||
foreach my $profile ( @profiles ) {
|
||||
my ( $token, $name, $encoding, $width, $height, $frame_rate_limit, $uri ) = @{$profile};
|
||||
print join(', ', $token,
|
||||
$name,
|
||||
$encoding,
|
||||
$width,
|
||||
$height,
|
||||
$frame_rate_limit,
|
||||
$uri,
|
||||
) . "\n";
|
||||
|
||||
} # end foreach profile
|
||||
} elsif( $action eq 'move' ) {
|
||||
my $dir = shift;
|
||||
ZoneMinder::ONVIF::move($client, $dir);
|
||||
|
|
|
@ -671,8 +671,9 @@ void Event::AddFrame(Image *image, struct timeval timestamp, int score, Image *a
|
|||
if ( db_frame ) {
|
||||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
|
||||
// The idea is to write out 1/sec
|
||||
frame_data.push(new Frame(id, frames, frame_type, timestamp, delta_time, score));
|
||||
if ( write_to_db || ( frame_data.size() > 20 ) ) {
|
||||
if ( write_to_db || (frame_data.size() > (int)monitor->get_fps()) ) {
|
||||
Debug(1, "Adding %d frames to DB", frame_data.size());
|
||||
WriteDbFrames();
|
||||
last_db_frame = frames;
|
||||
|
|
|
@ -547,6 +547,9 @@ public:
|
|||
#if HAVE_LIBAVCODEC
|
||||
//void StreamMpeg( const char *format, int scale=100, int maxfps=10, int bitrate=100000 );
|
||||
#endif // HAVE_LIBAVCODEC
|
||||
double get_fps( ) const {
|
||||
return fps;
|
||||
}
|
||||
};
|
||||
|
||||
#define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit))
|
||||
|
|
|
@ -246,7 +246,7 @@ function collectData() {
|
|||
if ( isset($elementData['sql']) )
|
||||
$fieldSql[] = $elementData['sql'].' as '.$element;
|
||||
else
|
||||
$fieldSql[] = '`'.$element.'`';
|
||||
$fieldSql[] = $element;
|
||||
if ( isset($elementData['table']) && isset($elementData['join']) ) {
|
||||
$joinSql[] = 'left join '.$elementData['table'].' on '.$elementData['join'];
|
||||
}
|
||||
|
@ -258,14 +258,15 @@ function collectData() {
|
|||
|
||||
if ( count($fieldSql) ) {
|
||||
$sql = 'SELECT '.join(', ', $fieldSql).' FROM '.$entitySpec['table'];
|
||||
#$sql = 'SELECT '.join(', ', array_map($fieldSql, function($f){return '`'.$f.'`';})).' FROM '.$entitySpec['table'];
|
||||
if ( $joinSql )
|
||||
$sql .= ' '.join(' ', array_unique($joinSql));
|
||||
if ( $id && !empty($entitySpec['selector']) ) {
|
||||
$index = 0;
|
||||
$where = array();
|
||||
foreach( $entitySpec['selector'] as $selIndex => $selector ) {
|
||||
foreach ( $entitySpec['selector'] as $selIndex => $selector ) {
|
||||
$selectorParamName = ':selector' . $selIndex;
|
||||
if ( is_array( $selector ) ) {
|
||||
if ( is_array($selector) ) {
|
||||
$where[] = $selector['selector'].' = '.$selectorParamName;
|
||||
$values[$selectorParamName] = validInt($id[$index]);
|
||||
} else {
|
||||
|
@ -280,15 +281,15 @@ function collectData() {
|
|||
$sql .= ' GROUP BY '.join(',', array_unique($groupSql));
|
||||
if ( !empty($_REQUEST['sort']) ) {
|
||||
$sql .= ' ORDER BY ';
|
||||
$sort_fields = explode(',',$_REQUEST['sort']);
|
||||
$sort_fields = explode(',', $_REQUEST['sort']);
|
||||
foreach ( $sort_fields as $sort_field ) {
|
||||
|
||||
preg_match('/^(\w+)\s*(ASC|DESC)?( NULLS FIRST)?$/i', $sort_field, $matches);
|
||||
preg_match('/^`?(\w+)`?\s*(ASC|DESC)?( NULLS FIRST)?$/i', $sort_field, $matches);
|
||||
if ( count($matches) ) {
|
||||
if ( in_array($matches[1], $fieldSql) ) {
|
||||
$sql .= $matches[1];
|
||||
} else {
|
||||
ZM\Error('Sort field ' . $matches[1] . ' not in SQL Fields');
|
||||
ZM\Error('Sort field '.$matches[1].' from ' .$sort_field.' not in SQL Fields: '.join(',', $sort_field));
|
||||
}
|
||||
if ( count($matches) > 2 ) {
|
||||
$sql .= ' '.strtoupper($matches[2]);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace ZM;
|
||||
require_once( 'config.php' );
|
||||
require_once('config.php');
|
||||
|
||||
class Logger {
|
||||
private static $instance;
|
||||
|
@ -70,7 +70,7 @@ class Logger {
|
|||
$this->terminate();
|
||||
}
|
||||
|
||||
public function initialise( $options=array() ) {
|
||||
public function initialise($options=array()) {
|
||||
if ( !empty($options['id']) )
|
||||
$this->id = $options['id'];
|
||||
|
||||
|
@ -237,31 +237,31 @@ class Logger {
|
|||
$this->effectiveLevel = $this->level;
|
||||
if ( !$this->hasTerm ) {
|
||||
if ( $lastLevel < self::DEBUG && $this->level >= self::DEBUG ) {
|
||||
$this->savedErrorReporting = error_reporting( E_ALL );
|
||||
$this->savedDisplayErrors = ini_set( 'display_errors', true );
|
||||
$this->savedErrorReporting = error_reporting(E_ALL);
|
||||
$this->savedDisplayErrors = ini_set('display_errors', true);
|
||||
} elseif ( $lastLevel >= self::DEBUG && $this->level < self::DEBUG ) {
|
||||
error_reporting( $this->savedErrorReporting );
|
||||
ini_set( 'display_errors', $this->savedDisplayErrors );
|
||||
error_reporting($this->savedErrorReporting);
|
||||
ini_set('display_errors', $this->savedDisplayErrors);
|
||||
}
|
||||
}
|
||||
}
|
||||
return( $this->level );
|
||||
return $this->level;
|
||||
}
|
||||
|
||||
public function debugOn() {
|
||||
return( $this->effectiveLevel >= self::DEBUG );
|
||||
}
|
||||
|
||||
public function termLevel( $termLevel ) {
|
||||
public function termLevel($termLevel) {
|
||||
if ( isset($termLevel) ) {
|
||||
$termLevel = $this->limit($termLevel);
|
||||
if ( $this->termLevel != $termLevel )
|
||||
$this->termLevel = $termLevel;
|
||||
}
|
||||
return( $this->termLevel );
|
||||
return $this->termLevel;
|
||||
}
|
||||
|
||||
public function databaseLevel( $databaseLevel=NULL ) {
|
||||
public function databaseLevel($databaseLevel=NULL) {
|
||||
if ( !is_null($databaseLevel) ) {
|
||||
$databaseLevel = $this->limit($databaseLevel);
|
||||
if ( $this->databaseLevel != $databaseLevel ) {
|
||||
|
@ -269,7 +269,7 @@ class Logger {
|
|||
if ( $this->databaseLevel > self::NOLOG ) {
|
||||
if ( (include_once 'database.php') === FALSE ) {
|
||||
$this->databaseLevel = self::NOLOG;
|
||||
Warning( 'Unable to write log entries to DB, database.php not found' );
|
||||
Warning('Unable to write log entries to DB, database.php not found');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ class Logger {
|
|||
return $this->databaseLevel;
|
||||
}
|
||||
|
||||
public function fileLevel( $fileLevel ) {
|
||||
public function fileLevel($fileLevel) {
|
||||
if ( isset($fileLevel) ) {
|
||||
$fileLevel = $this->limit($fileLevel);
|
||||
if ( $this->fileLevel != $fileLevel ) {
|
||||
|
@ -291,14 +291,14 @@ class Logger {
|
|||
return $this->fileLevel;
|
||||
}
|
||||
|
||||
public function weblogLevel( $weblogLevel ) {
|
||||
public function weblogLevel($weblogLevel) {
|
||||
if ( isset($weblogLevel) ) {
|
||||
$weblogLevel = $this->limit($weblogLevel);
|
||||
if ( $this->weblogLevel != $weblogLevel ) {
|
||||
if ( $weblogLevel > self::NOLOG && $this->weblogLevel <= self::NOLOG ) {
|
||||
$this->savedLogErrors = ini_set( 'log_errors', true );
|
||||
$this->savedLogErrors = ini_set('log_errors', true);
|
||||
} elseif ( $weblogLevel <= self::NOLOG && $this->weblogLevel > self::NOLOG ) {
|
||||
ini_set( 'log_errors', $this->savedLogErrors );
|
||||
ini_set('log_errors', $this->savedLogErrors);
|
||||
}
|
||||
$this->weblogLevel = $weblogLevel;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ class Logger {
|
|||
return $this->weblogLevel;
|
||||
}
|
||||
|
||||
public function syslogLevel( $syslogLevel ) {
|
||||
public function syslogLevel($syslogLevel) {
|
||||
if ( isset($syslogLevel) ) {
|
||||
$syslogLevel = $this->limit($syslogLevel);
|
||||
if ( $this->syslogLevel != $syslogLevel ) {
|
||||
|
@ -353,7 +353,7 @@ class Logger {
|
|||
fclose($this->logFd);
|
||||
}
|
||||
|
||||
public function logPrint( $level, $string, $file=NULL, $line=NULL ) {
|
||||
public function logPrint($level, $string, $file=NULL, $line=NULL) {
|
||||
if ( $level > $this->effectiveLevel ) {
|
||||
return;
|
||||
}
|
||||
|
@ -375,21 +375,21 @@ class Logger {
|
|||
$rootPath = getcwd();
|
||||
else
|
||||
$rootPath = $_SERVER['DOCUMENT_ROOT'];
|
||||
$file = preg_replace('/^'.addcslashes($rootPath,'/').'\/?/', '', $file);
|
||||
$file = preg_replace('/^'.addcslashes($rootPath, '/').'\/?/', '', $file);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->useErrorLog ) {
|
||||
$message .= ' at '.$file.' line '.$line;
|
||||
} else {
|
||||
$message = $message;
|
||||
}
|
||||
|
||||
if ( $level <= $this->termLevel ) {
|
||||
if ( $this->hasTerm )
|
||||
if ( $this->hasTerm ) {
|
||||
print($message."\n");
|
||||
else
|
||||
print(preg_replace("/\n/", '<br/>', htmlspecialchars($message)).'<br/>');
|
||||
} else {
|
||||
// Didn't we already replace all newlines with spaces above?
|
||||
print(preg_replace('/\n/', '<br/>', htmlspecialchars($message)).'<br/>');
|
||||
}
|
||||
}
|
||||
|
||||
if ( $level <= $this->fileLevel ) {
|
||||
|
@ -402,6 +402,9 @@ class Logger {
|
|||
}
|
||||
} else if ( $this->logFd ) {
|
||||
fprintf($this->logFd, $message."\n");
|
||||
} else {
|
||||
$this->fileLevel = self::NOLOG;
|
||||
Error('No logFd but have fileLevel logging!?');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue