Merge branch 'master' of github.com:ZoneMinder/ZoneMinder

pull/2434/head
Isaac Connor 2019-01-21 11:19:07 -05:00
commit a2d4dc974b
29 changed files with 3603 additions and 4131 deletions

View File

@ -13,7 +13,7 @@ switch ( $_REQUEST['task'] ) {
$string = $_POST['message']; $string = $_POST['message'];
$file = !empty($_POST['file']) ? preg_replace( '/\w+:\/\/\w+\//', '', $_POST['file'] ) : ''; $file = !empty($_POST['file']) ? preg_replace( '/\w+:\/\/[\w.:]+\//', '', $_POST['file'] ) : '';
if ( !empty( $_POST['line'] ) ) if ( !empty( $_POST['line'] ) )
$line = $_POST['line']; $line = $_POST['line'];
else else

View File

@ -49,6 +49,7 @@ function CSPHeaders($view, $nonce) {
} }
case 'bandwidth': case 'bandwidth':
case 'blank': case 'blank':
case 'console':
case 'controlcap': case 'controlcap':
case 'function': case 'function':
case 'log': case 'log':

View File

@ -47,7 +47,7 @@ function logReport( level, message, file, line ) {
return; return;
} }
/* eslint-disable no-caller */ /* eslint-disable no-caller */
if ( arguments && arguments.callee && arguments.callee.caller && arguments.callee.caller.name ) { if ( arguments && arguments.callee && arguments.callee.caller && arguments.callee.caller.caller && arguments.callee.caller.caller.name ) {
message += ' - '+arguments.callee.caller.caller.name+'()'; message += ' - '+arguments.callee.caller.caller.name+'()';
} }
/* eslint-enable no-caller */ /* eslint-enable no-caller */
@ -117,3 +117,12 @@ window.onerror =
function( message, url, line ) { function( message, url, line ) {
logReport( "ERR", message, url, line ); logReport( "ERR", message, url, line );
}; };
window.addEventListener("securitypolicyviolation", function logCSP(evt) {
var level = evt.disposition == "enforce" ? "ERR" : "DBG";
var message = evt.blockedURI + " violated CSP " + evt.violatedDirective;
if (evt.sample) {
message += " (Sample: " + evt.sample + ")";
}
logReport(level, message, evt.sourceFile, evt.lineNumber);
});

View File

@ -51,16 +51,14 @@ var Overlay = new Class({
}, },
show: function() { show: function() {
this.mask.show(); this.mask.show();
$(window).addEvent( 'resize', this.update.bind(this) ); window.addEventListener( 'resize', this.update.bind(this) );
$(window).addEvent( 'scroll', this.update.bind(this) ); window.addEventListener( 'scroll', this.update.bind(this) );
this.element.tween( 'opacity', [0, 1.0] ); this.element.tween( 'opacity', [0, 1.0] );
this.element.show(); this.element.show();
this.element.position(); this.element.position();
this.mask.position(); this.mask.position();
}, },
hideComplete: function() { hideComplete: function() {
$(window).removeEvent( 'resize', this.update.bind(this) );
$(window).removeEvent( 'scroll', this.update.bind(this) );
this.element.hide(); this.element.hide();
this.mask.hide(); this.mask.hide();
}, },
@ -82,12 +80,10 @@ var Overlay = new Class({
} }
updateOverlayLoading(); updateOverlayLoading();
this.loading.setStyle( 'display', 'block' ); this.loading.setStyle( 'display', 'block' );
$(window).addEvent( 'resize', this.update.bind(this) ); window.addEventListener( 'resize', this.update.bind(this) );
$(window).addEvent( 'scroll', this.update.bind(this) ); window.addEventListener( 'scroll', this.update.bind(this) );
}, },
hideAnimation: function() { hideAnimation: function() {
$(window).removeEvent( 'resize', this.update.bind(this) );
$(window).removeEvent( 'scroll', this.update.bind(this) );
if ( this.loading ) { if ( this.loading ) {
this.loading.setStyle( 'display', 'none' ); this.loading.setStyle( 'display', 'none' );
} }
@ -119,4 +115,4 @@ function setupOverlays() {
} }
} }
window.addEvent( 'domready', setupOverlays ); window.addEventListener( 'DOMContentLoaded', setupOverlays );

View File

@ -1 +1 @@
jquery-1.11.3.js jquery-2.2.4.js

View File

