Merge remote-tracking branch 'ZoneMinder/master'

This commit is contained in:
Steve Gilvarry 2015-11-18 23:15:38 +11:00
commit f01b0e84e8
17 changed files with 99 additions and 35 deletions

View File

@ -4,7 +4,7 @@
# #
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.6)
project (zoneminder) project (zoneminder)
set(zoneminder_VERSION "1.28.108") set(zoneminder_VERSION "1.28.109")
# make API version a minor of ZM version # make API version a minor of ZM version
set(zoneminder_API_VERSION "${zoneminder_VERSION}.1") set(zoneminder_API_VERSION "${zoneminder_VERSION}.1")

View File

@ -3,7 +3,7 @@
# For instructions on building with cmake, please see INSTALL # For instructions on building with cmake, please see INSTALL
# #
AC_PREREQ(2.59) AC_PREREQ(2.59)
AC_INIT(zm,1.28.108,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html) AC_INIT(zm,1.28.109,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html)
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR(src/zm.h) AC_CONFIG_SRCDIR(src/zm.h)
AC_CONFIG_HEADERS(config.h) AC_CONFIG_HEADERS(config.h)

View File

@ -13,7 +13,7 @@ SET @s = (SELECT IF(
AND table_schema = DATABASE() AND table_schema = DATABASE()
AND column_name = 'Id' AND column_name = 'Id'
) > 0, ) > 0,
"SELECT 'Column ID already exists in Monitors'", "SELECT 'Column ID already exists in Frames'",
"ALTER TABLE `Frames` ADD COLUMN `Id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT FIRST, DROP PRIMARY KEY, ADD PRIMARY KEY(`Id`)" "ALTER TABLE `Frames` ADD COLUMN `Id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT FIRST, DROP PRIMARY KEY, ADD PRIMARY KEY(`Id`)"
)); ));

21
db/zm_update-1.28.109.sql Normal file
View File

@ -0,0 +1,21 @@
--
-- This updates a 1.28.106 database to 1.28.107
--
--
-- Update Frame table to have a PrimaryKey of ID, insetad of a Composite Primary Key
-- Used primarially for compatibility with CakePHP
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Servers'
AND table_schema = DATABASE()
AND column_name = 'Hostname'
) > 0,
"SELECT 'Column Hostname already exists in Servers'",
"ALTER TABLE `Servers` ADD COLUMN `Hostname` TEXT AFTER Name"
));
PREPARE stmt FROM @s;
EXECUTE stmt;

View File

@ -15,7 +15,7 @@ if [ "$1" = "configure" ]; then
# test if database if already present... # test if database if already present...
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf
echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql echo 'grant lock tables, alter,select,insert,update,delete,create,index on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
fi fi
invoke-rc.d zoneminder stop || true invoke-rc.d zoneminder stop || true
@ -47,6 +47,8 @@ if [ "$1" = "configure" ]; then
chown www-data:www-data -R /var/cache/zoneminder chown www-data:www-data -R /var/cache/zoneminder
else else
chown www-data:www-data /var/log/zm chown www-data:www-data /var/log/zm
echo 'grant lock tables, create, index, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
zmupdate.pl zmupdate.pl
fi fi
fi fi

View File

@ -11,9 +11,9 @@ What's New
2. The ZoneMinder config file, zm.conf, has been moved under /etc/zm. 2. The ZoneMinder config file, zm.conf, has been moved under /etc/zm.
3. The ZoneMinder mysql account now requires "Create" permission. This change 3. The ZoneMinder mysql account now requires "create" and "index" permission.
must be done manually before ZoneMinder will run. See the installation steps This change must be done manually before ZoneMinder will run. See the
below. installation steps below.
4. A new permission group called "Groups" has been added. This allows the 4. A new permission group called "Groups" has been added. This allows the
system administrator to assign "view", "edit", or "none" permission to system administrator to assign "view", "edit", or "none" permission to
@ -46,7 +46,7 @@ New installs
mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
mysql -u root -p mysql -u root -p
mysql> grant select,insert,update,delete,lock tables,alter,create mysql> grant select,insert,update,delete,lock tables,alter,create,index
on zm.* to 'zmuser'@localhost identified by 'zmpass'; on zm.* to 'zmuser'@localhost identified by 'zmpass';
mysql> exit; mysql> exit;
mysqladmin -u root -p reload mysqladmin -u root -p reload
@ -113,8 +113,8 @@ Upgrades
Over time, the database account permissions required for normal operation Over time, the database account permissions required for normal operation
have changed. Verify the zmuser database account has been granted select, have changed. Verify the zmuser database account has been granted select,
insert, update, delete, lock tables, alter, and create permission to the insert, update, delete, lock tables, alter, create, and index permission
ZoneMinder database: to the ZoneMinder database:
mysql -u root -p mysql -u root -p
mysql> show grants for zmuser@localhost; mysql> show grants for zmuser@localhost;

