From 3be31020b79fb3b84d8230f2781bef312cb89563 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 14 Nov 2018 15:54:01 -0500 Subject: [PATCH 01/20] Automatically add width to frames view when thumbnails are turned on. --- web/skins/classic/js/base.js | 2 +- web/skins/classic/views/js/event.js | 2 +- web/skins/classic/views/js/event.js.php | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/js/base.js b/web/skins/classic/js/base.js index 9eb93ee77..fa59c8103 100644 --- a/web/skins/classic/js/base.js +++ b/web/skins/classic/js/base.js @@ -40,7 +40,7 @@ var popupSizes = { 'export': { 'width': 400, 'height': 340 }, 'filter': { 'width': 900, 'height': 700 }, 'frame': { 'addWidth': 32, 'minWidth': 384, 'addHeight': 200 }, - 'frames': { 'width': 600, 'height': 600 }, + 'frames': { 'addWidth': 600, 'addHeight': 600 }, 'function': { 'width': 350, 'height': 260 }, 'group': { 'width': 760, 'height': 600 }, 'groups': { 'width': 540, 'height': 420 }, diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js index e90016c1c..7f46936a9 100644 --- a/web/skins/classic/views/js/event.js +++ b/web/skins/classic/views/js/event.js @@ -887,7 +887,7 @@ function unarchiveEvent() { } function showEventFrames() { - createPopup( '?view=frames&eid='+eventData.Id, 'zmFrames', 'frames' ); + createPopup( '?view=frames&eid='+eventData.Id, 'zmFrames', 'frames', WEB_LIST_THUMB_WIDTH, WEB_LIST_THUMB_HEIGHT ); } function showStream() { diff --git a/web/skins/classic/views/js/event.js.php b/web/skins/classic/views/js/event.js.php index dbdc5c514..b1924a752 100644 --- a/web/skins/classic/views/js/event.js.php +++ b/web/skins/classic/views/js/event.js.php @@ -55,3 +55,5 @@ var streamMode = ''; // var deleteString = ""; var causeString = ""; +var WEB_LIST_THUMB_WIDTH = ''; +var WEB_LIST_THUMB_HEIGHT = ''; From 3a409b26aa897d5154ca6f211a1089ff0c6e88bb Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 14 Nov 2018 15:54:34 -0500 Subject: [PATCH 02/20] Use buttons instead of anchor tags for Prev/Next/FIrst/Last buttons --- web/skins/classic/views/frame.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/web/skins/classic/views/frame.php b/web/skins/classic/views/frame.php index 2e6bfb7b8..931951056 100644 --- a/web/skins/classic/views/frame.php +++ b/web/skins/classic/views/frame.php @@ -18,7 +18,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -if ( !canView( 'Events' ) ) { +if ( !canView('Events') ) { $view = 'error'; return; } @@ -29,7 +29,7 @@ $eid = validInt($_REQUEST['eid']); if ( !empty($_REQUEST['fid']) ) $fid = validInt($_REQUEST['fid']); -$Event = new Event( $eid ); +$Event = new Event($eid); $Monitor = $Event->Monitor(); if ( !empty($fid) ) { @@ -39,7 +39,7 @@ if ( !empty($fid) ) { } else { $frame = dbFetchOne( 'SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array( $eid, $Event->MaxScore() ) ); } -$Frame = new Frame( $frame ); +$Frame = new Frame($frame); $maxFid = $Event->Frames(); @@ -91,10 +91,10 @@ xhtmlHeaders(__FILE__, translate('Frame').' - '.$Event->Id()." - ".$Frame->Frame -
-

Id()."-".$Frame->FrameId()." (".$Frame->Score().")" ?>

- - +
+

Id().'-'.$Frame->FrameId().' ('.$Frame->Score().')' ?>

+ +
@@ -109,11 +109,13 @@ xhtmlHeaders(__FILE__, translate('Frame').' - '.$Event->Id()." - ".$Frame->Frame

FrameId() > 1 ) { ?> - - -FrameId() < $maxFid ) { ?> - - + + +FrameId() < $maxFid ) { ?> + +

From aa8ac9c31c65ae857024fb7a46a7ce9e60de025c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 14 Nov 2018 15:54:45 -0500 Subject: [PATCH 03/20] spaces and quotes --- web/skins/classic/views/frames.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/skins/classic/views/frames.php b/web/skins/classic/views/frames.php index c50da5e7e..f27f004c3 100644 --- a/web/skins/classic/views/frames.php +++ b/web/skins/classic/views/frames.php @@ -18,11 +18,11 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -if ( !canView( 'Events' ) ) { +if ( !canView('Events') ) { $view = 'error'; return; } -require_once( 'includes/Frame.php' ); +require_once('includes/Frame.php'); $Event = new Event( $_REQUEST['eid'] ); $sql = 'SELECT *, unix_timestamp( TimeStamp ) AS UnixTimeStamp FROM Frames WHERE EventID = ? ORDER BY FrameId'; @@ -30,7 +30,7 @@ $frames = dbFetchAll( $sql, NULL, array( $_REQUEST['eid'] ) ); $focusWindow = true; -xhtmlHeaders(__FILE__, translate('Frames')." - ".$Event->Id() ); +xhtmlHeaders(__FILE__, translate('Frames').' - '.$Event->Id() ); ?>
From 70d9fda7589b4d437d9bc305f5890b72895adde1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 14 Nov 2018 17:02:52 -0500 Subject: [PATCH 04/20] Implement a logging callback for avcodec to use our logging functions --- src/zm_ffmpeg.cpp | 39 ++++++++++++++++++++++++++++++++++++--- src/zm_logger.cpp | 1 + 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index 79a1d8b26..00aee7961 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -24,14 +24,47 @@ #if HAVE_LIBAVCODEC || HAVE_LIBAVUTIL || HAVE_LIBSWSCALE +void log_libav_callback( void *ptr, int level, const char *fmt, va_list vargs ) { + Logger *log = Logger::fetch(); + int log_level = 0; + if ( level == AV_LOG_QUIET ) { // -8 + log_level = Logger::NOLOG; + } else if ( level == AV_LOG_PANIC ) { //0 + log_level = Logger::PANIC; + } else if ( level == AV_LOG_FATAL ) { // 8 + log_level = Logger::FATAL; + } else if ( level == AV_LOG_ERROR ) { // 16 + log_level = Logger::ERROR; + } else if ( level == AV_LOG_WARNING ) { //24 + log_level = Logger::WARNING; + } else if ( level == AV_LOG_INFO ) { //32 + log_level = Logger::INFO; + } else if ( level == AV_LOG_VERBOSE ) { //40 + log_level = Logger::DEBUG1; + } else if ( level == AV_LOG_DEBUG ) { //48 + log_level = Logger::DEBUG2; + } else if ( level == AV_LOG_TRACE ) { + log_level = Logger::DEBUG8; + } else if ( level == AV_LOG_MAX_OFFSET ) { + log_level = Logger::DEBUG9; + } else { + Error("Unknown log level %d", level); + } + + if ( log ) { + log->logPrint(false, __FILE__, __LINE__, log_level, fmt, vargs); + } +} + void FFMPEGInit() { static bool bInit = false; if ( !bInit ) { - //if ( logDebugging() ) - //av_log_set_level( AV_LOG_DEBUG ); - //else + if ( logDebugging() ) + av_log_set_level( AV_LOG_DEBUG ); + else av_log_set_level( AV_LOG_QUIET ); + av_log_set_callback(log_libav_callback); av_register_all(); avformat_network_init(); bInit = true; diff --git a/src/zm_logger.cpp b/src/zm_logger.cpp index 736d36377..9740a100f 100644 --- a/src/zm_logger.cpp +++ b/src/zm_logger.cpp @@ -581,6 +581,7 @@ void Logger::logPrint( bool hex, const char * const filepath, const int line, co } } + void logInit(const char *name, const Logger::Options &options) { if ( !Logger::smInstance ) Logger::smInstance = new Logger(); From f2fc2348801a5c79b1858d9d027cf99e05f7317b Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 15 Nov 2018 08:26:54 -0600 Subject: [PATCH 05/20] rpm pkg - install zm php-fpm config in all cases for future nginx support --- distros/redhat/CMakeLists.txt | 6 ++---- distros/redhat/zoneminder.spec | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/distros/redhat/CMakeLists.txt b/distros/redhat/CMakeLists.txt index d940942c1..0b4938661 100644 --- a/distros/redhat/CMakeLists.txt +++ b/distros/redhat/CMakeLists.txt @@ -15,11 +15,11 @@ endif((NOT ZM_TARGET_DISTRO MATCHES "^fc") AND (ZM_WEB_USER STREQUAL "nginx")) # Configure the zoneminder service files configure_file(systemd/zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY) +configure_file(nginx/zoneminder.php-fpm.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.php-fpm.conf @ONLY) if(ZM_WEB_USER STREQUAL "nginx") configure_file(nginx/zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY) configure_file(nginx/zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.conf @ONLY) configure_file(nginx/zoneminder.tmpfiles.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.tmpfiles @ONLY) - configure_file(nginx/zoneminder.php-fpm.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.php-fpm.conf @ONLY) configure_file(nginx/README.Fedora ${CMAKE_CURRENT_SOURCE_DIR}/readme/README COPYONLY) else(ZM_WEB_USER STREQUAL "nginx") configure_file(systemd/zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY) @@ -55,10 +55,8 @@ install(FILES misc/redalert.wav DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INST # Install zoneminder service files install(FILES zoneminder.logrotate DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) install(FILES zoneminder.conf DESTINATION /etc/zm/www PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) +install(FILES zoneminder.php-fpm.conf DESTINATION /etc/zm/www PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) -if(ZM_WEB_USER STREQUAL "nginx") - install(FILES zoneminder.php-fpm.conf DESTINATION /etc/php-fpm.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME zoneminder.conf) -endif(ZM_WEB_USER STREQUAL "nginx") install(FILES zoneminder.service DESTINATION /usr/lib/systemd/system PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) install(FILES zoneminder.tmpfiles DESTINATION /usr/lib/tmpfiles.d RENAME zoneminder.conf PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index ecba0fb5a..f594635ae 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -264,13 +264,10 @@ EOF %config(noreplace) %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/conf.d/*.conf %ghost %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/conf.d/zmcustom.conf -%config(noreplace) %attr(644,root,root) /etc/zm/www/zoneminder.conf +%config(noreplace) %attr(644,root,root) %{_sysconfdir}/zm/www/zoneminder.conf +%config(noreplace) %{_sysconfdir}/www/zoneminder.php-fpm.conf %config(noreplace) %{_sysconfdir}/logrotate.d/zoneminder -%if 0%{?with_nginx} -%config(noreplace) %{_sysconfdir}/php-fpm.d/zoneminder.conf -%endif - %{_tmpfilesdir}/zoneminder.conf %{_unitdir}/zoneminder.service %{_datadir}/polkit-1/actions/com.zoneminder.systemctl.policy From 2f8c0654d5aab9bd2200cd63f29b1ce319d52564 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 15 Nov 2018 08:31:04 -0600 Subject: [PATCH 06/20] rpm pkg - fix for zm php-fpm config path --- distros/redhat/zoneminder.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index f594635ae..27cc59ba9 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -265,7 +265,7 @@ EOF %ghost %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/conf.d/zmcustom.conf %config(noreplace) %attr(644,root,root) %{_sysconfdir}/zm/www/zoneminder.conf -%config(noreplace) %{_sysconfdir}/www/zoneminder.php-fpm.conf +%config(noreplace) %{_sysconfdir}/zm/www/zoneminder.php-fpm.conf %config(noreplace) %{_sysconfdir}/logrotate.d/zoneminder %{_tmpfilesdir}/zoneminder.conf From 9b46c92ac559348e31e4c965a4cb10272efb2e7f Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 15 Nov 2018 09:19:26 -0600 Subject: [PATCH 07/20] rpm pkg - add note to zm php-fpm config file --- distros/redhat/nginx/zoneminder.php-fpm.conf.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/distros/redhat/nginx/zoneminder.php-fpm.conf.in b/distros/redhat/nginx/zoneminder.php-fpm.conf.in index ffc44bbe0..a4537b236 100644 --- a/distros/redhat/nginx/zoneminder.php-fpm.conf.in +++ b/distros/redhat/nginx/zoneminder.php-fpm.conf.in @@ -1,3 +1,5 @@ +; This config file is needed when using ZoneMinder with web servers other +; than Apache. You can ignore this file if you are using Apache web server. ; Change the user and group of the default pool to the web server account [www] From f72651da5a3ab9f20fb1a21c8c8356815f322f4e Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 15 Nov 2018 12:22:35 -0500 Subject: [PATCH 08/20] Add auth hash to ajax fps and status calls in zone edit --- web/skins/classic/views/js/zone.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/skins/classic/views/js/zone.js b/web/skins/classic/views/js/zone.js index 6389e3ce9..bfcd91943 100644 --- a/web/skins/classic/views/js/zone.js +++ b/web/skins/classic/views/js/zone.js @@ -471,6 +471,8 @@ function setAlarmState( currentAlarmState ) { } var streamCmdParms = "view=request&request=stream&connkey="+connKey; +if ( auth_hash ) + streamCmdParms += '&auth='+auth_hash; var streamCmdReq = new Request.JSON( { url: monitorUrl, method: 'get', @@ -552,6 +554,8 @@ function streamCmdQuery() { } var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate"; +if ( auth_hash ) + statusCmdParms += '&auth='+auth_hash; var statusCmdReq = new Request.JSON( { url: monitorUrl, method: 'get', From 415d43fafbde7151ac62053882414bd178318806 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 15 Nov 2018 12:23:52 -0500 Subject: [PATCH 09/20] Include Server Name when testing for CORS. Also be case insensitive. --- web/includes/functions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 7fe174470..53ea7e199 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -47,7 +47,11 @@ function CORSHeaders() { return; } foreach( $Servers as $Server ) { - if ( preg_match('/^(https?:\/\/)?'.preg_quote($Server->Hostname(),'/').'/', $_SERVER['HTTP_ORIGIN']) ) { + if ( + preg_match('/^(https?:\/\/)?'.preg_quote($Server->Hostname(),'/').'/i', $_SERVER['HTTP_ORIGIN']) + or + preg_match('/^(https?:\/\/)?'.preg_quote($Server->Name(),'/').'/i', $_SERVER['HTTP_ORIGIN']) + ) { $valid = true; Logger::Debug("Setting Access-Controll-Allow-Origin from " . $_SERVER['HTTP_ORIGIN']); header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']); From 5c2e5d89ed5fbf394cac971e6ff86cb3070e5011 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 15 Nov 2018 19:53:45 -0600 Subject: [PATCH 10/20] fix gpl mailing address This makes rpmlint & lintian complain less --- web/skins/classic/views/storage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/views/storage.php b/web/skins/classic/views/storage.php index dafd7bb67..3aecdb042 100644 --- a/web/skins/classic/views/storage.php +++ b/web/skins/classic/views/storage.php @@ -15,7 +15,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // if ( !canEdit( 'System' ) ) { From e5f2212a32bd9ccb32c793f12a8c3e7aae5d3925 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 15 Nov 2018 20:00:53 -0600 Subject: [PATCH 11/20] fix gpl mailing address --- scripts/ZoneMinder/lib/ZoneMinder/Control/IPCAMIOS.pm | 2 +- scripts/ZoneMinder/lib/ZoneMinder/Control/Reolink.pm | 2 +- scripts/ZoneMinder/lib/ZoneMinder/Storage.pm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/IPCAMIOS.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/IPCAMIOS.pm index 8465ee472..ec3bbfc70 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/IPCAMIOS.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/IPCAMIOS.pm @@ -16,7 +16,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # ========================================================================== # diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Reolink.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Reolink.pm index 370d463c3..7a2f72fc6 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/Reolink.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Reolink.pm @@ -16,7 +16,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # ========================================================================== # diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Storage.pm b/scripts/ZoneMinder/lib/ZoneMinder/Storage.pm index 134752594..1f7c1b9fe 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Storage.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Storage.pm @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # ========================================================================== # From 8df9e4c1ee23ebe2142bcaed101c567007539d60 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 15 Nov 2018 20:18:56 -0600 Subject: [PATCH 12/20] Update zoneminder.logrotate.in --- distros/redhat/systemd/zoneminder.logrotate.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/distros/redhat/systemd/zoneminder.logrotate.in b/distros/redhat/systemd/zoneminder.logrotate.in index b4919eb5e..210a84c07 100644 --- a/distros/redhat/systemd/zoneminder.logrotate.in +++ b/distros/redhat/systemd/zoneminder.logrotate.in @@ -2,7 +2,11 @@ missingok notifempty sharedscripts + delaycompress + compress postrotate - @BINDIR@/zmpkg.pl logrot 2> /dev/null > /dev/null || : + @BINDIR@/zmpkg.pl logrot > /dev/null 2>/dev/null || true endscript + daily + rotate 7 } From b353b625eb48751d0e1b6f72fe1f5440d8c7cccc Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 16 Nov 2018 10:40:39 -0600 Subject: [PATCH 13/20] rpm - configure the nginx config file in all cases --- distros/redhat/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distros/redhat/CMakeLists.txt b/distros/redhat/CMakeLists.txt index 0b4938661..37643cd89 100644 --- a/distros/redhat/CMakeLists.txt +++ b/distros/redhat/CMakeLists.txt @@ -16,9 +16,9 @@ endif((NOT ZM_TARGET_DISTRO MATCHES "^fc") AND (ZM_WEB_USER STREQUAL "nginx")) # Configure the zoneminder service files configure_file(systemd/zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY) configure_file(nginx/zoneminder.php-fpm.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.php-fpm.conf @ONLY) +configure_file(nginx/zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.nginx.conf @ONLY) if(ZM_WEB_USER STREQUAL "nginx") configure_file(nginx/zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY) - configure_file(nginx/zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.conf @ONLY) configure_file(nginx/zoneminder.tmpfiles.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.tmpfiles @ONLY) configure_file(nginx/README.Fedora ${CMAKE_CURRENT_SOURCE_DIR}/readme/README COPYONLY) else(ZM_WEB_USER STREQUAL "nginx") @@ -56,7 +56,7 @@ install(FILES misc/redalert.wav DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INST install(FILES zoneminder.logrotate DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) install(FILES zoneminder.conf DESTINATION /etc/zm/www PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) install(FILES zoneminder.php-fpm.conf DESTINATION /etc/zm/www PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) - +install(FILES zoneminder.nginx.conf DESTINATION /etc/zm/www PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) install(FILES zoneminder.service DESTINATION /usr/lib/systemd/system PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) install(FILES zoneminder.tmpfiles DESTINATION /usr/lib/tmpfiles.d RENAME zoneminder.conf PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) From 713e810632b09c25ccd6838f0a832da48518a471 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 16 Nov 2018 17:08:23 -0600 Subject: [PATCH 14/20] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 40 +++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 4e33ce4e0..512b5df1f 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,23 +1,43 @@ -You should only file an issue if you found a bug. Feature and enhancement requests, general discussions and support questions should occur in one of the following areas: +**THIS FORUM IS FOR BUG REPORTS ONLY** + +Do not post feature or enhancement requests, general discussions or support questions here. + +Feature and enhancement requests, general discussions and support questions should occur in one of the following areas: - The [ZoneMinder-Chat Slack channel](https://zoneminder-chat.herokuapp.com/) - The [ZoneMinder Forum](https://forums.zoneminder.com/) -**Do not post feature or enhancement requests, general discussions or support questions here.** - Docker related issues should be posted here: https://github.com/ZoneMinder/zmdockerfiles -Make sure you are running the latest version of ZoneMinder before reporting an issue. +In order to submit a bug report, please populate the field below. This is required. -**ZoneMinder Version (`zmaudit.pl -v`):** +**Describe Your Environment** +- Version of ZoneMinder [release version, development version, or commit] +- How you installed ZoneMinder [e.g. PPA, RPMFusion, from-source, etc] +- Full name and version of OS -**Are you using a development snapshot / git checkout? If so, what is the latest commit? (`git rev-parse HEAD`):** +**If the issue concerns a camera** +- Make and Model +- frame rate +- resolution +- ZoneMinder Source Type: -**Linux Distribution and Version (`cat /etc/os-release` or `cat /etc/redhat-release`):** +**Describe the bug** +A clear and concise description of what the bug is. -**If the issue concerns a camera, provide the make, model, frame rate, resolution and ZoneMinder Source Type:** +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error -**Relevant log lines:** +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Debug Logs** ``` -log lines here + + + ``` From 6883d5b532e08f88993b5c951784929a189a18f5 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 16 Nov 2018 17:11:05 -0600 Subject: [PATCH 15/20] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 512b5df1f..f52716c2d 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -2,14 +2,14 @@ Do not post feature or enhancement requests, general discussions or support questions here. -Feature and enhancement requests, general discussions and support questions should occur in one of the following areas: +Feature and enhancement requests, general discussions, and support questions should occur in one of the following areas: - The [ZoneMinder-Chat Slack channel](https://zoneminder-chat.herokuapp.com/) - The [ZoneMinder Forum](https://forums.zoneminder.com/) Docker related issues should be posted here: https://github.com/ZoneMinder/zmdockerfiles -In order to submit a bug report, please populate the field below. This is required. +In order to submit a bug report, please populate the fields below. This is required. **Describe Your Environment** - Version of ZoneMinder [release version, development version, or commit] From 15e720d4f7782c8f2355736509c6b3fee080e716 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 16 Nov 2018 17:50:54 -0600 Subject: [PATCH 16/20] Create config.yml --- .github/config.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/config.yml diff --git a/.github/config.yml b/.github/config.yml new file mode 100644 index 000000000..543a2c160 --- /dev/null +++ b/.github/config.yml @@ -0,0 +1,21 @@ +# Configuration for welcome - https://github.com/behaviorbot/welcome + +# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome + +# Comment to be posted to on first time issues +newIssueWelcomeComment: > + Thanks for opening your first issue here! Just a reminder, this forum is for Bug Reports only. Be sure to follow the issue template! + +# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome + +# Comment to be posted to on PRs from first time contributors in your repository +#newPRWelcomeComment: > +# Thanks for opening this pull request! Please check out our contributing guidelines. + +# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge + +# Comment to be posted to on pull requests merged by a first time user +#firstPRMergeComment: > +# Congrats on merging your first pull request! We here at behaviorbot are proud of you! + +# It is recommend to include as many gifs and emojis as possible From 21d311942fdf32b9a879e488a445cc472a8480c3 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 16 Nov 2018 17:54:24 -0600 Subject: [PATCH 17/20] Create no-response.yml --- .github/no-response.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/no-response.yml diff --git a/.github/no-response.yml b/.github/no-response.yml new file mode 100644 index 000000000..7e40c036f --- /dev/null +++ b/.github/no-response.yml @@ -0,0 +1,13 @@ +# Configuration for probot-no-response - https://github.com/probot/no-response + +# Number of days of inactivity before an Issue is closed for lack of response +daysUntilClose: 7 +# Label requiring a response +responseRequiredLabel: more-information-needed +# Comment to post when closing an Issue for lack of response. Set to `false` to disable +closeComment: > + This issue has been automatically closed because there has been no response + to our request for more information from the original author. With only the + information that is currently in the issue, we don't have enough information + to take action. Please reach out if you have or find the answers we need so + that we can investigate further. From b4f77077e9aeffec8b92f163eb29f3e325462989 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 16 Nov 2018 18:33:54 -0600 Subject: [PATCH 18/20] Update zmdc.pl.in temporary fix to #2292 --- scripts/zmdc.pl.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/zmdc.pl.in b/scripts/zmdc.pl.in index ac83fa6d6..4b32b3a65 100644 --- a/scripts/zmdc.pl.in +++ b/scripts/zmdc.pl.in @@ -438,7 +438,7 @@ sub start { $dbh = zmDbConnect(1); # This logReinit is required. Not sure why. - #logReinit(); + logReinit(); $process->{pid} = $cpid; $process->{started} = time(); From 87140ecdb59d60c2f845e082bf94fae5094da28f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 17 Nov 2018 10:39:42 -0500 Subject: [PATCH 19/20] white space and quiet warning --- src/zm_event.cpp | 2 +- web/skins/classic/views/zone.php | 64 ++++++++++++++++---------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 8d3108b31..fbf5cf848 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -174,7 +174,7 @@ Event::Event( Error("Can't mkdir %s: %s", path, strerror(errno)); } } else { - path_ptr += snprintf(path, sizeof(path), "/%" PRIu64, id); + snprintf(path, sizeof(path), "/%" PRIu64, id); if ( mkdir(path, 0755) ) { if ( errno != EEXIST ) Error("Can't mkdir %s: %s", path, strerror(errno)); diff --git a/web/skins/classic/views/zone.php b/web/skins/classic/views/zone.php index f6a763c19..6c04abf2f 100644 --- a/web/skins/classic/views/zone.php +++ b/web/skins/classic/views/zone.php @@ -62,39 +62,39 @@ $minY = 0; $maxY = $monitor->Height()-1; if ( !isset($newZone) ) { - if ( $zid > 0 ) { - $zone = dbFetchOne( 'SELECT * FROM Zones WHERE MonitorId = ? AND Id=?', NULL, array( $monitor->Id(), $zid ) ); - } else { - $zone = array( - 'Id' => 0, - 'Name' => translate('New'), - 'Type' => 'Active', - 'MonitorId' => $monitor->Id(), - 'NumCoords' => 4, - 'Coords' => sprintf( "%d,%d %d,%d, %d,%d %d,%d", $minX, $minY, $maxX, $minY, $maxX, $maxY, $minX, $maxY ), - 'Area' => $monitor->Width() * $monitor->Height(), - 'AlarmRGB' => 0xff0000, - 'CheckMethod' => 'Blobs', - 'MinPixelThreshold' => '', - 'MaxPixelThreshold' => '', - 'MinAlarmPixels' => '', - 'MaxAlarmPixels' => '', - 'FilterX' => '', - 'FilterY' => '', - 'MinFilterPixels' => '', - 'MaxFilterPixels' => '', - 'MinBlobPixels' => '', - 'MaxBlobPixels' => '', - 'MinBlobs' => '', - 'MaxBlobs' => '', - 'OverloadFrames' => '', - 'ExtendAlarmFrames' => '', - ); - } - $zone['Points'] = coordsToPoints( $zone['Coords'] ); - $zone['AreaCoords'] = preg_replace( '/\s+/', ',', $zone['Coords'] ); + if ( $zid > 0 ) { + $zone = dbFetchOne( 'SELECT * FROM Zones WHERE MonitorId = ? AND Id=?', NULL, array( $monitor->Id(), $zid ) ); + } else { + $zone = array( + 'Id' => 0, + 'Name' => translate('New'), + 'Type' => 'Active', + 'MonitorId' => $monitor->Id(), + 'NumCoords' => 4, + 'Coords' => sprintf( "%d,%d %d,%d, %d,%d %d,%d", $minX, $minY, $maxX, $minY, $maxX, $maxY, $minX, $maxY ), + 'Area' => $monitor->Width() * $monitor->Height(), + 'AlarmRGB' => 0xff0000, + 'CheckMethod' => 'Blobs', + 'MinPixelThreshold' => '', + 'MaxPixelThreshold' => '', + 'MinAlarmPixels' => '', + 'MaxAlarmPixels' => '', + 'FilterX' => '', + 'FilterY' => '', + 'MinFilterPixels' => '', + 'MaxFilterPixels' => '', + 'MinBlobPixels' => '', + 'MaxBlobPixels' => '', + 'MinBlobs' => '', + 'MaxBlobs' => '', + 'OverloadFrames' => '', + 'ExtendAlarmFrames' => '', + ); + } + $zone['Points'] = coordsToPoints( $zone['Coords'] ); + $zone['AreaCoords'] = preg_replace( '/\s+/', ',', $zone['Coords'] ); - $newZone = $zone; + $newZone = $zone; } # end if new Zone # Ensure Zone fits within the limits of the Monitor From 73d27f50954142cf26c019220f94d5435f227ad0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 23 Nov 2018 10:10:50 -0500 Subject: [PATCH 20/20] Add code to see if a db event is stored at the wrong storage area --- scripts/zmaudit.pl.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/zmaudit.pl.in b/scripts/zmaudit.pl.in index 7a5017fbd..c467d26e3 100644 --- a/scripts/zmaudit.pl.in +++ b/scripts/zmaudit.pl.in @@ -531,6 +531,19 @@ MAIN: while( $loop ) { next; } Debug("Event $db_event is not in fs. Should have been at ".$Event->Path()); + # Check for existence in other Storage Areas + foreach my $Storage ( ZoneMinder::Storage->find( ( $$Event{StorageId} ? ( 'Id !='=>$$Event{StorageId} ) : () ) ) ) { + my $path = $Storage->Path().'/'.$Event->RelativePath(); + if ( -e $path ) { + Info("Event $$Event{Id} found at $path instead of $$Event{Path}"); + if ( confirm() ) { + $Event->save({StorageId=>$$Storage{Id}}); + last; + } + } else { + Debug("$$Event{Id} Not found at $path"); + } + } if ( $Event->Archived() ) { Warning("Event $$Event{Id} is Archived. Taking no further action on it."); next;