@ -1 +1 @@
http://code.jquery.com/jquery-1.11.3.js https://code.jquery.com/jquery-2.2.4.js

View File

@ -337,14 +337,20 @@ function submitThisForm() {
this.form.submit(); this.form.submit();
} }
function toggleCheckbox( element, name ) { /**
var form = element.form; * @param {Element} headerCheckbox The select all/none checkbox that was just toggled.
var checked = element.checked; * @param {DOMString} name The name of the checkboxes to toggle.
*/
function updateFormCheckboxesByName( headerCheckbox ) {
var name = headerCheckbox.getAttribute("data-checkbox-name");
var form = headerCheckbox.form;
var checked = headerCheckbox.checked;
for (var i = 0; i < form.elements.length; i++) { for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name.indexOf(name) == 0) { if (form.elements[i].name.indexOf(name) == 0) {
form.elements[i].checked = checked; form.elements[i].checked = checked;
} }
} }
setButtonStates(headerCheckbox);
} }
function configureDeleteButton( element ) { function configureDeleteButton( element ) {
@ -378,7 +384,7 @@ if ( closePopup ) {
closeWindow(); closeWindow();
} }
window.addEvent( 'domready', checkSize ); window.addEventListener( 'DOMContentLoaded', checkSize );
function convertLabelFormat(LabelFormat, monitorName) { function convertLabelFormat(LabelFormat, monitorName) {
//convert label format from strftime to moment's format (modified from //convert label format from strftime to moment's format (modified from

View File

@ -46,6 +46,8 @@ foreach ( $storage_areas as $S ) {
$html = $html =
' '
<div class="controlHeader"> <div class="controlHeader">
<!-- Used to submit the form with the enter key -->
<input type="submit" class="hide"/>
<input type="hidden" name="filtering" value=""/> <input type="hidden" name="filtering" value=""/>
'; ';
@ -93,7 +95,7 @@ if ( ! empty($user['MonitorIds']) ) {
} }
$html .= '<span class="MonitorNameFilter"><label>'.translate('Name').'</label>'; $html .= '<span class="MonitorNameFilter"><label>'.translate('Name').'</label>';
$html .= '<input type="text" name="MonitorName" value="'.(isset($_SESSION['MonitorName'])?$_SESSION['MonitorName']:'').'" onkeydown="if(event&&event.keyCode==13){this.form.submit();}" placeholder="text or regular expression"/>'; $html .= '<input type="text" name="MonitorName" value="'.(isset($_SESSION['MonitorName'])?$_SESSION['MonitorName']:'').'" placeholder="text or regular expression"/>';
$html .= '</span>'; $html .= '</span>';
$Functions = array(); $Functions = array();
@ -158,7 +160,7 @@ $html .= htmlSelect( 'Status[]', $status_options,
$html .= '</span>'; $html .= '</span>';
$html .= '<span class="SourceFilter"><label>'.translate('Source').'</label>'; $html .= '<span class="SourceFilter"><label>'.translate('Source').'</label>';
$html .= '<input type="text" name="Source" value="'.(isset($_SESSION['Source'])?$_SESSION['Source']:'').'" onkeydown="if(event&&event.keyCode==13){this.form.submit();}" placeholder="text or regular expression"/>'; $html .= '<input type="text" name="Source" value="'.(isset($_SESSION['Source'])?$_SESSION['Source']:'').'" placeholder="text or regular expression"/>';
$html .= '</span>'; $html .= '</span>';
$sql = 'SELECT *,S.Status AS Status, S.CaptureFPS AS CaptureFPS, S.AnalysisFPS AS AnalysisFPS, S.CaptureBandwidth AS CaptureBandwidth $sql = 'SELECT *,S.Status AS Status, S.CaptureFPS AS CaptureFPS, S.AnalysisFPS AS AnalysisFPS, S.CaptureBandwidth AS CaptureBandwidth

View File

@ -219,7 +219,7 @@ ob_start();
?> ?>
<th class="colZones"><?php echo translate('Zones') ?></th> <th class="colZones"><?php echo translate('Zones') ?></th>
<?php if ( canEdit('Monitors') ) { ?> <?php if ( canEdit('Monitors') ) { ?>
<th class="colMark"><input type="checkbox" name="toggleCheck" value="1" onclick="toggleCheckbox(this, 'markMids[]');setButtonStates(this);"/> <?php echo translate('All') ?></th> <th class="colMark"><input type="checkbox" name="toggleCheck" value="1" data-checkbox-name="markMids[]" data-on-click-this="updateFormCheckboxesByName"/> <?php echo translate('All') ?></th>
<?php } ?> <?php } ?>
</tr> </tr>
</thead> </thead>

View File

@ -181,7 +181,7 @@ while ( $event_row = dbFetchNext($results) ) {
<?php <?php
} }
?> ?>
<th class="colMark"><input type="checkbox" name="toggleCheck" value="1" onclick="toggleCheckbox(this, 'markEids');"/></th> <th class="colMark"><input type="checkbox" name="toggleCheck" value="1" data-checkbox-name="markEids" data-on-click-this="updateFormCheckboxesByName"/></th>
</tr> </tr>
<?php <?php
} }

View File

@ -103,4 +103,4 @@ function initPage() {
probe(url); probe(url);
} }
} }
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -146,4 +146,4 @@ function applySort(event, ui) {
ajax.send(); ajax.send();
} // end function applySort(event,ui) } // end function applySort(event,ui)
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -9,4 +9,4 @@ function updateLabel() {
form.newLabel.value = ''; form.newLabel.value = '';
} }
} }
window.addEvent('domready', updateLabel); window.addEventListener('DOMContentLoaded', updateLabel);

