Merge branch 'storageareas' of github.com:ConnorTechnology/ZoneMinder into storageareas

This commit is contained in:
Isaac Connor 2017-03-06 16:22:25 -05:00
commit 3f7583ebda
29 changed files with 201 additions and 194 deletions

View File

@ -10,7 +10,7 @@ RUN apt-get update && \
libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 \
libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm cmake libjpeg-turbo8-dev \
libjpeg-turbo8 libtheora-dev libvorbis-dev libvpx-dev libx264-dev libmp4v2-dev libav-tools mysql-client \
apache2 php5 php5-mysql apache2-mpm-prefork libapache2-mod-php5 php5-cli openssh-server \
apache2 php5 php5-mysql apache2-mpm-prefork libapache2-mod-php5 php5-cli \
mysql-server libvlc-dev libvlc5 libvlccore-dev libvlccore7 vlc-data libcurl4-openssl-dev \
libavformat-dev libswscale-dev libavutil-dev libavcodec-dev libavfilter-dev \
libavresample-dev libavdevice-dev libpostproc-dev libv4l-dev libtool libnetpbm10-dev \
@ -42,22 +42,12 @@ ADD utils/docker/start.sh /tmp/start.sh
# give files in /usr/local/share/zoneminder/
RUN chown -R www-data:www-data /usr/local/share/zoneminder/
# Creating SSH privilege escalation dir
RUN mkdir /var/run/sshd
# Adding apache virtual hosts file
ADD utils/docker/apache-vhost /etc/apache2/sites-available/000-default.conf
ADD utils/docker/phpdate.ini /etc/php5/apache2/conf.d/25-phpdate.ini
# Set the root passwd
RUN echo 'root:root' | chpasswd
# Add a user we can actually login with
RUN useradd -m -s /bin/bash -G sudo zoneminder
RUN echo 'zoneminder:zoneminder' | chpasswd
# Expose ssh and http ports
EXPOSE 22 80
# Expose http ports
EXPOSE 80
# Initial database and apache setup:
RUN "/ZoneMinder/utils/docker/setup.sh"

View File

