From 17fbafd7dee9196a697bdf4d0146118f45494fc9 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 27 Feb 2020 17:42:02 -0500 Subject: [PATCH 01/19] including the language files must come after auth in order to user the user's language setting --- web/index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/index.php b/web/index.php index d5f261742..18da56e63 100644 --- a/web/index.php +++ b/web/index.php @@ -153,7 +153,6 @@ if ( } -require_once('includes/lang.php'); # Running is global but only do the daemonCheck if it is actually needed $running = null; @@ -184,10 +183,14 @@ if ( isset($_REQUEST['request']) ) $request = detaintPath($_REQUEST['request']); require_once('includes/auth.php'); + # Only one request can open the session file at a time, so let's close the session here to improve concurrency. # Any file/page that sets session variables must re-open it. session_write_close(); +// lang references $user[Language] so must come after auth +require_once('includes/lang.php'); + foreach ( getSkinIncludes('skin.php') as $includeFile ) { require_once $includeFile; } From 1ab294e2917df0811257aed3323591fc943c826e Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 27 Mar 2020 12:43:21 -0400 Subject: [PATCH 02/19] Fix selecting layout after save by using value in session. When applying layout, if height is auto, set the img height to auto. --- web/skins/classic/views/js/montage.js | 9 ++++++--- web/skins/classic/views/montage.php | 12 ++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index 00130f108..68a2acf2c 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -210,7 +210,6 @@ function Monitor(monitorData) { * @param {*} element - the event data passed by onchange callback */ function selectLayout(element) { - console.log(element); layout = $j(element).val(); if ( layout_id = parseInt(layout) ) { @@ -221,8 +220,8 @@ function selectLayout(element) { // Need to clear the current positioning, and apply the new monitor_frame = $j('#monitorFrame'+monitor.id); - if ( ! monitor_frame ) { - console.log("Error finding frame for " + monitor.id); + if ( !monitor_frame ) { + console.log('Error finding frame for ' + monitor.id); continue; } @@ -262,6 +261,10 @@ function selectLayout(element) { if ( streamImg.nodeName == 'IMG' ) { var src = streamImg.src; src = src.replace(/width=[\.\d]+/i, 'width=0' ); + if ( $j('#height').val() == 'auto' ) { + src = src.replace(/height=[\.\d]+/i, 'height=0' ); + streamImg.style.height = 'auto'; + } if ( src != streamImg.src ) { streamImg.src = ''; streamImg.src = src; diff --git a/web/skins/classic/views/montage.php b/web/skins/classic/views/montage.php index 45ebcb0cc..0009b9929 100644 --- a/web/skins/classic/views/montage.php +++ b/web/skins/classic/views/montage.php @@ -69,17 +69,19 @@ foreach ( $layouts as $l ) { } } foreach ( $layouts as $l ) { - if ( $l->Name() != "Freeform" ) + if ( $l->Name() != 'Freeform' ) $layoutsById[$l->Id()] = $l; } -session_start(); +zm_session_start(); $layout_id = ''; if ( isset($_COOKIE['zmMontageLayout']) ) { $layout_id = $_SESSION['zmMontageLayout'] = $_COOKIE['zmMontageLayout']; -#} elseif ( isset($_SESSION['zmMontageLayout']) ) { - #$layout_id = $_SESSION['zmMontageLayout']; + ZM\Logger::Debug("Using layout $layout_id"); +} elseif ( isset($_SESSION['zmMontageLayout']) ) { + $layout_id = $_SESSION['zmMontageLayout']; + ZM\Logger::Debug("Using layout $layout_id from session"); } $options = array(); @@ -88,6 +90,8 @@ $Positions = ''; if ( $layout_id and is_numeric($layout_id) and isset($layoutsById[$layout_id]) ) { $Layout = $layoutsById[$layout_id]; $Positions = json_decode($Layout->Positions(), true); +} else { + ZM\Logger::Debug("Layout not found"); } if ( $Layout and ( $Layout->Name() != 'Freeform' ) ) { // Use layout instead of other options From 50700031b19eb94bb0ea955fb775ed4f7a016461 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 27 Mar 2020 13:05:12 -0400 Subject: [PATCH 03/19] Use zm_session_start instead of session_start --- web/includes/actions/montage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/includes/actions/montage.php b/web/includes/actions/montage.php index 207c9a0f0..cd9a41aaf 100644 --- a/web/includes/actions/montage.php +++ b/web/includes/actions/montage.php @@ -36,7 +36,7 @@ if ( isset($_REQUEST['object']) ) { } $Layout->Positions($_REQUEST['Positions']); $Layout->save(); - session_start(); + zm_session_start(); $_SESSION['zmMontageLayout'] = $Layout->Id(); setcookie('zmMontageLayout', $Layout->Id(), 1); session_write_close(); From a555e09cad328e9991b9245bad8409460ee69018 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 27 Mar 2020 13:15:11 -0400 Subject: [PATCH 04/19] Bump version to 1.34.8. Please note that the lack of zm-update-1.34.8.sql is intentional. It is not needed as there are no db updates --- distros/redhat/zoneminder.spec | 2 +- version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index 39d6353f5..a38e41a03 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -28,7 +28,7 @@ %global _hardened_build 1 Name: zoneminder -Version: 1.34.7 +Version: 1.34.8 Release: 1%{?dist} Summary: A camera monitoring and analysis tool Group: System Environment/Daemons diff --git a/version b/version index ca380088a..bc4697cae 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.34.7 +1.34.8 From 3bfcd8eb334c92b32989687f8cc68cbdd205b672 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 2 Apr 2020 14:00:36 -0400 Subject: [PATCH 05/19] Check for definition of ZM_TIMEZONE before using it. Fixes #2895 --- web/includes/config.php.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/includes/config.php.in b/web/includes/config.php.in index 57064f22d..7052a061a 100644 --- a/web/includes/config.php.in +++ b/web/includes/config.php.in @@ -193,7 +193,7 @@ if ( ! defined('ZM_SERVER_ID') ) { } } -if ( ZM_TIMEZONE ) +if ( defined('ZM_TIMEZONE') and ZM_TIMEZONE ) ini_set('date.timezone', ZM_TIMEZONE); function process_configfile($configFile) { From 87069b99b668b8d18a40d592757c16310cce82d8 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 2 Apr 2020 14:13:28 -0400 Subject: [PATCH 06/19] Fix inline-script errors on groups page referenced in #2890 --- web/skins/classic/views/groups.php | 2 +- web/skins/classic/views/js/groups.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/web/skins/classic/views/groups.php b/web/skins/classic/views/groups.php index cba26aaea..4ffe47f7d 100644 --- a/web/skins/classic/views/groups.php +++ b/web/skins/classic/views/groups.php @@ -69,7 +69,7 @@ function group_line( $Group ) { $html .= str_repeat(' ', $Group->depth()); $html .= ''; if ( canEdit('Groups') ) { - $html .= ''. validHtmlStr($Group->Id() . ' ' . $Group->Name()).''; + $html .= ''.validHtmlStr($Group->Id().' '.$Group->Name()).''; } else { $html .= validHtmlStr($Group->Name()); } diff --git a/web/skins/classic/views/js/groups.js b/web/skins/classic/views/js/groups.js index 31c9402a2..8ff1b61ff 100644 --- a/web/skins/classic/views/js/groups.js +++ b/web/skins/classic/views/js/groups.js @@ -8,8 +8,13 @@ function setGroup( element ) { form.submit(); } -function editGroup( gid ) { - createPopup( '?view=group&gid='+gid, 'zmGroup', 'group' ); +function editGroup( element ) { + var gid = element.getAttribute('data-group-id'); + if ( !gid ) { + console.log('No group id found in editGroup'); + } else { + createPopup('?view=group&gid='+gid, 'zmGroup'+gid, 'group'); + } } function deleteGroup( element ) { From 1cc60f0857b5ba53eac5c58b0c49d68f61a27c8a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 2 Apr 2020 16:06:27 -0400 Subject: [PATCH 07/19] fix action on cycle play button --- web/skins/classic/views/cycle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/views/cycle.php b/web/skins/classic/views/cycle.php index a36390b52..b7281a719 100644 --- a/web/skins/classic/views/cycle.php +++ b/web/skins/classic/views/cycle.php @@ -167,7 +167,7 @@ xhtmlHeaders(__FILE__, translate('CycleWatch'));
- +
From ef9fbac90cbf9158ea73ce161bccccf9d21a0350 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 2 Apr 2020 18:14:14 -0400 Subject: [PATCH 08/19] Add Noscript warnings. Whitespace, improve some logic --- .../classic/includes/export_functions.php | 154 +++++++++++------- 1 file changed, 98 insertions(+), 56 deletions(-) diff --git a/web/skins/classic/includes/export_functions.php b/web/skins/classic/includes/export_functions.php index d43c697e3..8fa7ff3fa 100644 --- a/web/skins/classic/includes/export_functions.php +++ b/web/skins/classic/includes/export_functions.php @@ -20,11 +20,12 @@ function exportHeader($title) { ?> + <?php echo $title ?> - -

: Name()) ?> ()

+

Name()).( (!empty($otherlinks)) .' ('.$otherlinks.') ':'') ?>

DefaultVideo() ) { @@ -252,7 +283,7 @@ function exportEventImages($event, $exportDetail, $exportFrames, $myfilelist) { } ?>
-