View File

@ -6,4 +6,4 @@ function initCycle() {
nextCycleView.periodical(cycleRefreshTimeout); nextCycleView.periodical(cycleRefreshTimeout);
} }
window.addEvent('domready', initCycle); window.addEventListener('DOMContentLoaded', initCycle);

View File

@ -35,4 +35,4 @@ function initPage() {
} }
} }
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -1070,4 +1070,4 @@ function initPage() {
} }
// Kick everything off // Kick everything off
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -5,14 +5,9 @@ function closeWindows() {
filterWindow.close(); filterWindow.close();
} }
function toggleCheckbox( element, name ) { function setButtonStates( element ) {
var form = element.form; var form = element.form;
var checked = element.checked; var checked = element.checked;
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name.indexOf(name) == 0) {
form.elements[i].checked = checked;
}
}
form.viewBtn.disabled = !(canViewEvents && checked); form.viewBtn.disabled = !(canViewEvents && checked);
form.editBtn.disabled = !(canEditEvents && checked); form.editBtn.disabled = !(canEditEvents && checked);
form.archiveBtn.disabled = unarchivedEvents?!checked:true; form.archiveBtn.disabled = unarchivedEvents?!checked:true;

View File

@ -51,4 +51,4 @@ function initPage() {
} }
} }
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -254,4 +254,4 @@ function init() {
$j("#sortTable [name$='sort_field\\]']").chosen(); $j("#sortTable [name$='sort_field\\]']").chosen();
} }
window.addEvent( 'domready', init ); window.addEventListener( 'DOMContentLoaded', init );

View File

@ -314,4 +314,4 @@ function initPage() {
} }
// Kick everything off // Kick everything off
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -1,4 +1,4 @@
window.addEvent( 'domready', function() { window.addEventListener( 'DOMContentLoaded', function() {
if ( failed == true ) { if ( failed == true ) {
$('loginError').removeClass( 'hidden' ); $('loginError').removeClass( 'hidden' );
} }

View File

@ -48,4 +48,4 @@ function initPage() {
//updateMethods( $(protocolSelector) ); //updateMethods( $(protocolSelector) );
} }
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -447,4 +447,4 @@ function initPage() {
} }
} }
// Kick everything off // Kick everything off
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -943,4 +943,4 @@ function initPage() {
} }
window.addEventListener("resize", redrawScreen, {passive: true}); window.addEventListener("resize", redrawScreen, {passive: true});
// Kick everything off // Kick everything off
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -19,4 +19,4 @@ function initPage() {
return ( true ); return ( true );
} }
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -56,4 +56,4 @@ function initPage() {
}); });
} }
// Kick everything off // Kick everything off
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -775,4 +775,4 @@ function initPage() {
} }
// Kick everything off // Kick everything off
window.addEvent('domready', initPage); window.addEventListener('DOMContentLoaded', initPage);

View File

@ -733,4 +733,4 @@ function Polygon_calcArea( coords ) {
return Math.round( Math.abs( float_area ) ); return Math.round( Math.abs( float_area ) );
} }
window.addEvent( 'domready', initPage ); window.addEventListener( 'DOMContentLoaded', initPage );