View File

@ -1,9 +1,9 @@
What's New What's New
========== ==========
1. The ZoneMinder mysql account now requires "Create" permission. This change 1. The ZoneMinder mysql account now requires "create" and "index" permission.
must be done manually before ZoneMinder will run. See the installation steps This change must be done manually before ZoneMinder will run. See the
below. installation steps below.
2. A new permission group called "Groups" has been added. This allows the 2. A new permission group called "Groups" has been added. This allows the
system administrator to assign "view", "edit", or "none" permission to system administrator to assign "view", "edit", or "none" permission to
@ -32,7 +32,7 @@ New installs
mysql -uroot -p mysql -uroot -p
mysql> create database zm; mysql> create database zm;
mysql> grant select,insert,update,delete,lock tables,alter,create mysql> grant select,insert,update,delete,lock tables,alter,create,index
on zm.* to 'zmuser'@localhost identified by 'zmpass'; on zm.* to 'zmuser'@localhost identified by 'zmpass';
mysql> exit; mysql> exit;
mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
@ -105,8 +105,8 @@ New installs
Over time, the database account permissions required for normal operation Over time, the database account permissions required for normal operation
have changed. Verify the zmuser database account has been granted select, have changed. Verify the zmuser database account has been granted select,
insert, update, delete, lock tables, alter, and create permission to the insert, update, delete, lock tables, alter, create, and index permission
ZoneMinder database: to the ZoneMinder database:
mysql -u root -p mysql -u root -p
mysql> show grants for zmuser@localhost; mysql> show grants for zmuser@localhost;

View File

@ -1,9 +1,9 @@
What's New What's New
========== ==========
1. The ZoneMinder mysql account now requires "Create" permission. This change 1. The ZoneMinder mysql account now requires "create" and "index" permission.
must be done manually before ZoneMinder will run. See the installation steps This change must be done manually before ZoneMinder will run. See the
below. installation steps below.
2. A new permission group called "Groups" has been added. This allows the 2. A new permission group called "Groups" has been added. This allows the
system administrator to assign "view", "edit", or "none" permission to system administrator to assign "view", "edit", or "none" permission to
@ -34,7 +34,7 @@ New installs
mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
mysql -u root -p mysql -u root -p
mysql> grant select,insert,update,delete,lock tables,alter,create mysql> grant select,insert,update,delete,lock tables,alter,create,index
on zm.* to 'zmuser'@localhost identified by 'zmpass'; on zm.* to 'zmuser'@localhost identified by 'zmpass';
mysql> exit; mysql> exit;
mysqladmin -u root -p reload mysqladmin -u root -p reload
@ -100,8 +100,8 @@ Upgrades
Over time, the database account permissions required for normal operation Over time, the database account permissions required for normal operation
have changed. Verify the zmuser database account has been granted select, have changed. Verify the zmuser database account has been granted select,
insert, update, delete, lock tables, alter, and create permission to the insert, update, delete, lock tables, alter, create, and index permission
ZoneMinder database: to the ZoneMinder database:
mysql -u root -p mysql -u root -p
mysql> show grants for zmuser@localhost; mysql> show grants for zmuser@localhost;

View File

@ -1 +1 @@
3.0 (quilt) 3.0 (native)

View File

@ -8,6 +8,17 @@ if [ "$1" = "configure" ]; then
if [ -z "$2" ]; then if [ -z "$2" ]; then
chown www-data:www-data -R /var/cache/zoneminder chown www-data:www-data -R /var/cache/zoneminder
fi fi
# Do this every time the package is installed or upgraded
# Test for database presence to avoid failure of zmupdate.pl
# Ensure zoneminder is stopped
deb-systemd-invoke stop zoneminder.service || exit $?
echo 'grant lock tables, create, index, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
# Run the ZoneMinder update tool
zmupdate.pl --nointeractive
fi fi
#DEBHELPER# #DEBHELPER#

View File

@ -57,7 +57,7 @@ EXTRA_DIST = \
ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm \ ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm \
ZoneMinder/lib/ZoneMinder/ConfigData.pm.in \ ZoneMinder/lib/ZoneMinder/ConfigData.pm.in \
ZoneMinder/lib/ZoneMinder/Control.pm \ ZoneMinder/lib/ZoneMinder/Control.pm \
ZoneMinder/lib/ZoneMinder/Control \ # Grab all ptz control skips under the Control folder ZoneMinder/lib/ZoneMinder/Control \
ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm \ ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm \
ZoneMinder/lib/ZoneMinder/Trigger/Channel/Handle.pm \ ZoneMinder/lib/ZoneMinder/Trigger/Channel/Handle.pm \
ZoneMinder/lib/ZoneMinder/Trigger/Channel/Spawning.pm \ ZoneMinder/lib/ZoneMinder/Trigger/Channel/Spawning.pm \

