Merge branch 'master' into storageareas

This commit is contained in:
Isaac Connor 2019-03-28 11:20:29 -04:00
commit 90e97ff135
5 changed files with 167 additions and 165 deletions

View File

@ -766,7 +766,7 @@ FROM Frames WHERE EventId=?';
$res = $selectUnclosedEventsSth->execute() $res = $selectUnclosedEventsSth->execute()
or Fatal( "Can't execute: ".$selectUnclosedEventsSth->errstr() ); or Fatal( "Can't execute: ".$selectUnclosedEventsSth->errstr() );
while( my $event = $selectUnclosedEventsSth->fetchrow_hashref() ) { while( my $event = $selectUnclosedEventsSth->fetchrow_hashref() ) {
aud_print( "Found open event '$event->{Id}' at $$event{StartTime}" ); aud_print( "Found open event '$event->{Id}' on Monitor $event->{MonitorId} at $$event{StartTime}" );
if ( confirm( 'close', 'closing' ) ) { if ( confirm( 'close', 'closing' ) ) {
if ( ! ( $res = $selectFrameDataSth->execute($event->{Id}) ) ) { if ( ! ( $res = $selectFrameDataSth->execute($event->{Id}) ) ) {
Error( "Can't execute: $selectFrameDataSql:".$selectFrameDataSth->errstr() ); Error( "Can't execute: $selectFrameDataSql:".$selectFrameDataSth->errstr() );
@ -792,13 +792,13 @@ FROM Frames WHERE EventId=?';
$frame->{MaxScore}, $frame->{MaxScore},
RECOVER_TEXT, RECOVER_TEXT,
$event->{Id} $event->{Id}
) or Error( "Can't execute: ".$updateUnclosedEventsSth->errstr() ); ) or Error( 'Can\'t execute: '.$updateUnclosedEventsSth->errstr() );
} else { } else {
Error('SHOULD DELETE'); Error('SHOULD DELETE');
} # end if has frame data } # end if has frame data
} }
} # end while unclosed event } # end while unclosed event
Debug("Done closing open events."); Debug('Done closing open events.');
# Now delete any old image files # Now delete any old image files
if ( my @old_files = grep { -M > $max_image_age } <$image_path/*.{jpg,gif,wbmp}> ) { if ( my @old_files = grep { -M > $max_image_age } <$image_path/*.{jpg,gif,wbmp}> ) {

View File

@ -114,8 +114,7 @@ VideoStore::VideoStore(
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) #if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
//video_out_stream->codec = avcodec_alloc_context3(video_out_codec); //video_out_stream->codec = avcodec_alloc_context3(video_out_codec);
// Since we are not re-encoding, all we have to do is copy the parameters // Since we are not re-encoding, all we have to do is copy the parameters
video_out_ctx = video_out_stream->codec; video_out_ctx = avcodec_alloc_context3(video_out_codec);
//video_out_ctx = avcodec_alloc_context3(video_out_codec);
// Copy params from instream to ctx // Copy params from instream to ctx
ret = avcodec_parameters_to_context(video_out_ctx, video_in_stream->codecpar); ret = avcodec_parameters_to_context(video_out_ctx, video_in_stream->codecpar);
if ( ret < 0 ) { if ( ret < 0 ) {
@ -125,6 +124,7 @@ VideoStore::VideoStore(
zm_dump_codec(video_out_ctx); zm_dump_codec(video_out_ctx);
} }
#else #else
video_out_ctx = video_out_stream->codec;
ret = avcodec_copy_context(video_out_ctx, video_in_ctx); ret = avcodec_copy_context(video_out_ctx, video_in_ctx);
if ( ret < 0 ) { if ( ret < 0 ) {
Fatal("Unable to copy in video ctx to out video ctx %s", Fatal("Unable to copy in video ctx to out video ctx %s",

View File

@ -9,183 +9,185 @@
// The wrapper must be set BEFORE onreadystatechange is written to, since // The wrapper must be set BEFORE onreadystatechange is written to, since
// a bug in ActiveXObject prevents us from properly testing for it. // a bug in ActiveXObject prevents us from properly testing for it.
CsrfMagic = function(real) { CsrfMagic = function(real) {
// try to make it ourselves, if you didn't pass it // try to make it ourselves, if you didn't pass it
if (!real) try { real = new XMLHttpRequest; } catch (e) {;} if (!real) try {real = new XMLHttpRequest;} catch (e) {;}
if (!real) try { real = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) {;} if (!real) try {real = new ActiveXObject('Msxml2.XMLHTTP');} catch (e) {;}
if (!real) try { real = new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) {;} if (!real) try {real = new ActiveXObject('Microsoft.XMLHTTP');} catch (e) {;}
if (!real) try { real = new ActiveXObject('Msxml2.XMLHTTP.4.0'); } catch (e) {;} if (!real) try {real = new ActiveXObject('Msxml2.XMLHTTP.4.0');} catch (e) {;}
this.csrf = real; this.csrf = real;
// properties // properties
var csrfMagic = this; var csrfMagic = this;
real.onreadystatechange = function() { real.onreadystatechange = function() {
csrfMagic._updateProps();
return csrfMagic.onreadystatechange ? csrfMagic.onreadystatechange() : null;
};
csrfMagic._updateProps(); csrfMagic._updateProps();
} return csrfMagic.onreadystatechange ? csrfMagic.onreadystatechange() : null;
};
csrfMagic._updateProps();
};
CsrfMagic.prototype = { CsrfMagic.prototype = {
open: function(method, url, async, username, password) { open: function(method, url, async, username, password) {
if (method == 'POST') this.csrf_isPost = true; if (method == 'POST') this.csrf_isPost = true;
// deal with Opera bug, thanks jQuery // deal with Opera bug, thanks jQuery
if (username) return this.csrf_open(method, url, async, username, password); if (username) return this.csrf_open(method, url, async, username, password);
else return this.csrf_open(method, url, async); else return this.csrf_open(method, url, async);
}, },
csrf_open: function(method, url, async, username, password) { csrf_open: function(method, url, async, username, password) {
if (username) return this.csrf.open(method, url, async, username, password); if (username) return this.csrf.open(method, url, async, username, password);
else return this.csrf.open(method, url, async); else return this.csrf.open(method, url, async);
}, },
send: function(data) { send: function(data) {
if (!this.csrf_isPost) return this.csrf_send(data); if (!this.csrf_isPost) return this.csrf_send(data);
prepend = csrfMagicName + '=' + csrfMagicToken + '&'; prepend = csrfMagicName + '=' + csrfMagicToken + '&';
// XXX: Removed to eliminate 'Refused to set unsafe header "Content-length" ' errors in modern browsers // XXX: Removed to eliminate 'Refused to set unsafe header "Content-length" ' errors in modern browsers
// if (this.csrf_purportedLength === undefined) { // if (this.csrf_purportedLength === undefined) {
// this.csrf_setRequestHeader("Content-length", this.csrf_purportedLength + prepend.length); // this.csrf_setRequestHeader("Content-length", this.csrf_purportedLength + prepend.length);
// delete this.csrf_purportedLength; // delete this.csrf_purportedLength;
// } // }
delete this.csrf_isPost; delete this.csrf_isPost;
return this.csrf_send(prepend + data); return this.csrf_send(prepend + data);
}, },
csrf_send: function(data) { csrf_send: function(data) {
return this.csrf.send(data); return this.csrf.send(data);
}, },
setRequestHeader: function(header, value) { setRequestHeader: function(header, value) {
// We have to auto-set this at the end, since we don't know how long the // We have to auto-set this at the end, since we don't know how long the
// nonce is when added to the data. // nonce is when added to the data.
if (this.csrf_isPost && header == "Content-length") { if (this.csrf_isPost && header == "Content-length") {
this.csrf_purportedLength = value; this.csrf_purportedLength = value;
return; return;
} }
return this.csrf_setRequestHeader(header, value); return this.csrf_setRequestHeader(header, value);
}, },
csrf_setRequestHeader: function(header, value) { csrf_setRequestHeader: function(header, value) {
return this.csrf.setRequestHeader(header, value); return this.csrf.setRequestHeader(header, value);
}, },
abort: function() { abort: function() {
return this.csrf.abort(); return this.csrf.abort();
}, },
getAllResponseHeaders: function() { getAllResponseHeaders: function() {
return this.csrf.getAllResponseHeaders(); return this.csrf.getAllResponseHeaders();
}, },
getResponseHeader: function(header) { getResponseHeader: function(header) {
return this.csrf.getResponseHeader(header); return this.csrf.getResponseHeader(header);
} // , } // ,
} };
// proprietary // proprietary
CsrfMagic.prototype._updateProps = function() { CsrfMagic.prototype._updateProps = function() {
this.readyState = this.csrf.readyState; this.readyState = this.csrf.readyState;
if (this.readyState == 4) { if (this.readyState == 4) {
this.responseText = this.csrf.responseText; this.responseText = this.csrf.responseText;
this.responseXML = this.csrf.responseXML; this.responseXML = this.csrf.responseXML;
this.status = this.csrf.status; this.status = this.csrf.status;
this.statusText = this.csrf.statusText; this.statusText = this.csrf.statusText;
} }
} };
CsrfMagic.process = function(base) { CsrfMagic.process = function(base) {
if(typeof base == 'object') { if ( typeof base == 'object' ) {
base[csrfMagicName] = csrfMagicToken; base[csrfMagicName] = csrfMagicToken;
return base; return base;
} }
var prepend = csrfMagicName + '=' + csrfMagicToken; var prepend = csrfMagicName + '=' + csrfMagicToken;
if (base) return prepend + '&' + base; if ( base ) return prepend + '&' + base;
return prepend; return prepend;
} };
// callback function for when everything on the page has loaded // callback function for when everything on the page has loaded
CsrfMagic.end = function() { CsrfMagic.end = function() {
// This rewrites forms AGAIN, so in case buffering didn't work this // This rewrites forms AGAIN, so in case buffering didn't work this
// certainly will. // certainly will.
forms = document.getElementsByTagName('form'); forms = document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i++) { for (var i = 0; i < forms.length; i++) {
form = forms[i]; form = forms[i];
if (form.method.toUpperCase() !== 'POST') continue; if (form.method.toUpperCase() !== 'POST') continue;
if (form.elements[csrfMagicName]) continue; if (form.elements[csrfMagicName]) continue;
var input = document.createElement('input'); var input = document.createElement('input');
input.setAttribute('name', csrfMagicName); input.setAttribute('name', csrfMagicName);
input.setAttribute('value', csrfMagicToken); input.setAttribute('value', csrfMagicToken);
input.setAttribute('type', 'hidden'); input.setAttribute('type', 'hidden');
form.appendChild(input); form.appendChild(input);
} }
} };
// Sets things up for Mozilla/Opera/nice browsers // Sets things up for Mozilla/Opera/nice browsers
// We very specifically match against Internet Explorer, since they haven't // We very specifically match against Internet Explorer, since they haven't
// implemented prototypes correctly yet. // implemented prototypes correctly yet.
if (window.XMLHttpRequest && window.XMLHttpRequest.prototype && '\v' != 'v') { if ( window.XMLHttpRequest && window.XMLHttpRequest.prototype && '\v' != 'v' ) {
var x = XMLHttpRequest.prototype; var x = XMLHttpRequest.prototype;
var c = CsrfMagic.prototype; var c = CsrfMagic.prototype;
// Save the original functions // Save the original functions
x.csrf_open = x.open; x.csrf_open = x.open;
x.csrf_send = x.send; x.csrf_send = x.send;
x.csrf_setRequestHeader = x.setRequestHeader; x.csrf_setRequestHeader = x.setRequestHeader;
// Notice that CsrfMagic is itself an instantiatable object, but only // Notice that CsrfMagic is itself an instantiatable object, but only
// open, send and setRequestHeader are necessary as decorators. // open, send and setRequestHeader are necessary as decorators.
x.open = c.open; x.open = c.open;
x.send = c.send; x.send = c.send;
x.setRequestHeader = c.setRequestHeader; x.setRequestHeader = c.setRequestHeader;
} else { } else {
// The only way we can do this is by modifying a library you have been // The only way we can do this is by modifying a library you have been
// using. We support YUI, script.aculo.us, prototype, MooTools, // using. We support YUI, script.aculo.us, prototype, MooTools,
// jQuery, Ext and Dojo. // jQuery, Ext and Dojo.
if (window.jQuery) { if ( window.jQuery ) {
// jQuery didn't implement a new XMLHttpRequest function, so we have // jQuery didn't implement a new XMLHttpRequest function, so we have
// to do this the hard way. // to do this the hard way.
jQuery.csrf_ajax = jQuery.ajax; jQuery.csrf_ajax = jQuery.ajax;
jQuery.ajax = function( s ) { jQuery.ajax = function( s ) {
if (s.type && s.type.toUpperCase() == 'POST') { if (s.type && s.type.toUpperCase() == 'POST') {
s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
if ( s.data && s.processData && typeof s.data != "string" ) { if ( s.data && s.processData && typeof s.data != "string" ) {
s.data = jQuery.param(s.data); s.data = jQuery.param(s.data);
}
s.data = CsrfMagic.process(s.data);
}
return jQuery.csrf_ajax( s );
} }
} s.data = CsrfMagic.process(s.data);
if (window.Prototype) { }
// This works for script.aculo.us too return jQuery.csrf_ajax(s);
Ajax.csrf_getTransport = Ajax.getTransport; };
Ajax.getTransport = function() { }
return new CsrfMagic(Ajax.csrf_getTransport()); if ( window.Prototype ) {
} // This works for script.aculo.us too
} Ajax.csrf_getTransport = Ajax.getTransport;
if (window.MooTools) { Ajax.getTransport = function() {
Browser.csrf_Request = Browser.Request; return new CsrfMagic(Ajax.csrf_getTransport());
Browser.Request = function () { };
return new CsrfMagic(Browser.csrf_Request()); }
} if ( window.MooTools ) {
} Browser.csrf_Request = Browser.Request;
if (window.YAHOO) { Browser.Request = function() {
// old YUI API return new CsrfMagic(Browser.csrf_Request());
YAHOO.util.Connect.csrf_createXhrObject = YAHOO.util.Connect.createXhrObject; };
YAHOO.util.Connect.createXhrObject = function (transaction) { }
obj = YAHOO.util.Connect.csrf_createXhrObject(transaction); if ( window.YAHOO ) {
obj.conn = new CsrfMagic(obj.conn); // old YUI API
return obj; YAHOO.util.Connect.csrf_createXhrObject = YAHOO.util.Connect.createXhrObject;
} YAHOO.util.Connect.createXhrObject = function(transaction) {
} obj = YAHOO.util.Connect.csrf_createXhrObject(transaction);
if (window.Ext) { obj.conn = new CsrfMagic(obj.conn);
// Ext can use other js libraries as loaders, so it has to come last return obj;
// Ext's implementation is pretty identical to Yahoo's, but we duplicate };
// it for comprehensiveness's sake. }
Ext.lib.Ajax.csrf_createXhrObject = Ext.lib.Ajax.createXhrObject; if ( window.Ext ) {
Ext.lib.Ajax.createXhrObject = function (transaction) { // Ext can use other js libraries as loaders, so it has to come last
obj = Ext.lib.Ajax.csrf_createXhrObject(transaction); // Ext's implementation is pretty identical to Yahoo's, but we duplicate
obj.conn = new CsrfMagic(obj.conn); // it for comprehensiveness's sake.
return obj; Ext.lib.Ajax.csrf_createXhrObject = Ext.lib.Ajax.createXhrObject;
} Ext.lib.Ajax.createXhrObject = function(transaction) {
} obj = Ext.lib.Ajax.csrf_createXhrObject(transaction);
if (window.dojo) { obj.conn = new CsrfMagic(obj.conn);
// NOTE: this doesn't work with latest dojo return obj;
dojo.csrf__xhrObj = dojo._xhrObj; };
dojo._xhrObj = function () { }
return new CsrfMagic(dojo.csrf__xhrObj()); if ( window.dojo ) {
} // NOTE: this doesn't work with latest dojo
} dojo.csrf__xhrObj = dojo._xhrObj;
} dojo._xhrObj = function() {
return new CsrfMagic(dojo.csrf__xhrObj());
};
}
};

View File

@ -47,13 +47,13 @@ function exportResponse(respObj, respText) {
return; return;
if ( 0 ) { if ( 0 ) {
var eids = new Array(); var eids = new Array();
for (var i = 0, len=form.elements.length; i < len; i++) { for (var i = 0, len=form.elements.length; i < len; i++) {
if ( form.elements[i].name == 'eids[]' ) { if ( form.elements[i].name == 'eids[]' ) {
eids[eids.length] = 'eids[]='+form.elements[i].value; eids[eids.length] = 'eids[]='+form.elements[i].value;
}
} }
} }
}
form.submit(); form.submit();
//window.location.replace( thisUrl+'?view='+currentView+'&'+eids.join('&')+'&exportFile='+respObj.exportFile+'&generated='+((respObj.result=='Ok')?1:0) ); //window.location.replace( thisUrl+'?view='+currentView+'&'+eids.join('&')+'&exportFile='+respObj.exportFile+'&generated='+((respObj.result=='Ok')?1:0) );

View File

@ -27,7 +27,7 @@ function Monitor(monitorData) {
this.eventHandler = function( event ) { this.eventHandler = function( event ) {
console.log(event); console.log(event);
} };
this.onclick = function(evt) { this.onclick = function(evt) {
var el = evt.currentTarget; var el = evt.currentTarget;