Merge branch 'master' into filter_pre_post

This commit is contained in:
Isaac Connor 2020-08-26 15:28:48 -04:00
commit ab68bef39a
45 changed files with 291 additions and 302 deletions

2
.gitignore vendored
View File

@ -120,7 +120,7 @@ src/CMakeFiles/
src/cmake_install.cmake
src/libzm.a
src/nph-zms
src/zm_config.h
src/zm_config_data.h
src/zm_config_defines.h
src/zma
src/zmc

View File

@ -37,12 +37,9 @@ env:
- SMPFLAGS=-j4 OS=el DIST=8 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=fedora DIST=31 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=fedora DIST=32 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=ubuntu DIST=trusty DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=ubuntu DIST=xenial DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=ubuntu DIST=bionic DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=ubuntu DIST=disco DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=ubuntu DIST=focal DOCKER_REPO=iconzm/packpack
- 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
@ -67,3 +64,4 @@ deploy:
script: utils/packpack/rsync_xfer.sh
on:
branch: master
condition: fork = false

View File

@ -21,7 +21,7 @@ endif(ZM_TARGET_DISTRO MATCHES "^el")
# Configure the common zoneminder files
configure_file(common/zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY)
configure_file(common/zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY)
file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events temp)
file(MAKE_DIRECTORY sock swap zoneminder events temp)
# Configure the Apache zoneminder files
configure_file(httpd/zm-httpd.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zm-httpd.conf @ONLY)
@ -51,7 +51,6 @@ install(DIRECTORY sock swap DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSION
install(DIRECTORY zoneminder DESTINATION /var/log DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder DESTINATION /var/run DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder DESTINATION /var/cache DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder-upload DESTINATION /var/spool DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY events temp DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# Install the Apache zoneminder files

View File

@ -204,7 +204,6 @@ mv -f CakePHP-Enum-Behavior-%{ceb_version} ./web/api/app/Plugin/CakePHP-Enum-Beh
# Change the following default values
./utils/zmeditconfigdata.sh ZM_OPT_CAMBOZOLA yes
./utils/zmeditconfigdata.sh ZM_UPLOAD_FTP_LOC_DIR %{_localstatedir}/spool/zoneminder-upload
./utils/zmeditconfigdata.sh ZM_OPT_CONTROL yes
./utils/zmeditconfigdata.sh ZM_CHECK_FOR_UPDATES no
./utils/zmeditconfigdata.sh ZM_DYN_SHOW_DONATE_REMINDER no
@ -399,7 +398,6 @@ EOF
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/temp
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/cache/zoneminder
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/log/zoneminder
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/spool/zoneminder-upload
%files nginx
%config(noreplace) %attr(640,root,nginx) %{_sysconfdir}/zm/zm.conf
@ -423,7 +421,6 @@ EOF
%dir %attr(755,nginx,nginx) %{_sharedstatedir}/zoneminder/temp
%dir %attr(755,nginx,nginx) %{_localstatedir}/cache/zoneminder
%dir %attr(755,nginx,nginx) %{_localstatedir}/log/zoneminder
%dir %attr(755,nginx,nginx) %{_localstatedir}/spool/zoneminder-upload
%changelog
* Tue Feb 04 2020 Andrew Bauer <zonexpertconsulting@outlook.com> - 1.34.2-1

View File

@ -1,3 +1,3 @@
zoneminder (1.31.39~20180223.27-stretch-1) unstable; urgency=low
zoneminder (1.35.6~20200825.27-xenial) xenial; urgency=low
*
-- Isaac Connor <iconnor@connortechnology.com> Fri, 23 Feb 2018 14:15:59 -0500
-- Isaac Connor <isaac@zoneminder.com> Tue, 25 Aug 2020 09:28:18 -0400

View File

@ -3,7 +3,7 @@ Section: net
Priority: optional
Maintainer: Isaac Connor <isaac@zoneminder.com>
Uploaders: Isaac Connor <isaac@zoneminder.com>
Build-Depends: debhelper, dh-systemd, sphinx-doc, dh-linktree, dh-systemd, dh-apache2
Build-Depends: debhelper, dh-systemd, sphinx-doc, python3-sphinx, dh-linktree, dh-systemd, dh-apache2
,cmake
,libx264-dev, libmp4v2-dev
,libavdevice-dev

View File

@ -1,7 +1,7 @@
# CMakeLists.txt for the ZoneMinder binaries
# Create files from the .in files
configure_file(zm_config.h.in "${CMAKE_CURRENT_BINARY_DIR}/zm_config.h" @ONLY)
configure_file(zm_config_data.h.in "${CMAKE_CURRENT_BINARY_DIR}/zm_config_data.h" @ONLY)
# Group together all the source files that are used by all the binaries (zmc, zma, zmu, zms etc)
set(ZM_BIN_SRC_FILES zm_box.cpp zm_buffer.cpp zm_camera.cpp zm_comms.cpp zm_config.cpp zm_coord.cpp zm_curl_camera.cpp zm.cpp zm_db.cpp zm_logger.cpp zm_event.cpp zm_frame.cpp zm_eventstream.cpp zm_exception.cpp zm_file_camera.cpp zm_ffmpeg_input.cpp zm_ffmpeg_camera.cpp zm_group.cpp zm_image.cpp zm_jpeg.cpp zm_libvlc_camera.cpp zm_libvnc_camera.cpp zm_local_camera.cpp zm_monitor.cpp zm_monitorstream.cpp zm_ffmpeg.cpp zm_mpeg.cpp zm_packet.cpp zm_packetqueue.cpp zm_poly.cpp zm_regexp.cpp zm_remote_camera.cpp zm_remote_camera_http.cpp zm_remote_camera_nvsocket.cpp zm_remote_camera_rtsp.cpp zm_rtp.cpp zm_rtp_ctrl.cpp zm_rtp_data.cpp zm_rtp_source.cpp zm_rtsp.cpp zm_rtsp_auth.cpp zm_sdp.cpp zm_signal.cpp zm_stream.cpp zm_swscale.cpp zm_thread.cpp zm_time.cpp zm_timer.cpp zm_user.cpp zm_utils.cpp zm_video.cpp zm_videostore.cpp zm_zone.cpp zm_storage.cpp zm_fifo.cpp zm_crypt.cpp)

View File

@ -107,7 +107,7 @@ void zmLoadConfig() {
snprintf(staticConfig.video_file_format, sizeof(staticConfig.video_file_format), "%%s/%%s");
}
void process_configfile(char* configFile) {
void process_configfile(char const *configFile) {
FILE *cfg;
char line[512];
if ( (cfg = fopen(configFile, "r")) == NULL ) {

View File

@ -23,19 +23,13 @@
#if !defined(PATH_MAX)
#define PATH_MAX 1024
#endif
#include "config.h"
#include "zm_config_defines.h"
#include "zm_config_data.h"
#include <string>
#define ZM_CONFIG "@ZM_CONFIG@" // Path to config file
#define ZM_CONFIG_SUBDIR "@ZM_CONFIG_SUBDIR@" // Path to the ZoneMinder config subfolder
#define ZM_VERSION "@VERSION@" // ZoneMinder Version
#define ZM_HAS_V4L1 @ZM_HAS_V4L1@
#define ZM_HAS_V4L2 @ZM_HAS_V4L2@
#define ZM_HAS_V4L @ZM_HAS_V4L@
#ifdef HAVE_LIBAVFORMAT
#define ZM_HAS_FFMPEG 1
#endif // HAVE_LIBAVFORMAT
@ -62,7 +56,7 @@
extern void zmLoadConfig();
extern void process_configfile( char* configFile );
extern void process_configfile(char const *configFile);
struct StaticConfig {
std::string DB_HOST;

31
src/zm_config_data.h.in Normal file
View File

@ -0,0 +1,31 @@
//
// ZoneMinder Configuration, $Date$, $Revision$
// Copyright (C) 2001-2008 Philip Coombes
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#ifndef ZM_CONFIG_DATA_H
#define ZM_CONFIG_DATA_H
#define ZM_CONFIG "@ZM_CONFIG@" // Path to config file
#define ZM_CONFIG_SUBDIR "@ZM_CONFIG_SUBDIR@" // Path to the ZoneMinder config subfolder
#define ZM_VERSION "@VERSION@" // ZoneMinder Version
#define ZM_HAS_V4L1 @ZM_HAS_V4L1@
#define ZM_HAS_V4L2 @ZM_HAS_V4L2@
#define ZM_HAS_V4L @ZM_HAS_V4L@
#endif // ZM_CONFIG_DATA_H

View File

@ -136,7 +136,7 @@ void Zone::RecordStats(const Event *event) {
db_mutex.lock();
snprintf(sql, sizeof(sql),
"INSERT INTO Stats SET MonitorId=%d, ZoneId=%d, EventId=%" PRIu64 ", FrameId=%d, PixelDiff=%d, AlarmPixels=%d, FilterPixels=%d, BlobPixels=%d, Blobs=%d, MinBlobSize=%d, MaxBlobSize=%d, MinX=%d, MinY=%d, MaxX=%d, MaxY=%d, Score=%d",
monitor->Id(), id, event->Id(), event->Frames()+1, pixel_diff, alarm_pixels, alarm_filter_pixels, alarm_blob_pixels, alarm_blobs, min_blob_size, max_blob_size, alarm_box.LoX(), alarm_box.LoY(), alarm_box.HiX(), alarm_box.HiY(), score
monitor->Id(), id, event->Id(), event->Frames(), pixel_diff, alarm_pixels, alarm_filter_pixels, alarm_blob_pixels, alarm_blobs, min_blob_size, max_blob_size, alarm_box.LoX(), alarm_box.LoY(), alarm_box.HiX(), alarm_box.HiY(), score
);
if ( mysql_query(&dbconn, sql) ) {
Error("Can't insert event stats: %s", mysql_error(&dbconn));

View File

@ -1,4 +1,7 @@
#!/bin/bash
set -o pipefail
# packpack setup file for the ZoneMinder project
# Written by Andrew Bauer
@ -250,6 +253,13 @@ execpackpack () {
else
packpack/packpack $parms
fi
if [ $? -ne 0 ]; then
echo
echo "ERROR: An error occurred while executing packpack."
echo
exit 1
fi
}
# Check for connectivity with the deploy target host
@ -337,10 +347,10 @@ elif [ "${OS}" == "debian" ] || [ "${OS}" == "ubuntu" ] || [ "${OS}" == "raspbia
setdebpkgname
movecrud
if [ "${DIST}" == "trusty" ] || [ "${DIST}" == "precise" ]; then
ln -sfT distros/ubuntu1204 debian
elif [ "${DIST}" == "wheezy" ]; then
ln -sfT distros/debian debian
if [ "${DIST}" == "focal" ] || [ "${DIST}" == "buster" ]; then
ln -sfT distros/ubuntu2004 debian
elif [ "${DIST}" == "beowulf" ]; then
ln -sfT distros/beowulf debian
else
ln -sfT distros/ubuntu1604 debian
fi

View File

@ -1,29 +0,0 @@
#!/bin/bash -x
set -e
set -o pipefail
set -x
with_timestamps() {
while read -r line; do
echo -e "$(date +%T)\t$line";
done
}
bootstrap_zm() {
if [ "$ZM_BUILDMETHOD" = "autotools" ]; then libtoolize --force; fi
if [ "$ZM_BUILDMETHOD" = "autotools" ]; then aclocal; fi
if [ "$ZM_BUILDMETHOD" = "autotools" ]; then autoheader; fi
if [ "$ZM_BUILDMETHOD" = "autotools" ]; then automake --force-missing --add-missing; fi
if [ "$ZM_BUILDMETHOD" = "autotools" ]; then autoconf; fi
mysql -uroot -e "CREATE DATABASE IF NOT EXISTS zm"
mysql -uroot -e "GRANT ALL ON zm.* TO 'zmuser'@'localhost' IDENTIFIED BY 'zmpass'";
mysql -uroot -e "FLUSH PRIVILEGES"
mysql -uzmuser -pzmpass < ${TRAVIS_BUILD_DIR}/db/zm_create.sql
}
bootstrap_zm | with_timestamps

View File

@ -1,33 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
with_timestamps() {
while read -r line; do
echo -e "$(date +%T)\t$line";
done
}
cd $TRAVIS_BUILD_DIR
build_zm() {
if [ "$ZM_BUILDMETHOD" = "autotools" ]; then
./configure --prefix=/usr --with-libarch=lib/$DEB_HOST_GNU_TYPE --host=$DEB_HOST_GNU_TYPE --build=$DEB_BUILD_GNU_TYPE --with-mysql=/usr --with-ffmpeg=/usr --with-webdir=/usr/share/zoneminder/www --with-cgidir=/usr/libexec/zoneminder/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-crashtrace=yes --disable-debug --enable-mmap=yes ZM_SSL_LIB=openssl
fi
if [ "$ZM_BUILDMETHOD" = "cmake" ]; then
cmake -DCMAKE_INSTALL_PREFIX="/usr"
fi
make
sudo make install
if [ "$ZM_BUILDMETHOD" = "cmake" ]; then
sudo ./zmlinkcontent.sh
fi
}
build_zm | with_timestamps

View File

@ -1,20 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
with_timestamps() {
while read -r line; do
echo -e "$(date +%T)\t$line";
done
}
install_deps() {
sudo apt-get update -qq
sudo apt-get install -y -qq zlib1g-dev apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf cmake libjpeg-turbo8-dev apache2-mpm-prefork libapache2-mod-php5 php5-cli libtheora-dev libvorbis-dev libvpx-dev libx264-dev 2>&1 > /dev/null
}
install_deps | with_timestamps

View File

@ -1,11 +0,0 @@
#!/bin/bash
set -e
git clone --depth=10 --branch=master git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-shared --enable-swscale --enable-gpl --enable-libx264 --enable-libvpx --enable-libvorbis --enable-libtheora
make -j `grep processor /proc/cpuinfo|wc -l`
sudo make install
sudo make install-libs

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
with_timestamps() {
while read -r line; do
echo -e "$(date +%T)\t$line";
done
}
run_tests() {
mysql -uzmuser -pzmpass zm < ../../db/test.monitor.sql
sudo zmu -l
sudo zmc -m1 &
sudo zma -m1 &
sudo zmu -l
sudo grep ERR /var/log/syslog
sudo zmpkg.pl start
sudo zmfilter.pl -f purgewhenfull
}
run_tests | with_timestamps

View File

@ -205,9 +205,13 @@ class Monitor extends ZM_Object {
if ( ZM_RAND_STREAM ) {
$args['rand'] = time();
}
foreach ( array('scale') as $int_arg ) {
if ( isset($args[$int_arg]) and (!is_numeric($args[$int_arg]) or !$args[$int_arg] ) ) {
unset($args[$int_arg]);
# zms doesn't support width & height, so if no scale is set, default it
if ( ! isset($args['scale']) ) {
if ( isset($args['width']) and intval($args['width']) ) {
$args['scale'] = intval((100*intval($args['width']))/$this->ViewWidth());
} else if ( isset($args['height']) and intval($args['height']) ) {
$args['scale'] = intval((100*intval($args['height']))/$this->ViewHeight());
}
}

View File

@ -260,6 +260,22 @@ function userFromSession() {
return $user;
}
function get_auth_relay() {
if ( ZM_OPT_USE_AUTH ) {
if ( ZM_AUTH_RELAY == 'hashed' ) {
return 'auth='.generateAuthHash(ZM_AUTH_HASH_IPS);
} else if ( ZM_AUTH_RELAY == 'plain' ) {
// password probably needs to be escaped
return 'username='.$_SESSION['username'].'&password='.urlencode($_SESSION['password']);
} else if ( ZM_AUTH_RELAY == 'none' ) {
return 'username='.$_SESSION['username'];
} else {
ZM\Error('Unknown value for ZM_AUTH_RELAY ' . ZM_AUTH_RELAY);
}
}
return '';
} // end function get_auth_relay
if ( ZM_OPT_USE_AUTH ) {
if ( !empty($_REQUEST['token']) ) {
// we only need to get the username here

View File

@ -389,7 +389,7 @@ function csrf_conf($key, $val) {
*/
function csrf_start() {
if ($GLOBALS['csrf']['auto-session'] && !session_id()) {
session_start();
zm_session_start();
}
}

View File

@ -153,10 +153,7 @@ function dbQuery($sql, $params=NULL) {
}
}
if ( defined('ZM_DB_DEBUG') ) {
if ( $params )
ZM\Logger::Debug("SQL: $sql " . implode(',',$params) . ' rows: '.$result->rowCount());
else
ZM\Logger::Debug("SQL: $sql: rows:" . $result->rowCount());
ZM\Logger::Debug('SQL: '.$sql.' '.($params?implode(',',$params):'').' rows: '.$result->rowCount());
}
} catch(PDOException $e) {
ZM\Error("SQL-ERR '".$e->getMessage()."', statement was '".$sql."' params:" . ($params?implode(',',$params):''));

View File

@ -528,12 +528,18 @@ input[type=submit]:disabled,
margin-left: 0;
}
.table {
width: 100%;
margin-bottom: 1rem;
color: #eeeeee;
}
.table-striped > tbody > tr:nth-of-type(2n+1) {
background-color: #333333;
}
.table-hover>tbody>tr:hover {
background-color: #444444;
.table-hover > tbody > tr:hover {
background-color: orange;
}
.nav-pills>li.active>a, .nav-pills>li.active>a:focus, .nav-pills>li.active>a:hover {

View File

@ -59,7 +59,7 @@ var popupSizes = {
'options': {'width': 1000, 'height': 660},
'preset': {'width': 300, 'height': 220},
'server': {'width': 600, 'height': 405},
'settings': {'width': 220, 'height': 235},
'settings': {'width': 250, 'height': 335},
'shutdown': {'width': 400, 'height': 400},
'state': {'width': 400, 'height': 170},
'stats': {'width': 840, 'height': 200},

View File

@ -70,23 +70,5 @@ var focusWindow = <?php echo !empty($focusWindow)?'true':'false' ?>;
var imagePrefix = "<?php echo '?view=image&eid=' ?>";
var auth_hash;
var auth_relay;
<?php
if ( ZM_OPT_USE_AUTH ) {
if ( ZM_AUTH_RELAY == 'hashed' ) {
echo ' auth_hash = \''.generateAuthHash(ZM_AUTH_HASH_IPS).'\';
';
} else if ( ZM_AUTH_RELAY == 'plain' ) {
// password probably needs to be escaped
echo ' auth_relay=\'username='.$_SESSION['username'].'&password='.$_SESSION['password'].'\';
';
} else if ( ZM_AUTH_RELAY == 'none' ) {
// password probably needs to be escaped
echo ' auth_relay=\'username='.$_SESSION['username'].'\';
';
} else {
ZM\Error('Unknown value for ZM_AUTH_RELAY ' . ZM_AUTH_RELAY);
}
}
?>
var auth_hash = '<?php echo generateAuthHash(ZM_AUTH_HASH_IPS) ?>';
var auth_relay = '<?php echo get_auth_relay() ?>';

View File

@ -23,7 +23,7 @@ $ServersById = array();
foreach ( $servers as $S ) {
$ServersById[$S->Id()] = $S;
}
session_start();
zm_session_start();
foreach ( array('GroupId','Function','ServerId','StorageId','Status','MonitorId','MonitorName','Source') as $var ) {
if ( isset($_REQUEST[$var]) ) {
if ( $_REQUEST[$var] != '' ) {

View File

@ -244,7 +244,7 @@ echo $table_head;
for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
$monitor = $displayMonitors[$monitor_i];
$Monitor = new ZM\Monitor($monitor);
include('function.php');
if ( $monitor_i and ( $monitor_i % 100 == 0 ) ) {
echo '</table>';
echo $table_head;
@ -284,15 +284,16 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
<?php
}
$imgHTML='';
if ( ZM_WEB_LIST_THUMBS && $monitor['Status'] == 'Connected' && $running ) {
if ( ZM_WEB_LIST_THUMBS && ($monitor['Status'] == 'Connected') && $running ) {
$options = array();
$ratio_factor = $Monitor->Height()/ $Monitor->Width();
$ratio_factor = $Monitor->Height() / $Monitor->Width();
$options['width'] = ZM_WEB_LIST_THUMB_WIDTH;
$options['height'] = ZM_WEB_LIST_THUMB_HEIGHT ? ZM_WEB_LIST_THUMB_HEIGHT : ZM_WEB_LIST_THUMB_WIDTH*$ratio_factor;
$options['scale'] = intval(100*ZM_WEB_LIST_THUMB_WIDTH / $Monitor->Width());
$options['mode'] = 'single';
$stillSrc = $Monitor->getStreamSrc($options);
$streamSrc = $Monitor->getStreamSrc(array('scale'=>$scale));
$streamSrc = $Monitor->getStreamSrc(array('scale'=>$options['scale']*5));
$thmbWidth = ( $options['width'] ) ? 'width:'.$options['width'].'px;' : '';
$thmbHeight = ( $options['height'] ) ? 'height:'.$options['height'].'px;' : '';
@ -324,7 +325,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
?>
</div></td>
<td class="colFunction">
<?php echo makePopupLink( '?view=function&amp;mid='.$monitor['Id'], 'zmFunction', 'function', '<span class="'.$function_class.'">'.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', <span class="disabledText">disabled</span>' : '' ) .'</span>', canEdit('Monitors') ) ?><br/>
<a class="functionLnk <?php echo $function_class ?>" data-mid="<?php echo $monitor['Id'] ?>" id="functionLnk-<?php echo $monitor['Id'] ?>" href="#"><?php echo translate('Fn'.$monitor['Function']) ?></a><br/>
<?php echo translate('Status'.$monitor['Status']) ?><br/>
<div class="small text-nowrap text-muted">
<?php
@ -347,7 +348,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
<td class="colServer"><?php $Server = isset($ServersById[$monitor['ServerId']]) ? $ServersById[$monitor['ServerId']] : new ZM\Server($monitor['ServerId']); echo validHtmlStr($Server->Name()); ?></td>
<?php
}
echo '<td class="colSource">'. makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$source_class.'">'.validHtmlStr($Monitor->Source()).'</span>', canEdit('Monitors') ).'</td>';
echo '<td class="colSource">'. makeLink( '?view=monitor&amp;mid='.$monitor['Id'], '<span class="'.$source_class.'">'.validHtmlStr($Monitor->Source()).'</span>', canEdit('Monitors') ).'</td>';
if ( $show_storage_areas ) {
?>
<td class="colStorage"><?php echo isset($StorageById[$monitor['StorageId']]) ? validHtmlStr($StorageById[$monitor['StorageId']]->Name()) : ($monitor['StorageId']?'<span class="error">Deleted '.$monitor['StorageId'].'</span>' : '') ?></td>
@ -425,4 +426,8 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
</div>
</div>
</form>
<?php xhtmlFooter() ?>
<?php
xhtmlFooter();
// Include Donate Modal
include('donate.php');
?>

View File

@ -91,7 +91,7 @@ if ( !$monitor ) {
}
$options['connkey'] = generateConnKey();
session_start();
zm_session_start();
if ( isset($_REQUEST['scale']) ) {
$options['scale'] = validInt($_REQUEST['scale']);

View File

@ -33,17 +33,18 @@ $options = array(
'already' => translate('DonateAlready'),
);
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Donate'));
?>
<body>
<div id="page">
<div id="header">
<h2><?php echo translate('Donate') ?></h2>
<h1>ZoneMinder - <?php echo translate('Donate') ?></h1>
<!-- Donate Modal -->
<div class="modal fade" id="donate" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="donateLabel">ZoneMinder - <?php echo translate('Donate') ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div id="content">
<div class="modal-body">
<form name="contentForm" id="contentForm" method="post" action="?">
<input type="hidden" name="view" value="donate"/>
<input type="hidden" name="action" value="donate"/>
@ -59,6 +60,11 @@ xhtmlHeaders(__FILE__, translate('Donate'));
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Understood</button>
</div>
</body>
</html>
</div>
</div>
</div>

View File

@ -61,7 +61,7 @@ if ( isset($_REQUEST['scale']) ) {
$codec = 'auto';
if ( isset($_REQUEST['codec']) ) {
$codec = $_REQUEST['codec'];
session_start();
zm_session_start();
$_SESSION['zmEventCodec'.$Event->MonitorId()] = $codec;
session_write_close();
} else if ( isset($_SESSION['zmEventCodec'.$Event->MonitorId()]) ) {

View File

@ -22,42 +22,35 @@ if ( !canEdit('Monitors') ) {
$view = 'error';
return;
}
$monitor = ZM\Monitor::find_one(array('Id'=>$_REQUEST['mid']));
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Function').' - '.validHtmlStr($monitor->Name()));
?>
<body>
<div id="page">
<div id="header">
<h2><?php echo translate('Function').' - '.validHtmlStr($monitor->Name()) ?></h2>
<div id="modalFunction-<?php echo $Monitor->Id() ?>" class="modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><?php echo translate('Function').' - '.validHtmlStr($Monitor->Name()) ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div id="content">
<form name="contentForm" id="contentForm" method="post" action="?">
<input type="hidden" name="view" value="function"/>
<input type="hidden" name="action" value="function"/>
<input type="hidden" name="mid" value="<?php echo $monitor->Id() ?>"/>
<div class="modal-body">
<p>
<select name="newFunction">
<?php
foreach ( getEnumValues('Monitors', 'Function') as $optFunction ) {
?>
<option value="<?php echo $optFunction ?>"<?php if ( $optFunction == $monitor->Function() ) { ?> selected="selected"<?php } ?>><?php echo translate('Fn'.$optFunction) ?></option>
<?php
}
?>
<select name="newFunction" id="funcSelect-<?php echo $monitor['Id'] ?>">
<?php
foreach ( getEnumValues('Monitors', 'Function') as $optFunction ) {
$selected = ( $optFunction == $Monitor->Function() ) ? ' selected="selected"' : '';
echo '<option value="' .$optFunction. '"'. $selected. '>' .translate('Fn'.$optFunction). '</option>'.PHP_EOL;
}
?>
</select>
<label for="newEnabled"><?php echo translate('Enabled') ?></label>
<input type="checkbox" name="newEnabled" id="newEnabled" value="1"<?php echo $monitor->Enabled() ?' checked="checked"' : '' ?>/>
<input type="checkbox" name="newEnabled" id="newEnabled-<?php echo $monitor['Id'] ?>" value="1"<?php echo $Monitor->Enabled() ?' checked="checked"' : '' ?>/>
</p>
<div id="contentButtons">
<button type="submit" value="Save"><?php echo translate('Save') ?></button>
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
</div>
</form>
<div class="modal-footer">
<button data-mid="<?php echo $monitor['Id'] ?>" type="button" class="funcSaveBtn btn btn-primary"><?php echo translate('Save') ?></button>
<button data-mid="<?php echo $monitor['Id'] ?>" type="button" class="funcCancelBtn btn btn-secondary" data-dismiss="modal"><?php echo translate('Cancel') ?></button>
</div>
</div>
</body>
</html>
</div>
</div>

View File

@ -135,12 +135,22 @@ function reloadWindow() {
}
function initPage() {
$j('.functionLnk').click(function(evt) {
if ( ! canEditEvents ) {
alert("You do not have permission to change monitor function.");
return;
}
var mid = evt.currentTarget.getAttribute("data-mid");
evt.preventDefault();
$j('#modalFunction-'+mid).modal('show');
});
reloadWindow.periodical(consoleRefreshTimeout);
if ( showVersionPopup ) {
createPopup('?view=version', 'zmVersion', 'version');
}
if ( showDonatePopup ) {
createPopup('?view=donate', 'zmDonate', 'donate');
$j('#donate').modal('show');
}
// Makes table sortable
@ -154,6 +164,23 @@ function initPage() {
// Setup the thumbnail video animation
initThumbAnimation();
// Manage the CANCEL modal buttons
$j('.funcCancelBtn').click(function(evt) {
var mid = evt.currentTarget.getAttribute("data-mid");
evt.preventDefault();
$j('#modalFunction-'+mid).modal('hide');
});
// Manage the SAVE modal buttons
$j('.funcSaveBtn').click(function(evt) {
var mid = evt.currentTarget.getAttribute("data-mid");
var newFunc = $j("#funcSelect-"+mid).val();
var newEnabled = $j('#newEnabled-'+mid).is(':checked') ? 1 : 0;
evt.preventDefault();
$j.getJSON(thisUrl + '?view=function&action=function&mid='+mid+'&newFunction='+newFunc+'&newEnabled='+newEnabled);
window.location.reload(true);
});
}
function applySort(event, ui) {

View File

@ -1,3 +1,6 @@
<?php
global $labels;
?>
var labels = new Array();
<?php
foreach ( $labels as $index=>$label ) {

View File

@ -1077,6 +1077,12 @@ function initPage() {
vid.on('click', function(event) {
handleClick(event);
});
vid.on('volumechange', function() {
Cookie.write('volume', vid.volume(), {duration: 10*365});
});
if ( Cookie.read('volume') != null ) {
vid.volume(Cookie.read('volume'));
}
vid.on('timeupdate', function() {
$j('#progressValue').html(secsToTime(Math.floor(vid.currentTime())));
});

View File

@ -1,3 +1,7 @@
<?php
global $filterQuery;
global $sortQuery;
?>
//var openFilterWindow = <?php echo $_REQUEST['filter']?'true':'false' ?>;
var openFilterWindow = false;

View File

@ -19,11 +19,7 @@ function initThumbAnimation() {
function processClicks(event, field, value, row, $element) {
if ( field == 'FramesScore' ) {
if ( value > 0 ) {
window.location.assign('?view=stats&eid='+row.EventId+'&fid='+row.FramesId);
} else {
alert("No statistics available");
}
} else {
window.location.assign('?view=frame&eid='+row.EventId+'&fid='+row.FramesId);
}

View File

@ -50,7 +50,7 @@ layouts[0] = {}; // reserved, should hold which fields to clear when transitioni
global $layouts;
foreach ( $layouts as $layout ) {
?>
layouts[<?php echo $layout->Id() ?>] = {"Name":"<?php echo $layout->Name()?>","Positions":<?php echo $layout->Positions() ?>};
layouts[<?php echo $layout->Id() ?>] = {"Name":"<?php echo $layout->Name()?>","Positions":<?php echo json_decode($layout->Positions())?$layout->Positions():'{}' ?>};
<?php
} // end foreach layout
?>

View File

@ -1,3 +1,4 @@
<?php global $restartWarning; ?>
var restartWarning = <?php echo empty($restartWarning)?'false':'true' ?>;
if ( restartWarning ) {
alert( "<?php echo translate('OptionRestartWarning') ?>" );

View File

@ -214,3 +214,30 @@ window.addEventListener('DOMContentLoaded', function() {
});
});
function initPage() {
var backBtn = $j('#backBtn');
// Don't enable the back button if there is no previous zm page to go back to
backBtn.prop('disabled', !document.referrer.length);
// Manage the BACK button
document.getElementById("backBtn").addEventListener("click", function onBackClick(evt) {
evt.preventDefault();
window.history.back();
});
// Manage the REFRESH Button
document.getElementById("refreshBtn").addEventListener("click", function onRefreshClick(evt) {
evt.preventDefault();
window.location.reload(true);
});
// Manage the LIST Button
document.getElementById("listBtn").addEventListener("click", function onListClick(evt) {
evt.preventDefault();
window.location.assign('?view=events'+filterQuery);
});
}
$j(document).ready(function() {
initPage();
});

View File

@ -1,3 +1,6 @@
<?php
global $event;
?>
var eventId = '<?php echo $event->Id() ?>';
var videoGenSuccessString = '<?php echo addslashes(translate('VideoGenSucceeded')) ?>';

View File

@ -36,7 +36,7 @@ xhtmlHeaders(__FILE__, translate('Logout') );
<input type="submit" value="<?php echo translate('Logout') ?>"/>
<?php
if ( ZM_USER_SELF_EDIT ) {
echo makePopupButton('?view=user&uid=' . $user['Id'], 'zmUser', 'user', translate('Config'));
echo makeLink('?view=user&uid=' . $user['Id'], translate('Config'));
}
?>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>

View File

@ -157,7 +157,7 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as
ZM\Logger::Debug("monitors: ".$user_row['Username'] . ' ' . $user_row['MonitorIds']. ' :' . print_r($userMonitors, true));
?>
<tr>
<td class="colUsername"><?php echo makePopupLink('?view=user&amp;uid='.$user_row['Id'], 'zmUser', 'user', validHtmlStr($user_row['Username']).($user['Username']==$user_row['Username']?'*':''), $canEdit) ?></td>
<td class="colUsername"><?php echo makeLink('?view=user&amp;uid='.$user_row['Id'], validHtmlStr($user_row['Username']).($user['Username']==$user_row['Username']?'*':''), $canEdit) ?></td>
<td class="colLanguage"><?php echo $user_row['Language']?validHtmlStr($user_row['Language']):'default' ?></td>
<td class="colEnabled"><?php echo translate($user_row['Enabled']?'Yes':'No') ?></td>
<td class="colStream"><?php echo validHtmlStr($user_row['Stream']) ?></td>

View File

@ -26,12 +26,14 @@ $monitor = ZM\Monitor::find_one(array('Id'=>$_REQUEST['mid']));
$zmuCommand = getZmuCommand(' -m '.escapeshellarg($_REQUEST['mid']).' -B -C -H -O');
$zmuOutput = exec( $zmuCommand );
list($brightness, $contrast, $hue, $colour) = explode(' ', $zmuOutput);
if ( $zmuOutput ) {
list($brightness, $contrast, $hue, $colour) = explode(' ', $zmuOutput);
$monitor->Brightness($brightness);
$monitor->Contrast($contrast);
$monitor->Hue($hue);
$monitor->Colour($colour);
$monitor->Brightness($brightness);
$monitor->Contrast($contrast);
$monitor->Hue($hue);
$monitor->Colour($colour);
}
$focusWindow = true;
@ -47,23 +49,23 @@ xhtmlHeaders(__FILE__, validHtmlStr($monitor->Name()).' - '.translate('Settings'
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="action" value="settings"/>
<input type="hidden" name="mid" value="<?php echo validInt($_REQUEST['mid']) ?>"/>
<table id="contentTable" class="major" cellspacing="0">
<table id="contentTable" class="major">
<tbody>
<tr>
<th scope="row"><?php echo translate('Brightness') ?></th>
<td><input type="number" name="newBrightness" value="<?php echo $monitor->Brightness() ?>" <?php if ( !canView( 'Control' ) ) { ?> disabled="disabled"<?php } ?>/></td>
<td><input type="number" name="newBrightness" value="<?php echo $monitor->Brightness() ?>" <?php if ( !canView( 'Control' ) ) { ?> disabled="disabled"<?php } ?> /></td>
</tr>
<tr>
<th scope="row"><?php echo translate('Contrast') ?></th>
<td><input type="number" name="newContrast" value="<?php echo $monitor->Contrast() ?>" <?php echo canView('Control') ? '' : ' disabled="disabled"' ?>/></td>
<td><input type="number" name="newContrast" value="<?php echo $monitor->Contrast() ?>" <?php echo canView('Control') ? '' : ' disabled="disabled"' ?> /></td>
</tr>
<tr>
<th scope="row"><?php echo translate('Hue') ?></th>
<td><input type="number" name="newHue" value="<?php echo $monitor->Hue() ?>" <?php echo canView('Control') ? '' : ' disabled="disabled"' ?>/></td>
<td><input type="number" name="newHue" value="<?php echo $monitor->Hue() ?>" <?php echo canView('Control') ? '' : ' disabled="disabled"' ?> /></td>
</tr>
<tr>
<th scope="row"><?php echo translate('Colour') ?></th>
<td><input type="number" name="newColour" value="<?php echo $monitor->Colour() ?>" <?php echo canView('Control') ? '' : ' disabled="disabled"' ?>/></td>
<td><input type="number" name="newColour" value="<?php echo $monitor->Colour() ?>" <?php echo canView('Control') ? '' : ' disabled="disabled"' ?> /></td>
</tr>
</tbody>
</table>

View File

@ -673,18 +673,17 @@ $focusWindow = true;
xhtmlHeaders(__FILE__, translate('Timeline'));
?>
<body>
<div id="page">
<?php echo getNavBarHTML() ?>
<div id="header">
<div id="info">
<h2><?php echo translate('Timeline') ?></h2>
<a id="refreshLink" href="#" data-on-click="refreshWindow"><?php echo translate('Refresh') ?></a>
</div>
<div id="headerButtons">
<a href="#" data-on-click="backWindow"><?php echo translate('Back') ?></a>
<a href="?view=events&amp;page=1<?php echo htmlspecialchars($filterQuery) ?>"><?php echo translate('List') ?></a>
<div id="page p-0">
<div class="d-flex p-1">
<div class="mr-auto" id="toolbar" >
<button id="backBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Back') ?>" disabled><i class="fa fa-arrow-left"></i></button>
<button id="refreshBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Refresh') ?>" ><i class="fa fa-refresh"></i></button>
<button id="listBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('List') ?>" ><i class="fa fa-list"></i></button>
</div>
<h2 class="align-self-end"><?php echo translate('Timeline') ?></h2>
</div>
<div id="content" class="chartSize">
<div id="topPanel" class="graphWidth">
<div id="imagePanel">

View File

@ -58,81 +58,80 @@ $focusWindow = true;
xhtmlHeaders(__FILE__, translate('User').' - '.$newUser->Username());
?>
<body>
<?php echo getNavBarHTML() ?>
<div id="page">
<div id="header">
<h2><?php echo translate('User').' - '.validHtmlStr($newUser->Username()); ?></h2>
</div>
<div id="content">
<div id="content" class="row justify-content-center">
<form id="contentForm" name="contentForm" method="post" action="?view=user">
<input type="hidden" name="uid" value="<?php echo validHtmlStr($_REQUEST['uid']) ?>"/>
<table id="contentTable" class="major">
<table id="contentTable" class="table">
<tbody>
<?php
if ( canEdit('System') ) {
?>
<tr>
<th scope="row"><?php echo translate('Username') ?></th>
<th class="text-right" scope="row"><?php echo translate('Username') ?></th>
<td><input type="text" name="newUser[Username]" value="<?php echo validHtmlStr($newUser->Username()); ?>"<?php echo $newUser->Username() == 'admin' ? ' readonly="readonly"':''?>/></td>
</tr>
<?php
}
?>
<tr>
<th scope="row"><?php echo translate('NewPassword') ?></th>
<th class="text-right" scope="row"><?php echo translate('NewPassword') ?></th>
<td><input type="password" name="newUser[Password]" autocomplete="new-password"/></td>
</tr>
<tr>
<th scope="row"><?php echo translate('ConfirmPassword') ?></th>
<th class="text-right" scope="row"><?php echo translate('ConfirmPassword') ?></th>
<td><input type="password" name="conf_password" autocomplete="new-password"/></td>
</tr>
<tr>
<th scope="row"><?php echo translate('Language') ?></th>
<th class="text-right" scope="row"><?php echo translate('Language') ?></th>
<td><?php echo htmlSelect('newUser[Language]', $langs, $newUser->Language()) ?></td>
</tr>
<?php
if ( canEdit('System') and ( $newUser->Username() != 'admin' ) ) {
?>
<tr>
<th scope="row"><?php echo translate('Enabled') ?></th>
<th class="text-right" scope="row"><?php echo translate('Enabled') ?></th>
<td><?php echo htmlSelect('newUser[Enabled]', $yesno, $newUser->Enabled()) ?></td>
</tr>
<tr>
<th scope="row"><?php echo translate('Stream') ?></th>
<th class="text-right" scope="row"><?php echo translate('Stream') ?></th>
<td><?php echo htmlSelect('newUser[Stream]', $nv, $newUser->Stream()) ?></td>
</tr>
<tr>
<th scope="row"><?php echo translate('Events') ?></th>
<th class="text-right" scope="row"><?php echo translate('Events') ?></th>
<td><?php echo htmlSelect('newUser[Events]', $nve, $newUser->Events()) ?></td>
</tr>
<tr>
<th scope="row"><?php echo translate('Control') ?></th>
<th class="text-right" scope="row"><?php echo translate('Control') ?></th>
<td><?php echo htmlSelect('newUser[Control]', $nve, $newUser->Control()) ?></td>
</tr>
<tr>
<th scope="row"><?php echo translate('Monitors') ?></th>
<th class="text-right" scope="row"><?php echo translate('Monitors') ?></th>
<td><?php echo htmlSelect('newUser[Monitors]', $nve, $newUser->Monitors()) ?></td>
</tr>
<tr>
<th scope="row"><?php echo translate('Groups') ?></th>
<th class="text-right" scope="row"><?php echo translate('Groups') ?></th>
<td><?php echo htmlSelect('newUser[Groups]', $nve, $newUser->Groups()) ?></td>
</tr>
<tr>
<th scope="row"><?php echo translate('System') ?></th>
<th class="text-right" scope="row"><?php echo translate('System') ?></th>
<td><?php echo htmlSelect('newUser[System]', $nve, $newUser->System()) ?></td>
</tr>
<tr>
<th scope="row"><?php echo translate('MaxBandwidth') ?></th>
<th class="text-right" scope="row"><?php echo translate('MaxBandwidth') ?></th>
<td><?php echo htmlSelect('newUser[MaxBandwidth]', $bandwidths, $newUser->MaxBandwidth()) ?></td>
</tr>
<tr>
<th scope="row"><?php echo translate('RestrictedMonitors') ?></th>
<th class="text-right" scope="row"><?php echo translate('RestrictedMonitors') ?></th>
<td>
<?php echo htmlSelect('newUser[MonitorIds][]', $monitors, explode(',', $newUser->MonitorIds()), array('multiple'=>'multiple')); ?>
</td>
</tr>
<?php if ( ZM_OPT_USE_API ) { ?>
<tr>
<th scope="row"><?php echo translate('APIEnabled')?></th>
<th class="text-right" scope="row"><?php echo translate('APIEnabled')?></th>
<td><?php echo htmlSelect('newUser[APIEnabled]', $yesno, $newUser->APIEnabled()) ?></td>
</tr>

View File

@ -67,7 +67,7 @@ xhtmlHeaders(__FILE__, $monitor->Name().' - '.translate('Feed'));
<?php
if ( canView('Control') && $monitor->Type() == 'Local' ) {
?>
<div id="settingsControl"><?php echo makePopupLink($monitor->Server()->UrlToIndex().'?view=settings&amp;mid='.$monitor->Id(), 'zmSettings'.$monitor->Id(), 'settings', translate('Settings'), true, 'id="settingsLink"') ?></div>
<div id="settingsControl"><?php echo makePopupLink($monitor->UrlToIndex().'?view=settings&amp;mid='.$monitor->Id().'&amp;'.get_auth_relay(), 'zmSettings'.$monitor->Id(), 'settings', translate('Settings'), true, 'id="settingsLink"') ?></div>
<?php
}
?>