diff --git a/.travis.yml b/.travis.yml index de71ce36e..525f68450 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/web/includes/session.php b/web/includes/session.php index d34695616..47f85d877 100644 --- a/web/includes/session.php +++ b/web/includes/session.php @@ -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 diff --git a/web/skins/classic/css/base/skin.css b/web/skins/classic/css/base/skin.css index 5a4907a75..3e9428d41 100644 --- a/web/skins/classic/css/base/skin.css +++ b/web/skins/classic/css/base/skin.css @@ -711,6 +711,7 @@ li.search-choice { } #dropdown_storage, +#dropdown_reminder, #dropdown_bandwidth { background-color:#485460; } diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 2bbc2ea54..0d038316e 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -134,64 +134,7 @@ if ( $css != 'base' ) - + '. - makePopupLink('?view=version', 'zmVersion', 'version', 'v' .ZM_VERSION. '', canEdit('System')). - ''.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 = 'v' .ZM_VERSION. ''.PHP_EOL; + $content .= ''.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 .= ''.PHP_EOL; return $result; } diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js index 67488f7a7..cf50e1dd8 100644 --- a/web/skins/classic/js/skin.js +++ b/web/skins/classic/js/skin.js @@ -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 + }); +}