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

This commit is contained in:
Isaac Connor 2020-08-09 22:20:08 -04:00
commit e64e786c5b
5 changed files with 115 additions and 80 deletions

View File

@ -32,6 +32,7 @@ install:
- update-binfmts --enable qemu-arm
env:
- SMPFLAGS=-j4 OS=eslint DIST=eslint
- SMPFLAGS=-j4 OS=el DIST=7 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=el DIST=8 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=fedora DIST=31 DOCKER_REPO=knnniggett/packpack
@ -45,7 +46,6 @@ env:
- SMPFLAGS=-j4 OS=debian DIST=jessie DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=debian DIST=stretch DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=debian DIST=buster DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=eslint DIST=eslint
compiler:
- gcc

View File

@ -16,7 +16,7 @@ function zm_session_start() {
$currentCookieParams['path'],
$currentCookieParams['domain'],
$currentCookieParams['secure'],
$currentCookieParams['httponly'],
$currentCookieParams['httponly']
);
} else {
# samesite was introduced in 7.3.0

View File

@ -711,6 +711,7 @@ li.search-choice {
}
#dropdown_storage,
#dropdown_reminder,
#dropdown_bandwidth {
background-color:#485460;
}

View File

@ -134,64 +134,7 @@ if ( $css != 'base' )
<script src="skins/<?php echo $skin; ?>/js/dateTimePicker/jquery-ui-timepicker-addon.js"></script>
<script src="<?php echo cache_bust('js/Server.js'); ?>"></script>
<script nonce="<?php echo $cspNonce; ?>">
jQuery(document).ready(function() {
// Workaround Bootstrap-Mootools conflict
var bootstrapLoaded = (typeof jQuery().carousel == 'function');
var mootoolsLoaded = (typeof MooTools != 'undefined');
if (bootstrapLoaded && mootoolsLoaded) {
Element.implement({
hide: function() {
return this;
},
show: function(v) {
return this;
},
slide: function(v) {
return this;
}
});
}
jQuery("#dropdown_bandwidth a").click(function() {
var bwval = jQuery(this).data('pdsa-dropdown-val');
setCookie("zmBandwidth",bwval,3600);
getNavBar();
});
jQuery("#flip").click(function() {
jQuery("#panel").slideToggle("slow");
var flip = jQuery("#flip");
if ( flip.html() == 'keyboard_arrow_up' ) {
flip.html('keyboard_arrow_down');
Cookie.write('zmHeaderFlip', 'down', {duration: 10*365} );
} else {
flip.html('keyboard_arrow_up');
Cookie.write('zmHeaderFlip', 'up', {duration: 10*365} );
}
});
jQuery("#fbflip").click(function() {
jQuery("#fbpanel").slideToggle("slow");
var fbflip = jQuery("#fbflip");
if ( fbflip.html() == 'keyboard_arrow_up' ) {
fbflip.html('keyboard_arrow_down');
Cookie.write('zmFilterBarFlip', 'down', {duration: 10*365} );
} else {
fbflip.html('keyboard_arrow_up');
Cookie.write('zmFilterBarFlip', 'up', {duration: 10*365} );
jQuery('.chosen').chosen("destroy");
jQuery('.chosen').chosen();
}
});
jQuery(document).click(function(event) {
var target = jQuery(event.target);
var _mobileMenuOpen = jQuery("#main-header-nav").hasClass("show");
if (_mobileMenuOpen === true && !target.hasClass("navbar-toggler")) {
jQuery("button.navbar-toggler").click();
}
});
});
var $j = jQuery.noConflict();
// $j is now an alias to the jQuery function; creating the new alias is optional.
</script>
<script nonce="<?php echo $cspNonce; ?>">var $j = jQuery.noConflict();</script>
<script src="<?php echo cache_bust('skins/'.$skin.'/views/js/state.js') ?>"></script>
<?php
if ( $view == 'event' ) {
@ -620,11 +563,38 @@ function getBandwidthHTML($bandwidth_options, $user) {
// Returns the html representing the version of ZoneMinder
function getZMVersionHTML() {
$result = '';
$content = '';
$class = (ZM_DYN_DB_VERSION&&(ZM_DYN_DB_VERSION!=ZM_VERSION))?'text-danger':'';
$result .= '<li id="getZMVersionHTML" class="nav-item dropdown mx-2">'.
makePopupLink('?view=version', 'zmVersion', 'version', '<span class="version ' .$class. '">v' .ZM_VERSION. '</span>', canEdit('System')).
'</li>'.PHP_EOL;
if ( ZM_DYN_DB_VERSION && (ZM_DYN_DB_VERSION != ZM_VERSION) ) { // Must upgrade before proceeding
$class = 'text-danger';
$tt_text = translate('RunLocalUpdate');
$content = 'v'.ZM_VERSION.PHP_EOL;
} else if ( verNum( ZM_DYN_LAST_VERSION ) <= verNum( ZM_VERSION ) ) { // No update needed
$class = ''; // Don't change the text color under normal conditions
$tt_text = translate('UpdateNotNecessary');
$content = 'v'.ZM_VERSION.PHP_EOL;
} else if ( canEdit('System') ) { // An update is available and the user is an administrator
$class = 'text-warning';
$tt_text = translate('UpdateAvailable');
$content = '<a class="dropdown ' .$class. '" data-toggle="dropdown" href="#">v' .ZM_VERSION. '</a>'.PHP_EOL;
$content .= '<div class="dropdown-menu" id="dropdown_reminder" aria-labelledby="dropdown_reminder">'.PHP_EOL;
$content .= '<h6 class="dropdown-header">' .translate('UpdateAvailable'). '</h6>'.PHP_EOL;
$content .= '<a class="dropdown-item" data-pdsa-dropdown-val="ignore" href="#">' .translate('VersionIgnore'). '</a>'.PHP_EOL;
$content .= '<a class="dropdown-item" data-pdsa-dropdown-val="hour" href="#">' .translate('VersionRemindHour'). '</a>'.PHP_EOL;
$content .= '<a class="dropdown-item" data-pdsa-dropdown-val="day" href="#">' .translate('VersionRemindDay'). '</a>'.PHP_EOL;
$content .= '<a class="dropdown-item" data-pdsa-dropdown-val="week" href="#">' .translate('VersionRemindWeek'). '</a>'.PHP_EOL;
$content .= '<a class="dropdown-item" data-pdsa-dropdown-val="month" href="#">' .translate('VersionRemindMonth'). '</a>'.PHP_EOL;
$content .= '<a class="dropdown-item" data-pdsa-dropdown-val="never" href="#">' .translate('VersionRemindNever'). '</a>'.PHP_EOL;
$content .= '</div>'.PHP_EOL;
} else { // An update is available and the user is NOT an administrator
$class = 'text-warning';
$tt_text = translate('UpdateAvailable');
$content = 'v'.ZM_VERSION.PHP_EOL;
}
$result .= '<li id="getZMVersionHTML" class="nav-item dropdown ' .$class. '" data-placement="bottom" data-placement="bottom" title="' .$tt_text. '">'.PHP_EOL;
$result .= $content;
$result .= '</li>'.PHP_EOL;
return $result;
}

View File

@ -21,7 +21,6 @@
// This file should only contain static JavaScript and no php.
// Use skin.js.php for JavaScript that need pre-processing
//
var popupOptions = "resizable,scrollbars,status=no,toolbar=yes";
function checkSize() {
@ -313,9 +312,64 @@ if ( currentView != 'none' && currentView != 'login' ) {
$j.ajaxSetup({timeout: AJAX_TIMEOUT}); //sets timeout for all getJSON.
$j(document).ready(function() {
// Trigger autorefresh of the widget bar stats on the navbar
if ( $j('.navbar').length ) {
setInterval(getNavBar, navBarRefresh);
}
// Workaround Bootstrap-Mootools conflict
var bootstrapLoaded = (typeof $j().carousel == 'function');
var mootoolsLoaded = (typeof MooTools != 'undefined');
if (bootstrapLoaded && mootoolsLoaded) {
Element.implement({
hide: function() {
return this;
},
show: function(v) {
return this;
},
slide: function(v) {
return this;
}
});
}
// Update zmBandwidth cookie when the user makes a selection from the dropdown
bwClickFunction();
// Update update reminders when the user makes a selection from the dropdown
reminderClickFunction();
// Manage the widget bar minimize chevron
$j("#flip").click(function() {
$j("#panel").slideToggle("slow");
var flip = $j("#flip");
if ( flip.html() == 'keyboard_arrow_up' ) {
flip.html('keyboard_arrow_down');
Cookie.write('zmHeaderFlip', 'down', {duration: 10*365} );
} else {
flip.html('keyboard_arrow_up');
Cookie.write('zmHeaderFlip', 'up', {duration: 10*365} );
}
});
// Manage the web console filter bar minimize chevron
$j("#fbflip").click(function() {
$j("#fbpanel").slideToggle("slow");
var fbflip = $j("#fbflip");
if ( fbflip.html() == 'keyboard_arrow_up' ) {
fbflip.html('keyboard_arrow_down');
Cookie.write('zmFilterBarFlip', 'down', {duration: 10*365} );
} else {
fbflip.html('keyboard_arrow_up');
Cookie.write('zmFilterBarFlip', 'up', {duration: 10*365} );
$j('.chosen').chosen("destroy");
$j('.chosen').chosen();
}
});
// Autoclose the hamburger button if the end user clicks outside the button
$j(document).click(function(event) {
var target = $j(event.target);
var _mobileMenuOpen = $j("#main-header-nav").hasClass("show");
if (_mobileMenuOpen === true && !target.hasClass("navbar-toggler")) {
$j("button.navbar-toggler").click();
}
});
});
function getNavBar() {
@ -343,13 +397,7 @@ if ( currentView != 'none' && currentView != 'login' ) {
if ( key == "auth" ) continue;
if ( $j('#'+key).hasClass("show") ) continue; // don't update if the user has the dropdown open
if ( $j('#'+key).length ) $j('#'+key).replaceWith(data[key]);
if ( key == 'getBandwidthHTML' ) {
jQuery("#dropdown_bandwidth a").click(function() {
var bwval = jQuery(this).data('pdsa-dropdown-val');
setCookie("zmBandwidth",bwval,3600);
getNavBar();
});
}
if ( key == 'getBandwidthHTML' ) bwClickFunction();
}
}
}
@ -588,16 +636,32 @@ function setButtonState(element_id, butClass) {
}
}
function setCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
function setCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function delCookie(name) {
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
function bwClickFunction() {
$j("#dropdown_bandwidth a").click(function() {
var bwval = $j(this).data('pdsa-dropdown-val');
setCookie("zmBandwidth", bwval, 3600);
getNavBar();
});
}
function reminderClickFunction() {
$j("#dropdown_reminder a").click(function() {
var option = $j(this).data('pdsa-dropdown-val');
$j.getJSON(thisUrl + '?view=version&action=version&option=' + option);
window.location.reload(true); //Do a full refresh to update ZM_DYN_LAST_VERSION
});
}