From aaf8f6c98b4236f82fe4abbf171928d624a72080 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 18 Oct 2016 10:14:19 -0400 Subject: [PATCH 001/141] add the missing case for ServerId in Filter processing. --- web/includes/functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/includes/functions.php b/web/includes/functions.php index 9b5d1e8f1..7ec725a4a 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1196,6 +1196,9 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&' ) { case 'MonitorName': $filter['sql'] .= 'M.'.preg_replace( '/^Monitor/', '', $filter['terms'][$i]['attr'] ); break; + case 'ServerId': + $filter['sql'] .= 'M.ServerId'; + break; case 'DateTime': $filter['sql'] .= "E.StartTime"; break; @@ -1241,6 +1244,13 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&' ) { case 'Notes': $value = dbEscape($value); break; + case 'ServerId': + if ( $value == 'ZM_SERVER_ID' ) { + $value = ZM_SERVER_ID; + } else { + $value = dbEscape($value); + } + break; case 'DateTime': $value = "'".strftime( STRF_FMT_DATETIME_DB, strtotime( $value ) )."'"; break; From 9748b9346e8d34e7057c16fc25f59534badb9aa6 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 8 Jan 2017 16:52:16 -0500 Subject: [PATCH 002/141] bump required version to 3.1 so that we can use a simple statement to turn on c++11 features --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index baba4218d..a70ebe8e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,12 @@ # Created by mastertheknife (Kfir Itzhak) # For more information and installation, see the INSTALL file # -cmake_minimum_required (VERSION 2.8.7) +cmake_minimum_required (VERSION 3.1.0) project (zoneminder) file (STRINGS "version" zoneminder_VERSION) # make API version a minor of ZM version set(zoneminder_API_VERSION "${zoneminder_VERSION}.1") +set (CMAKE_CXX_STANDARD 11) # Make sure the submodules are there if( NOT EXISTS "${CMAKE_SOURCE_DIR}/web/api/app/Plugin/Crud/Lib/CrudControllerTrait.php" ) From 8f3e40d7af19c78676f72c304cb4b8e7366a7e9a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 8 Jan 2017 16:53:15 -0500 Subject: [PATCH 003/141] add a const array of char * strings for the frame types so that we can make better use of the FrameType enum for more efficient code --- src/zm_event.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/zm_event.h b/src/zm_event.h index 901e5dc52..37cb69c64 100644 --- a/src/zm_event.h +++ b/src/zm_event.h @@ -64,7 +64,8 @@ public: typedef std::map StringSetMap; protected: - typedef enum { NORMAL, BULK, ALARM } FrameType; + typedef enum { NORMAL=0, BULK, ALARM } FrameType; + static const constexpr char * const frame_type_names[] = { "Normal", "Bulk", "Alarm" }; struct PreAlarmData { From 8ae02b9ac000dbf99948706c2d699224a4f516ee Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 8 Jan 2017 16:53:29 -0500 Subject: [PATCH 004/141] use a FrameType enum instead of string comparisons --- src/zm_event.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 9b6202966..7902f5036 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -566,17 +566,17 @@ void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image * struct DeltaTimeval delta_time; DELTA_TIMEVAL( delta_time, timestamp, start_time, DT_PREC_2 ); - const char *frame_type = score>0?"Alarm":(score<0?"Bulk":"Normal"); + FrameType frame_type = score>0?ALARM:(score<0?BULK:NORMAL); if ( score < 0 ) score = 0; - bool db_frame = (strcmp(frame_type,"Bulk") != 0) || ((frames%config.bulk_frame_interval)==0) || !frames; + bool db_frame = ( frame_type != BULK ) || ((frames%config.bulk_frame_interval)==0) || !frames; if ( db_frame ) { - Debug( 1, "Adding frame %d of type \"%s\" to DB", frames, frame_type ); + Debug( 1, "Adding frame %d of type \"%s\" to DB", frames, frame_type_names[frame_type] ); static char sql[ZM_SQL_MED_BUFSIZ]; - snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, Type, TimeStamp, Delta, Score ) values ( %d, %d, '%s', from_unixtime( %ld ), %s%ld.%02ld, %d )", id, frames, frame_type, timestamp.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, score ); + snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, Type, TimeStamp, Delta, Score ) values ( %d, %d, '%s', from_unixtime( %ld ), %s%ld.%02ld, %d )", id, frames, frame_type_names[frame_type], timestamp.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, score ); if ( mysql_query( &dbconn, sql ) ) { Error( "Can't insert frame: %s", mysql_error( &dbconn ) ); @@ -585,7 +585,7 @@ void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image * last_db_frame = frames; // We are writing a Bulk frame - if ( !strcmp( frame_type,"Bulk") ) + if ( frame_type == BULK ) { snprintf( sql, sizeof(sql), "update Events set Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, id ); if ( mysql_query( &dbconn, sql ) ) @@ -598,8 +598,8 @@ void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image * end_time = timestamp; - // We are writing an Alarm frame - if ( !strcmp( frame_type,"Alarm") ) + // We are writing an Alarm frame + if ( frame_type == ALARM ) { alarm_frames++; From aae4a1f83b09d31ec42d49e594e21f30f2829bee Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 4 Feb 2017 11:20:21 -0500 Subject: [PATCH 005/141] remove extraneous setting of NULL to videowriter which is already NULL --- src/zm_event.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 61fa6c926..a174ea4be 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -57,6 +57,7 @@ char Event::general_file_format[PATH_MAX]; char Event::video_file_format[PATH_MAX]; int Event::pre_alarm_count = 0; + Event::PreAlarmData Event::pre_alarm_data[MAX_PRE_ALARM_FRAMES] = { { 0 } }; Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string &p_cause, const StringSetMap &p_noteSetMap, bool p_videoEvent ) : @@ -192,7 +193,6 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string #if ZM_HAVE_VIDEOWRITER_X264MP4 videowriter = new X264MP4Writer(video_file, monitor->Width(), monitor->Height(), monitor->Colours(), monitor->SubpixelOrder(), monitor->GetOptEncoderParams()); #else - videowriter = NULL; Error("ZoneMinder was not compiled with the X264 MP4 video writer, check dependencies (x264 and mp4v2)"); #endif } From c72704bf0bb6366af38d601c7d4fc4ba758f4693 Mon Sep 17 00:00:00 2001 From: SteveGilvarry Date: Sun, 5 Feb 2017 15:34:06 +1100 Subject: [PATCH 006/141] Change descriptions for ffmpeg methods and put TCP first. --- web/skins/classic/views/monitor.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 5ef870a63..c3e9a8450 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -242,6 +242,13 @@ $rtspMethods = array( "rtpRtspHttp" => "RTP/RTSP/HTTP" ); +$rtspFFMpegMethods = array( + "rtpRtsp" => "TCP", + "rtpUni" => "UDP", + "rtpMulti" => "UDP Multicast", + "rtpRtspHttp" => "HTTP Tunnel" +); + $httpMethods = array( "simple" => "Simple", "regexp" => "Regexp", @@ -858,7 +865,7 @@ switch ( $tab ) { ?> - +  () Date: Sun, 5 Feb 2017 18:43:47 +1100 Subject: [PATCH 007/141] Add Option help --- web/lang/en_gb.php | 8 ++++++++ web/skins/classic/views/monitor.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/web/lang/en_gb.php b/web/lang/en_gb.php index 4adb1fc7f..c57d63aea 100644 --- a/web/lang/en_gb.php +++ b/web/lang/en_gb.php @@ -614,6 +614,7 @@ $SLANG = array( 'Rewind' => 'Rewind', 'RotateLeft' => 'Rotate Left', 'RotateRight' => 'Rotate Right', + 'RTSPTransport' => 'RTSP Transport Protocol', 'RunLocalUpdate' => 'Please run zmupdate.pl to update', 'RunMode' => 'Run Mode', 'Running' => 'Running', @@ -903,6 +904,13 @@ $OLANG = array( "\"reorder_queue_size=nnn\" Set number of packets to buffer for handling of reordered packets~~~~". "\"loglevel=debug\" Set verbosity of FFmpeg (quiet, panic, fatal, error, warning, info, verbose, debug)" ), + 'OPTIONS_RTSPTrans' => array( + 'Help' => "This sets the lower RTSP Transport Protocol for FFmpeg.~~ ". + "TCP - Use TCP (interleaving within the RTSP control channel) as lower transport protocol.~~". + "UDP - Use UDP as lower transport protocol~~". + "UDP Multicast - Use UDP Multicast as lower transport protocol~~". + "HTTP - Use HTTP tunneling as lower transport protocol, which is useful for passing proxies.~~" + ), 'OPTIONS_LIBVLC' => array( 'Help' => "Parameters in this field are passed on to libVLC. Multiple parameters can be separated by ,~~ ". "Examples (do not enter quotes)~~~~". diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index c3e9a8450..efb80fdfc 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -865,7 +865,7 @@ switch ( $tab ) { ?> - +  ()  () Date: Mon, 6 Feb 2017 08:01:04 +1100 Subject: [PATCH 008/141] Wording of help text fixes --- web/lang/en_gb.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/lang/en_gb.php b/web/lang/en_gb.php index c57d63aea..906548063 100644 --- a/web/lang/en_gb.php +++ b/web/lang/en_gb.php @@ -905,11 +905,11 @@ $OLANG = array( "\"loglevel=debug\" Set verbosity of FFmpeg (quiet, panic, fatal, error, warning, info, verbose, debug)" ), 'OPTIONS_RTSPTrans' => array( - 'Help' => "This sets the lower RTSP Transport Protocol for FFmpeg.~~ ". - "TCP - Use TCP (interleaving within the RTSP control channel) as lower transport protocol.~~". - "UDP - Use UDP as lower transport protocol~~". - "UDP Multicast - Use UDP Multicast as lower transport protocol~~". - "HTTP - Use HTTP tunneling as lower transport protocol, which is useful for passing proxies.~~" + 'Help' => "This sets the RTSP Transport Protocol for FFmpeg.~~ ". + "TCP - Use TCP (interleaving within the RTSP control channel) as transport protocol.~~". + "UDP - Use UDP as transport protocol. Higher resolution cameras have experienced some 'smearing' while using UDP, if so try TCP~~". + "UDP Multicast - Use UDP Multicast as transport protocol~~". + "HTTP - Use HTTP tunneling as transport protocol, which is useful for passing proxies.~~" ), 'OPTIONS_LIBVLC' => array( 'Help' => "Parameters in this field are passed on to libVLC. Multiple parameters can be separated by ,~~ ". From 0f7910cabf6cda081d6d26d4117c2aaae1ec3a4c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 14 Feb 2017 11:54:35 -0500 Subject: [PATCH 009/141] try custom --- distros/ubuntu1604/source/format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/ubuntu1604/source/format b/distros/ubuntu1604/source/format index af745b310..710c0ea0b 100644 --- a/distros/ubuntu1604/source/format +++ b/distros/ubuntu1604/source/format @@ -1 +1 @@ -3.0 (git) +3.0 (custom) From 60b78ea2226f62e46da4240e85b994fc2a80188e Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 14 Feb 2017 11:56:20 -0500 Subject: [PATCH 010/141] go back to quilt --- distros/ubuntu1604/source/format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/ubuntu1604/source/format b/distros/ubuntu1604/source/format index 710c0ea0b..163aaf8d8 100644 --- a/distros/ubuntu1604/source/format +++ b/distros/ubuntu1604/source/format @@ -1 +1 @@ -3.0 (custom) +3.0 (quilt) From 706f7239c5f2e0e38d3108498b5e824c0612198a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 14 Feb 2017 11:57:34 -0500 Subject: [PATCH 011/141] go back to 1.0 --- distros/ubuntu1604/source/format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/ubuntu1604/source/format b/distros/ubuntu1604/source/format index 163aaf8d8..d3827e75a 100644 --- a/distros/ubuntu1604/source/format +++ b/distros/ubuntu1604/source/format @@ -1 +1 @@ -3.0 (quilt) +1.0 From cfb18a05ba1adf04ca14ef363809cb93c6593ebb Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 14 Feb 2017 12:14:28 -0500 Subject: [PATCH 012/141] build in auto snapshot from date --- utils/do_debian_package.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index 2b649a3a1..d518facde 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -87,6 +87,9 @@ else echo "Defaulting to master branch"; BRANCH="master"; fi; + if [ "$SNAPSHOT" == "NOW" ]; then + SNAPSHOT=`date +%Y%m%d%H%M%S`; + fi; fi; fi From 2bf4b5ad1aef3e83849c5487f3746a2cb684749a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 15 Feb 2017 09:45:25 -0500 Subject: [PATCH 013/141] use escapeshellarg on inputs to daemonControl and other functions where exec is called --- web/includes/functions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 970a5a822..eaff22795 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -832,9 +832,9 @@ function packageControl( $command ) { function daemonControl( $command, $daemon=false, $args=false ) { $string = ZM_PATH_BIN."/zmdc.pl $command"; if ( $daemon ) { - $string .= " $daemon"; + $string .= escapeshellarg(" $daemon"); if ( $args ) { - $string .= " $args"; + $string .= escapeshellarg(" $args"); } } $string .= " 2>/dev/null >&- <&- >/dev/null"; @@ -944,9 +944,9 @@ function zmaStatus( $monitor ) { function daemonCheck( $daemon=false, $args=false ) { $string = ZM_PATH_BIN."/zmdc.pl check"; if ( $daemon ) { - $string .= " $daemon"; + $string .= escapeshellarg(" $daemon"); if ( $args ) - $string .= " $args"; + $string .= escapeshellarg(" $args"); } $result = exec( $string ); return( preg_match( '/running/', $result ) ); @@ -1447,7 +1447,7 @@ function getDiskPercent($path = ZM_DIR_EVENTS) { } function getDiskBlocks() { - $df = shell_exec( 'df '.ZM_DIR_EVENTS ); + $df = shell_exec( 'df '.escapeshellarg(ZM_DIR_EVENTS) ); $space = -1; if ( preg_match( '/\s(\d+)\s+\d+\s+\d+%/ms', $df, $matches ) ) $space = $matches[1]; From 4792d21a68ac3e1290a499a3d023ba32fcc9d99b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 15 Feb 2017 10:56:38 -0500 Subject: [PATCH 014/141] use source format 1.0 --- distros/ubuntu1604/source/format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/ubuntu1604/source/format b/distros/ubuntu1604/source/format index 89ae9db8f..d3827e75a 100644 --- a/distros/ubuntu1604/source/format +++ b/distros/ubuntu1604/source/format @@ -1 +1 @@ -3.0 (native) +1.0 From 78612e39257da24a8385a31e2e5b16cc86ba30db Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 15 Feb 2017 11:25:11 -0500 Subject: [PATCH 015/141] use format 1.0 --- distros/ubuntu1604/source/format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/ubuntu1604/source/format b/distros/ubuntu1604/source/format index af745b310..d3827e75a 100644 --- a/distros/ubuntu1604/source/format +++ b/distros/ubuntu1604/source/format @@ -1 +1 @@ -3.0 (git) +1.0 From 4809a5d7de4fb03eb29ed79db3fae7a31b32603f Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 16 Feb 2017 15:59:43 -0600 Subject: [PATCH 016/141] patch packpack to remove "bebian" from the tarball filename --- utils/packpack/deb.mk.patch | 11 +++++++++++ utils/packpack/startpackpack.sh | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 utils/packpack/deb.mk.patch diff --git a/utils/packpack/deb.mk.patch b/utils/packpack/deb.mk.patch new file mode 100644 index 000000000..0cf0100f2 --- /dev/null +++ b/utils/packpack/deb.mk.patch @@ -0,0 +1,11 @@ +--- a/packpack/pack/deb.mk 2017-01-15 16:41:32.938418279 -0600 ++++ b/packpack/pack/deb.mk 2017-02-16 15:44:43.267900717 -0600 +@@ -14,7 +14,7 @@ + DPKG_BUILD:=$(PRODUCT)_$(DEB_VERSION)-$(RELEASE)_$(DPKG_ARCH).build + DPKG_DSC:=$(PRODUCT)_$(DEB_VERSION)-$(RELEASE).dsc + DPKG_ORIG_TARBALL:=$(PRODUCT)_$(DEB_VERSION).orig.tar.$(TARBALL_COMPRESSOR) +-DPKG_DEBIAN_TARBALL:=$(PRODUCT)_$(DEB_VERSION)-$(RELEASE).debian.tar.$(TARBALL_COMPRESSOR) ++DPKG_DEBIAN_TARBALL:=$(PRODUCT)_$(DEB_VERSION)-$(RELEASE).tar.$(TARBALL_COMPRESSOR) + + # gh-7: Ubuntu/Debian should export DEBIAN_FRONTEND=noninteractive + export DEBIAN_FRONTEND=noninteractive diff --git a/utils/packpack/startpackpack.sh b/utils/packpack/startpackpack.sh index e3933a9b6..0956c99a8 100755 --- a/utils/packpack/startpackpack.sh +++ b/utils/packpack/startpackpack.sh @@ -80,6 +80,9 @@ if [ "${OS}" == "el" ] || [ "${OS}" == "fedora" ]; then elif [ "${OS}" == "debian" ] || [ "${OS}" == "ubuntu" ]; then echo "Begin Debian build..." + # patch packpack to remove "debian" from the source tarball filename + patch -p1 < utils/packpack/deb.mk.patch + # Uncompress the Crud tarball and move it into place if [ -e "web/api/app/Plugin/Crud/LICENSE.txt" ]; then echo "Crud plugin already installed..." From dc76a876a12a8e0425c71a79cb092ee3444efa61 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 17 Feb 2017 07:07:17 -0600 Subject: [PATCH 017/141] packpack rpm specfile - ensure Crud submodule folder is empty --- utils/packpack/startpackpack.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/packpack/startpackpack.sh b/utils/packpack/startpackpack.sh index 0956c99a8..fc0bbb586 100755 --- a/utils/packpack/startpackpack.sh +++ b/utils/packpack/startpackpack.sh @@ -52,6 +52,12 @@ if [ "${OS}" == "el" ] || [ "${OS}" == "fedora" ]; then #patch -p1 < utils/packpack/autosetup.patch ln -sf distros/redhat rpm + # The rpm specfile requires the Crud submodule folder to be empty + if [ -e "web/api/app/Plugin/Crud/LICENSE.txt" ]; then + rm -rf web/api/app/Plugin/Crud + mkdir web/api/app/Plugin/Crud + fi + if [ "${OS}" == "el" ]; then zmrepodistro=${OS} else From d139623ed5027d8e1403150d8e466d5507404e3e Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 17 Feb 2017 09:42:30 -0500 Subject: [PATCH 018/141] change where binary packages get uploaded to --- utils/do_debian_package.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index d518facde..de7b31178 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -93,9 +93,6 @@ else fi; fi -if [ "$URGENCY" = "" ]; then - URGENCY="medium" -fi; # Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead. if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then @@ -162,6 +159,10 @@ else fi fi +if [ "$URGENCY" = "" ]; then + URGENCY="medium" +fi; + if [ "$SNAPSHOT" == "stable" ]; then cat < debian/changelog zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY @@ -185,6 +186,7 @@ fi; # Auto-install all ZoneMinder's depedencies using the Debian control file sudo apt-get install devscripts equivs sudo mk-build-deps -ir ./debian/control +echo "Status: $?" #rm -rf .git #rm .gitignore @@ -204,6 +206,7 @@ if [ "$DEBSIGN_KEYID" != "" ]; then DEBUILD="$DEBUILD -k$DEBSIGN_KEYID" fi $DEBUILD +echo "Status: $?" cd ../ if [ "$INTERACTIVE" != "no" ]; then @@ -225,7 +228,7 @@ if [ $TYPE == "binary" ]; then echo "Do you want to upload this binary to zmrepo? (y/N)" read install if [ "$install" == "Y" ]; then - scp "zoneminder_*-${VERSION}-${DISTRO}*" "zmrepo.connortechnology.com:zmrepo/debian-${BRANCH}/" + scp "zoneminder_*-${VERSION}-${DISTRO}*" "zmrepo@zmrepo.connortechnology.com:debian/${BRANCH}/mini-dinstall/incoming/" fi; fi; fi; From 11b90e60111971d864afaa5e9907219d9584eefa Mon Sep 17 00:00:00 2001 From: Manojav Sridhar Date: Fri, 17 Feb 2017 12:37:58 -0500 Subject: [PATCH 019/141] fix usage of wrong key --- web/skins/classic/views/monitor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 5ef870a63..45dd6f775 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -744,7 +744,7 @@ switch ( $tab ) { ?> - + From 33e8afa0e09c182b602d6588329eb7c2f01b2189 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Fri, 17 Feb 2017 13:25:17 -0600 Subject: [PATCH 020/141] only patch packpack if it is not already patched --- utils/packpack/startpackpack.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/packpack/startpackpack.sh b/utils/packpack/startpackpack.sh index fc0bbb586..117f1c1a9 100755 --- a/utils/packpack/startpackpack.sh +++ b/utils/packpack/startpackpack.sh @@ -87,7 +87,10 @@ elif [ "${OS}" == "debian" ] || [ "${OS}" == "ubuntu" ]; then echo "Begin Debian build..." # patch packpack to remove "debian" from the source tarball filename - patch -p1 < utils/packpack/deb.mk.patch + patch --dry-run --silent -f -p1 < utils/packpack/deb.mk.patch 2>/dev/null + if [ $? -eq 0 ]; then + patch -p1 < utils/packpack/deb.mk.patch + fi # Uncompress the Crud tarball and move it into place if [ -e "web/api/app/Plugin/Crud/LICENSE.txt" ]; then From f50c0e2096917f9c73f1adc08f55f4b1bdd3e4bd Mon Sep 17 00:00:00 2001 From: Manojav Sridhar Date: Sat, 18 Feb 2017 11:15:43 -0500 Subject: [PATCH 021/141] fix missing isset check, caused number of Undefined Property warnings --- web/includes/Event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/includes/Event.php b/web/includes/Event.php index e9ecd4bae..11a8f4faa 100644 --- a/web/includes/Event.php +++ b/web/includes/Event.php @@ -196,7 +196,7 @@ class Event { } // end function createListThumbnail function getImageSrc( $frame, $scale=SCALE_BASE, $captureOnly=false, $overwrite=false ) { - $Storage = new Storage( $this->{'StorageId'} ); + $Storage = new Storage( isset($this->{'StorageId'}) ? $this->{'StorageId'} : NULL ); $Event = $this; $eventPath = $Event->Path(); From df4739826b36e99a2349c496e09441bd104fdc5a Mon Sep 17 00:00:00 2001 From: Matthew Noorenberghe Date: Sat, 18 Feb 2017 22:52:56 -0800 Subject: [PATCH 022/141] Reduce the default API debug level --- web/api/app/Config/core.php.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/api/app/Config/core.php.default b/web/api/app/Config/core.php.default index 43736a61f..a210fbd79 100644 --- a/web/api/app/Config/core.php.default +++ b/web/api/app/Config/core.php.default @@ -31,7 +31,7 @@ * In production mode, flash messages redirect after a time interval. * In development mode, you need to click the flash message to continue. */ - Configure::write('debug', 2); + Configure::write('debug', 0); /** * Configure the Error handler used to handle errors for your application. By default From 548464c0d58676225dc15f0604df7df1961abb83 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Mon, 20 Feb 2017 11:12:15 +0200 Subject: [PATCH 023/141] zmlinkcontent: fix syntax error --- zmlinkcontent.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zmlinkcontent.sh.in b/zmlinkcontent.sh.in index 5f0d8336a..d6c791823 100755 --- a/zmlinkcontent.sh.in +++ b/zmlinkcontent.sh.in @@ -69,7 +69,7 @@ if [ -n "$ZM_CONFIG" ]; then elif [ -f "zm.conf" ]; then echo "Using local zm.conf" source "zm.conf" -elif [ -f "/etc/zm.conf"]; then +elif [ -f "/etc/zm.conf" ]; then echo "Using system zm.conf" source "/etc/zm.conf" else From 27ca8d86742199683e85e77bccba68671782b13a Mon Sep 17 00:00:00 2001 From: Andy Bauer Date: Tue, 21 Feb 2017 12:33:05 -0600 Subject: [PATCH 024/141] use === operator in getDiskPercent function --- web/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 970a5a822..8e3f910cb 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1434,12 +1434,12 @@ function getLoad() { function getDiskPercent($path = ZM_DIR_EVENTS) { $total = disk_total_space($path); - if ( ! $total ) { + if ( $total === false ) { Error("disk_total_space returned false for " . $path ); return 0; } $free = disk_free_space($path); - if ( ! $free ) { + if ( $free === false ) { Error("disk_free_space returned false for " . $path ); } $space = round(($total - $free) / $total * 100); From 8759e2bdb43a66ee8595e5ffa3367860e7190043 Mon Sep 17 00:00:00 2001 From: Andy Bauer Date: Tue, 21 Feb 2017 13:10:41 -0600 Subject: [PATCH 025/141] prevent divide by zero, make error messages more descriptive --- web/includes/functions.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 8e3f910cb..82676b27d 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1435,14 +1435,17 @@ function getLoad() { function getDiskPercent($path = ZM_DIR_EVENTS) { $total = disk_total_space($path); if ( $total === false ) { - Error("disk_total_space returned false for " . $path ); + Error("disk_total_space returned false. Verify the web account user has access to " . $path ); return 0; + } elseif ( $total == 0 ) { + Error("disk_total_space indicates the following path has a filesystem size of zero bytes" . $path ); + return 100; } $free = disk_free_space($path); if ( $free === false ) { - Error("disk_free_space returned false for " . $path ); + Error("disk_free_space returned false. Verify the web account user has access to " . $path ); } - $space = round(($total - $free) / $total * 100); + $space = round((($total - $free) / $total) * 100); return( $space ); } From a0dd36d8696fd56c03a931e1320e12d6a23d7664 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 27 Feb 2017 16:40:40 -0500 Subject: [PATCH 026/141] add width and height scale dropdowns --- web/skins/classic/views/montage.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/web/skins/classic/views/montage.php b/web/skins/classic/views/montage.php index 4591b40eb..92ac2b9d7 100644 --- a/web/skins/classic/views/montage.php +++ b/web/skins/classic/views/montage.php @@ -36,6 +36,20 @@ if ( !empty($_REQUEST['group']) ) { $showControl = false; $monitors = array(); +$widths = array( + '' => 'auto', + 160 => 160, + 320 => 320, + 352 => 352, + 640 => 640, + 1280 => 1280 ); +$heights = array( + '' => 'auto', + 240 => 240, + 480 => 480, +); + + foreach( dbFetchAll( $sql ) as $row ) { if ( !visibleMonitor( $row['Id'] ) ) { @@ -56,6 +70,12 @@ foreach( dbFetchAll( $sql ) as $row ) { $showControl = true; $row['connKey'] = generateConnKey(); $monitors[] = new Monitor( $row ); + if ( ! isset( $widths[$row['Width']] ) ) { + $widths[$row['Width']] = $row['Width']; + } + if ( ! isset( $heights[$row['Height']] ) ) { + $heights[$row['Height']] = $row['Height']; + } } $focusWindow = true; @@ -71,6 +91,7 @@ $layouts = array( if ( isset($_COOKIE['zmMontageLayout']) ) $layout = $_COOKIE['zmMontageLayout']; + xhtmlHeaders(__FILE__, translate('Montage') ); ?> @@ -89,6 +110,8 @@ if ( $showControl )

+ : + : :
From c3a52272d8f85c053e63ba834d6911ada1d458c0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 27 Feb 2017 20:56:14 -0500 Subject: [PATCH 027/141] implement changeWidth, changeHeight and alter getStreamHTML to take an array of options --- web/includes/functions.php | 25 ++++++++++-- web/skins/classic/views/js/montage.js | 59 +++++++++++++++++++++++++-- web/skins/classic/views/montage.php | 20 +++++---- 3 files changed, 89 insertions(+), 15 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 8cc3f606f..9ecb44362 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -2096,13 +2096,30 @@ function validHtmlStr( $input ) { return( htmlspecialchars( $input, ENT_QUOTES ) ); } -function getStreamHTML( $monitor, $scale=100, $mode='stream' ) { +function getStreamHTML( $monitor, $options = array() ) { + + if ( isset($options['scale']) ) { + $options['width'] = reScale( $monitor->Width(), $options['scale'] ); + $options['height'] = reScale( $monitor->Height(), $options['scale'] ); + } + if ( ! isset($options['mode'] ) ) { + $options['mode'] = 'stream'; + } + $width = NULL; + if ( $options['scale'] != 100 ) { + $width = + //FIXME, the width and height of the image need to be scaled. if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) { - $streamSrc = $monitor->getStreamSrc( array( 'mode=mpeg', 'scale='.$scale, 'bitrate='.ZM_WEB_VIDEO_BITRATE, 'maxfps='.ZM_WEB_VIDEO_MAXFPS, 'format='.ZM_MPEG_LIVE_FORMAT ) ); - return getVideoStream( 'liveStream'.$monitor->Id(), $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), ZM_MPEG_LIVE_FORMAT, $monitor->Name() ); + $streamSrc = $monitor->getStreamSrc( array( 'mode=mpeg', 'scale='.$options['scale'], 'bitrate='.ZM_WEB_VIDEO_BITRATE, 'maxfps='.ZM_WEB_VIDEO_MAXFPS, 'format='.ZM_MPEG_LIVE_FORMAT ) ); + + return getVideoStream( 'liveStream'.$monitor->Id(), $streamSrc, $options, ZM_MPEG_LIVE_FORMAT, $monitor->Name() ); } else if ( $mode == 'stream' and canStream() ) { - $streamSrc = $monitor->getStreamSrc( array( 'mode=jpeg', 'scale='.$scale, 'maxfps='.ZM_WEB_VIDEO_MAXFPS, 'buffer='.$monitor->StreamReplayBuffer() ) ); + $streamSrc = $monitor->getStreamSrc( array( 'mode=jpeg', + ( isset($options['scale']) ? 'scale='.$options['scale'] : () ), + ( isset($options['width']) ? 'width='.$options['width'] : () ), + ( isset($options['height']) ? 'height='.$options['height'] : () ), + 'maxfps='.ZM_WEB_VIDEO_MAXFPS, 'buffer='.$monitor->StreamReplayBuffer() ) ); if ( canStreamNative() ) return getImageStream( 'liveStream'.$monitor->Id(), $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() ); elseif ( canStreamApplet() ) diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index 210eb8c62..879f8b26d 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -130,12 +130,45 @@ function selectLayout( element ) Cookie.write( 'zmMontageLayout', $(element).get('value'), { duration: 10*365 } ); } -function changeScale() -{ +function changeWidth() { + var width = $('width').get('value'); + + for ( var x = 0; x < monitors.length; x++ ) { + var monitor = monitors[x]; + /*Stream could be an applet so can't use moo tools*/ + var streamImg = document.getElementById( 'liveStream'+monitor.id ); + if ( streamImg ) { + streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) )); + streamImg.style.width = width + "px"; + streamImg.style.height = ''; + } + } + $('height').set('value', ''); + $('scale').set('value', ''); + Cookie.write( 'zmMontageScale', '', { duration: 10*365 } ); + Cookie.write( 'zmMontageWidth', width, { duration: 10*365 } ); + Cookie.write( 'zmMontageHeight', '', { duration: 10*365 } ); +} // end function changeWidth() + +function changeHeight() { + var height = $('height').get('value'); + + for ( var x = 0; x < monitors.length; x++ ) { + var monitor = monitors[x]; + /*Stream could be an applet so can't use moo tools*/ + var streamImg = document.getElementById( 'liveStream'+monitor.id ); + if ( streamImg ) { + streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) )); + streamImg.style.height = height + "px"; + } + } + Cookie.write( 'zmMontageheight', height, { duration: 10*365 } ); +} // end function changeHeight() + +function changeScale() { var scale = $('scale').get('value'); - for ( var x = 0; x < monitors.length; x++ ) - { + for ( var x = 0; x < monitors.length; x++ ) { var monitor = monitors[x]; var newWidth = ( monitorData[x].width * scale ) / SCALE_BASE; var newHeight = ( monitorData[x].height * scale ) / SCALE_BASE; @@ -149,6 +182,24 @@ function changeScale() } Cookie.write( 'zmMontageScale', scale, { duration: 10*365 } ); } +function changeScale() { + var scale = $('scale').get('value'); + + for ( var x = 0; x < monitors.length; x++ ) { + var monitor = monitors[x]; + var newWidth = ( monitorData[x].width * scale ) / SCALE_BASE; + var newHeight = ( monitorData[x].height * scale ) / SCALE_BASE; + /*Stream could be an applet so can't use moo tools*/ + var streamImg = document.getElementById( 'liveStream'+monitor.id ); + if ( streamImg ) { + streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) )); + streamImg.style.width = newWidth + "px"; + streamImg.style.height = newHeight + "px"; + } + } + Cookie.write( 'zmMontageScale', scale, { duration: 10*365 } ); +} + var monitors = new Array(); function initPage() diff --git a/web/skins/classic/views/montage.php b/web/skins/classic/views/montage.php index 92ac2b9d7..65fd88a38 100644 --- a/web/skins/classic/views/montage.php +++ b/web/skins/classic/views/montage.php @@ -60,8 +60,8 @@ foreach( dbFetchAll( $sql ) as $row ) { $scale = validInt($_REQUEST['scale']); else if ( isset( $_COOKIE['zmMontageScale'] ) ) $scale = $_COOKIE['zmMontageScale']; - else - $scale = reScale( SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); + #else + #$scale = reScale( SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); $row['Scale'] = $scale; $row['PopupScale'] = reScale( SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); @@ -90,6 +90,12 @@ $layouts = array( if ( isset($_COOKIE['zmMontageLayout']) ) $layout = $_COOKIE['zmMontageLayout']; +$width = 0; +$height = 0; +if ( isset($_COOKIE['zmMontageWidth']) and $_COOKIE['zmMontageWidth'] ) + $width = $_COOKIE['zmMontageWidth']; +if ( isset($_COOKIE['zmMontageHeight']) and $_COOKIE['zmMontageHeight'] ) + $height = $_COOKIE['zmMontageHeight']; xhtmlHeaders(__FILE__, translate('Montage') ); @@ -110,10 +116,10 @@ if ( $showControl )

- : - : - : - + + + +
@@ -126,7 +132,7 @@ foreach ( $monitors as $monitor )
- Scale() ); ?> + $monitor->Scale(), ( $width ? 'width'=>$width : () ), ( $height ? 'height'=>$height : () ) ) ); ?>
Date: Mon, 27 Feb 2017 21:48:08 -0500 Subject: [PATCH 028/141] convert arguments from an array of strong to a hash and use http_build_query --- web/includes/Monitor.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/web/includes/Monitor.php b/web/includes/Monitor.php index 4dd2e6a2a..9e4c6a95a 100644 --- a/web/includes/Monitor.php +++ b/web/includes/Monitor.php @@ -143,7 +143,7 @@ private $control_fields = array( } } else { - Error("No row for Monitor " . $IdOrRow ); + Error('No row for Monitor ' . $IdOrRow ); } } # end if isset($IdOrRow) } // end function __construct @@ -170,6 +170,7 @@ private $control_fields = array( } } } + public function getStreamSrc( $args, $querySep='&' ) { if ( isset($this->{'ServerId'}) and $this->{'ServerId'} ) { $Server = new Server( $this->{'ServerId'} ); @@ -178,27 +179,27 @@ private $control_fields = array( $streamSrc = ZM_BASE_URL.ZM_PATH_ZMS; } - $args[] = "monitor=".$this->{'Id'}; + $args['monitor'] = $this->{'Id'}; if ( ZM_OPT_USE_AUTH ) { - if ( ZM_AUTH_RELAY == "hashed" ) { - $args[] = "auth=".generateAuthHash( ZM_AUTH_HASH_IPS ); - } elseif ( ZM_AUTH_RELAY == "plain" ) { - $args[] = "user=".$_SESSION['username']; - $args[] = "pass=".$_SESSION['password']; - } elseif ( ZM_AUTH_RELAY == "none" ) { - $args[] = "user=".$_SESSION['username']; + if ( ZM_AUTH_RELAY == 'hashed' ) { + $args['auth'] = generateAuthHash( ZM_AUTH_HASH_IPS ); + } elseif ( ZM_AUTH_RELAY == 'plain' ) { + $args['user'] = $_SESSION['username']; + $args['pass'] = $_SESSION['password']; + } elseif ( ZM_AUTH_RELAY == 'none' ) { + $args['user'] = $_SESSION['username']; } } - if ( !in_array( "mode=single", $args ) && !empty($GLOBALS['connkey']) ) { - $args[] = "connkey=".$GLOBALS['connkey']; + if ( ( (!isset($args['mode'])) or ( $args['mode'] != 'single' ) ) && !empty($GLOBALS['connkey']) ) { + $args['connkey'] = $GLOBALS['connkey']; } if ( ZM_RAND_STREAM ) { - $args[] = "rand=".time(); + $args['rand'] = time(); } if ( count($args) ) { - $streamSrc .= "?".join( $querySep, $args ); + $streamSrc .= '?'.http_build_query( $args,'', $querySep ); } return( $streamSrc ); From 4fc0aead7016f0e00dcf5c11e8dd6c6a2341096f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 1 Mar 2017 15:26:40 -0500 Subject: [PATCH 029/141] wip --- web/includes/functions.php | 30 +++++++++++++-------------- web/skins/classic/views/js/montage.js | 12 +++++++++-- web/skins/classic/views/montage.php | 15 +++++++------- web/skins/classic/views/zones.php | 30 ++++++++++++++------------- 4 files changed, 48 insertions(+), 39 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 9ecb44362..b3b0cc1bc 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -337,9 +337,9 @@ function outputImageStream( $id, $src, $width, $height, $title="" ) { function getImageStream( $id, $src, $width, $height, $title="" ) { if ( canStreamIframe() ) { - return '