View File

@ -30,8 +30,9 @@
RemoteCameraRtsp::RemoteCameraRtsp( int p_id, const std::string &p_method, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, bool p_rtsp_describe, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) : RemoteCameraRtsp::RemoteCameraRtsp( int p_id, const std::string &p_method, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, bool p_rtsp_describe, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
RemoteCamera( p_id, "rtsp", p_host, p_port, p_path, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture ), RemoteCamera( p_id, "rtsp", p_host, p_port, p_path, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture ),
rtspThread( 0 ), rtsp_describe( p_rtsp_describe ),
rtsp_describe( p_rtsp_describe ) rtspThread( 0 )
{ {
if ( p_method == "rtpUni" ) if ( p_method == "rtpUni" )
method = RtspThread::RTP_UNICAST; method = RtspThread::RTP_UNICAST;

View File

@ -50,12 +50,13 @@ private:
private: private:
int mId; int mId;
bool mRtspDescribe;
RtspMethod mMethod; RtspMethod mMethod;
std::string mProtocol; std::string mProtocol;
std::string mHost; std::string mHost;
std::string mPort; std::string mPort;
std::string mPath; std::string mPath;
bool mRtspDescribe;
std::string mUrl; std::string mUrl;
// Reworked authentication system // Reworked authentication system

View File

@ -1 +1 @@
1.28.108 1.28.109

View File

@ -86,9 +86,21 @@ class EventsController extends AppController {
$event = $this->Event->find('first', $options); $event = $this->Event->find('first', $options);
$path = $configs['ZM_DIR_EVENTS'].'/'.$this->Image->getEventPath($event).'/'; $path = $configs['ZM_DIR_EVENTS'].'/'.$this->Image->getEventPath($event).'/';
$event['Event']['BasePath'] = $path; $event['Event']['BasePath'] = $path;
# Get the previous and next events for any monitor
$this->Event->id = $id;
$event_neighbors = $this->Event->find('neighbors');
$event['Event']['Next'] = $event_neighbors['next']['Event']['Id'];
$event['Event']['Prev'] = $event_neighbors['prev']['Event']['Id'];
# Also get the previous and next events for the same monitor
$event_monitor_neighbors = $this->Event->find('neighbors', array(
'conditions'=>array('Event.MonitorId'=>$event['Event']['MonitorId'])
));
$event['Event']['NextOfMonitor'] = $event_monitor_neighbors['next']['Event']['Id'];
$event['Event']['PrevOfMonitor'] = $event_monitor_neighbors['prev']['Event']['Id'];
$this->set(array( $this->set(array(
'event' => $event, 'event' => $event,
'_serialize' => array('event') '_serialize' => array('event')

View File

@ -32,6 +32,7 @@ function dbConnect()
try { try {
$dbConn = new PDO( ZM_DB_TYPE . ':host=' . ZM_DB_HOST . ';dbname='.ZM_DB_NAME, ZM_DB_USER, ZM_DB_PASS ); $dbConn = new PDO( ZM_DB_TYPE . ':host=' . ZM_DB_HOST . ';dbname='.ZM_DB_NAME, ZM_DB_USER, ZM_DB_PASS );
$dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $ex ) { } catch(PDOException $ex ) {
echo "Unable to connect to ZM db." . $ex->getMessage(); echo "Unable to connect to ZM db." . $ex->getMessage();
$dbConn = null; $dbConn = null;
@ -111,7 +112,7 @@ function dbQuery( $sql, $params=NULL ) {
$result = $dbConn->query( $sql ); $result = $dbConn->query( $sql );
} }
} catch(PDOException $e) { } catch(PDOException $e) {
Fatal( "SQL-ERR '".$e.getMessage()."', statement was '".$sql."'" ); Fatal( "SQL-ERR '".$e->getMessage()."', statement was '".$sql."'" );
} }
return( $result ); return( $result );
} }

View File

@ -40,6 +40,21 @@ if ( !canView( 'Events' ) )
header( 'Content-type: image/jpeg' ); header( 'Content-type: image/jpeg' );
// Compatibility for PHP 5.4
if (!function_exists('imagescale'))
{
function imagescale($image, $new_width, $new_height = -1, $mode = 0)
{
$mode; // Not supported
$new_height = ($new_height == -1) ? imagesy($image) : $new_height;
$imageNew = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($imageNew, $image, 0, 0, 0, 0, (int)$new_width, (int)$new_height, imagesx($image), imagesy($image));
return $imageNew;
}
}
$errorText = false; $errorText = false;
if ( empty($_REQUEST['path']) ) if ( empty($_REQUEST['path']) )
{ {