@ -194,7 +194,7 @@ CREATE TABLE `Events` (
`Length` decimal(10,2) NOT NULL default '0.00',
`Frames` int(10) unsigned default NULL,
`AlarmFrames` int(10) unsigned default NULL,
`DefaultVideo` VARCHAR( 64 ) NOT NULL,
`DefaultVideo` VARCHAR( 64 ) DEFAULT '' NOT NULL,
`TotScore` int(10) unsigned NOT NULL default '0',
`AvgScore` smallint(5) unsigned default '0',
`MaxScore` smallint(5) unsigned default '0',
@ -572,7 +572,7 @@ CREATE TABLE `Storage` (
--
-- Create a default storage location
--
insert into Storage VALUES (NULL, '/var/lib/zoneminder/events', 'Default' );
insert into Storage VALUES (NULL, '/var/cache/zoneminder/events', 'Default' );
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;

View File

@ -52,7 +52,7 @@ SET @s = (SELECT IF(
AND column_name = 'DefaultVideo'
) > 0,
"SELECT 'Column DefaultVideo exists in Events'",
"ALTER TABLE `Events` ADD `DefaultVideo` VARCHAR( 64 ) NOT NULL AFTER `AlarmFrames`"
"ALTER TABLE `Events` ADD `DefaultVideo` VARCHAR( 64 ) NOT NULL DEFAULT '' AFTER `AlarmFrames`"
));
PREPARE stmt FROM @s;

View File

@ -6,9 +6,9 @@
%if "%{zmuid_final}" == "nginx"
%global with_nginx 1
%global wwwconfdir /etc/nginx/default.d
%global wwwconfdir %{_sysconfdir}/nginx/default.d
%else
%global wwwconfdir /etc/httpd/conf.d
%global wwwconfdir %{_sysconfdir}/httpd/conf.d
%endif
%global sslcert %{_sysconfdir}/pki/tls/certs/localhost.crt
@ -24,19 +24,12 @@
%global with_init_sysv 1
%endif
# php-mysql deprecated in f25
%if 0%{?fedora} >= 25
%global with_php_mysqlnd 1
%else
%global with_php_mysql 1
%endif
%global readme_suffix %{?rhel:Redhat%{?rhel}}%{!?rhel:Fedora}
%global _hardened_build 1
Name: zoneminder
Version: 1.30.1
Release: 2%{?dist}
Version: 1.30.2
Release: 1%{?dist}
Summary: A camera monitoring and analysis tool
Group: System Environment/Daemons
# jscalendar is LGPL (any version): http://www.dynarch.com/projects/calendar/
@ -88,10 +81,9 @@ BuildRequires: polkit-devel
%{?with_nginx:Requires: nginx}
%{?with_nginx:Requires: fcgiwrap}
%{?with_nginx:Requires: php-fpm}
%{!?with_nginx:Requires: httpd php}
%{!?with_nginx:Requires: httpd}
%{!?with_nginx:Requires: php}
%{?with_php_mysqlnd:Requires: php-mysqlnd}
%{?with_php_mysql:Requires: php-mysql}
Requires: php-mysqli
Requires: php-common
Requires: php-gd
Requires: cambozola
@ -282,9 +274,9 @@ rm -rf %{_docdir}/%{name}-%{version}
%files
%license COPYING
%doc AUTHORS README.md distros/redhat/readme/README.%{readme_suffix} distros/redhat/readme/README.https distros/redhat/jscalendar-doc
%config(noreplace) %attr(640,root,%{zmgid_final}) /etc/zm/zm.conf
%config(noreplace) %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/zm.conf
%config(noreplace) %attr(644,root,root) %{wwwconfdir}/zoneminder.conf
%config(noreplace) /etc/logrotate.d/zoneminder
%config(noreplace) %{_sysconfdir}/logrotate.d/zoneminder
%if 0%{?with_nginx}
%config(noreplace) %{_sysconfdir}/php-fpm.d/zoneminder.conf
@ -344,6 +336,9 @@ rm -rf %{_docdir}/%{name}-%{version}
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %ghost %{_localstatedir}/run/zoneminder
%changelog
* Wed Feb 08 2017 Andrew Bauer <zonexpertconsulting@outlook.com> - 1.30.2-1
- Bump version for 1.30.2 release
* Wed Dec 28 2016 Andrew Bauer <zonexpertconsulting@outlook.com> - 1.30.1-2
- Changes from rpmfusion #4393

View File

@ -8,7 +8,7 @@ ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
Options -Indexes +ollowSymLinks
Options -Indexes +FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>

View File

@ -0,0 +1 @@
1.0

View File

@ -40,6 +40,8 @@ Type
Preset
The preset chooser sets sensible default values based on computational needs (fast v. best) and sensitivity (low, medium, high.) It is not required that you select a preset, and you can alter any of the parameters after choosing a preset. For a small number of monitors with ZoneMinder running on modern equipment, Best, high sensitivity can be chosen as a good starting point.
It is important to understand that the available presets are intended merely as a starting point. Since every camera's view is unique, they are not guaranteed to work properly in every case. Presets tend to work acceptably for indoor cameras, where the objects of interest are relatively close and there typically are few or no unwanted objects moving within the cameras view. Presets, on the other hand, tend to not work acceptably for outdoor cameras, where the field of view is typically much wider, objects of interest are farther away, and changing weather patterns can cause false triggers. For outdoor cameras in particular, you will almost certainly have to tune your motion detection zone to get desired results. Please refer to `this guide <http://www.zoneminder.com/wiki/index.php/Understanding_ZoneMinder%27s_Zoning_system_for_Dummies>`__ to learn how to do this.
Units
* Pixels - Selecting this option will allow many of the following values to be entered (or viewed) in units of pixels.
* Percentage - Selecting this option will allow may of the following values to be entered (or viewed) as a percentage. The sense of the percentage values refers to the area of the zone and not the image as a whole. This makes trying to work out necessary sizes rather easier.

View File

@ -313,7 +313,7 @@ $dbh->ping();
}
if ( $filter->{AutoExecute} )
{
if ( !$event->{Execute} )
if ( !$event->{Executed} )
{
$delete_ok = undef if ( !executeCommand( $filter, $event ) );
}

View File

@ -510,13 +510,13 @@ void Logger::logPrint( bool hex, const char * const filepath, const int line, co
{
if ( level <= mEffectiveLevel )
{
char classString[4];
char timeString[64];
char logString[8192];
va_list argPtr;
struct timeval timeVal;
const char * const file = basename(filepath);
const char *classString = smCodes[level].c_str();
if ( level < PANIC || level > DEBUG9 )
Panic( "Invalid logger level %d", level );
@ -569,7 +569,7 @@ void Logger::logPrint( bool hex, const char * const filepath, const int line, co
timeString,
mId.c_str(),
tid,
smCodes[level].c_str(),
classString,
file,
line
);

View File

@ -178,7 +178,7 @@ bool Monitor::MonitorLink::disconnect() {
connected = false;
#if ZM_MEM_MAPPED
if ( mem_ptr > 0 ) {
if ( mem_ptr > (void *)0 ) {
msync( mem_ptr, mem_size, MS_ASYNC );
munmap( mem_ptr, mem_size );
}

View File

@ -189,8 +189,7 @@ int RemoteCameraHttp::SendRequest()
* > 0 is the # of bytes read.
*/
int RemoteCameraHttp::ReadData( Buffer &buffer, int bytes_expected )
{
int RemoteCameraHttp::ReadData( Buffer &buffer, unsigned int bytes_expected ) {
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(sd, &rfds);
@ -198,8 +197,7 @@ int RemoteCameraHttp::ReadData( Buffer &buffer, int bytes_expected )
struct timeval temp_timeout = timeout;
int n_found = select( sd+1, &rfds, NULL, NULL, &temp_timeout );
if( n_found == 0 )
{
if( n_found == 0 ) {
Debug( 4, "Select timed out timeout was %d secs %d usecs", temp_timeout.tv_sec, temp_timeout.tv_usec );
int error = 0;
socklen_t len = sizeof (error);
@ -213,39 +211,32 @@ int RemoteCameraHttp::ReadData( Buffer &buffer, int bytes_expected )
// Why are we disconnecting? It's just a timeout, meaning that data wasn't available.
//Disconnect();
return( 0 );
}
else if ( n_found < 0)
{
} else if ( n_found < 0) {
Error( "Select error: %s", strerror(errno) );
return( -1 );
}
int total_bytes_to_read = 0;
unsigned int total_bytes_to_read = 0;
if ( bytes_expected )
{
if ( bytes_expected ) {
total_bytes_to_read = bytes_expected;
}
else
{
if ( ioctl( sd, FIONREAD, &total_bytes_to_read ) < 0 )
{
} else {
if ( ioctl( sd, FIONREAD, &total_bytes_to_read ) < 0 ) {
Error( "Can't ioctl(): %s", strerror(errno) );
return( -1 );
}
if ( total_bytes_to_read == 0 )
{
if ( total_bytes_to_read == 0 ) {
if( mode == SINGLE_IMAGE ) {
int error = 0;
socklen_t len = sizeof (error);
int retval = getsockopt (sd, SOL_SOCKET, SO_ERROR, &error, &len);
if(retval != 0 ) {
Debug( 1, "error getting socket error code %s", strerror(retval) );
}
if (error != 0) {
return -1;
}
int error = 0;
socklen_t len = sizeof (error);
int retval = getsockopt( sd, SOL_SOCKET, SO_ERROR, &error, &len );
if(retval != 0 ) {
Debug( 1, "error getting socket error code %s", strerror(retval) );
}
if (error != 0) {
return -1;
}
// Case where we are grabbing a single jpg, but no content-length was given, so the expectation is that we read until close.
return( 0 );
}
@ -263,34 +254,27 @@ int RemoteCameraHttp::ReadData( Buffer &buffer, int bytes_expected )
} else {
Debug(3, "Just getting %d", total_bytes_to_read );
}
}
} // end if bytes_expected or not
Debug( 3, "Expecting %d bytes", total_bytes_to_read );
int total_bytes_read = 0;
do
{
do {
int bytes_read = buffer.read_into( sd, total_bytes_to_read );
if ( bytes_read < 0)
{
if ( bytes_read < 0 ) {
Error( "Read error: %s", strerror(errno) );
return( -1 );
}
else if ( bytes_read == 0)
{
} else if ( bytes_read == 0 ) {
Debug( 2, "Socket closed" );
//Disconnect(); // Disconnect is done outside of ReadData now.
return( -1 );
}
else if ( bytes_read < total_bytes_to_read )
{
} else if ( bytes_read < total_bytes_to_read ) {
Error( "Incomplete read, expected %d, got %d", total_bytes_to_read, bytes_read );
return( -1 );
}
Debug( 3, "Read %d bytes", bytes_read );
total_bytes_read += bytes_read;
total_bytes_to_read -= bytes_read;
}
while ( total_bytes_to_read );
} while ( total_bytes_to_read );
Debug( 4, buffer );

View File

@ -54,7 +54,7 @@ public:
int Connect();
int Disconnect();
int SendRequest();
int ReadData( Buffer &buffer, int bytes_expected=0 );
int ReadData( Buffer &buffer, unsigned int bytes_expected=0 );
int GetResponse();
int PreCapture();
int Capture( Image &image );

View File

@ -260,7 +260,7 @@ Debug(2, "Have audio_output_context");
/* check that the encoder supports s16 pcm input */
if (!check_sample_fmt( audio_output_codec, audio_output_context->sample_fmt)) {
Error( "Encoder does not support sample format %s, setting to FLTP",
Debug( 3, "Encoder does not support sample format %s, setting to FLTP",
av_get_sample_fmt_name( audio_output_context->sample_fmt));
audio_output_context->sample_fmt = AV_SAMPLE_FMT_FLTP;
}

View File

@ -87,12 +87,12 @@ else
echo "Defaulting to master branch";
BRANCH="master";
fi;
if [ "$SNAPSHOT" == "NOW" ]; then
SNAPSHOT=`date +%Y%m%d%H%M%S`;
fi;
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
@ -159,6 +159,10 @@ else
fi
fi
if [ "$URGENCY" = "" ]; then
URGENCY="medium"
fi;
if [ "$SNAPSHOT" == "stable" ]; then
cat <<EOF > debian/changelog
zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY
@ -182,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
@ -201,6 +206,7 @@ if [ "$DEBSIGN_KEYID" != "" ]; then
DEBUILD="$DEBUILD -k$DEBSIGN_KEYID"
fi
$DEBUILD
echo "Status: $?"
cd ../
if [ "$INTERACTIVE" != "no" ]; then
@ -222,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;

View File

@ -36,9 +36,6 @@ service apache2 restart
# Start ZoneMinder
/usr/local/bin/zmpkg.pl start
# Start SSHD
/usr/sbin/sshd
while :
do
sleep 3600

View File

@ -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

View File

@ -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
@ -80,10 +86,21 @@ if [ "${OS}" == "el" ] || [ "${OS}" == "fedora" ]; then
elif [ "${OS}" == "debian" ] || [ "${OS}" == "ubuntu" ]; then
echo "Begin Debian build..."
# Uncompress the Crud tarball and move it into place
tar -xzf build/crud-${CRUDVER}.tar.gz
rmdir web/api/app/Plugin/Crud
mv -f crud-${CRUDVER} web/api/app/Plugin/Crud
# patch packpack to remove "debian" from the source tarball filename
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
echo "Crud plugin already installed..."
else
echo "Unpacking Crud plugin..."
tar -xzf build/crud-${CRUDVER}.tar.gz
rmdir web/api/app/Plugin/Crud
mv -f crud-${CRUDVER} web/api/app/Plugin/Crud
fi
if [ ${DIST} == "trusty" ] || [ ${DIST} == "precise" ]; then
ln -sf distros/ubuntu1204 debian

View File

@ -35,85 +35,85 @@ switch ( $_REQUEST['task'] )
if ( !canView( 'System' ) )
ajaxError( 'Insufficient permissions to view log entries' );
$servers = Server::find_all();
$servers_by_Id = array();
$servers = Server::find_all();
$servers_by_Id = array();
# There is probably a better way to do this.
foreach ( $servers as $server ) {
$servers_by_Id[$server->Id()] = $server;
}
foreach ( $servers as $server ) {
$servers_by_Id[$server->Id()] = $server;
}
$minTime = isset($_POST['minTime'])?$_POST['minTime']:NULL;
$maxTime = isset($_POST['maxTime'])?$_POST['maxTime']:NULL;
$limit = 100;
if ( isset($_POST['limit']) ) {
if ( ( !is_integer( $_POST['limit'] ) and !ctype_digit($_POST['limit']) ) ) {
Error("Invalid value for limit " . $_POST['limit'] );
} else {
$limit = $_POST['limit'];
}
}
if ( isset($_POST['limit']) ) {
if ( ( !is_integer( $_POST['limit'] ) and !ctype_digit($_POST['limit']) ) ) {
Error("Invalid value for limit " . $_POST['limit'] );
} else {
$limit = $_POST['limit'];
}
}
$sortField = 'TimeKey';
if ( isset($_POST['sortField']) ) {
if ( ! in_array( $_POST['sortField'], $filterFields ) and ( $_POST['sortField'] != 'TimeKey' ) ) {
Error("Invalid sort field " . $_POST['sortField'] );
} else {
$sortField = $_POST['sortField'];
}
}
if ( isset($_POST['sortField']) ) {
if ( ! in_array( $_POST['sortField'], $filterFields ) and ( $_POST['sortField'] != 'TimeKey' ) ) {
Error("Invalid sort field " . $_POST['sortField'] );
} else {
$sortField = $_POST['sortField'];
}
}
$sortOrder = (isset($_POST['sortOrder']) and $_POST['sortOrder']) == 'asc' ? 'asc':'desc';
$filter = isset($_POST['filter'])?$_POST['filter']:array();
$total = dbFetchOne( 'SELECT count(*) AS Total FROM Logs', 'Total' );
$sql = 'SELECT * FROM Logs';
$where = array();
$values = array();
$values = array();
if ( $minTime ) {
$where[] = "TimeKey > ?";
$values[] = $minTime;
} elseif ( $maxTime ) {
$where[] = "TimeKey < ?";
$values[] = $maxTime;
}
$where[] = "TimeKey > ?";
$values[] = $minTime;
} elseif ( $maxTime ) {
$where[] = "TimeKey < ?";
$values[] = $maxTime;
}
foreach ( $filter as $field=>$value ) {
if ( ! in_array( $field, $fileFields ) ) {
Error("$field is not in valid filter fields");
continue;
}
if ( $field == 'Level' ){
$where[] = $field." <= ?";
$values[] = $value;
} else {
$where[] = $field." = ?";
$values[] = $value;
}
}
if ( count($where) )
$sql.= ' WHERE '.join( ' AND ', $where );
if ( ! in_array( $field, $filterFields ) ) {
Error("$field is not in valid filter fields");
continue;
}
if ( $field == 'Level' ){
$where[] = $field." <= ?";
$values[] = $value;
} else {
$where[] = $field." = ?";
$values[] = $value;
}
}
if ( count($where) )
$sql.= ' WHERE '.join( ' AND ', $where );
$sql .= " order by ".$sortField." ".$sortOrder." limit ".$limit;
$logs = array();
foreach ( dbFetchAll( $sql, NULL, $values ) as $log ) {
$log['DateTime'] = preg_replace( '/^\d+/', strftime( "%Y-%m-%d %H:%M:%S", intval($log['TimeKey']) ), $log['TimeKey'] );
$log['Server'] = ( $log['ServerId'] and isset($servers_by_Id[$log['ServerId']]) ) ? $servers_by_Id[$log['ServerId']]->Name() : '';
$log['Server'] = ( $log['ServerId'] and isset($servers_by_Id[$log['ServerId']]) ) ? $servers_by_Id[$log['ServerId']]->Name() : '';
$logs[] = $log;
}
$options = array();
$where = array();
$values = array();
$values = array();
foreach( $filter as $field=>$value ) {
if ( $field == 'Level' ) {
$where[$field] = $field." <= ?";
$values[$field] = $value;
$values[$field] = $value;
} else {
$where[$field] = $field." = ?";
$values[$field] = $value;
}
}
$values[$field] = $value;
}
}
foreach( $filterFields as $field )
{
$sql = "SELECT DISTINCT $field FROM Logs WHERE NOT isnull($field)";
$fieldWhere = array_diff_key( $where, array( $field=>true ) );
$fieldValues = array_diff_key( $values, array( $field=>true ) );
$fieldValues = array_diff_key( $values, array( $field=>true ) );
if ( count($fieldWhere) )
$sql.= " AND ".join( ' AND ', $fieldWhere );
$sql.= " ORDER BY $field ASC";
@ -129,7 +129,7 @@ switch ( $_REQUEST['task'] )
{
foreach( dbFetchAll( $sql, $field, array_values($fieldValues) ) as $value )
$options['ServerId'][$value] = ( $value and isset($servers_by_Id[$value]) ) ? $servers_by_Id[$value]->Name() : '';
}
else
{
@ -169,7 +169,7 @@ switch ( $_REQUEST['task'] )
//$limit = isset($_POST['limit'])?$_POST['limit']:1000;
$filter = isset($_POST['filter'])?$_POST['filter']:array();
$sortField = 'TimeKey';
if ( isset($_POST['sortField']) ) {
if ( isset($_POST['sortField']) ) {
if ( ! in_array( $_POST['sortField'], $filterFields ) and ( $_POST['sortField'] != 'TimeKey' ) ) {
Error("Invalid sort field " . $_POST['sortField'] );
} else {
@ -178,41 +178,41 @@ switch ( $_REQUEST['task'] )
}
$sortOrder = (isset($_POST['sortOrder']) and $_POST['sortOrder']) == 'asc' ? 'asc':'desc';
$servers = Server::find_all();
$servers_by_Id = array();
# There is probably a better way to do this.
foreach ( $servers as $server ) {
$servers_by_Id[$server->Id()] = $server;
}
$servers = Server::find_all();
$servers_by_Id = array();
# There is probably a better way to do this.
foreach ( $servers as $server ) {
$servers_by_Id[$server->Id()] = $server;
}
$sql = "select * from Logs";
$where = array();
$values = array();
$values = array();
if ( $minTime )
{
preg_match( '/(.+)(\.\d+)/', $minTime, $matches );
$minTime = strtotime($matches[1]).$matches[2];
$where[] = "TimeKey >= ?";
$values[] = $minTime;
$values[] = $minTime;
}
if ( $maxTime )
{
preg_match( '/(.+)(\.\d+)/', $maxTime, $matches );
$maxTime = strtotime($matches[1]).$matches[2];
$where[] = "TimeKey <= ?";
$values[] = $maxTime;
$values[] = $maxTime;
}
foreach ( $filter as $field=>$value ) {
if ( $value != '' ) {
if ( $field == 'Level' ) {
$where[] = $field." <= ?";
$values[] = $value;
$values[] = $value;
} else {
$where[] = $field." = ?'";
$values[] = $value;
}
}
}
$values[] = $value;
}
}
}
if ( count($where) )
$sql.= " where ".join( " and ", $where );
$sql .= " order by ".$sortField." ".$sortOrder;
@ -244,7 +244,7 @@ switch ( $_REQUEST['task'] )
foreach ( dbFetchAll( $sql, NULL, $values ) as $log )
{
$log['DateTime'] = preg_replace( '/^\d+/', strftime( "%Y-%m-%d %H:%M:%S", intval($log['TimeKey']) ), $log['TimeKey'] );
$log['Server'] = ( $log['ServerId'] and isset($servers_by_Id[$log['ServerId']]) ) ? $servers_by_Id[$log['ServerId']]->Name() : '';
$log['Server'] = ( $log['ServerId'] and isset($servers_by_Id[$log['ServerId']]) ) ? $servers_by_Id[$log['ServerId']]->Name() : '';
$logs[] = $log;
}
switch( $format )
@ -262,20 +262,20 @@ switch ( $_REQUEST['task'] )
}
case 'tsv' :
{
# This line doesn't need fprintf, it could use fwrite
# This line doesn't need fprintf, it could use fwrite
fprintf( $exportFP, join( "\t",
translate('DateTime'),
translate('Component'),
translate('Server'),
translate('Pid'),
translate('Level'),
translate('Message'),
translate('File'),
translate('Line')
)."\n" );
translate('DateTime'),
translate('Component'),
translate('Server'),
translate('Pid'),
translate('Level'),
translate('Message'),
translate('File'),
translate('Line')
)."\n" );
foreach ( $logs as $log )
{
fprintf( $exportFP, "%s\t%s\t%s\t%d\t%s\t%s\t%s\t%s\n", $log['DateTime'], $log['Component'], $log['Server'], $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
fprintf( $exportFP, "%s\t%s\t%s\t%d\t%s\t%s\t%s\t%s\n", $log['DateTime'], $log['Component'], $log['Server'], $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
}
break;
}

View File

@ -113,11 +113,13 @@ switch ( $data['type'] )
$data['delay'] = round( $data['delay'], 2 );
$data['zoom'] = round( $data['zoom']/SCALE_BASE, 1 );
if ( ZM_OPT_USE_AUTH && ZM_AUTH_RELAY == "hashed" ) {
session_start();
$time = time();
// Regenerate auth hash after half the lifetime of the hash
if ( $_SESSION['AuthHashGeneratedAt'] < $time - (ZM_AUTH_HASH_TTL * 1800) ) {
$data['auth'] = generateAuthHash( ZM_AUTH_HASH_IPS );
}
session_write_close();
}
ajaxResponse( array( 'status'=>$data ) );
break;
@ -129,11 +131,13 @@ switch ( $data['type'] )
$data['rate'] /= RATE_BASE;
$data['zoom'] = round( $data['zoom']/SCALE_BASE, 1 );
if ( ZM_OPT_USE_AUTH && ZM_AUTH_RELAY == "hashed" ) {
session_start();
$time = time();
// Regenerate auth hash after half the lifetime of the hash
if ( $_SESSION['AuthHashGeneratedAt'] < $time - (ZM_AUTH_HASH_TTL * 1800) ) {
$data['auth'] = generateAuthHash( ZM_AUTH_HASH_IPS );
}
session_write_close();
}
ajaxResponse( array( 'status'=>$data ) );
break;

View File

@ -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

View File

@ -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();

View File

@ -44,6 +44,7 @@ function dbConnect()
try {
$dbConn = new PDO( ZM_DB_TYPE . $socket . ';dbname='.ZM_DB_NAME, ZM_DB_USER, ZM_DB_PASS );
$dbConn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $ex ) {
echo "Unable to connect to ZM db." . $ex->getMessage();

View File

@ -56,6 +56,7 @@ function userLogin( $username, $password="", $passwordHashed=false ) {
if ( ZM_AUTH_TYPE == "builtin" ) {
$_SESSION['passwordHash'] = $user['Password'];
}
session_regenerate_id();
} else {
Warning( "Login denied for user \"$username\"" );
$_SESSION['loginFailed'] = true;

View File

@ -20,9 +20,9 @@
#monitors .alert {
color: #ffa500;
margin: 0;
padding: 0;
border-radius: 0;
margin: 0;
padding: 0;
border-radius: 0;
}
#monitors .imageFeed {
@ -32,9 +32,9 @@
#monitors .imageFeed img {
border: 2px solid #ffffff;
margin: 0;
padding: 0;
border-radius: 0;
margin: 0;
padding: 0;
border-radius: 0;
}
#monitors .imageFeed img.idle {

View File

@ -95,7 +95,7 @@
}
.zones polygon {
fill-opacity: 0.25;
stroke-width: 0;
stroke-width: 0;
}
.zones polygon.Editing {
stroke-width: 2px;

View File

@ -722,7 +722,7 @@ switch ( $tab )
</td>
</tr>
<tr><td><?php echo translate('AnalysisFPS') ?></td><td><input type="text" name="newMonitor[AnalysisFPS]" value="<?php echo validHtmlStr($monitor->AnalysisFPS) ?>" size="6"/></td></tr>
<?php if ( $monitor->Type != "Local" && $monitor->Type != "File" ) { ?>
<?php if ( $monitor->Type() != "Local" && $monitor->Type() != "File" ) { ?>
<tr>
<td><?php echo translate('MaximumFPS') ?>&nbsp;(<?php echo makePopupLink('?view=optionhelp&amp;option=OPTIONS_MAXFPS', 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td>
<td><input type="text" onclick="document.getElementById('newMonitor[MaxFPS]').innerHTML= ' CAUTION: See the help text'" name="newMonitor[MaxFPS]" value="<?php echo validHtmlStr($monitor->MaxFPS) ?>" size="5"/><span id="newMonitor[MaxFPS]" style="color:red"></span></td>
@ -738,8 +738,18 @@ switch ( $tab )
}
if ( ZM_FAST_IMAGE_BLENDS ) {
?>
<tr><td><?php echo translate('RefImageBlendPct') ?></td><td><select name="newMonitor[RefBlendPerc]"><?php foreach ( $fastblendopts as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->RefBlendPerc ) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>
<tr><td><?php echo translate('AlmRefImageBlendPct') ?></td><td><select name="newMonitor[AlarmRefBlendPerc]"><?php foreach ( $fastblendopts_alarm as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->AlarmRefBlendPerc ) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>
<tr>
<td><?php echo translate('RefImageBlendPct') ?></td>
<td><select name="newMonitor[RefBlendPerc]"><?php foreach ( $fastblendopts as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->RefBlendPerc() ) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td>
</tr>
<tr>
<td><?php echo translate('AlarmRefImageBlendPct') ?></td>
<td>
<select name="newMonitor[AlarmRefBlendPerc]">
<?php foreach ( $fastblendopts_alarm as $name => $value ) { ?>
<option value="<?php echo $value ?>"<?php if ( $value == $monitor->AlarmRefBlendPerc() ) { ?> selected="selected"<?php } ?>><?php echo $name ?></option>
<?php } ?>
</select></td></tr>
<?php
} else {
?>

View File

@ -18,8 +18,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
if ( !canView( 'Stream' ) )
{
if ( !canView( 'Stream' ) ) {
$view = 'error';
return;
}
@ -78,8 +77,7 @@ xhtmlHeaders(__FILE__, translate('Montage') );
<div id="header">
<div id="headerButtons">
<?php
if ( $showControl )
{
if ( $showControl ) {
?>
<a href="#" onclick="createPopup( '?view=control', 'zmControl', 'control' )"><?php echo translate('Control') ?></a>
<?php
@ -89,15 +87,14 @@ if ( $showControl )
</div>
<h2><?php echo translate('Montage') ?></h2>
<div id="headerControl">
<span id="scaleControl"><?php echo translate('Scale') ?>: <?php echo buildSelect( 'scale', $scales, 'changeScale(this);' ); ?></span>
<span id="scaleControl"><label><?php echo translate('Scale') ?></label>: <?php echo buildSelect( 'scale', $scales, 'changeScale(this);' ); ?></span>
<label for="layout"><?php echo translate('Layout') ?>:</label><?php echo buildSelect( 'layout', $layouts, 'selectLayout(this);' )?>
</div>
</div>
<div id="content">
<div id="monitors">
<?php
foreach ( $monitors as $monitor )
{
foreach ( $monitors as $monitor ) {
$connkey = $monitor->connKey(); // Minor hack
?>
<div id="monitorFrame<?php echo $monitor->Id() ?>" class="monitorFrame" title="<?php echo $monitor->Id() . ' ' .$monitor->Name() ?>">
@ -106,8 +103,7 @@ foreach ( $monitors as $monitor )
<?php echo getStreamHTML( $monitor, $monitor->Scale() ); ?>
</div>
<?php
if ( !ZM_WEB_COMPACT_MONTAGE )
{
if ( !ZM_WEB_COMPACT_MONTAGE ) {
?>
<div id="monitorState<?php echo $monitor->Id() ?>" class="monitorState idle"><?php echo translate('State') ?>:&nbsp;<span id="stateValue<?php echo $monitor->Id() ?>"></span>&nbsp;-&nbsp;<span id="fpsValue<?php echo $monitor->Id() ?>"></span>&nbsp;fps</div>
<?php

View File

@ -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

View File

@ -42,12 +42,6 @@
#cmakedefine HAVE_GNUTLS_GNUTLS_H 1
#cmakedefine HAVE_LIBMYSQLCLIENT 1
#cmakedefine HAVE_MYSQL_H 1
#cmakedefine HAVE_LIBX264 1
#cmakedefine HAVE_X264_H 1
#cmakedefine HAVE_LIBMP4V2 1
#cmakedefine HAVE_MP4V2_MP4V2_H 1
#cmakedefine HAVE_MP4V2_H 1
#cmakedefine HAVE_MP4_H 1
#cmakedefine HAVE_LIBAVFORMAT 1
#cmakedefine HAVE_LIBAVFORMAT_AVFORMAT_H 1
#cmakedefine HAVE_LIBAVCODEC 1
@ -59,8 +53,6 @@
#cmakedefine HAVE_LIBAVUTIL_MATHEMATICS_H 1
#cmakedefine HAVE_LIBSWSCALE 1
#cmakedefine HAVE_LIBSWSCALE_SWSCALE_H 1
#cmakedefine HAVE_LIBSWRESAMPLE 1
#cmakedefine HAVE_LIBSWRESAMPLE_SWRESAMPLE_H 1
#cmakedefine HAVE_LIBVLC 1
#cmakedefine HAVE_VLC_VLC_H 1