Imported missing files from master to feature-h264-videostorage
This commit is contained in:
parent
d4654f63ae
commit
df3ab025f8
|
@ -0,0 +1,51 @@
|
|||
# ZoneMinder
|
||||
|
||||
FROM ubuntu:precise
|
||||
MAINTAINER Kyle Johnson <kjohnson@gnulnx.net>
|
||||
|
||||
# Let the conatiner know that there is no tty
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# Resynchronize the package index files
|
||||
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
|
||||
RUN apt-get update
|
||||
|
||||
# Install the prerequisites
|
||||
RUN apt-get install -y build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf libjpeg-turbo8-dev libjpeg-turbo8 libtheora-dev libvorbis-dev libvpx-dev libx264-dev libmp4v2-dev ffmpeg git wget mysql-client apache2 php5 php5-mysql apache2-mpm-prefork libapache2-mod-php5 php5-cli openssh-server mysql-server libvlc-dev libvlc5 libvlccore-dev libvlccore5 vlc-data vlc libcurl4-openssl-dev
|
||||
|
||||
# Grab the latest ZoneMinder code in master
|
||||
RUN git clone https://github.com/kylejohnson/ZoneMinder.git
|
||||
|
||||
# Change into the ZoneMinder directory
|
||||
WORKDIR ZoneMinder
|
||||
|
||||
# Check out the release-1.27 branch
|
||||
RUN git checkout release-1.27
|
||||
|
||||
# Setup the ZoneMinder build environment
|
||||
RUN aclocal && autoheader && automake --force-missing --add-missing && autoconf
|
||||
|
||||
# Configure ZoneMinder
|
||||
RUN ./configure --with-libarch=lib/$DEB_HOST_GNU_TYPE --disable-debug --host=$DEB_HOST_GNU_TYPE --build=$DEB_BUILD_GNU_TYPE --with-mysql=/usr --with-webdir=/var/www/zm --with-ffmpeg=/usr --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-mmap=yes ZM_SSL_LIB=openssl ZM_DB_USER=zm ZM_DB_PASS=zm
|
||||
|
||||
# Build ZoneMinder
|
||||
RUN make
|
||||
|
||||
# Install ZoneMinder
|
||||
RUN make install
|
||||
|
||||
# Adding the start script
|
||||
ADD utils/docker/start.sh /tmp/start.sh
|
||||
|
||||
# Make start script executable
|
||||
RUN chmod 755 /tmp/start.sh
|
||||
|
||||
# Set the root passwd
|
||||
RUN echo 'root:root' | chpasswd
|
||||
|
||||
# Expose ssh and http ports
|
||||
EXPOSE 80
|
||||
EXPOSE 22
|
||||
|
||||
|
||||
CMD "/tmp/start.sh"
|
|
@ -0,0 +1,98 @@
|
|||
# - Check if the protoype we expect is correct.
|
||||
# check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE)
|
||||
# FUNCTION - The name of the function (used to check if prototype exists)
|
||||
# PROTOTYPE- The prototype to check.
|
||||
# RETURN - The return value of the function.
|
||||
# HEADER - The header files required.
|
||||
# VARIABLE - The variable to store the result.
|
||||
# Example:
|
||||
# check_prototype_definition(getpwent_r
|
||||
# "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)"
|
||||
# "NULL"
|
||||
# "unistd.h;pwd.h"
|
||||
# SOLARIS_GETPWENT_R)
|
||||
# The following variables may be set before calling this macro to
|
||||
# modify the way the check is run:
|
||||
#
|
||||
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
||||
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
# Copyright 2010-2011 Andreas Schneider <asn@cryptomilk.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
#
|
||||
|
||||
|
||||
get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
|
||||
function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
|
||||
|
||||
if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$")
|
||||
set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n")
|
||||
|
||||
set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
if (CMAKE_REQUIRED_LIBRARIES)
|
||||
set(CHECK_PROTOTYPE_DEFINITION_LIBS
|
||||
${LINK_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES})
|
||||
else()
|
||||
set(CHECK_PROTOTYPE_DEFINITION_LIBS)
|
||||
endif()
|
||||
if (CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_SYMBOL_EXISTS_INCLUDES
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||
else()
|
||||
set(CMAKE_SYMBOL_EXISTS_INCLUDES)
|
||||
endif()
|
||||
|
||||
foreach(_FILE ${_HEADER})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_HEADER
|
||||
"${CHECK_PROTOTYPE_DEFINITION_HEADER}#include <${_FILE}>\n")
|
||||
endforeach()
|
||||
|
||||
set(CHECK_PROTOTYPE_DEFINITION_SYMBOL ${_FUNCTION})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_PROTO ${_PROTOTYPE})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_RETURN ${_RETURN})
|
||||
|
||||
configure_file("${__check_proto_def_dir}/CheckPrototypeDefinition.c.in"
|
||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c" @ONLY)
|
||||
|
||||
file(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c _SOURCE)
|
||||
|
||||
try_compile(${_VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${CHECK_PROTOTYPE_DEFINITION_LIBS}
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CHECK_PROTOTYPE_DEFINITION_FLAGS}
|
||||
"${CMAKE_SYMBOL_EXISTS_INCLUDES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
||||
if (${_VARIABLE})
|
||||
set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
|
||||
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n"
|
||||
"${OUTPUT}\n\n")
|
||||
else ()
|
||||
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
|
||||
set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n"
|
||||
"${OUTPUT}\n\n${_SOURCE}\n\n")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
endfunction()
|
|
@ -0,0 +1,26 @@
|
|||
if(POLICY CMP0007)
|
||||
cmake_policy(SET CMP0007 OLD)
|
||||
endif(POLICY CMP0007)
|
||||
|
||||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
list(REVERSE files)
|
||||
foreach (file ${files})
|
||||
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||
if (EXISTS "$ENV{DESTDIR}${file}")
|
||||
execute_process(
|
||||
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RESULT_VARIABLE rm_retval
|
||||
)
|
||||
if(NOT ${rm_retval} EQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
endif (NOT ${rm_retval} EQUAL 0)
|
||||
else (EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
endif (EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
|
@ -0,0 +1,25 @@
|
|||
--
|
||||
-- This updates a 1.26.4 database to 1.26.5
|
||||
--
|
||||
|
||||
--
|
||||
-- Add AlarmRefBlendPerc field for controlling the reference image blend percent during alarm (see pull request #241)
|
||||
--
|
||||
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_name = 'Monitors'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'AlarmRefBlendPerc'
|
||||
) > 0,
|
||||
"SELECT 1",
|
||||
"ALTER TABLE `Monitors` ADD `AlarmRefBlendPerc` TINYINT(3) UNSIGNED NOT NULL DEFAULT '6' AFTER `RefBlendPerc`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
UPDATE `Monitors` SET `AlarmRefBlendPerc` = `RefBlendPerc`;
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
--
|
||||
-- This updates a 1.26.5 database to 1.27
|
||||
--
|
||||
|
||||
--
|
||||
-- Add Libvlc and cURL monitor types
|
||||
--
|
||||
|
||||
ALTER TABLE Controls modify column Type enum('Local','Remote','Ffmpeg','Libvlc','cURL') NOT NULL default 'Local';
|
||||
ALTER TABLE MonitorPresets modify column Type enum('Local','Remote','File','Ffmpeg','Libvlc','cURL') NOT NULL default 'Local';
|
||||
ALTER TABLE Monitors modify column Type enum('Local','Remote','File','Ffmpeg','Libvlc','cURL') NOT NULL default 'Local';
|
||||
|
||||
--
|
||||
-- Add required fields for cURL authenication
|
||||
--
|
||||
ALTER TABLE `Monitors` ADD `User` VARCHAR(32) NOT NULL AFTER `SubPath`;
|
||||
ALTER TABLE `Monitors` ADD `Pass` VARCHAR(32) NOT NULL AFTER `User`;
|
||||
|
||||
--
|
||||
-- Add default zone preset
|
||||
--
|
||||
INSERT INTO ZonePresets VALUES (NULL,'Default','Active','Percent','Blobs',25,NULL,3,75,3,3,3,75,2,NULL,1,NULL,0);
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
--
|
||||
-- This updates a 1.27.0 database to 1.27.1
|
||||
--
|
||||
|
||||
--
|
||||
-- Add Controls definition for Wanscam
|
||||
--
|
||||
INSERT INTO Controls
|
||||
SELECT * FROM (SELECT NULL as Id,
|
||||
'WanscamPT' as Name,
|
||||
'Remote' as Type,
|
||||
'Wanscam' as Protocol,
|
||||
1 as CanWake,
|
||||
1 as CanSleep,
|
||||
1 as CanReset,
|
||||
0 as CanZoom,
|
||||
0 as CanAutoZoom,
|
||||
0 as CanZoomAbs,
|
||||
0 as CanZoomRel,
|
||||
0 as CanZoomCon,
|
||||
0 as MinZoomRange,
|
||||
0 as MaxZoomRange,
|
||||
0 as MinZoomStep,
|
||||
0 as MaxZoomStep,
|
||||
0 as HasZoomSpeed,
|
||||
0 as MinZoomSpeed,
|
||||
0 as MaxZoomSpeed,
|
||||
0 as CanFocus,
|
||||
0 as CanAutoFocus,
|
||||
0 as CanFocusAbs,
|
||||
0 as CanFocusRel,
|
||||
0 as CanFocusCon,
|
||||
0 as MinFocusRange,
|
||||
0 as MaxFocusRange,
|
||||
0 as MinFocusStep,
|
||||
0 as MaxFocusStep,
|
||||
0 as HasFocusSpeed,
|
||||
0 as MinFocusSpeed,
|
||||
0 as MaxFocusSpeed,
|
||||
1 as CanIris,
|
||||
0 as CanAutoIris,
|
||||
1 as CanIrisAbs,
|
||||
0 as CanIrisRel,
|
||||
0 as CanIrisCon,
|
||||
0 as MinIrisRange,
|
||||
16 as MaxIrisRange,
|
||||
0 as MinIrisStep,
|
||||
0 as MaxIrisStep,
|
||||
0 as HasIrisSpeed,
|
||||
0 as MinIrisSpeed,
|
||||
0 as MaxIrisSpeed,
|
||||
0 as CanGain,
|
||||
0 as CanAutoGain,
|
||||
0 as CanGainAbs,
|
||||
0 as CanGainRel,
|
||||
0 as CanGainCon,
|
||||
0 as MinGainRange,
|
||||
0 as MaxGainRange,
|
||||
0 as MinGainStep,
|
||||
0 as MaxGainStep,
|
||||
0 as HasGainSpeed,
|
||||
0 as MinGainSpeed,
|
||||
0 as MaxGainSpeed,
|
||||
1 as CanWhite,
|
||||
0 as CanAutoWhite,
|
||||
1 as CanWhiteAbs,
|
||||
0 as CanWhiteRel,
|
||||
0 as CanWhiteCon,
|
||||
0 as MinWhiteRange,
|
||||
16 as MaxWhiteRange,
|
||||
0 as MinWhiteStep,
|
||||
0 as MaxWhiteStep,
|
||||
0 as HasWhiteSpeed,
|
||||
0 as MinWhiteSpeed,
|
||||
0 as MaxWhiteSpeed,
|
||||
1 as HasPresets,
|
||||
16 as NumPresets,
|
||||
1 as HasHomePreset,
|
||||
1 as CanSetPresets,
|
||||
1 as CanMove,
|
||||
1 as CanMoveDiag,
|
||||
0 as CanMoveMap,
|
||||
0 as CanMoveAbs,
|
||||
0 as CanMoveRel,
|
||||
1 as CanMoveCon,
|
||||
1 as CanPan,
|
||||
0 as MinPanRange,
|
||||
0 as MaxPanRange,
|
||||
0 as MinPanStep,
|
||||
0 as MaxPanStep,
|
||||
0 as HasPanSpeed,
|
||||
0 as MinPanSpeed,
|
||||
0 as MaxPanSpeed,
|
||||
0 as HasTurboPan,
|
||||
0 as TurboPanSpeed,
|
||||
1 as CanTilt,
|
||||
0 as MinTiltRange,
|
||||
0 as MaxTiltRange,
|
||||
0 as MinTiltStep,
|
||||
0 as MaxTiltStep,
|
||||
0 as HasTiltSpeed,
|
||||
0 as MinTiltSpeed,
|
||||
0 as MaxTiltSpeed,
|
||||
0 as HasTurboTilt,
|
||||
0 as TurboTiltSpeed,
|
||||
0 as CanAutoScan,
|
||||
0 as NumScanPaths) AS tmp
|
||||
WHERE NOT EXISTS (
|
||||
SELECT Name FROM Controls WHERE name = 'WanscamPT'
|
||||
) LIMIT 1;
|
||||
|
||||
-- Add extend alarm frame count to zone definition and Presets
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_name = 'Zones'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'ExtendAlarmFrames'
|
||||
) > 0,
|
||||
"SELECT 'Column ExtendAlarmFrames exists in Zones'",
|
||||
"ALTER TABLE `Zones` ADD `ExtendAlarmFrames` smallint(5) unsigned not null default 0 AFTER `OverloadFrames`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_name = 'ZonePresets'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'ExtendAlarmFrames'
|
||||
) > 0,
|
||||
"SELECT 'Column ExtendAlarmFrames exists in ZonePresets'",
|
||||
"ALTER TABLE `ZonePresets` ADD `ExtendAlarmFrames` smallint(5) unsigned not null default 0 AFTER `OverloadFrames`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
--
|
||||
-- Add MotionSkipFrame field for controlling how many frames motion detection should skip.
|
||||
--
|
||||
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_name = 'Monitors'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'MotionFrameSkip'
|
||||
) > 0,
|
||||
"SELECT 1",
|
||||
"ALTER TABLE `Monitors` ADD `MotionFrameSkip` smallint(5) unsigned NOT NULL default '0' AFTER `FrameSkip`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
|
@ -0,0 +1,42 @@
|
|||
# CMakeLists.txt for the Fedora Target Distro.
|
||||
|
||||
# Download jscalendar & move files into position
|
||||
file(DOWNLOAD http://downloads.sourceforge.net/jscalendar/jscalendar-1.0.zip ${CMAKE_CURRENT_SOURCE_DIR}/jscalendar-1.0.zip STATUS download_jsc)
|
||||
if(download_jsc EQUAL 0)
|
||||
message(STATUS "Jscalander successfully downloaded. Installing...")
|
||||
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/jscalendar.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ERROR_VARIABLE unzip_jsc)
|
||||
message(STATUS "Status of jscalender script was: ${unzip_jsc}")
|
||||
else(download_jsc EQUAL 0)
|
||||
message(STATUS "Unable to download optional jscalander. Skipping...")
|
||||
endif(download_jsc EQUAL 0)
|
||||
|
||||
# Create several empty folders
|
||||
file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events images temp)
|
||||
|
||||
# Install the empty folders
|
||||
#install(DIRECTORY run DESTINATION /var DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_WRITE WORLD_READ WORLD_EXECUTE)
|
||||
install(DIRECTORY sock swap DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
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 /run 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 images temp DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
# Create symlinks
|
||||
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/events \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/events\")")
|
||||
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/images \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/images\")")
|
||||
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/temp \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/temp\")")
|
||||
|
||||
# Fedora requires cambozola as a separate package so just link to it
|
||||
install(CODE "execute_process(COMMAND ln -sf ../../java/cambozola.jar \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/cambozola.jar\")")
|
||||
|
||||
# Install auxillary files required to run zoneminder on Fedora
|
||||
install(FILES zoneminder.conf DESTINATION /etc/httpd/conf.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
||||
install(FILES zoneminder.logrotate DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
||||
install(FILES zoneminder.tmpfiles DESTINATION /etc/tmpfiles.d RENAME zoneminder.conf PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
install(FILES redalert.wav DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/sounds PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
install(FILES zoneminder.service DESTINATION /usr/lib/systemd/system PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
||||
|
||||
# Install jscalendar
|
||||
if(unzip_jsc STREQUAL "")
|
||||
install(DIRECTORY jscalendar-1.0/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/tools/jscalendar)
|
||||
endif(unzip_jsc STREQUAL "")
|
|
@ -0,0 +1 @@
|
|||
../redhat/jscalendar.sh
|
|
@ -0,0 +1 @@
|
|||
../redhat/redalert.wav
|
|
@ -0,0 +1,76 @@
|
|||
--- configure.ac 2013-08-15 11:44:10.000000000 -0500
|
||||
+++ configure.ac.logdir 2013-08-17 09:20:07.326053328 -0500
|
||||
@@ -46,7 +46,7 @@
|
||||
AC_SUBST(ZM_TMPDIR,[/tmp/zm])
|
||||
fi
|
||||
if test "$ZM_LOGDIR" == ""; then
|
||||
- AC_SUBST(ZM_LOGDIR,[/var/log/zm])
|
||||
+ AC_SUBST(ZM_LOGDIR,[/var/log/zoneminder])
|
||||
fi
|
||||
|
||||
LIB_ARCH=lib
|
||||
--- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in 2013-08-01 18:14:45.175241378 -0500
|
||||
+++ scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in.defaults 2013-08-07 18:57:42.525006149 -0500
|
||||
@@ -187,7 +187,7 @@
|
||||
},
|
||||
{
|
||||
name => "ZM_PATH_ZMS",
|
||||
- default => "/cgi-bin/nph-zms",
|
||||
+ default => "/cgi-bin/zm/nph-zms",
|
||||
description => "Web path to zms streaming server",
|
||||
help => "The ZoneMinder streaming server is required to send streamed images to your browser. It will be installed into the cgi-bin path given at configuration time. This option determines what the web path to the server is rather than the local path on your machine. Ordinarily the streaming server runs in parser-header mode however if you experience problems with streaming you can change this to non-parsed-header (nph) mode by changing 'zms' to 'nph-zms'.",
|
||||
type => $types{rel_path},
|
||||
@@ -276,7 +276,7 @@
|
||||
},
|
||||
{
|
||||
name => "ZM_OPT_CAMBOZOLA",
|
||||
- default => "no",
|
||||
+ default => "yes",
|
||||
description => "Is the (optional) cambozola java streaming client installed",
|
||||
help => "Cambozola is a handy low fat cheese flavoured Java applet that ZoneMinder uses to view image streams on browsers such as Internet Explorer that don't natively support this format. If you use this browser it is highly recommended to install this from http://www.charliemouse.com/code/cambozola/ however if it is not installed still images at a lower refresh rate can still be viewed.",
|
||||
type => $types{boolean},
|
||||
@@ -526,7 +526,7 @@
|
||||
},
|
||||
{
|
||||
name => "ZM_LOG_DEBUG_FILE",
|
||||
- default => "@ZM_TMPDIR@/zm_debug.log+",
|
||||
+ default => "/var/log/zoneminder/zm_debug_log+",
|
||||
description => "Where extra debug is output to",
|
||||
help => "This option allows you to specify a different target for debug output. All components have a default log file which will norally be in /tmp or /var/log and this is where debug will be written to if this value is empty. Adding a path here will temporarily redirect debug, and other logging output, to this file. This option is a simple filename and you are debugging several components then they will all try and write to the same file with undesirable consequences. Appending a '+' to the filename will cause the file to be created with a '.<pid>' suffix containing your process id. In this way debug from each run of a component is kept separate. This is the recommended setting as it will also prevent subsequent runs from overwriting the same log. You should ensure that permissions are set up to allow writing to the file and directory specified here.",
|
||||
requires => [ { name => "ZM_LOG_DEBUG", value => "yes" } ],
|
||||
@@ -623,7 +623,7 @@
|
||||
},
|
||||
{
|
||||
name => "ZM_PATH_SOCKS",
|
||||
- default => "@ZM_TMPDIR@",
|
||||
+ default => "/var/lib/zoneminder/sock",
|
||||
description => "Path to the various Unix domain socket files that ZoneMinder uses",
|
||||
help => "ZoneMinder generally uses Unix domain sockets where possible. This reduces the need for port assignments and prevents external applications from possibly compromising the daemons. However each Unix socket requires a .sock file to be created. This option indicates where those socket files go.",
|
||||
type => $types{abs_path},
|
||||
@@ -639,7 +639,7 @@
|
||||
},
|
||||
{
|
||||
name => "ZM_PATH_SWAP",
|
||||
- default => "@ZM_TMPDIR@",
|
||||
+ default => "/dev/shm",
|
||||
description => "Path to location for temporary swap images used in streaming",
|
||||
help => "Buffered playback requires temporary swap images to be stored for each instance of the streaming daemons. This option determines where these images will be stored. The images will actually be stored in sub directories beneath this location and will be automatically cleaned up after a period of time.",
|
||||
type => $types{abs_path},
|
||||
@@ -902,7 +902,7 @@
|
||||
},
|
||||
{
|
||||
name => "ZM_UPLOAD_FTP_LOC_DIR",
|
||||
- default => "@ZM_TMPDIR@",
|
||||
+ default => "/var/spool/zoneminder-upload",
|
||||
description => "The local directory in which to create upload files",
|
||||
help => "You can use filters to instruct ZoneMinder to upload events to a remote ftp server. This option indicates the local directory that ZoneMinder should use for temporary upload files. These are files that are created from events, uploaded and then deleted.",
|
||||
requires => [ { name => "ZM_OPT_UPLOAD", value => "yes" } ],
|
||||
@@ -1258,7 +1258,7 @@
|
||||
},
|
||||
{
|
||||
name => "ZM_OPT_CONTROL",
|
||||
- default => "no",
|
||||
+ default => "yes",
|
||||
description => "Support controllable (e.g. PTZ) cameras",
|
||||
help => "ZoneMinder includes limited support for controllable cameras. A number of sample protocols are included and others can easily be added. If you wish to control your cameras via ZoneMinder then select this option otherwise if you only have static cameras or use other control methods then leave this option off.",
|
||||
type => $types{boolean},
|
|
@ -0,0 +1,81 @@
|
|||
--- configure.ac 2013-09-05 10:33:08.000000000 -0500
|
||||
+++ configure.ac.dbinstall 2013-09-05 17:23:28.555553447 -0500
|
||||
@@ -1,13 +1,11 @@
|
||||
AC_PREREQ(2.59)
|
||||
-AC_INIT(zm,1.26.4,[http://www.zoneminder.com/forums/ - Please check FAQ first],ZoneMinder,http://www.zoneminder.com/downloads.html)
|
||||
+AC_INIT(zm,1.26.4,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html)
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_SRCDIR(src/zm.h)
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
|
||||
AC_SUBST([AM_CXXFLAGS], [-D__STDC_CONSTANT_MACROS])
|
||||
|
||||
-PATH_BUILD=`pwd`
|
||||
-AC_SUBST(PATH_BUILD)
|
||||
TIME_BUILD=`date +'%s'`
|
||||
AC_SUBST(TIME_BUILD)
|
||||
|
||||
@@ -354,6 +352,8 @@ AC_PROG_PERL_MODULES(X10::ActiveHome,,AC
|
||||
|
||||
AC_DEFINE_DIR([BINDIR],[bindir],[Expanded binary directory])
|
||||
AC_DEFINE_DIR([LIBDIR],[libdir],[Expanded library directory])
|
||||
+AC_DEFINE_DIR([DATADIR],[datadir],[Expanded data directory])
|
||||
+AC_SUBST(PKGDATADIR,"$DATADIR/$PACKAGE")
|
||||
AC_SUBST(ZM_PID,"$ZM_RUNDIR/zm.pid")
|
||||
AC_DEFINE_DIR([SYSCONFDIR],[sysconfdir],[Expanded configuration directory])
|
||||
AC_SUBST(ZM_CONFIG,"$SYSCONFDIR/zm.conf")
|
||||
diff -up ./db/Makefile.am.dbinstall ./db/Makefile.am
|
||||
--- ./db/Makefile.am.dbinstall 2009-10-14 04:42:46.000000000 -0500
|
||||
+++ ./db/Makefile.am 2011-03-24 22:50:14.173912137 -0500
|
||||
@@ -1,7 +1,16 @@
|
||||
AUTOMAKE_OPTIONS = gnu
|
||||
|
||||
+zmdbdatadir = $(pkgdatadir)/db
|
||||
+
|
||||
EXTRA_DIST = \
|
||||
zm_create.sql.in \
|
||||
+ $(dbupgrade_scripts)
|
||||
+
|
||||
+dist_zmdbdata_DATA = \
|
||||
+ zm_create.sql \
|
||||
+ $(dbupgrade_scripts)
|
||||
+
|
||||
+dbupgrade_scripts = \
|
||||
zm_update-0.0.1.sql \
|
||||
zm_update-0.9.7.sql \
|
||||
zm_update-0.9.8.sql \
|
||||
diff -up ./scripts/zmupdate.pl.in.dbinstall ./scripts/zmupdate.pl.in
|
||||
--- scripts/zmupdate.pl.in 2013-10-05 14:46:16.000000000 -0500
|
||||
+++ scripts/zmupdate.pl.in.dbinstall 2013-10-05 18:56:05.431045910 -0500
|
||||
@@ -429,7 +429,7 @@ if ( $version )
|
||||
}
|
||||
else
|
||||
{
|
||||
- $command .= ZM_PATH_BUILD."/db";
|
||||
+ $command .= ZM_PATH_DATA."/db";
|
||||
}
|
||||
$command .= "/zm_update-".$version.".sql";
|
||||
|
||||
@@ -1030,7 +1030,7 @@ if ( $version )
|
||||
if ( $version ge '1.26.0' ) {
|
||||
|
||||
my @files;
|
||||
- $updateDir = ZM_PATH_BUILD."/db" if ! $updateDir;
|
||||
+ $updateDir = ZM_PATH_DATA."/db" if ! $updateDir;
|
||||
opendir( my $dh, $updateDir ) || die "Can't open updateDir $!";
|
||||
@files = sort grep { (!/^\./) && /^zm_update\-[\d\.]+\.sql$/ && -f "$updateDir/$_" } readdir($dh);
|
||||
closedir $dh;
|
||||
diff -up ./zm.conf.in.dbinstall ./zm.conf.in
|
||||
--- ./zm.conf.in.dbinstall 2008-07-25 04:48:16.000000000 -0500
|
||||
+++ ./zm.conf.in 2011-03-24 22:50:14.175912077 -0500
|
||||
@@ -12,8 +12,8 @@
|
||||
# Current version of ZoneMinder
|
||||
ZM_VERSION=@VERSION@
|
||||
|
||||
-# Path to build directory, used mostly for finding DB upgrade scripts
|
||||
-ZM_PATH_BUILD=@PATH_BUILD@
|
||||
+# Path to installed data directory, used mostly for finding DB upgrade scripts
|
||||
+ZM_PATH_DATA=@PKGDATADIR@
|
||||
|
||||
# Build time, used to record when to trigger various checks
|
||||
ZM_TIME_BUILD=@TIME_BUILD@
|
|
@ -0,0 +1,388 @@
|
|||
%define zmuid $(id -un)
|
||||
%define zmgid $(id -gn)
|
||||
%define zmuid_final apache
|
||||
%define zmgid_final apache
|
||||
|
||||
%global _hardened_build 1
|
||||
|
||||
### Delete the lines below to build with ffmpeg and/or x10
|
||||
%define _without_ffmpeg 1
|
||||
%define _without_x10 1
|
||||
|
||||
Name: zoneminder
|
||||
Version: 1.27
|
||||
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/
|
||||
# Mootools is inder the MIT license: http://mootools.net/
|
||||
License: GPLv2+ and LGPLv2+ and MIT
|
||||
URL: http://www.zoneminder.com/
|
||||
|
||||
#Source: https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz
|
||||
Source: ZoneMinder-%{version}.tar.gz
|
||||
|
||||
Patch1: zoneminder-1.26.0-defaults.patch
|
||||
|
||||
BuildRequires: cmake gnutls-devel systemd-units bzip2-devel
|
||||
BuildRequires: community-mysql-devel pcre-devel libjpeg-turbo-devel
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
|
||||
BuildRequires: perl(Date::Manip) perl(DBD::mysql)
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent)
|
||||
BuildRequires: perl(MIME::Entity) perl(MIME::Lite)
|
||||
BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap)
|
||||
BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign)
|
||||
BuildRequires: perl(Expect) perl(Sys::Syslog)
|
||||
BuildRequires: gcc gcc-c++ vlc-devel libcurl-devel
|
||||
%{!?_without_ffmpeg:BuildRequires: ffmpeg-devel}
|
||||
%{!?_without_x10:BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)}
|
||||
# cmake needs the following installed at build time due to the way it auto-detects certain parameters
|
||||
BuildRequires: httpd
|
||||
%{!?_without_ffmpeg:BuildRequires: ffmpeg}
|
||||
|
||||
Requires: httpd php php-mysql cambozola
|
||||
Requires: libjpeg-turbo vlc-core libcurl
|
||||
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
||||
Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip)
|
||||
Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP)
|
||||
Requires: perl(LWP::Protocol::https)
|
||||
%{!?_without_ffmpeg:Requires: ffmpeg}
|
||||
|
||||
Requires(post): systemd-units systemd-sysv
|
||||
Requires(post): /usr/bin/gpasswd
|
||||
Requires(post): /usr/bin/less
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
|
||||
%description
|
||||
ZoneMinder is a set of applications which is intended to provide a complete
|
||||
solution allowing you to capture, analyse, record and monitor any cameras you
|
||||
have attached to a Linux based machine. It is designed to run on kernels which
|
||||
support the Video For Linux (V4L) interface and has been tested with cameras
|
||||
attached to BTTV cards, various USB cameras and IP network cameras. It is
|
||||
designed to support as many cameras as you can attach to your computer without
|
||||
too much degradation of performance.
|
||||
|
||||
%prep
|
||||
%setup -q -n ZoneMinder-%{version}
|
||||
|
||||
%patch1 -p0 -b .defaults
|
||||
#%patch2 -p0 -b .noffmpeg
|
||||
|
||||
%build
|
||||
%cmake \
|
||||
-DZM_TARGET_DISTRO="f19" \
|
||||
-DZM_PERL_SUBPREFIX=`x="%{perl_vendorlib}" ; echo ${x#"%{_prefix}"}` \
|
||||
%{?_without_ffmpeg:-DZM_NO_FFMPEG=ON} \
|
||||
%{?_without_x10:-DZM_NO_X10=ON} \
|
||||
.
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
export DESTDIR=%{buildroot}
|
||||
make install
|
||||
|
||||
%post
|
||||
if [ $1 -eq 1 ] ; then
|
||||
# Initial installation
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
# Allow zoneminder access to local video sources, serial ports, and x10
|
||||
/usr/bin/gpasswd -a %{zmuid_final} video
|
||||
/usr/bin/gpasswd -a %{zmuid_final} dialout
|
||||
|
||||
# Display the README for post installation instructions
|
||||
/usr/bin/less %{_docdir}/%{name}-%{version}/README.Fedora
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ] ; then
|
||||
# Package removal, not upgrade
|
||||
/bin/systemctl --no-reload disable zoneminder.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop zoneminder.service > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%postun
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
if [ $1 -ge 1 ] ; then
|
||||
# Package upgrade, not uninstall
|
||||
/bin/systemctl try-restart zoneminder.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%triggerun -- zoneminder < 1.25.0-4
|
||||
# Save the current service runlevel info
|
||||
# User must manually run systemd-sysv-convert --apply zoneminder
|
||||
# to migrate them to systemd targets
|
||||
/usr/bin/systemd-sysv-convert --save zoneminder >/dev/null 2>&1 ||:
|
||||
|
||||
# Run these because the SysV package being removed won't do them
|
||||
/sbin/chkconfig --del zoneminder >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart zoneminder.service >/dev/null 2>&1 || :
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS COPYING README.md distros/fedora/README.Fedora distros/fedora/jscalendar-doc
|
||||
%config %attr(640,root,%{zmgid_final}) /etc/zm.conf
|
||||
%config(noreplace) %attr(644,root,root) /etc/httpd/conf.d/zoneminder.conf
|
||||
%config(noreplace) /etc/tmpfiles.d/zoneminder.conf
|
||||
%config(noreplace) /etc/logrotate.d/zoneminder
|
||||
|
||||
%{_unitdir}/zoneminder.service
|
||||
|
||||
%{_bindir}/zma
|
||||
%{_bindir}/zmaudit.pl
|
||||
%{_bindir}/zmc
|
||||
%{_bindir}/zmcontrol.pl
|
||||
%{_bindir}/zmdc.pl
|
||||
%{_bindir}/zmf
|
||||
%{_bindir}/zmfilter.pl
|
||||
# zmfix removed from zoneminder 1.26.6
|
||||
#%attr(4755,root,root) %{_bindir}/zmfix
|
||||
%{_bindir}/zmpkg.pl
|
||||
%{_bindir}/zmstreamer
|
||||
%{_bindir}/zmtrack.pl
|
||||
%{_bindir}/zmtrigger.pl
|
||||
%{_bindir}/zmu
|
||||
%{_bindir}/zmupdate.pl
|
||||
%{_bindir}/zmvideo.pl
|
||||
%{_bindir}/zmwatch.pl
|
||||
%{_bindir}/zmcamtool.pl
|
||||
%{!?_without_x10:%{_bindir}/zmx10.pl}
|
||||
|
||||
%{perl_vendorlib}/ZoneMinder*
|
||||
%{perl_vendorlib}/%{_arch}-linux-thread-multi/auto/ZoneMinder*
|
||||
#%{perl_archlib}/ZoneMinder*
|
||||
%{_mandir}/man*/*
|
||||
%dir %{_libexecdir}/zoneminder
|
||||
%{_libexecdir}/zoneminder/cgi-bin
|
||||
%dir %{_datadir}/zoneminder
|
||||
%{_datadir}/zoneminder/db
|
||||
%{_datadir}/zoneminder/www
|
||||
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/events
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/images
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/sock
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/swap
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/lib/zoneminder/temp
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/log/zoneminder
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/spool/zoneminder-upload
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /run/zoneminder
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Mar 14 2014 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.27
|
||||
- Tweak build requirements for cmake
|
||||
|
||||
* Sat Feb 01 2014 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.27
|
||||
- Add zmcamtool.pl. Bump version for 1.27 release.
|
||||
|
||||
* Mon Dec 16 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.5
|
||||
- This is a bug fixe release
|
||||
- RTSP fixes, cmake enhancements, couple other misc fixes
|
||||
|
||||
* Mon Oct 07 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.4
|
||||
- Initial cmake build.
|
||||
|
||||
* Sat Oct 05 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.4
|
||||
- Fedora specific path changes have been moved to zoneminder-1.26.0-defaults.patch
|
||||
- All files are now part of the zoneminder source tree. Update specfile accordingly.
|
||||
|
||||
* Sat Sep 21 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.3
|
||||
- Initial rebuild for ZoneMinder 1.26.3 release.
|
||||
|
||||
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.25.0-13
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||
|
||||
* Mon Jan 21 2013 Adam Tkac <atkac redhat com> - 1.25.0-12
|
||||
- rebuild due to "jpeg8-ABI" feature drop
|
||||
|
||||
* Mon Jan 7 2013 Remi Collet <rcollet@redhat.com> - 1.25.0-11
|
||||
- fix configuration file for httpd 2.4, #871502
|
||||
|
||||
* Fri Dec 21 2012 Adam Tkac <atkac redhat com> - 1.25.0-10
|
||||
- rebuild against new libjpeg
|
||||
|
||||
* Thu Aug 09 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-9
|
||||
- Add patch to work around v4l2 api breakage in 3.5 kernel.
|
||||
|
||||
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.25.0-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
* Sat Jun 23 2012 Petr Pisar <ppisar@redhat.com> - 1.25.0-7
|
||||
- Perl 5.16 rebuild
|
||||
|
||||
* Wed Mar 21 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-6
|
||||
- Fix stupid thinko in sql modifications.
|
||||
|
||||
* Sat Feb 25 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-5
|
||||
- Clean up macro usage.
|
||||
|
||||
* Sat Feb 25 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-4
|
||||
- Convert to systemd.
|
||||
- Add tmpfiles.d configuration since the initscript isn't around to create
|
||||
/run/zoneminder.
|
||||
- Remove some pointless executable permissions.
|
||||
- Add logrotate file.
|
||||
|
||||
* Wed Feb 22 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-3
|
||||
- Update README.Fedora to reference systemctl and mention timezone info in
|
||||
php.ini.
|
||||
- Add proper default for EYEZM_LOG_TO_FILE.
|
||||
|
||||
|
||||
* Thu Feb 09 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-2
|
||||
- Rebuild for new pcre.
|
||||
|
||||
* Thu Jan 19 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-1
|
||||
- Update to 1.25.0
|
||||
- Fix gcc4.7 build problems.
|
||||
- Drop gcc4.4 build fixes; for whatever reason they now break the build.
|
||||
- Clean up old patches.
|
||||
- Force setting of ZM_TMPDIR and ZM_RUNDIR.
|
||||
|
||||
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.4-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
|
||||
|
||||
* Thu Sep 15 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.4-3
|
||||
- Re-add the dist-tag that somehow got lost.
|
||||
|
||||
* Thu Sep 15 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.4-2
|
||||
- Add patch for bug 711780 - fix syntax issue in Mapped.pm.
|
||||
- Undo that patch, and undo another which was the cause of the whole mess.
|
||||
- Fix up other patches so ZM_PATH_BUILD is both defined and useful.
|
||||
- Make sure database creation mods actually take.
|
||||
- Update Fedora-specific docs with some additional info.
|
||||
- Use bundled mootools (javascript, so no guideline violation).
|
||||
- Update download location.
|
||||
- Update the gcrypt patch to actually work.
|
||||
- Upstream changed the tarball without changing the version to patch a
|
||||
vulnerability, so redownload.
|
||||
|
||||
* Sun Aug 14 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.4-1
|
||||
- Initial attempt to upgrade to 1.24.4.
|
||||
- Add patch from BZ 460310 to build against libgcrypt instead of requiring the
|
||||
gnutls openssl libs.
|
||||
|
||||
* Thu Jul 21 2011 Petr Sabata <contyk@redhat.com> - 1.24.3-7.20110324svn3310
|
||||
- Perl mass rebuild
|
||||
|
||||
* Wed Jul 20 2011 Petr Sabata <contyk@redhat.com> - 1.24.3-6.20110324svn3310
|
||||
- Perl mass rebuild
|
||||
|
||||
* Mon May 09 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-5.20110324svn3310
|
||||
- Bump for gnutls update.
|
||||
|
||||
* Thu Mar 24 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-4.20110324svn3310
|
||||
- Update to latest 1.24.3 subversion. Turns out that what upstream was calling
|
||||
1.24.3 is really just an occasionally updated devel snapshot.
|
||||
- Rebase various patches.
|
||||
|
||||
* Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 1.24.3-3
|
||||
- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient)
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Tue Jan 25 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-1
|
||||
- Update to latest upstream version.
|
||||
- Rebase patches.
|
||||
- Initial incomplete attempt to disable v4l1 support.
|
||||
|
||||
* Fri Jan 21 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-6
|
||||
- Unbundle cambozola; instead link to the separately pacakged copy.
|
||||
- Remove BuildRoot:, %%clean and buildroot cleaning in %%install.
|
||||
- Git rid of mixed space/tab usage by removing all tabs.
|
||||
- Remove unnecessary Conflicts: line.
|
||||
- Attempt to force short_open_tag on for the code directories.
|
||||
- Move default location of sockets, swaps, logfiles and some temporary files to
|
||||
make more sense and allow things to work better with a future selinux policy.
|
||||
- Fix errors in README.Fedora.
|
||||
|
||||
* Wed Jun 02 2010 Marcela Maslanova <mmaslano@redhat.com> - 1.24.2-5
|
||||
- Mass rebuild with perl-5.12.0
|
||||
|
||||
* Fri Dec 4 2009 Stepan Kasal <skasal@redhat.com> - 1.24.2-4
|
||||
- rebuild against perl 5.10.1
|
||||
- use Perl vendorarch and archlib variables correctly
|
||||
|
||||
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-2
|
||||
- Bump release since 1.24.2-1 was mistakenly tagged a few months ago.
|
||||
|
||||
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-1
|
||||
- Initial update to 1.24.2.
|
||||
- Rebase patches.
|
||||
- Update mootools download location.
|
||||
- Update to mootools 1.2.3.
|
||||
- Add additional dependencies for some optional features.
|
||||
|
||||
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-3
|
||||
- Remove unused Sys::Mmap perl dependency RPM is finding
|
||||
|
||||
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-2
|
||||
- Update gcc44 patch to disable -frepo, seems to be broken with gcc44
|
||||
- Added noffmpeg patch to make building outside mock easier
|
||||
|
||||
* Sat Mar 21 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-1
|
||||
- Patch for gcc 4.4 compilation errors
|
||||
- Upgrade to 1.24.1
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23.3-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Sat Jan 24 2009 Caolán McNamara <caolanm@redhat.com> - 1.23.3-3
|
||||
- rebuild for dependencies
|
||||
|
||||
* Mon Dec 15 2008 Martin Ebourne <martin@zepler.org> - 1.23.3-2
|
||||
- Fix permissions on zm.conf
|
||||
|
||||
* Fri Jul 11 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.23.3-1
|
||||
- Initial attempt at packaging 1.23.
|
||||
|
||||
* Tue Jul 1 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-15
|
||||
- Add perl module compat dependency, bz #453590
|
||||
|
||||
* Tue May 6 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-14
|
||||
- Remove default runlevel, bz #441315
|
||||
|
||||
* Mon Apr 28 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.22.3-13
|
||||
- Backport patch for CVE-2008-1381 from 1.23.3 to 1.22.3.
|
||||
|
||||
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.22.3-12
|
||||
- Autorebuild for GCC 4.3
|
||||
|
||||
* Thu Jan 3 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-11
|
||||
- Fix compilation on gcc 4.3
|
||||
|
||||
* Thu Dec 6 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-10
|
||||
- Rebuild for new openssl
|
||||
|
||||
* Thu Aug 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-8
|
||||
- Fix licence tag
|
||||
|
||||
* Thu Jul 12 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-7
|
||||
- Fixes from testing by Jitz including missing dependencies and database creation
|
||||
|
||||
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-6
|
||||
- Disable crashtrace on ppc
|
||||
|
||||
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-5
|
||||
- Fix uid for directories in /var/lib/zoneminder
|
||||
|
||||
* Tue Jun 26 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-4
|
||||
- Added perl Archive::Tar dependency
|
||||
- Disabled web interface due to lack of access control on the event images
|
||||
|
||||
* Sun Jun 10 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-3
|
||||
- Changes recommended in review by Jason Tibbitts
|
||||
|
||||
* Mon Apr 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-2
|
||||
- Standardised on package name of zoneminder
|
||||
|
||||
* Thu Dec 28 2006 Martin Ebourne <martin@zepler.org> - 1.22.3-1
|
||||
- First version. Uses some parts from zm-1.20.1 by Corey DeLasaux and Serg Oskin
|
|
@ -0,0 +1 @@
|
|||
d /run/zoneminder 0755 apache apache
|
|
@ -0,0 +1,51 @@
|
|||
# CMakeLists.txt for the OpenSuse Target Distro.
|
||||
# Amended Apr 02 2014 David Wilcox
|
||||
# Add named variables so that if destinations change it will be easier
|
||||
# temp directory was not being installed
|
||||
|
||||
SET(zmuid_final wwwrun)
|
||||
SET(zmgid_final www)
|
||||
SET(webroot /srv/www/htdocs)
|
||||
SET(zm_webdir ${webroot}/zoneminder)
|
||||
|
||||
# Download jscalendar & move files into position
|
||||
file(DOWNLOAD http://downloads.sourceforge.net/jscalendar/jscalendar-1.0.zip ${CMAKE_CURRENT_SOURCE_DIR}/jscalendar-1.0.zip STATUS download_jsc)
|
||||
if(download_jsc EQUAL 0)
|
||||
message(STATUS "Jscalander successfully downloaded. Installing...")
|
||||
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/jscalendar.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ERROR_VARIABLE unzip_jsc)
|
||||
message(STATUS "Status of jscalender script was: ${unzip_jsc}")
|
||||
else(download_jsc EQUAL 0)
|
||||
message(STATUS "Unable to download optional jscalander. Skipping...")
|
||||
endif(download_jsc EQUAL 0)
|
||||
|
||||
# Create several empty folders
|
||||
file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events images temp)
|
||||
|
||||
# Install the empty folders
|
||||
#install(DIRECTORY run DESTINATION /var DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_WRITE WORLD_READ WORLD_EXECUTE)
|
||||
#install(DIRECTORY sock swap DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
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-upload DESTINATION /var/spool DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
install(DIRECTORY zoneminder DESTINATION ${webroot} DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
install(DIRECTORY events images temp DESTINATION ${zm_webdir} DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
# Create symlinks
|
||||
install(CODE "execute_process(COMMAND ln -sf ../../../../${zm_webdir}/events \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/events\")")
|
||||
install(CODE "execute_process(COMMAND ln -sf ../../../../${zm_webdir}/images \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/images\")")
|
||||
install(CODE "execute_process(COMMAND ln -sf ../../../../${zm_webdir}/temp \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/temp\")")
|
||||
|
||||
# Opensuse cambazola? requires cambozola as a separate package so just link to it
|
||||
#install(CODE "execute_process(COMMAND ln -sf ../../java/cambozola.jar \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/cambozola.jar\")")
|
||||
|
||||
# Install auxillary files required to run zoneminder on OpenSuse
|
||||
install(FILES zoneminder.conf DESTINATION /etc/apache2/conf.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
||||
install(FILES zoneminder.logrotate DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
||||
install(FILES zoneminder.tmpfiles DESTINATION /etc/tmpfiles.d RENAME zoneminder.conf PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
install(FILES redalert.wav DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/sounds PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
install(FILES zoneminder.service DESTINATION /usr/lib/systemd/system PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
||||
|
||||
# Install jscalendar
|
||||
if(unzip_jsc STREQUAL "")
|
||||
install(DIRECTORY jscalendar-1.0/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/tools/jscalendar)
|
||||
endif(unzip_jsc STREQUAL "")
|
|
@ -0,0 +1,176 @@
|
|||
OpenSuse Notes
|
||||
===============
|
||||
|
||||
1. OpenSuse, along with other distros, now use systemd for task control.
|
||||
One of the capabilties of systemd is to use private space for /tmp to reduce
|
||||
the possibility of cross talk between applications. The default settings
|
||||
for zoneminder use /tmp for a number of files. When you start/stop
|
||||
zoneminder from a web page /tmp will be in private space but when the
|
||||
start/stop script zmpkg.pl is run from a shell it will be looking in the
|
||||
real /tmp. This can result in two instances of zoneminder running at
|
||||
the same time.
|
||||
|
||||
In order to remove this problem the OpenSuse rpm defaults the temporary
|
||||
directory to /var/run/zoneminder. For a new install this will not be a
|
||||
problem but if you use the rpm to upgrade you may have to make database
|
||||
changes.
|
||||
|
||||
Note: the location is held both within the database an explicitly within some
|
||||
scripts. It is therefore essential that the database conforms to the values
|
||||
used in the scripts. Please see information in the Upgrades section of this
|
||||
document.
|
||||
|
||||
2. OpenSuse prefers mariadb to mysql. mariadb is a direct replacement for mysql
|
||||
and all mysql functions work in the same way. These notes assumes that you
|
||||
are running mariadb.
|
||||
|
||||
3. It is necessary to add repositories to allow the zoneminder rpm to install.
|
||||
These can be added using commands (as root):
|
||||
zypper ar -f http://packman.inode.at/suse/openSUSE_13.1/ packman
|
||||
zypper ar -f -n perl-modules http://download.opensuse.org/repositories/devel:/languages:/perl/openSUSE_13.1 perl-modules
|
||||
|
||||
The first time the repositories are accessed a prompt will be issued
|
||||
asking if the key is to be trusted. We suggest that you a(lways) trust
|
||||
this repository
|
||||
|
||||
4. There may be a prompt about the version of libavcodec.s0.55 and a change
|
||||
of vendor for libavutil52. In order to allow zoneminder to run correctly
|
||||
this solution change vendro should be accepted.
|
||||
|
||||
New installs
|
||||
============
|
||||
|
||||
1. Unless you are already using the MySQL server or you are running it
|
||||
remotely you will need to ensure that the server is installed and secured:
|
||||
|
||||
The rpm install should ensure that the database is installed. To ensure
|
||||
that it is running at boot time and scure for zoneminder run the
|
||||
following commands (as root):
|
||||
|
||||
systemctl enable mysql
|
||||
|
||||
systemctl start mysql.service
|
||||
|
||||
mysql_secure_installation
|
||||
|
||||
IMPORTANT: mariadb defaults to strict mode of operation which will cause
|
||||
some zoneminder database writes to fail. In order to turn this off -
|
||||
which will be for the whole database - you will need to edit
|
||||
/etc/my.cnf and comment out the record
|
||||
|
||||
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES and restart the
|
||||
server
|
||||
|
||||
2. Using the password for the root account set during the previous step, you
|
||||
will need to create the ZoneMinder database, assuming your database server
|
||||
is local:
|
||||
|
||||
mysql -uroot -p < /opt/zoneminder/share/zoneminder/db/zm_create.sql
|
||||
mysqladmin -uroot -p reload
|
||||
|
||||
3. The database needs a user. One is not created by default because this would
|
||||
introduce an obvious security issue. The following should set this up:
|
||||
|
||||
mysqladmin -uroot -p reload
|
||||
grant select,insert,update,delete,alter on zm.* to
|
||||
'zmuser'@localhost identified by 'zmpass';
|
||||
|
||||
Obviously, change at least zmpass to an actual, secure password or
|
||||
passphrase. You can change zmuser as well if you like.
|
||||
|
||||
4. Edit /etc/zm.conf and, at the bottom, change ZM_DB_PASS and perhaps
|
||||
ZM_DB_USER to match.
|
||||
|
||||
5. Edit /etc/php5/apache2/php.ini, uncomment the date.timezone line, and add
|
||||
your local timezone. For whatever reason, PHP will complain loudly if
|
||||
this is not set, or if it is set incorrectly, and these complaints will
|
||||
show up in the zoneminder logging system as errors.
|
||||
|
||||
If you are not sure of the proper timezone specification to use, look at
|
||||
http://php.net/date.timezone
|
||||
|
||||
6. This package probably does not work with SELinux enabled at the moment. It
|
||||
may be necessary to disable SELinux for httpd, or even completely for
|
||||
ZoneMinder to function. This will be addressed in a later release. Run
|
||||
|
||||
setenforce 0
|
||||
|
||||
for testing, and edit /etc/sysconfig/selinux to disable it at boot time.
|
||||
|
||||
7. Now start the web server (as root):
|
||||
|
||||
systemctl enable apache2.service
|
||||
systemctl start apache2.service
|
||||
|
||||
9. You should immediately visit http://localhost/zm and secure the system if
|
||||
it is network facing. To do this:
|
||||
|
||||
a) click Options, then System.
|
||||
b) check OPT_USE_AUTH.
|
||||
c) set AUTH_HASH_SECRET to a random string.
|
||||
d) click Save and refresh the main browser window.
|
||||
e) You should be prompted to log in;
|
||||
the default username/password is admin/admin.
|
||||
f) Open Options again, choose the newly visible Users tab.
|
||||
g) click the admin user and set a password.
|
||||
h) enable OPT_CONTROL on the Ssytem tab to enable ptz camera control.
|
||||
|
||||
10. You should be able to start zoneminder by issuing the commands (as root):
|
||||
|
||||
systemctl enable zoneminder
|
||||
systemctl start zoneminder
|
||||
|
||||
|
||||
Upgrades
|
||||
========
|
||||
|
||||
1. Update /etc/zm.conf. Check for any new settings and update the version
|
||||
information. Comparing /etc/zm.conf and /etc/zm.conf.rpmnew should help to
|
||||
do this.
|
||||
|
||||
2. Add the mysql ALTER permission to the zmuser account:
|
||||
|
||||
mysql -u root -p
|
||||
use zm
|
||||
grant alter, lock tables on zm.* to 'zmuser'@localhost;
|
||||
|
||||
Since this is an upgrade, the assumption is that the zmuser account already
|
||||
has select, insert, update, and delete permission.
|
||||
|
||||
3. You will need to upgrade the ZoneMinder database as described in the
|
||||
manual. Only if the previous step was succesful, may you run zmupdate like
|
||||
so (as root):
|
||||
|
||||
/opt/zoneminder/bin/zmupdate.pl
|
||||
|
||||
|
||||
4. As mentioned in the OpenSuse notes you may need to change database values.
|
||||
These steps may be run at any time (as root):
|
||||
|
||||
stop the current instance of zoneminder - systemctl stop zoneminder
|
||||
|
||||
ensure that all zoneminder processes have terminated:
|
||||
|
||||
ps -ef|grep zm
|
||||
if you find any process still running issue a kill -9 for each
|
||||
|
||||
mysql -u root
|
||||
use zm
|
||||
update Config set DefaultValue = '/var/run/zoneminder'
|
||||
where name = 'ZM_PATH_LOGS';
|
||||
update Config set Value = '/var/run/zoneminder'
|
||||
where name = 'ZM_PATH_LOGS';
|
||||
update Config set DefaultValue = '/var/run/zoneminder'
|
||||
where name = 'ZM_PATH_SOCKS';
|
||||
update Config set Value = '/var/run/zoneminder'
|
||||
where name = 'ZM_PATH_SOCKS';
|
||||
update Config set DefaultValue = '/var/run/zoneminder'
|
||||
where name = 'ZM_PATH_LOGS';
|
||||
update Config set Value = '/var/run/zoneminder'
|
||||
where name = 'ZM_PATH_SWAP';
|
||||
commit;
|
||||
exit
|
||||
|
||||
|
||||
You can then restart zoneminder - systemctl start zoneminder
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
unzip -o jscalendar-1.0.zip
|
||||
mkdir -v jscalendar-doc
|
||||
cd jscalendar-1.0
|
||||
mv -v *html *php doc/* README ../jscalendar-doc
|
||||
rmdir -v doc
|
|
@ -0,0 +1 @@
|
|||
../redhat/redalert.wav
|
|
@ -0,0 +1,49 @@
|
|||
--- CMakeLists.txt.orig 2014-03-06 20:29:40.041817163 +0000
|
||||
+++ CMakeLists.txt 2014-03-10 16:03:05.169663558 +0000
|
||||
@@ -65,7 +65,23 @@
|
||||
set(ZM_NO_X10 "OFF" CACHE BOOL "Set to ON to build ZoneMinder without X10 support. default: OFF")
|
||||
set(ZM_PERL_SUBPREFIX "${CMAKE_INSTALL_LIBDIR}/perl5" CACHE PATH "Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. lib will be turned into <prefix>/lib, default: <libdir>/perl5")
|
||||
set(ZM_PERL_USE_PATH "${CMAKE_INSTALL_PREFIX}/${ZM_PERL_SUBPREFIX}" CACHE PATH "Override the include path for zm perl modules. Useful if you are moving the perl modules without using the ZM_PERL_SUBPREFIX option. default: <prefix>/<zmperlsubprefix>")
|
||||
-set(ZM_TARGET_DISTRO "" CACHE STRING "Build ZoneMinder for a specific distribution. Currently, valid names are: f19, el6")
|
||||
+set(ZM_TARGET_DISTRO "" CACHE STRING "Build ZoneMinder for a specific distribution. Currently, valid names are: f19, el6, OS13")
|
||||
+
|
||||
+# Reassign some variables if a target distro has been specified
|
||||
+if((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6"))
|
||||
+ set(ZM_RUNDIR "/var/run/zoneminder")
|
||||
+ set(ZM_TMPDIR "/var/lib/zoneminder/temp")
|
||||
+ set(ZM_LOGDIR "/var/log/zoneminder")
|
||||
+elseif(ZM_TARGET_DISTRO STREQUAL "OS13")
|
||||
+ set(ZM_RUNDIR "/var/run/zoneminder")
|
||||
+ set(ZM_TMPDIR "/var/run/zoneminder")
|
||||
+ set(ZM_CONTENTDIR "/var/run/zoneminder")
|
||||
+ set(ZM_LOGDIR "/var/log/zoneminder")
|
||||
+ set(ZM_WEB_USER "wwwrun")
|
||||
+ set(ZM_WEB_GROUP "www")
|
||||
+ set(ZM_WEBDIR "/srv/www/htdocs/zoneminder")
|
||||
+ set(ZM_CGIDIR "/srv/www/cgi-bin")
|
||||
+endif((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6"))
|
||||
|
||||
# Required for certain checks to work
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h)
|
||||
@@ -437,12 +453,6 @@
|
||||
set(ZM_DB_TYPE "mysql")
|
||||
set(EXTRA_PERL_LIB "use lib '${ZM_PERL_USE_PATH}';")
|
||||
|
||||
-# Reassign some variables if a target distro has been specified
|
||||
-if((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6"))
|
||||
- set(ZM_RUNDIR "/var/run/zoneminder")
|
||||
- set(ZM_TMPDIR "/var/lib/zoneminder/temp")
|
||||
- set(ZM_LOGDIR "/var/log/zoneminder")
|
||||
-endif((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6"))
|
||||
|
||||
# Generate files from the .in files
|
||||
configure_file(zm.conf.in "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" @ONLY)
|
||||
@@ -461,6 +471,8 @@
|
||||
add_subdirectory(distros/fedora)
|
||||
elseif(ZM_TARGET_DISTRO STREQUAL "el6")
|
||||
add_subdirectory(distros/redhat)
|
||||
+elseif(ZM_TARGET_DISTRO STREQUAL "OS13")
|
||||
+ add_subdirectory(distros/opensuse)
|
||||
else(ZM_TARGET_DISTRO STREQUAL "el6")
|
||||
add_subdirectory(misc)
|
||||
endif(ZM_TARGET_DISTRO STREQUAL "f19")
|
|
@ -0,0 +1,388 @@
|
|||
%define zmuid $(id -un)
|
||||
%define zmgid $(id -gn)
|
||||
%define zmuid_final wwwrun
|
||||
%define zmgid_final www
|
||||
# definitions for OpenSuse
|
||||
%define zm_tmpdir /var/run/zoneminder
|
||||
%define zm_instdir /opt/zoneminder
|
||||
%define zm_rundir %{zm_instdir}/bin
|
||||
# OpenSuse seems to have its web services in a different
|
||||
# directory structure to some other distros
|
||||
%define webroot /srv/www/htdocs
|
||||
%define webcgi /srv/www/cgi-bin
|
||||
|
||||
Name: zoneminder
|
||||
Version: 1.27.0
|
||||
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/
|
||||
# Mootools is under the MIT license: http://mootools.net/
|
||||
License: GPLv2+ and LGPLv2+ and MIT
|
||||
URL: http://www.zoneminder.com/
|
||||
|
||||
Source: ZoneMinder-%{version}.tar.gz
|
||||
|
||||
# patch no longer necessary as OpenSuse now in standard build
|
||||
# Patch1: zoneminder-1.26.5-opensuse.patch
|
||||
|
||||
BuildRequires: cmake
|
||||
BuildRequires: perl-DBI perl-DBD-mysql perl-Date-Manip perl-Sys-Mmap
|
||||
BuildRequires: libjpeg62 libjpeg62-devel libmysqld-devel libSDL-devel libgcrypt-devel libgnutls-devel
|
||||
BuildRequires: libffmpeg-devel x264
|
||||
BuildRequires: pcre-devel w32codec-all
|
||||
|
||||
Requires: apache2 apache2-mod_php5 mysql
|
||||
Requires: ffmpeg libavformat55
|
||||
Requires: php php-mysql
|
||||
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
||||
Requires: perl-Sys-Mmap perl-Date-Manip perl-DBD-mysql
|
||||
Requires: perl-Archive-Tar perl-Archive-Zip
|
||||
Requires: perl-MIME-Lite perl-LWP-Protocol-https
|
||||
|
||||
# Can't find suitable packages for OpenSuse for
|
||||
# perl-MIME-Entity perl-Net-SMTP perl-Net-FTP so installing using cpanm
|
||||
# cpanm needs make
|
||||
# Am installing perl(MIME::Tools), perl(Net::SMTP) and perl(Net::FTP)
|
||||
# MIME::Tools provides MIME::Entity
|
||||
|
||||
Requires(post): make cpanm
|
||||
|
||||
Requires(post): /usr/bin/gpasswd
|
||||
|
||||
%description
|
||||
ZoneMinder is a set of applications which is intended to provide a complete
|
||||
solution allowing you to capture, analyse, record and monitor any cameras you
|
||||
have attached to a Linux based machine. It is designed to run on kernels which
|
||||
support the Video For Linux (V4L) interface and has been tested with cameras
|
||||
attached to BTTV cards, various USB cameras and IP network cameras. It is
|
||||
designed to support as many cameras as you can attach to your computer without
|
||||
too much degradation of performance.
|
||||
|
||||
%prep
|
||||
%setup -q -n ZoneMinder-%{version}
|
||||
# cp and patch no longer necessary as opensuse distro now in standard build from 1.27.0 on
|
||||
# cp -R /home/makerpm/rpmbuild/SOURCES/opensuse distros
|
||||
# %patch1 -p0 -b .opensuse
|
||||
|
||||
%build
|
||||
# For OpenSuse 13.1 we need to set DENABLE_MMAP to yes to vercome a problem
|
||||
# where the perl modules don't have shared memory enabled
|
||||
%cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=%{zm_instdir} \
|
||||
-DZM_TARGET_DISTRO="OS13" \
|
||||
-DZM_NO_X10=ON \
|
||||
-DENABLE_MMAP=yes
|
||||
|
||||
make
|
||||
# There doesn't seem to be any point in using the next make as the
|
||||
# makefiles for cmake don't seem to support multiple streams
|
||||
#make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
export DESTDIR=%{buildroot}
|
||||
# don't understand why but the built system appears in build under BUILDROOT
|
||||
cd build
|
||||
make install prefix=\${RPM_BUILD_ROOT}
|
||||
cd ..
|
||||
|
||||
%post
|
||||
if [ $1 -eq 1 ] ; then
|
||||
# Initial installation
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
# Allow zoneminder access to local video sources
|
||||
/usr/bin/gpasswd -a %zmuid_final video
|
||||
|
||||
|
||||
# Display the README for post installation instructions
|
||||
#/usr/bin/less %{_docdir}/%{name}-%{version}/README.OpenSuse
|
||||
# both less and more scroll straight off the end of the file
|
||||
# so we'll output info with echo
|
||||
|
||||
echo Installing additional perl modules
|
||||
/usr/bin/cpanm MIME::Tools
|
||||
/usr/bin/cpanm Net::SMTP
|
||||
/usr/bin/cpanm Net::FTP
|
||||
echo \***********************************************
|
||||
echo \***** For further information
|
||||
echo \***** please refer to
|
||||
echo \***** %{_docdir}/%{name}/README.OpenSuse
|
||||
echo \*****
|
||||
echo \***********************************************
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ] ; then
|
||||
# Package removal, not upgrade
|
||||
/bin/systemctl --no-reload disable zoneminder.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop zoneminder.service > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%postun
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
if [ $1 -ge 1 ] ; then
|
||||
# Package upgrade, not uninstall
|
||||
/bin/systemctl try-restart zoneminder.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
# Next section removed for OpenSuse as the install starts
|
||||
# at 1.26.5 for this rpm
|
||||
# %triggerun -- zoneminder < 1.25.0-4
|
||||
# Save the current service runlevel info
|
||||
# User must manually run systemd-sysv-convert --apply zoneminder
|
||||
# to migrate them to systemd targets
|
||||
# /usr/bin/systemd-sysv-convert --save zoneminder >/dev/null 2>&1 ||:
|
||||
|
||||
# Run these because the SysV package being removed won't do them
|
||||
# /sbin/chkconfig --del zoneminder >/dev/null 2>&1 || :
|
||||
# /bin/systemctl try-restart zoneminder.service >/dev/null 2>&1 || :
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS COPYING README.md distros/opensuse/README.OpenSuse distros/opensuse/jscalendar-doc
|
||||
%docdir /opt/zoneminder/share/man
|
||||
%config %attr(640,root,%{zmgid_final}) /etc/zm.conf
|
||||
%config(noreplace) %attr(644,root,root) /etc/apache2/conf.d/zoneminder.conf
|
||||
%config(noreplace) %attr(644,root,root) /etc/tmpfiles.d/zoneminder.conf
|
||||
%config(noreplace) %attr(644,root,root) /etc/logrotate.d/zoneminder
|
||||
|
||||
%{_unitdir}/zoneminder.service
|
||||
|
||||
# zmfix removed from zoneminder 1.26.6
|
||||
# %attr(4755,root,root) %{zm_rundir}/zmfix
|
||||
|
||||
|
||||
%{zm_instdir}
|
||||
%{webcgi}/nph-zms
|
||||
%{webcgi}/zms
|
||||
%{webroot}/zoneminder
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{webroot}/zoneminder/events
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{webroot}/zoneminder/images
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{webroot}/zoneminder/temp
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{webcgi}
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{zm_tmpdir}
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/log/zoneminder
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) /var/spool/zoneminder-upload
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Apr 02 2014 David Wilcox <david.wilcox@cloverbeen.com> - 1.27.0
|
||||
- Correct requires for cpanm and make as they should be post
|
||||
- change cpanm call to be full path name
|
||||
- correct permissions on events, images and temp
|
||||
|
||||
* Mon Mar 24 2014 David Wilcox <david.wilcox@cloverbeen.com> - 1.27.0
|
||||
- Update to zm 1.27.0
|
||||
- Remove patch which brought opensuse into distros as it is now included
|
||||
|
||||
* Tue Mar 18 2014 David Wilcox <david.wilcox@cloverbeen.com> - 1.26.5
|
||||
- Latest update for Opensuse 13.1 - work is still in progress
|
||||
|
||||
* Thu Feb 06 2014 David Wilcox <david.wilcox@cloverbeen.com> - 1.26.5
|
||||
- Initial build for OpenSuse 13.1 - based on Fedora 19 build
|
||||
|
||||
* Mon Oct 07 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.4
|
||||
- Initial cmake build.
|
||||
|
||||
* Sat Oct 05 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.4
|
||||
- Fedora specific path changes have been moved to zoneminder-1.26.0-defaults.patch
|
||||
- All files are now part of the zoneminder source tree. Update specfile accordingly.
|
||||
|
||||
* Sat Sep 21 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.3
|
||||
- Initial rebuild for ZoneMinder 1.26.3 release.
|
||||
|
||||
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.25.0-13
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||
|
||||
* Mon Jan 21 2013 Adam Tkac <atkac redhat com> - 1.25.0-12
|
||||
- rebuild due to "jpeg8-ABI" feature drop
|
||||
|
||||
* Mon Jan 7 2013 Remi Collet <rcollet@redhat.com> - 1.25.0-11
|
||||
- fix configuration file for httpd 2.4, #871502
|
||||
|
||||
* Fri Dec 21 2012 Adam Tkac <atkac redhat com> - 1.25.0-10
|
||||
- rebuild against new libjpeg
|
||||
|
||||
* Thu Aug 09 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-9
|
||||
- Add patch to work around v4l2 api breakage in 3.5 kernel.
|
||||
|
||||
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.25.0-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
* Sat Jun 23 2012 Petr Pisar <ppisar@redhat.com> - 1.25.0-7
|
||||
- Perl 5.16 rebuild
|
||||
|
||||
* Wed Mar 21 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-6
|
||||
- Fix stupid thinko in sql modifications.
|
||||
|
||||
* Sat Feb 25 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-5
|
||||
- Clean up macro usage.
|
||||
|
||||
* Sat Feb 25 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-4
|
||||
- Convert to systemd.
|
||||
- Add tmpfiles.d configuration since the initscript isn't around to create
|
||||
/run/zoneminder.
|
||||
- Remove some pointless executable permissions.
|
||||
- Add logrotate file.
|
||||
|
||||
* Wed Feb 22 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-3
|
||||
- Update README.Fedora to reference systemctl and mention timezone info in
|
||||
php.ini.
|
||||
- Add proper default for EYEZM_LOG_TO_FILE.
|
||||
|
||||
|
||||
* Thu Feb 09 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-2
|
||||
- Rebuild for new pcre.
|
||||
|
||||
* Thu Jan 19 2012 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.25.0-1
|
||||
- Update to 1.25.0
|
||||
- Fix gcc4.7 build problems.
|
||||
- Drop gcc4.4 build fixes; for whatever reason they now break the build.
|
||||
- Clean up old patches.
|
||||
- Force setting of ZM_TMPDIR and ZM_RUNDIR.
|
||||
|
||||
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.4-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
|
||||
|
||||
* Thu Sep 15 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.4-3
|
||||
- Re-add the dist-tag that somehow got lost.
|
||||
|
||||
* Thu Sep 15 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.4-2
|
||||
- Add patch for bug 711780 - fix syntax issue in Mapped.pm.
|
||||
- Undo that patch, and undo another which was the cause of the whole mess.
|
||||
- Fix up other patches so ZM_PATH_BUILD is both defined and useful.
|
||||
- Make sure database creation mods actually take.
|
||||
- Update Fedora-specific docs with some additional info.
|
||||
- Use bundled mootools (javascript, so no guideline violation).
|
||||
- Update download location.
|
||||
- Update the gcrypt patch to actually work.
|
||||
- Upstream changed the tarball without changing the version to patch a
|
||||
vulnerability, so redownload.
|
||||
|
||||
* Sun Aug 14 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.4-1
|
||||
- Initial attempt to upgrade to 1.24.4.
|
||||
- Add patch from BZ 460310 to build against libgcrypt instead of requiring the
|
||||
gnutls openssl libs.
|
||||
|
||||
* Thu Jul 21 2011 Petr Sabata <contyk@redhat.com> - 1.24.3-7.20110324svn3310
|
||||
- Perl mass rebuild
|
||||
|
||||
* Wed Jul 20 2011 Petr Sabata <contyk@redhat.com> - 1.24.3-6.20110324svn3310
|
||||
- Perl mass rebuild
|
||||
|
||||
* Mon May 09 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-5.20110324svn3310
|
||||
- Bump for gnutls update.
|
||||
|
||||
* Thu Mar 24 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-4.20110324svn3310
|
||||
- Update to latest 1.24.3 subversion. Turns out that what upstream was calling
|
||||
1.24.3 is really just an occasionally updated devel snapshot.
|
||||
- Rebase various patches.
|
||||
|
||||
* Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 1.24.3-3
|
||||
- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient)
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Tue Jan 25 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-1
|
||||
- Update to latest upstream version.
|
||||
- Rebase patches.
|
||||
- Initial incomplete attempt to disable v4l1 support.
|
||||
|
||||
* Fri Jan 21 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-6
|
||||
- Unbundle cambozola; instead link to the separately pacakged copy.
|
||||
- Remove BuildRoot:, %%clean and buildroot cleaning in %%install.
|
||||
- Git rid of mixed space/tab usage by removing all tabs.
|
||||
- Remove unnecessary Conflicts: line.
|
||||
- Attempt to force short_open_tag on for the code directories.
|
||||
- Move default location of sockets, swaps, logfiles and some temporary files to
|
||||
make more sense and allow things to work better with a future selinux policy.
|
||||
- Fix errors in README.Fedora.
|
||||
|
||||
* Wed Jun 02 2010 Marcela Maslanova <mmaslano@redhat.com> - 1.24.2-5
|
||||
- Mass rebuild with perl-5.12.0
|
||||
|
||||
* Fri Dec 4 2009 Stepan Kasal <skasal@redhat.com> - 1.24.2-4
|
||||
- rebuild against perl 5.10.1
|
||||
- use Perl vendorarch and archlib variables correctly
|
||||
|
||||
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-2
|
||||
- Bump release since 1.24.2-1 was mistakenly tagged a few months ago.
|
||||
|
||||
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-1
|
||||
- Initial update to 1.24.2.
|
||||
- Rebase patches.
|
||||
- Update mootools download location.
|
||||
- Update to mootools 1.2.3.
|
||||
- Add additional dependencies for some optional features.
|
||||
|
||||
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-3
|
||||
- Remove unused Sys::Mmap perl dependency RPM is finding
|
||||
|
||||
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-2
|
||||
- Update gcc44 patch to disable -frepo, seems to be broken with gcc44
|
||||
- Added noffmpeg patch to make building outside mock easier
|
||||
|
||||
* Sat Mar 21 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-1
|
||||
- Patch for gcc 4.4 compilation errors
|
||||
- Upgrade to 1.24.1
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23.3-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Sat Jan 24 2009 Caolán McNamara <caolanm@redhat.com> - 1.23.3-3
|
||||
- rebuild for dependencies
|
||||
|
||||
* Mon Dec 15 2008 Martin Ebourne <martin@zepler.org> - 1.23.3-2
|
||||
- Fix permissions on zm.conf
|
||||
|
||||
* Fri Jul 11 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.23.3-1
|
||||
- Initial attempt at packaging 1.23.
|
||||
|
||||
* Tue Jul 1 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-15
|
||||
- Add perl module compat dependency, bz #453590
|
||||
|
||||
* Tue May 6 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-14
|
||||
- Remove default runlevel, bz #441315
|
||||
|
||||
* Mon Apr 28 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.22.3-13
|
||||
- Backport patch for CVE-2008-1381 from 1.23.3 to 1.22.3.
|
||||
|
||||
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.22.3-12
|
||||
- Autorebuild for GCC 4.3
|
||||
|
||||
* Thu Jan 3 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-11
|
||||
- Fix compilation on gcc 4.3
|
||||
|
||||
* Thu Dec 6 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-10
|
||||
- Rebuild for new openssl
|
||||
|
||||
* Thu Aug 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-8
|
||||
- Fix licence tag
|
||||
|
||||
* Thu Jul 12 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-7
|
||||
- Fixes from testing by Jitz including missing dependencies and database creation
|
||||
|
||||
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-6
|
||||
- Disable crashtrace on ppc
|
||||
|
||||
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-5
|
||||
- Fix uid for directories in /var/lib/zoneminder
|
||||
|
||||
* Tue Jun 26 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-4
|
||||
- Added perl Archive::Tar dependency
|
||||
- Disabled web interface due to lack of access control on the event images
|
||||
|
||||
* Sun Jun 10 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-3
|
||||
- Changes recommended in review by Jason Tibbitts
|
||||
|
||||
* Mon Apr 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-2
|
||||
- Standardised on package name of zoneminder
|
||||
|
||||
* Thu Dec 28 2006 Martin Ebourne <martin@zepler.org> - 1.22.3-1
|
||||
- First version. Uses some parts from zm-1.20.1 by Corey DeLasaux and Serg Oskin
|
|
@ -0,0 +1,45 @@
|
|||
# The Zoneminder web interface has been disabled by default due to a small
|
||||
# security issue in the default install.
|
||||
#
|
||||
# When using Zoneminder's own authentication, recorded CCTV images are
|
||||
# accessible from the web directly without passing the authentication. This
|
||||
# means any attacker could see your CCTV images without a password. In order
|
||||
# to avoid this you can disable Zoneminder's authentication and configure
|
||||
# standard Apache authentication (see the Apache documentation for details on
|
||||
# this).
|
||||
#
|
||||
# If you still wish to use Zoneminder's own authentication, or have an
|
||||
# internal site which needs no authentication, you need to delete the line
|
||||
# marked below and restart Apache.
|
||||
|
||||
Alias /zm "/srv/www/htdocs/zoneminder"
|
||||
<Directory "srv/www/htdocs/zoneminder">
|
||||
Options -Indexes +MultiViews +FollowSymLinks
|
||||
AllowOverride All
|
||||
<IfModule mod_authz_core.c>
|
||||
# Apache 2.4
|
||||
Require all granted
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
# Apache 2.2
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</IfModule>
|
||||
# The code unfortunately uses short tags in many places
|
||||
php_value short_open_tag 1
|
||||
</Directory>
|
||||
|
||||
ScriptAlias /cgi-bin/zm "/srv/www/cgi-bin"
|
||||
<Directory "/srv/www/cgi-bin">
|
||||
AllowOverride All
|
||||
Options ExecCGI
|
||||
<IfModule mod_authz_core.c>
|
||||
# Apache 2.4
|
||||
Require all granted
|
||||
</IfModule>
|
||||
<IfModule !mod_authz_core.c>
|
||||
# Apache 2.2
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</IfModule>
|
||||
</Directory>
|
|
@ -0,0 +1,8 @@
|
|||
/var/log/zoneminder/*.log {
|
||||
missingok
|
||||
notifempty
|
||||
sharedscripts
|
||||
postrotate
|
||||
/opt/zoneminder/bin/zmpkg.pl logrot 2> /dev/null > /dev/null || :
|
||||
endscript
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=Video security and surveillance system
|
||||
After=mysqld.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/opt/zoneminder/bin/zmpkg.pl start
|
||||
ExecStop=/opt/zoneminder/bin/zmpkg.pl stop
|
||||
ExecReload=/opt/zoneminder/bin/zmpkg.pl reload
|
||||
PIDFile=/var/run/zoneminder/zm.pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1 @@
|
|||
d /var/run/zoneminder 0755 wwwrun www
|
|
@ -0,0 +1,57 @@
|
|||
# CMakeLists.txt for the Redhat/CentOS Target Distro.
|
||||
|
||||
# Create the zoneminder service file
|
||||
configure_file(zoneminder.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY)
|
||||
|
||||
# Download jscalendar & move files into position
|
||||
file(DOWNLOAD http://softlayer-dal.dl.sourceforge.net/project/jscalendar/jscalendar/1.0/jscalendar-1.0.zip ${CMAKE_CURRENT_SOURCE_DIR}/jscalendar-1.0.zip LOG jsc_log STATUS download_jsc)
|
||||
#message(STATUS "Log of jscalender script was: ${jsc_log}")
|
||||
if(download_jsc EQUAL 0)
|
||||
message(STATUS "Jscalander successfully downloaded. Installing...")
|
||||
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/jscalendar.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ERROR_VARIABLE unzip_jsc)
|
||||
message(STATUS "Status of jscalender script was: ${unzip_jsc}")
|
||||
else(download_jsc EQUAL 0)
|
||||
message(STATUS "Unable to download optional jscalander. Skipping...")
|
||||
endif(download_jsc EQUAL 0)
|
||||
|
||||
# Download cambozola & move files into position
|
||||
file(DOWNLOAD http://www.andywilcock.com/code/cambozola/cambozola-0.931.tar.gz ${CMAKE_CURRENT_SOURCE_DIR}/cambozola-0.931.tar.gz STATUS download_camb)
|
||||
if(download_camb EQUAL 0)
|
||||
message(STATUS "Cambozola successfully downloaded. Installing...")
|
||||
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cambozola.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ERROR_VARIABLE untar_camb)
|
||||
message(STATUS "Status of cambozola script was: ${untar_camb}")
|
||||
else(download_camb EQUAL 0)
|
||||
message(STATUS "Unable to download optional Cambozola. Skipping...")
|
||||
endif(download_camb EQUAL 0)
|
||||
|
||||
# Create several empty folders
|
||||
file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events images temp)
|
||||
|
||||
# Install the empty folders
|
||||
#install(DIRECTORY run DESTINATION /var DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_WRITE GROUP_READ GROUP_EXECUTE WORLD_WRITE WORLD_READ WORLD_EXECUTE)
|
||||
install(DIRECTORY sock swap DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
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 /run 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 images temp DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
# Create symlinks
|
||||
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/events \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/events\")")
|
||||
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/images \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/images\")")
|
||||
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/temp \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/temp\")")
|
||||
|
||||
# Install auxillary files required to run zoneminder on CentOS
|
||||
install(FILES zoneminder.conf DESTINATION /etc/httpd/conf.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
||||
install(FILES zm-logrotate_d DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
||||
install(FILES redalert.wav DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/sounds PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
install(FILES zoneminder.service DESTINATION /etc/rc.d/init.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
||||
|
||||
# Install jscalendar
|
||||
if(unzip_jsc STREQUAL "")
|
||||
install(DIRECTORY jscalendar-1.0/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/tools/jscalendar)
|
||||
endif(unzip_jsc STREQUAL "")
|
||||
|
||||
# Install cambozola
|
||||
if(untar_camb STREQUAL "")
|
||||
install(FILES cambozola-0.931/dist/cambozola.jar DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www)
|
||||
endif(untar_camb STREQUAL "")
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
tar -xvzf cambozola-0.931.tar.gz
|
||||
mkdir -v cambozola-doc
|
||||
cd cambozola-0.931
|
||||
mv -v application.properties build.xml dist.sh *html LICENSE testPages/* ../cambozola-doc
|
||||
rmdir -v testPages
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
unzip -o jscalendar-1.0.zip
|
||||
mkdir -v jscalendar-doc
|
||||
cd jscalendar-1.0
|
||||
mv -v *html *php doc/* README ../jscalendar-doc
|
||||
rmdir -v doc
|
|
@ -0,0 +1,322 @@
|
|||
%define zmuid $(id -un)
|
||||
%define zmgid $(id -gn)
|
||||
%define zmuid_final apache
|
||||
%define zmgid_final apache
|
||||
|
||||
Name: zoneminder
|
||||
Version: 1.27
|
||||
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/
|
||||
# Mootools is inder the MIT license: http://mootools.net/
|
||||
# Cambozola is GPL: http://www.charliemouse.com/code/cambozola/
|
||||
License: GPLv2+ and LGPLv2+ and MIT
|
||||
URL: http://www.zoneminder.com/
|
||||
|
||||
#Source0: https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz
|
||||
Source0: ZoneMinder-%{version}.tar.gz
|
||||
|
||||
Patch1: zoneminder-1.26.0-defaults.patch
|
||||
|
||||
BuildRequires: cmake gnutls-devel bzip2-devel
|
||||
BuildRequires: mysql-devel pcre-devel libjpeg-turbo-devel
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
|
||||
BuildRequires: perl(Date::Manip) perl(DBD::mysql)
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent)
|
||||
BuildRequires: perl(MIME::Entity) perl(MIME::Lite)
|
||||
BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap)
|
||||
BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign)
|
||||
BuildRequires: perl(Expect) perl(X10::ActiveHome) perl(Astro::SunTime)
|
||||
BuildRequires: libcurl-devel vlc-devel ffmpeg-devel
|
||||
# cmake needs the following installed at build time due to the way it auto-detects certain parameters
|
||||
BuildRequires: httpd ffmpeg
|
||||
|
||||
Requires: httpd php php-mysql mysql-server libjpeg-turbo
|
||||
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
||||
Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip)
|
||||
Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP)
|
||||
Requires: libcurl vlc-core ffmpeg
|
||||
|
||||
Requires(post): /sbin/chkconfig
|
||||
Requires(post): /usr/bin/checkmodule
|
||||
Requires(post): /usr/bin/semodule_package
|
||||
Requires(post): /usr/sbin/semodule
|
||||
Requires(post): /usr/bin/gpasswd
|
||||
Requires(post): /usr/bin/less
|
||||
Requires(preun): /sbin/chkconfig
|
||||
Requires(preun): /sbin/service
|
||||
Requires(preun): /usr/sbin/semodule
|
||||
Requires(postun): /sbin/service
|
||||
|
||||
|
||||
%description
|
||||
ZoneMinder is a set of applications which is intended to provide a complete
|
||||
solution allowing you to capture, analyse, record and monitor any cameras you
|
||||
have attached to a Linux based machine. It is designed to run on kernels which
|
||||
support the Video For Linux (V4L) interface and has been tested with cameras
|
||||
attached to BTTV cards, various USB cameras and IP network cameras. It is
|
||||
designed to support as many cameras as you can attach to your computer without
|
||||
too much degradation of performance.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n ZoneMinder-%{version}
|
||||
|
||||
%patch1 -p0 -b .defaults
|
||||
|
||||
%build
|
||||
# Have to override CMAKE_INSTALL_LIBDIR for cmake < 2.8.7 due to this bug:
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=795542
|
||||
%cmake -DZM_TARGET_DISTRO="el6" -DCMAKE_INSTALL_LIBDIR:PATH=%{_lib} -DZM_PERL_SUBPREFIX=`x="%{perl_vendorlib}" ; echo ${x#"%{_prefix}"}` .
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
export DESTDIR=%{buildroot}
|
||||
make install
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add zoneminder
|
||||
/sbin/chkconfig zoneminder on
|
||||
|
||||
# Allow zoneminder access to local video sources, serial ports, and x10
|
||||
echo
|
||||
/usr/bin/gpasswd -a %{zmuid_final} video
|
||||
/usr/bin/gpasswd -a %{zmuid_final} dialout
|
||||
|
||||
# Create and load zoneminder selinux policy module
|
||||
echo -e "\nCreating and installing a ZoneMinder SELinux policy module. Please wait.\n"
|
||||
/usr/bin/checkmodule -M -m -o %{_docdir}/%{name}-%{version}/local_zoneminder.mod %{_docdir}/%{name}-%{version}/local_zoneminder.te > /dev/null
|
||||
/usr/bin/semodule_package -o %{_docdir}/%{name}-%{version}/local_zoneminder.pp -m %{_docdir}/%{name}-%{version}/local_zoneminder.mod > /dev/null
|
||||
/usr/sbin/semodule -i %{_docdir}/%{name}-%{version}/local_zoneminder.pp > /dev/null
|
||||
|
||||
# Display the README for post installation instructions
|
||||
/usr/bin/less %{_docdir}/%{name}-%{version}/README.CentOS
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ]; then
|
||||
/sbin/service zoneminder stop > /dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del zoneminder
|
||||
echo -e "\nRemoving ZoneMinder SELinux policy module. Please wait.\n"
|
||||
/usr/sbin/semodule -r local_zoneminder.pp
|
||||
fi
|
||||
|
||||
|
||||
%postun
|
||||
if [ $1 -ge 1 ]; then
|
||||
/sbin/service zoneminder condrestart > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
# Remove the doc folder.
|
||||
rm -rf %{_docdir}/%{name}-%{version}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS BUGS ChangeLog COPYING LICENSE NEWS README.md distros/redhat/README.CentOS distros/redhat/jscalendar-doc
|
||||
%doc distros/redhat/cambozola-doc distros/redhat/local_zoneminder.te
|
||||
%config %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm.conf
|
||||
%config(noreplace) %attr(644,root,root) %{_sysconfdir}/httpd/conf.d/zoneminder.conf
|
||||
%config(noreplace) /etc/logrotate.d/%{name}
|
||||
%attr(755,root,root) %{_initrddir}/zoneminder
|
||||
|
||||
%{_bindir}/zma
|
||||
%{_bindir}/zmaudit.pl
|
||||
%{_bindir}/zmc
|
||||
%{_bindir}/zmcontrol.pl
|
||||
%{_bindir}/zmdc.pl
|
||||
%{_bindir}/zmf
|
||||
%{_bindir}/zmfilter.pl
|
||||
# zmfix removed from zoneminder 1.26.6
|
||||
#%attr(4755,root,root) %{_bindir}/zmfix
|
||||
%{_bindir}/zmpkg.pl
|
||||
%{_bindir}/zmstreamer
|
||||
%{_bindir}/zmtrack.pl
|
||||
%{_bindir}/zmtrigger.pl
|
||||
%{_bindir}/zmu
|
||||
%{_bindir}/zmupdate.pl
|
||||
%{_bindir}/zmvideo.pl
|
||||
%{_bindir}/zmwatch.pl
|
||||
%{_bindir}/zmcamtool.pl
|
||||
%{_bindir}/zmx10.pl
|
||||
|
||||
%{perl_vendorlib}/ZoneMinder*
|
||||
%{perl_vendorlib}/%{_arch}-linux-thread-multi/auto/ZoneMinder*
|
||||
%{_mandir}/man*/*
|
||||
%dir %{_libexecdir}/%{name}
|
||||
%{_libexecdir}/%{name}/cgi-bin
|
||||
%dir %{_datadir}/%{name}
|
||||
%{_datadir}/%{name}/db
|
||||
%{_datadir}/%{name}/www
|
||||
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/events
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/images
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/sock
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/swap
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/temp
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/log/zoneminder
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/spool/zoneminder-upload
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Mar 14 2014 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.27
|
||||
- Tweak build requirements for cmake
|
||||
|
||||
* Sat Feb 01 2014 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.27
|
||||
- Add zmcamtool.pl. Bump version for 1.27 release.
|
||||
|
||||
* Mon Dec 16 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.5
|
||||
- This is a bug fixe release
|
||||
- RTSP fixes, cmake enhancements, couple other misc fixes
|
||||
|
||||
* Sat Oct 19 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.4
|
||||
- Streamline the cmake build. Move much code into cmakelist.txt file.
|
||||
|
||||
* Mon Oct 07 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.4
|
||||
- Initial cmake build.
|
||||
|
||||
* Sun Oct 06 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.4
|
||||
- All files are now part of the zoneminder source tree. Update specfile accordingly.
|
||||
|
||||
* Thu Sep 05 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0
|
||||
- 1.26.0 Release
|
||||
- https://github.com/ZoneMinder/ZoneMinder/archive/v1.26.0.tar.gz
|
||||
|
||||
* Sun Sep 01 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
|
||||
- Update SELinux policy module
|
||||
|
||||
* Thu Aug 29 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
|
||||
- Third Beta release
|
||||
- https://github.com/ZoneMinder/ZoneMinder/tree/release-1.26
|
||||
- Reduce number of uneeded dependencies by integrating cambozola into spec file
|
||||
|
||||
* Thu Aug 15 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
|
||||
- Initial Beta release
|
||||
- https://github.com/ZoneMinder/ZoneMinder/tree/release-1.26
|
||||
|
||||
* Sun Aug 11 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-kfirproper
|
||||
- Modified specfile to work with kfir-proper branch
|
||||
- https://github.com/ZoneMinder/ZoneMinder/tree/kfir-proper
|
||||
|
||||
* Wed Aug 07 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-2svn3827
|
||||
- Move RHEL/CentOS specific defaults to a patch file
|
||||
- Add bzip2-devel as a build dependency
|
||||
- Default ZM_SSL_LIB back to gnutls. AUTH_RELAY = hashed didn't work with openssl.
|
||||
|
||||
* Fri Aug 02 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-1svn3827
|
||||
- Update to latest 1.25.0 subversion.
|
||||
- Does not compile with modern versions of ffmpeg. Configure to work only with older versions.
|
||||
- Does not compile with gcc 4.7. Configure to build with gcc less than 4.7.
|
||||
|
||||
* Thu Mar 24 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-4.20110324svn3310
|
||||
- Update to latest 1.24.3 subversion. Turns out that what upstream was calling
|
||||
1.24.3 is really just an occasionally updated devel snapshot.
|
||||
- Rebase various patches.
|
||||
|
||||
* Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 1.24.3-3
|
||||
- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient)
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Tue Jan 25 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-1
|
||||
- Update to latest upstream version.
|
||||
- Rebase patches.
|
||||
- Initial incomplete attempt to disable v4l1 support.
|
||||
|
||||
* Fri Jan 21 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-6
|
||||
- Unbundle cambozola; instead link to the separately pacakged copy.
|
||||
- Remove BuildRoot:, %%clean and buildroot cleaning in %%install.
|
||||
- Git rid of mixed space/tab usage by removing all tabs.
|
||||
- Remove unnecessary Conflicts: line.
|
||||
- Attempt to force short_open_tag on for the code directories.
|
||||
- Move default location of sockets, swaps, logfiles and some temporary files to
|
||||
make more sense and allow things to work better with a future selinux policy.
|
||||
- Fix errors in README.CentOS.
|
||||
|
||||
* Wed Jun 02 2010 Marcela Maslanova <mmaslano@redhat.com> - 1.24.2-5
|
||||
- Mass rebuild with perl-5.12.0
|
||||
|
||||
* Fri Dec 4 2009 Stepan Kasal <skasal@redhat.com> - 1.24.2-4
|
||||
- rebuild against perl 5.10.1
|
||||
- use Perl vendorarch and archlib variables correctly
|
||||
|
||||
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-2
|
||||
- Bump release since 1.24.2-1 was mistakenly tagged a few months ago.
|
||||
|
||||
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-1
|
||||
- Initial update to 1.24.2.
|
||||
- Rebase patches.
|
||||
- Update mootools download location.
|
||||
- Update to mootools 1.2.3.
|
||||
- Add additional dependencies for some optional features.
|
||||
|
||||
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-3
|
||||
- Remove unused Sys::Mmap perl dependency RPM is finding
|
||||
|
||||
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-2
|
||||
- Update gcc44 patch to disable -frepo, seems to be broken with gcc44
|
||||
- Added noffmpeg patch to make building outside mock easier
|
||||
|
||||
* Sat Mar 21 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-1
|
||||
- Patch for gcc 4.4 compilation errors
|
||||
- Upgrade to 1.24.1
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23.3-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Sat Jan 24 2009 Caolán McNamara <caolanm@redhat.com> - 1.23.3-3
|
||||
- rebuild for dependencies
|
||||
|
||||
* Mon Dec 15 2008 Martin Ebourne <martin@zepler.org> - 1.23.3-2
|
||||
- Fix permissions on zm.conf
|
||||
|
||||
* Fri Jul 11 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.23.3-1
|
||||
- Initial attempt at packaging 1.23.
|
||||
|
||||
* Tue Jul 1 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-15
|
||||
- Add perl module compat dependency, bz #453590
|
||||
|
||||
* Tue May 6 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-14
|
||||
- Remove default runlevel, bz #441315
|
||||
|
||||
* Mon Apr 28 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.22.3-13
|
||||
- Backport patch for CVE-2008-1381 from 1.23.3 to 1.22.3.
|
||||
|
||||
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.22.3-12
|
||||
- Autorebuild for GCC 4.3
|
||||
|
||||
* Thu Jan 3 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-11
|
||||
- Fix compilation on gcc 4.3
|
||||
|
||||
* Thu Dec 6 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-10
|
||||
- Rebuild for new openssl
|
||||
|
||||
* Thu Aug 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-8
|
||||
- Fix licence tag
|
||||
|
||||
* Thu Jul 12 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-7
|
||||
- Fixes from testing by Jitz including missing dependencies and database creation
|
||||
|
||||
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-6
|
||||
- Disable crashtrace on ppc
|
||||
|
||||
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-5
|
||||
- Fix uid for directories in /var/lib/zoneminder
|
||||
|
||||
* Tue Jun 26 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-4
|
||||
- Added perl Archive::Tar dependency
|
||||
- Disabled web interface due to lack of access control on the event images
|
||||
|
||||
* Sun Jun 10 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-3
|
||||
- Changes recommended in review by Jason Tibbitts
|
||||
|
||||
* Mon Apr 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-2
|
||||
- Standardised on package name of zoneminder
|
||||
|
||||
* Thu Dec 28 2006 Martin Ebourne <martin@zepler.org> - 1.22.3-1
|
||||
- First version. Uses some parts from zm-1.20.1 by Corey DeLasaux and Serg Oskin
|
|
@ -0,0 +1,419 @@
|
|||
%define cambrev 0.931
|
||||
%define moorev 1.3.2
|
||||
%define jscrev 1.0
|
||||
|
||||
%define zmuid $(id -un)
|
||||
%define zmgid $(id -gn)
|
||||
%define zmuid_final apache
|
||||
%define zmgid_final apache
|
||||
|
||||
Name: zoneminder
|
||||
Version: 1.27
|
||||
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/
|
||||
# Mootools is inder the MIT license: http://mootools.net/
|
||||
# Cambozola is GPL: http://www.charliemouse.com/code/cambozola/
|
||||
License: GPLv2+ and LGPLv2+ and MIT
|
||||
URL: http://www.zoneminder.com/
|
||||
|
||||
#Source0: https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz
|
||||
Source0: ZoneMinder-%{version}.tar.gz
|
||||
Source1: jscalendar-%{jscrev}.zip
|
||||
#Source1: http://downloads.sourceforge.net/jscalendar/jscalendar-%{jscrev}.zip
|
||||
|
||||
# Mootools is currently bundled in the zoneminder tarball
|
||||
#Source2: mootools-core-%{moorev}-full-compat-yc.js
|
||||
#Source2: http://mootools.net/download/get/mootools-core-%{moorev}-full-compat-yc.js
|
||||
|
||||
Source3: cambozola-%{cambrev}.tar.gz
|
||||
#Source3: http://www.andywilcock.com/code/cambozola/cambozola-%{cambrev}.tar.gz
|
||||
|
||||
#Patch1: zoneminder-1.26.4-dbinstall.patch
|
||||
Patch2: zoneminder-runlevel.patch
|
||||
#Patch3: zoneminder-1.25.0-installfix.patch
|
||||
Patch4: zoneminder-1.26.0-defaults.patch
|
||||
|
||||
# BuildRoot is depreciated and ignored in EPEL6
|
||||
#BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: automake gnutls-devel bzip2-devel libtool
|
||||
BuildRequires: mysql-devel pcre-devel libjpeg-turbo-devel
|
||||
BuildRequires: perl(Archive::Tar) perl(Archive::Zip)
|
||||
BuildRequires: perl(Date::Manip) perl(DBD::mysql)
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent)
|
||||
BuildRequires: perl(MIME::Entity) perl(MIME::Lite)
|
||||
BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap)
|
||||
BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign)
|
||||
BuildRequires: perl(Expect) perl(X10::ActiveHome) perl(Astro::SunTime)
|
||||
BuildRequires: libcurl-devel vlc-devel ffmpeg-devel >= 0.4.9
|
||||
|
||||
Requires: httpd php php-mysql mysql-server libjpeg-turbo
|
||||
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
||||
Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip)
|
||||
Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP)
|
||||
Requires: libcurl vlc-core ffmpeg >= 0.4.9
|
||||
|
||||
Requires(post): /sbin/chkconfig
|
||||
Requires(post): /usr/bin/checkmodule
|
||||
Requires(post): /usr/bin/semodule_package
|
||||
Requires(post): /usr/sbin/semodule
|
||||
Requires(post): /usr/bin/gpasswd
|
||||
Requires(post): /usr/bin/less
|
||||
Requires(preun): /sbin/chkconfig
|
||||
Requires(preun): /sbin/service
|
||||
Requires(preun): /usr/sbin/semodule
|
||||
Requires(postun): /sbin/service
|
||||
|
||||
|
||||
%description
|
||||
ZoneMinder is a set of applications which is intended to provide a complete
|
||||
solution allowing you to capture, analyse, record and monitor any cameras you
|
||||
have attached to a Linux based machine. It is designed to run on kernels which
|
||||
support the Video For Linux (V4L) interface and has been tested with cameras
|
||||
attached to BTTV cards, various USB cameras and IP network cameras. It is
|
||||
designed to support as many cameras as you can attach to your computer without
|
||||
too much degradation of performance.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n ZoneMinder-%{version}
|
||||
|
||||
# Unpack jscalendar and move some files around
|
||||
%setup -q -D -T -a 1 -n ZoneMinder-%{version}
|
||||
mkdir jscalendar-doc
|
||||
pushd jscalendar-%{jscrev}
|
||||
mv *html *php doc/* README ../jscalendar-doc
|
||||
rmdir doc
|
||||
popd
|
||||
|
||||
# Unpack Cambozola and move some files around
|
||||
%setup -q -D -T -a 3 -n ZoneMinder-%{version}
|
||||
mkdir cambozola-doc
|
||||
pushd cambozola-%{cambrev}
|
||||
mv application.properties build.xml dist.sh *html LICENSE testPages/* ../cambozola-doc
|
||||
rmdir testPages
|
||||
popd
|
||||
|
||||
#%patch1 -p0 -b .dbinstall
|
||||
%patch2 -p0 -b .runlevel
|
||||
#%patch3 -p0 -b .installfix
|
||||
%patch4 -p0
|
||||
|
||||
%build
|
||||
libtoolize --force
|
||||
aclocal
|
||||
autoheader
|
||||
automake --force-missing --add-missing
|
||||
autoconf
|
||||
|
||||
OPTS=""
|
||||
%ifnarch %{ix86} x86_64
|
||||
OPTS="$OPTS --disable-crashtrace"
|
||||
%endif
|
||||
|
||||
%configure \
|
||||
--with-libarch=%{_lib} \
|
||||
%ifarch %{ix86} %{x8664}
|
||||
--enable-crashtrace \
|
||||
%else
|
||||
--disable-crashtrace \
|
||||
%endif
|
||||
--with-mysql=%{_prefix} \
|
||||
--with-ffmpeg=%{_prefix} \
|
||||
--with-webdir=%{_datadir}/%{name}/www \
|
||||
--with-cgidir=%{_libexecdir}/%{name}/cgi-bin \
|
||||
--with-webuser=%{zmuid} \
|
||||
--with-webgroup=%{zmgid} \
|
||||
--enable-mmap=yes \
|
||||
--disable-debug \
|
||||
--with-webhost=zm.local \
|
||||
ZM_SSL_LIB="gnutls" \
|
||||
ZM_RUNDIR=/var/run/zoneminder \
|
||||
ZM_TMPDIR=/var/lib/zoneminder/temp \
|
||||
%ifarch x86_64
|
||||
CXXFLAGS="-D__STDC_CONSTANT_MACROS -msse2" \
|
||||
%else
|
||||
CXXFLAGS="-D__STDC_CONSTANT_MACROS" \
|
||||
%endif
|
||||
--with-extralibs=""
|
||||
|
||||
make %{?_smp_mflags}
|
||||
%{__perl} -pi -e 's/(ZM_WEB_USER=).*$/${1}%{zmuid_final}/;' \
|
||||
-e 's/(ZM_WEB_GROUP=).*$/${1}%{zmgid_final}/;' zm.conf
|
||||
|
||||
%install
|
||||
install -d %{buildroot}/%{_localstatedir}/run
|
||||
install -d %{buildroot}/etc/logrotate.d
|
||||
|
||||
make install DESTDIR=%{buildroot} \
|
||||
INSTALLDIRS=vendor
|
||||
|
||||
rm -rf %{buildroot}/%{perl_vendorarch} %{buildroot}/%{perl_archlib}
|
||||
|
||||
install -m 755 -d %{buildroot}/%{_localstatedir}/log/zoneminder
|
||||
for dir in events images temp
|
||||
do
|
||||
install -m 755 -d %{buildroot}/%{_localstatedir}/lib/zoneminder/$dir
|
||||
if [ -d %{buildroot}/%{_datadir}/zoneminder/www/$dir ]; then
|
||||
rmdir %{buildroot}/%{_datadir}/%{name}/www/$dir
|
||||
fi
|
||||
ln -sf ../../../..%{_localstatedir}/lib/zoneminder/$dir %{buildroot}/%{_datadir}/%{name}/www/$dir
|
||||
done
|
||||
install -m 755 -d %{buildroot}/%{_localstatedir}/lib/zoneminder/sock
|
||||
install -m 755 -d %{buildroot}/%{_localstatedir}/lib/zoneminder/swap
|
||||
install -m 755 -d %{buildroot}/%{_localstatedir}/spool/zoneminder-upload
|
||||
|
||||
install -D -m 755 scripts/zm %{buildroot}/%{_initrddir}/zoneminder
|
||||
install -D -m 644 distros/redhat/zoneminder.conf %{buildroot}/%{_sysconfdir}/httpd/conf.d/zoneminder.conf
|
||||
install -D -m 755 distros/redhat/redalert.wav %{buildroot}/%{_datadir}/%{name}/www/sounds/redalert.wav
|
||||
install distros/redhat/zm-logrotate_d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
|
||||
|
||||
# Install jscalendar
|
||||
install -d -m 755 %{buildroot}/%{_datadir}/%{name}/www/jscalendar
|
||||
cp -rp jscalendar-%{jscrev}/* %{buildroot}/%{_datadir}/%{name}/www/jscalendar
|
||||
|
||||
# Install Cambozola
|
||||
cp -rp cambozola-%{cambrev}/dist/cambozola.jar %{buildroot}/%{_datadir}/%{name}/www/
|
||||
rm -rf cambozola-%{cambrev}
|
||||
|
||||
# Install mootools
|
||||
pushd %{buildroot}/%{_datadir}/%{name}/www
|
||||
#install -m 644 %{Source2} mootools-core-%{moorev}-full-compat-yc.js
|
||||
#ln -s mootools-core-%{moorev}-full-compat-yc.js mootools.js
|
||||
ln -f -s tools/mootools/mootools-core-%{moorev}-yc.js mootools-core.js
|
||||
ln -f -s tools/mootools/mootools-more-%{moorev}.1-yc.js mootools-more.js
|
||||
popd
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add zoneminder
|
||||
/sbin/chkconfig zoneminder on
|
||||
|
||||
# Allow zoneminder access to local video sources, serial ports, and x10
|
||||
echo
|
||||
/usr/bin/gpasswd -a %{zmuid_final} video
|
||||
/usr/bin/gpasswd -a %{zmuid_final} dialout
|
||||
|
||||
# Create and load zoneminder selinux policy module
|
||||
echo -e "\nCreating and installing a ZoneMinder SELinux policy module. Please wait.\n"
|
||||
/usr/bin/checkmodule -M -m -o %{_docdir}/%{name}-%{version}/local_zoneminder.mod %{_docdir}/%{name}-%{version}/local_zoneminder.te > /dev/null
|
||||
/usr/bin/semodule_package -o %{_docdir}/%{name}-%{version}/local_zoneminder.pp -m %{_docdir}/%{name}-%{version}/local_zoneminder.mod > /dev/null
|
||||
/usr/sbin/semodule -i %{_docdir}/%{name}-%{version}/local_zoneminder.pp > /dev/null
|
||||
|
||||
# Display the README for post installation instructions
|
||||
/usr/bin/less %{_docdir}/%{name}-%{version}/README.CentOS
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ]; then
|
||||
/sbin/service zoneminder stop > /dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del zoneminder
|
||||
echo -e "\nRemoving ZoneMinder SELinux policy module. Please wait.\n"
|
||||
/usr/sbin/semodule -r local_zoneminder.pp
|
||||
fi
|
||||
|
||||
|
||||
%postun
|
||||
if [ $1 -ge 1 ]; then
|
||||
/sbin/service zoneminder condrestart > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS BUGS ChangeLog COPYING LICENSE NEWS README.md distros/redhat/README.CentOS jscalendar-doc cambozola-doc distros/redhat/local_zoneminder.te
|
||||
%config %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm.conf
|
||||
%config(noreplace) %attr(644,root,root) %{_sysconfdir}/httpd/conf.d/zoneminder.conf
|
||||
%config(noreplace) /etc/logrotate.d/%{name}
|
||||
%attr(755,root,root) %{_initrddir}/zoneminder
|
||||
|
||||
%{_bindir}/zma
|
||||
%{_bindir}/zmaudit.pl
|
||||
%{_bindir}/zmc
|
||||
%{_bindir}/zmcontrol.pl
|
||||
%{_bindir}/zmdc.pl
|
||||
%{_bindir}/zmf
|
||||
%{_bindir}/zmfilter.pl
|
||||
# zmfix removed from zoneminder 1.26.6
|
||||
#%attr(4755,root,root) %{_bindir}/zmfix
|
||||
%{_bindir}/zmpkg.pl
|
||||
%{_bindir}/zmstreamer
|
||||
%{_bindir}/zmtrack.pl
|
||||
%{_bindir}/zmtrigger.pl
|
||||
%{_bindir}/zmu
|
||||
%{_bindir}/zmupdate.pl
|
||||
%{_bindir}/zmvideo.pl
|
||||
%{_bindir}/zmwatch.pl
|
||||
%{_bindir}/zmcamtool.pl
|
||||
%{_bindir}/zmx10.pl
|
||||
|
||||
%{perl_vendorlib}/ZoneMinder*
|
||||
%{_mandir}/man*/*
|
||||
%dir %{_libexecdir}/%{name}
|
||||
%{_libexecdir}/%{name}/cgi-bin
|
||||
%dir %{_datadir}/%{name}
|
||||
%{_datadir}/%{name}/db
|
||||
%{_datadir}/%{name}/www
|
||||
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/events
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/images
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/sock
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/swap
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/lib/zoneminder/temp
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/log/zoneminder
|
||||
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_localstatedir}/spool/zoneminder-upload
|
||||
|
||||
|
||||
%changelog
|
||||
* Sat Feb 01 2014 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.27
|
||||
- Add zmcamtool.pl. Bump version for 1.27 release.
|
||||
|
||||
* Mon Dec 16 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.5
|
||||
- This is a bug fixe release
|
||||
- RTSP fixes, cmake enhancements, couple other misc fixes
|
||||
|
||||
* Sun Oct 06 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.4
|
||||
- All files are now part of the zoneminder source tree. Update specfile accordingly.
|
||||
|
||||
* Thu Sep 05 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0
|
||||
- 1.26.0 Release
|
||||
- https://github.com/ZoneMinder/ZoneMinder/archive/v1.26.0.tar.gz
|
||||
|
||||
* Sun Sep 01 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
|
||||
- Update SELinux policy module
|
||||
|
||||
* Thu Aug 29 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
|
||||
- Third Beta release
|
||||
- https://github.com/ZoneMinder/ZoneMinder/tree/release-1.26
|
||||
- Reduce number of uneeded dependencies by integrating cambozola into spec file
|
||||
|
||||
* Thu Aug 15 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.26.0-beta
|
||||
- Initial Beta release
|
||||
- https://github.com/ZoneMinder/ZoneMinder/tree/release-1.26
|
||||
|
||||
* Sun Aug 11 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-kfirproper
|
||||
- Modified specfile to work with kfir-proper branch
|
||||
- https://github.com/ZoneMinder/ZoneMinder/tree/kfir-proper
|
||||
|
||||
* Wed Aug 07 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-2svn3827
|
||||
- Move RHEL/CentOS specific defaults to a patch file
|
||||
- Add bzip2-devel as a build dependency
|
||||
- Default ZM_SSL_LIB back to gnutls. AUTH_RELAY = hashed didn't work with openssl.
|
||||
|
||||
* Fri Aug 02 2013 Andrew Bauer <knnniggett@users.sourceforge.net> - 1.25.0-1svn3827
|
||||
- Update to latest 1.25.0 subversion.
|
||||
- Does not compile with modern versions of ffmpeg. Configure to work only with older versions.
|
||||
- Does not compile with gcc 4.7. Configure to build with gcc less than 4.7.
|
||||
|
||||
* Thu Mar 24 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-4.20110324svn3310
|
||||
- Update to latest 1.24.3 subversion. Turns out that what upstream was calling
|
||||
1.24.3 is really just an occasionally updated devel snapshot.
|
||||
- Rebase various patches.
|
||||
|
||||
* Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 1.24.3-3
|
||||
- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient)
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Tue Jan 25 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.3-1
|
||||
- Update to latest upstream version.
|
||||
- Rebase patches.
|
||||
- Initial incomplete attempt to disable v4l1 support.
|
||||
|
||||
* Fri Jan 21 2011 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-6
|
||||
- Unbundle cambozola; instead link to the separately pacakged copy.
|
||||
- Remove BuildRoot:, %%clean and buildroot cleaning in %%install.
|
||||
- Git rid of mixed space/tab usage by removing all tabs.
|
||||
- Remove unnecessary Conflicts: line.
|
||||
- Attempt to force short_open_tag on for the code directories.
|
||||
- Move default location of sockets, swaps, logfiles and some temporary files to
|
||||
make more sense and allow things to work better with a future selinux policy.
|
||||
- Fix errors in README.CentOS.
|
||||
|
||||
* Wed Jun 02 2010 Marcela Maslanova <mmaslano@redhat.com> - 1.24.2-5
|
||||
- Mass rebuild with perl-5.12.0
|
||||
|
||||
* Fri Dec 4 2009 Stepan Kasal <skasal@redhat.com> - 1.24.2-4
|
||||
- rebuild against perl 5.10.1
|
||||
- use Perl vendorarch and archlib variables correctly
|
||||
|
||||
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.24.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-2
|
||||
- Bump release since 1.24.2-1 was mistakenly tagged a few months ago.
|
||||
|
||||
* Wed Jul 22 2009 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.24.2-1
|
||||
- Initial update to 1.24.2.
|
||||
- Rebase patches.
|
||||
- Update mootools download location.
|
||||
- Update to mootools 1.2.3.
|
||||
- Add additional dependencies for some optional features.
|
||||
|
||||
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-3
|
||||
- Remove unused Sys::Mmap perl dependency RPM is finding
|
||||
|
||||
* Sat Apr 11 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-2
|
||||
- Update gcc44 patch to disable -frepo, seems to be broken with gcc44
|
||||
- Added noffmpeg patch to make building outside mock easier
|
||||
|
||||
* Sat Mar 21 2009 Martin Ebourne <martin@zepler.org> - 1.24.1-1
|
||||
- Patch for gcc 4.4 compilation errors
|
||||
- Upgrade to 1.24.1
|
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23.3-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
|
||||
|
||||
* Sat Jan 24 2009 Caolán McNamara <caolanm@redhat.com> - 1.23.3-3
|
||||
- rebuild for dependencies
|
||||
|
||||
* Mon Dec 15 2008 Martin Ebourne <martin@zepler.org> - 1.23.3-2
|
||||
- Fix permissions on zm.conf
|
||||
|
||||
* Fri Jul 11 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.23.3-1
|
||||
- Initial attempt at packaging 1.23.
|
||||
|
||||
* Tue Jul 1 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-15
|
||||
- Add perl module compat dependency, bz #453590
|
||||
|
||||
* Tue May 6 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-14
|
||||
- Remove default runlevel, bz #441315
|
||||
|
||||
* Mon Apr 28 2008 Jason L Tibbitts III <tibbs@math.uh.edu> - 1.22.3-13
|
||||
- Backport patch for CVE-2008-1381 from 1.23.3 to 1.22.3.
|
||||
|
||||
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.22.3-12
|
||||
- Autorebuild for GCC 4.3
|
||||
|
||||
* Thu Jan 3 2008 Martin Ebourne <martin@zepler.org> - 1.22.3-11
|
||||
- Fix compilation on gcc 4.3
|
||||
|
||||
* Thu Dec 6 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-10
|
||||
- Rebuild for new openssl
|
||||
|
||||
* Thu Aug 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-8
|
||||
- Fix licence tag
|
||||
|
||||
* Thu Jul 12 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-7
|
||||
- Fixes from testing by Jitz including missing dependencies and database creation
|
||||
|
||||
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-6
|
||||
- Disable crashtrace on ppc
|
||||
|
||||
* Sat Jun 30 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-5
|
||||
- Fix uid for directories in /var/lib/zoneminder
|
||||
|
||||
* Tue Jun 26 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-4
|
||||
- Added perl Archive::Tar dependency
|
||||
- Disabled web interface due to lack of access control on the event images
|
||||
|
||||
* Sun Jun 10 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-3
|
||||
- Changes recommended in review by Jason Tibbitts
|
||||
|
||||
* Mon Apr 2 2007 Martin Ebourne <martin@zepler.org> - 1.22.3-2
|
||||
- Standardised on package name of zoneminder
|
||||
|
||||
* Thu Dec 28 2006 Martin Ebourne <martin@zepler.org> - 1.22.3-1
|
||||
- First version. Uses some parts from zm-1.20.1 by Corey DeLasaux and Serg Oskin
|
|
@ -0,0 +1,121 @@
|
|||
#!/bin/sh
|
||||
# description: ZoneMinder is the top Linux video camera security and surveillance solution. ZoneMinder is intended for use in single or multi-camera video security applications.Copyright: Philip Coombes, Corey DeLasaux 2003-2008
|
||||
# chkconfig: - 99 00
|
||||
# processname: zmpkg.pl
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
prog=ZoneMinder
|
||||
ZM_CONFIG="@ZM_CONFIG@"
|
||||
pidfile="@ZM_RUNDIR@"
|
||||
LOCKFILE=/var/lock/subsys/zm
|
||||
|
||||
loadconf()
|
||||
{
|
||||
if [ -f $ZM_CONFIG ]; then
|
||||
. $ZM_CONFIG
|
||||
else
|
||||
echo "ERROR: $ZM_CONFIG not found."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
loadconf
|
||||
command="$ZM_PATH_BIN/zmpkg.pl"
|
||||
|
||||
start()
|
||||
{
|
||||
# Commenting out as it is not needed. Leaving as a placeholder for future use.
|
||||
# zmupdate || return $?
|
||||
loadconf || return $?
|
||||
#Make sure the directory for our PID folder exists or create one.
|
||||
[ ! -d $pidfile ] \
|
||||
&& mkdir -m 774 $pidfile \
|
||||
&& chown $ZM_WEB_USER:$ZM_WEB_GROUP $pidfile
|
||||
#Make sure the folder for the socks file exists or create one
|
||||
GetPath="select Value from Config where Name='ZM_PATH_SOCKS'"
|
||||
dbHost=`echo $ZM_DB_HOST | cut -d: -f1`
|
||||
dbPort=`echo $ZM_DB_HOST | cut -d: -s -f2`
|
||||
if [ "$dbPort" = "" ]
|
||||
then
|
||||
ZM_PATH_SOCK=`echo $GetPath | mysql -B -h$ZM_DB_HOST -u$ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME | grep -v '^Value'`
|
||||
else
|
||||
ZM_PATH_SOCK=`echo $GetPath | mysql -B -h$dbHost -P$dbPort -u$ZM_DB_USER -p$ZM_DB_PASS $ZM_DB_NAME | grep -v '^Value'`
|
||||
fi
|
||||
[ ! -d $ZM_PATH_SOCK ] \
|
||||
&& mkdir -m 774 $ZM_PATH_SOCK \
|
||||
&& chown $ZM_WEB_USER:$ZM_WEB_GROUP $ZM_PATH_SOCK
|
||||
echo -n $"Starting $prog: "
|
||||
$command start
|
||||
RETVAL=$?
|
||||
[ $RETVAL = 0 ] && success || failure
|
||||
echo
|
||||
[ $RETVAL = 0 ] && touch $LOCKFILE
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
loadconf
|
||||
echo -n $"Stopping $prog: "
|
||||
$command stop
|
||||
RETVAL=$?
|
||||
[ $RETVAL = 0 ] && success || failure
|
||||
echo
|
||||
[ $RETVAL = 0 ] && rm -f $LOCKFILE
|
||||
}
|
||||
|
||||
zmstatus()
|
||||
{
|
||||
loadconf
|
||||
result=`$command status`
|
||||
if [ "$result" = "running" ]; then
|
||||
echo "ZoneMinder is running"
|
||||
$ZM_PATH_BIN/zmu -l
|
||||
RETVAL=0
|
||||
else
|
||||
echo "ZoneMinder is stopped"
|
||||
RETVAL=1
|
||||
fi
|
||||
}
|
||||
|
||||
zmupdate()
|
||||
{
|
||||
if [ -x $ZM_PATH_BIN/zmupdate.pl ]; then
|
||||
$ZM_PATH_BIN/zmupdate.pl -f
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
'start')
|
||||
start
|
||||
;;
|
||||
'stop')
|
||||
stop
|
||||
;;
|
||||
'restart')
|
||||
stop
|
||||
start
|
||||
;;
|
||||
'condrestart')
|
||||
loadconf
|
||||
result=`$ZM_PATH_BIN/zmdc.pl check`
|
||||
if [ "$result" = "running" ]; then
|
||||
$ZM_PATH_BIN/zmdc.pl shutdown > /dev/null
|
||||
rm -f $LOCKFILE
|
||||
start
|
||||
fi
|
||||
;;
|
||||
'status')
|
||||
status httpd
|
||||
status mysqld
|
||||
zmstatus
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 { start | stop | restart | condrestart | status }"
|
||||
RETVAL=1
|
||||
;;
|
||||
esac
|
||||
exit $RETVAL
|
|
@ -0,0 +1,177 @@
|
|||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
||||
# User-friendly check for sphinx-build
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||
endif
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " xml to make Docutils-native XML files"
|
||||
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ZoneMinder.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ZoneMinder.qhc"
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/ZoneMinder"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ZoneMinder"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
latexpdfja:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
|
||||
xml:
|
||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||
@echo
|
||||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||
|
||||
pseudoxml:
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
|
@ -0,0 +1 @@
|
|||
The latest version of these docs can be found at http://zoneminder.readthedocs.org/
|
|
@ -0,0 +1,118 @@
|
|||
API
|
||||
===
|
||||
|
||||
This document will provide an overview of ZoneMinder's API.
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
In an effort to further 'open up' ZoneMinder, an API was needed. This will
|
||||
allow quick integration with and development of ZoneMinder.
|
||||
|
||||
The API is built in CakePHP and lives under the ``/api`` directory. It
|
||||
provides a RESTful service and supports CRUD (create, retrieve, update, delete)
|
||||
functions for Monitors, Events, Frames, Zones and Config.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Here be a list of examples. Some results may be truncated.
|
||||
|
||||
You will see each URL ending in either ``.xml`` or ``.json``. This is the
|
||||
format of the request, and it determines the format that any data returned to
|
||||
you will be in. I like json, however you can use xml if you'd like.
|
||||
|
||||
Return a list of all monitors
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
``curl -XGET http://zmdevapi/monitors.json``
|
||||
|
||||
Retrieve monitor 1
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
``curl -XGET http://zmdevapi/monitors/1.json``
|
||||
|
||||
Add a monitor
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
This command will add a new http monitor.
|
||||
|
||||
``curl -XPOST http://zmdevapi/monitors.js -d "Monitor[Name]=Cliff-Burton \
|
||||
&Monitor[Function]=Modect \
|
||||
&Monitor[Protocol]=http \
|
||||
&Monitor[Method]=simple \
|
||||
&Monitor[Host]=ussr:pass@192.168.11.20 \
|
||||
&Monitor[Port]=80 \
|
||||
&Monitor[Path]=/mjpg/video.mjpg \
|
||||
&Monitor[Width]=704 \
|
||||
&Monitor[Height]=480 \
|
||||
&Monitor[Colours]=4"``
|
||||
|
||||
Edit monitor 1
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
This command will change the 'Name' field of Monitor 1 to 'tits'
|
||||
|
||||
``curl -XPUT http://zmdevapi/monitors/1.json -d "Monitor[Name]=tits"``
|
||||
|
||||
Delete monitor 1
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This command will delete Monitor 1, but will _not_ delete any Events which
|
||||
depend on it.
|
||||
|
||||
|
||||
``curl -XDELETE http://zmdevapi/monitors/1.json``
|
||||
|
||||
Return a list of all events
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
``curl -XGET http://zmdevapi/events.json``
|
||||
|
||||
Retrieve event 1
|
||||
^^^^^^^^^^^^^^^^
|
||||
``curl -XGET http://zmdevapi/events/1.json``
|
||||
|
||||
Edit event 1
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This command will change the 'Name' field of Event 1 to 'Seek and Destroy'
|
||||
|
||||
``curl -XPUT http://zmdevapi/events/1.json -d "Event[Name]=Seek and Destroy"``
|
||||
|
||||
Delete event 1
|
||||
^^^^^^^^^^^^^^
|
||||
This command will delete Event 1, and any Frames which depend on it.
|
||||
|
||||
``curl -XDELETE http://zmdevapi/events/1.json``
|
||||
|
||||
Edit config 121
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
This command will change the 'Value' field of Config 121 to 901.
|
||||
|
||||
``curl -XPUT http://zmdevapi/configs/121.json -d "Config[Value]=901"``
|
||||
|
||||
Create a Zone
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
``curl -XPOST http://zmdevapi/zones.json -d "Zone[Name]=Jason-Newsted \
|
||||
&Zone[MonitorId]=3 \
|
||||
&Zone[Type]=Active \
|
||||
&Zone[Units]=Percent \
|
||||
&Zone[NumCoords]=4 \
|
||||
&Zone[Coords]=0,0 639,0 639,479 0,479 \
|
||||
&Zone[AlarmRGB]=16711680 \
|
||||
&Zone[CheckMethod]=Blobs \
|
||||
&Zone[MinPixelThreshold]=25 \
|
||||
&Zone[MaxPixelThreshold]= \
|
||||
&Zone[MinAlarmPixels]=9216 \
|
||||
&Zone[MaxAlarmPixels]= \
|
||||
&Zone[FilterX]=3 \
|
||||
&Zone[FilterY]=3 \
|
||||
&Zone[MinFilterPixels]=9216 \
|
||||
&Zone[MaxFilterPixels]=230400 \
|
||||
&Zone[MinBlobPixels]=6144 \
|
||||
&Zone[MaxBlobPixels]= \
|
||||
&Zone[MinBlobs]=1 \
|
||||
&Zone[MaxBlobs]= \
|
||||
&Zone[OverloadFrames]=0"``
|
|
@ -0,0 +1,258 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# ZoneMinder documentation build configuration file, created by
|
||||
# sphinx-quickstart on Fri Apr 25 18:31:58 2014.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = []
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'ZoneMinder'
|
||||
copyright = u'2014, https://github.com/ZoneMinder/ZoneMinder/graphs/contributors'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '1.27.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.27.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'default'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# Add any extra paths that contain custom files (such as robots.txt or
|
||||
# .htaccess) here, relative to this directory. These files are copied
|
||||
# directly to the root of the documentation.
|
||||
#html_extra_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'ZoneMinderdoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'ZoneMinder.tex', u'ZoneMinder Documentation',
|
||||
u'https://github.com/ZoneMinder/ZoneMinder/graphs/contributors', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'zoneminder', u'ZoneMinder Documentation',
|
||||
[u'https://github.com/ZoneMinder/ZoneMinder/graphs/contributors'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'ZoneMinder', u'ZoneMinder Documentation',
|
||||
u'https://github.com/ZoneMinder/ZoneMinder/graphs/contributors', 'ZoneMinder', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
|
@ -0,0 +1,7 @@
|
|||
Contributing
|
||||
============
|
||||
|
||||
1. Check for `open issues <https://github.com/ZoneMinder/ZoneMinder/issues/>`_ or open a fresh issue to start a discussion around a feature idea or a bug.
|
||||
2. Fork the ZoneMinder repository on Github to start making your changes.
|
||||
3. Send a pull request and bug the maintainer until it gets merged and published. Stop by the #zoneminder channel on irc.freenode.net.
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
Frequently Asked Questions (FAQ)
|
||||
================================
|
||||
|
||||
This is the FAQ page. Feel free to contribute any FAQs that you think are missing.
|
||||
|
||||
Why can't I view all of my monitors in Montage view?
|
||||
----------------------------------------------------
|
||||
|
||||
1. You will most likely need to increase `mysql_max_connections` in my.cnf.
|
||||
2. If using Firefox, you may need to increase `network.http.max-persistent-connections-per-server` in `about:config`.
|
||||
|
||||
|
||||
How do I enable ZoneMinder's security?
|
||||
--------------------------------------
|
||||
|
||||
You may also consider to use the web server security, for example, htaccess files under Apache, or mod_auth.
|
||||
|
||||
1. In the console, click on Options.
|
||||
2. Check the box next to "ZM_OPT_USE_AUTH".
|
||||
3. Click Save
|
||||
4. You will immediately be asked to login. The username is 'admin' and the password is 'admin'.
|
||||
|
||||
To Manage Users
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
1. In main console, go to Options->Users.
|
||||
|
||||
The "Zones" view for a Monitor is blank (I can't see / setup a Zone)
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Snapshots and Zones images are stored in the `images` directory in your webroot.
|
||||
Ensure that the `images` directory is writable by the user which ZoneMinder is
|
||||
running as. If the `images` directory is a symlink, ensure that your web server
|
||||
has access to that directory as well.
|
||||
|
||||
How do the 3 AlarmCheckMethods interact?
|
||||
----------------------------------------
|
||||
|
||||
In example, if I set the alarm % to 5-10% and the filtered and blob to 1-100%, what happens?
|
||||
|
||||
1. If any of the min/max values is 0, the check that the value is applied to is skipped.
|
||||
2. If you have a min-alarmed area and you're below that, then it quits.
|
||||
3. If you have a max-alarmed area and you're above that, then it quits.
|
||||
4. If you're on filtered or blobs
|
||||
|
||||
1. and have a min filtered area that you're below then it quits
|
||||
2. and have a max filtered area that you're above then it quits
|
||||
|
||||
5. If you're on blobs
|
||||
|
||||
1. any blob smaller than the min blob area (if set) is discarded
|
||||
2. any blob larger than the max blob area (if set) is discarded
|
||||
3. If there are less remaining blobs than the minimum-blobs, then it quits.
|
||||
4. If there are more remaining blobs than the maximum-blobs, then it quits.
|
||||
|
||||
If AlarmedPixels is selected, you can only enter min/max pixel threshold and
|
||||
min/max alarmed area. If FilteredPixels is selected, the Blob options are
|
||||
disabled. The Blob check method allows you to specify all options. Filtered
|
||||
adds more checks than alarmed, and blobs adds more checks than filtered. The
|
||||
final 'score' is calculated using final check method.
|
|
@ -0,0 +1,26 @@
|
|||
.. ZoneMinder documentation master file, created by
|
||||
sphinx-quickstart on Fri Apr 25 18:31:58 2014.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to ZoneMinder's documentation!
|
||||
======================================
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
api
|
||||
faq
|
||||
contributing
|
||||
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
|
@ -0,0 +1 @@
|
|||
\.pm\.in$
|
|
@ -0,0 +1 @@
|
|||
\.pm\.in$
|
|
@ -0,0 +1,231 @@
|
|||
# ==========================================================================
|
||||
#
|
||||
# ZoneMinder Foscam FI8908W / FI8918W IP Control Protocol Module, $Date$, $Revision$
|
||||
# Copyright (C) 2001-2008 Philip Coombes
|
||||
# Modified for use with Foscam FI8908W IP Camera by Dave Harris
|
||||
#
|
||||
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ==========================================================================
|
||||
#
|
||||
package ZoneMinder::Control::FI8908W;
|
||||
|
||||
use 5.006;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
require ZoneMinder::Base;
|
||||
require ZoneMinder::Control;
|
||||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
# Foscam FI8908W IP Control Protocol
|
||||
#
|
||||
# ==========================================================================
|
||||
|
||||
use ZoneMinder::Logger qw(:all);
|
||||
use ZoneMinder::Config qw(:all);
|
||||
|
||||
use Time::HiRes qw( usleep );
|
||||
|
||||
sub new
|
||||
{
|
||||
my $class = shift;
|
||||
my $id = shift;
|
||||
my $self = ZoneMinder::Control->new( $id );
|
||||
bless( $self, $class );
|
||||
srand( time() );
|
||||
return $self;
|
||||
}
|
||||
|
||||
our $AUTOLOAD;
|
||||
|
||||
sub AUTOLOAD
|
||||
{
|
||||
my $self = shift;
|
||||
my $class = ref($self) || croak( "$self not object" );
|
||||
my $name = $AUTOLOAD;
|
||||
$name =~ s/.*://;
|
||||
if ( exists($self->{$name}) )
|
||||
{
|
||||
return( $self->{$name} );
|
||||
}
|
||||
Fatal( "Can't access $name member of object of class $class" );
|
||||
}
|
||||
|
||||
sub open
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
$self->loadMonitor();
|
||||
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
||||
sub close
|
||||
{
|
||||
my $self = shift;
|
||||
$self->{state} = 'closed';
|
||||
}
|
||||
|
||||
sub printMsg
|
||||
{
|
||||
my $self = shift;
|
||||
my $msg = shift;
|
||||
my $msg_len = length($msg);
|
||||
|
||||
Debug( $msg."[".$msg_len."]" );
|
||||
}
|
||||
|
||||
sub sendCmd
|
||||
{
|
||||
my $self = shift;
|
||||
my $cmd = shift;
|
||||
my $result = undef;
|
||||
|
||||
my ($user, $password) = split /:/, $self->{Monitor}->{ControlDevice};
|
||||
|
||||
if ( !defined $password ) {
|
||||
# If value of "Control device" does not consist of two parts, then only password is given and we fallback to default user:
|
||||
$password = $user;
|
||||
$user = 'admin';
|
||||
}
|
||||
|
||||
$cmd .= "user=$user&pwd=$password";
|
||||
|
||||
printMsg( $cmd, "Tx" );
|
||||
|
||||
my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" );
|
||||
my $res = $self->{ua}->request($req);
|
||||
|
||||
if ( $res->is_success )
|
||||
{
|
||||
$result = !undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
Error( "Error check failed: '".$res->status_line()."' for URL ".$req->uri() );
|
||||
}
|
||||
|
||||
return( $result );
|
||||
}
|
||||
|
||||
sub reset
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Camera Reset" );
|
||||
$self->sendCmd( 'reboot.cgi?' );
|
||||
}
|
||||
|
||||
#Up Arrow
|
||||
sub moveConUp
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Up" );
|
||||
$self->sendCmd( 'decoder_control.cgi?command=0&' );
|
||||
}
|
||||
|
||||
#Down Arrow
|
||||
sub moveConDown
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Down" );
|
||||
$self->sendCmd( 'decoder_control.cgi?command=2&' );
|
||||
}
|
||||
|
||||
#Left Arrow
|
||||
sub moveConLeft
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Left" );
|
||||
$self->sendCmd( 'decoder_control.cgi?command=6&' );
|
||||
}
|
||||
|
||||
#Right Arrow
|
||||
sub moveConRight
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Right" );
|
||||
$self->sendCmd( 'decoder_control.cgi?command=4&' );
|
||||
}
|
||||
|
||||
#Diagonally Up Right Arrow
|
||||
sub moveConUpRight
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Diagonally Up Right" );
|
||||
$self->sendCmd( 'decoder_control.cgi?command=90&' );
|
||||
}
|
||||
|
||||
#Diagonally Down Right Arrow
|
||||
sub moveConDownRight
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Diagonally Down Right" );
|
||||
$self->sendCmd( 'decoder_control.cgi?command=92&' );
|
||||
}
|
||||
|
||||
#Diagonally Up Left Arrow
|
||||
sub moveConUpLeft
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Diagonally Up Left" );
|
||||
$self->sendCmd( 'decoder_control.cgi?command=91&' );
|
||||
}
|
||||
|
||||
#Diagonally Down Left Arrow
|
||||
sub moveConDownLeft
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Diagonally Down Left" );
|
||||
$self->sendCmd( 'decoder_control.cgi?command=93&' );
|
||||
}
|
||||
|
||||
#Stop
|
||||
sub moveStop
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Stop" );
|
||||
$self->sendCmd( 'decoder_control.cgi?command=1&' );
|
||||
}
|
||||
|
||||
#Move Camera to Home Position
|
||||
sub presetHome
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Home Preset" );
|
||||
$self->sendCmd( 'decoder_control.cgi?command=25&' );
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
=pod
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module contains the implementation of the Foscam FI8908W / FI8918W IP camera control
|
||||
protocol.
|
||||
|
||||
The module uses "Control Device" value to retrieve user and password. User and password should
|
||||
be separated by colon, e.g. user:password. If colon is not provided, then "admin" is used
|
||||
as a fallback value for the user.
|
||||
=cut
|
|
@ -0,0 +1,257 @@
|
|||
# ==========================================================================
|
||||
#
|
||||
# ZoneMinder Toshiba IK WB11A IP Camera Control Protocol Module,
|
||||
# Copyright (C) 2013 Tim Craig (timcraigNO@SPAMsonic.net)
|
||||
#
|
||||
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ==========================================================================
|
||||
#
|
||||
# This module contains the implementation of the Airlink SkyIPCam
|
||||
# AICN747/AICN747W, TrendNet TV-IP410/TV-IP410W and other OEM versions of the
|
||||
# Fitivision CS-130A/CS-131A camera control protocol.
|
||||
#
|
||||
package ZoneMinder::Control::Toshiba_IK_WB11A;
|
||||
|
||||
use 5.006;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
require ZoneMinder::Base;
|
||||
require ZoneMinder::Control;
|
||||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
# Toshiba IK-WB11A IP Camera Control Protocol
|
||||
#
|
||||
# ==========================================================================
|
||||
|
||||
use ZoneMinder::Logger qw(:all);
|
||||
use ZoneMinder::Config qw(:all);
|
||||
|
||||
use Time::HiRes qw( usleep );
|
||||
|
||||
sub new
|
||||
{
|
||||
my $class = shift;
|
||||
my $id = shift;
|
||||
my $self = ZoneMinder::Control->new( $id );
|
||||
bless( $self, $class );
|
||||
srand( time() );
|
||||
return $self;
|
||||
}
|
||||
|
||||
our $AUTOLOAD;
|
||||
|
||||
sub AUTOLOAD
|
||||
{
|
||||
my $self = shift;
|
||||
my $class = ref($self) || croak( "$self not object" );
|
||||
my $name = $AUTOLOAD;
|
||||
$name =~ s/.*://;
|
||||
if ( exists($self->{$name}) )
|
||||
{
|
||||
return( $self->{$name} );
|
||||
}
|
||||
Fatal( "Can't access $name member of object of class $class" );
|
||||
}
|
||||
|
||||
sub open
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
$self->loadMonitor();
|
||||
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
||||
sub close
|
||||
{
|
||||
my $self = shift;
|
||||
$self->{state} = 'closed';
|
||||
}
|
||||
|
||||
sub printMsg
|
||||
{
|
||||
my $self = shift;
|
||||
my $msg = shift;
|
||||
my $msg_len = length($msg);
|
||||
|
||||
Debug( $msg."[".$msg_len."]" );
|
||||
}
|
||||
|
||||
sub sendCmd
|
||||
{
|
||||
my $self = shift;
|
||||
my $cmd = shift;
|
||||
|
||||
#my $result = undef;
|
||||
|
||||
printMsg( $cmd, "Tx" );
|
||||
|
||||
my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."$cmd" );
|
||||
my $res = $self->{ua}->request($req);
|
||||
return( !undef );
|
||||
}
|
||||
|
||||
sub reset
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Camera Reset" );
|
||||
my $cmd = "/control.cgi?cont_2=16";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub moveMap
|
||||
{
|
||||
Debug("MoveMap");
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $xcoord = $self->getParam( $params, 'xcoord' );
|
||||
my $ycoord = $self->getParam( $params, 'ycoord' );
|
||||
|
||||
my $hor = $xcoord / $self->{Monitor}->{Width};
|
||||
my $ver = $ycoord / $self->{Monitor}->{Height};
|
||||
|
||||
my $maxver = 10;
|
||||
my $maxhor = 10;
|
||||
|
||||
my $horSteps = 0;
|
||||
my $verSteps = 0;
|
||||
|
||||
$horSteps = $hor * $maxhor;
|
||||
$verSteps = $ver * $maxver;
|
||||
|
||||
my $v = int($verSteps);
|
||||
my $h = int($horSteps);
|
||||
|
||||
Debug( "Move Map to $xcoord,$ycoord, hor=$h, ver=$v");
|
||||
my $cmd = "/cont.cgi?contptpoint_".$h."_".$v."=1";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub moveRelUp
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Step Up" );
|
||||
my $cmd = "/control.cgi?cont_2=4";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub moveRelDown
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Step Down" );
|
||||
my $cmd = "/control.cgi?cont_2=8";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub moveRelLeft
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Step Left" );
|
||||
my $cmd = "/control.cgi?cont_2=1";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub moveRelRight
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Step Right" );
|
||||
my $cmd = "/control.cgi?cont_2=2";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub presetClear
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam( $params, 'preset' );
|
||||
Debug( "Clear Preset $preset" );
|
||||
my $cmdNum = 3 << 8 | $preset;
|
||||
my $cmd = "/control.cgi?cont_4=$cmdNum";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub presetSet
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam( $params, 'preset' );
|
||||
Debug( "Set Preset $preset" );
|
||||
my $cmdNum = 2 << 8 | $preset;
|
||||
my $cmd = "/control.cgi?cont_4=$cmdNum";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub presetGoto
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam( $params, 'preset' );
|
||||
Debug( "Goto Preset $preset" );
|
||||
my $cmdNum = 1 << 8 | $preset;
|
||||
my $cmd = "/control.cgi?cont_4=$cmdNum";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
# Below is stub documentation for your module. You'd better edit it!
|
||||
|
||||
=head1 NAME
|
||||
|
||||
ZoneMinder::Control::Toshiba_IK_WB11A - Zoneminder PTZ control module the Toshiba IK-WB11A IP Camera
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use ZoneMinder::Control::Toshiba_IK_WB11A;
|
||||
blah blah blah
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is for Zoneminder PTZ control module for the Toshib_IK_WB11A camera.
|
||||
|
||||
=head2 EXPORT
|
||||
|
||||
None by default.
|
||||
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
www.zoneminder.com
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Philip Coombes, E<lt>philip.coombes@zoneminder.comE<gt>
|
||||
Tim Craig, E<lt>timcraigNO@SPAMsonic.netE<gt>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2013 by Tim Craig
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the same terms as Perl itself, either Perl version 5.8.3 or,
|
||||
at your option, any later version of Perl 5 you may have available.
|
||||
|
||||
|
||||
=cut
|
|
@ -0,0 +1,502 @@
|
|||
# ==========================================================================
|
||||
#
|
||||
# ZoneMinder Wanscam Control Protocol Module, $Date: 2009-11-25 09:20:00 +0000 (Wed, 04 Nov 2009) $, $Revision: 0001 $
|
||||
# Copyright (C) 2001-2008 Philip Coombes
|
||||
# Modified for use with Foscam FI8918W IP Camera by Dave Harris
|
||||
# Modified Feb 2011 by Howard Durdle (http://durdl.es/x) to:
|
||||
# fix horizontal panning, add presets and IR on/off
|
||||
# use Control Device field to pass username and password
|
||||
# Modified June 5th, 2012 by Chris Bagwell to:
|
||||
# Rename to IPCAM since its common protocol with wide range of cameras.
|
||||
# Work with Logger module instead of Debug module.
|
||||
# Fix off-by-1 preset bug.
|
||||
# Support optional autostop timeout.
|
||||
# Add Zoom, Brightness, and Contrast support.
|
||||
# Modified July 7th, 2012 by Patrik Brander to:
|
||||
# Rename to Wanscam
|
||||
# Pan Left/Right switched
|
||||
# IR On/Off switched
|
||||
# Brightness Increase/Decrease in 16 steps
|
||||
#
|
||||
#
|
||||
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ==========================================================================
|
||||
#
|
||||
# This module contains the implementation of the Wanscam camera control
|
||||
# protocol.
|
||||
#
|
||||
# This is a protocol shared by a wide range of affordable cameras that
|
||||
# appear to share similar reference design and software. Examples
|
||||
# include Foscam, Agasio, Wansview, etc.
|
||||
#
|
||||
# The basis for CGI based API can be found on internet by searching for
|
||||
# "IPCAM CGI SDK 2.1". Here is sample site that also developes replacement
|
||||
# firmware for some hardware versions.
|
||||
#
|
||||
# http://www.openipcam.com/files/Manuals/IPCAM%20CGI%20SDK%202.1.pdf
|
||||
#
|
||||
package ZoneMinder::Control::Wanscam;
|
||||
|
||||
use 5.006;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
require ZoneMinder::Base;
|
||||
require ZoneMinder::Control;
|
||||
|
||||
our @ISA = qw(ZoneMinder::Control);
|
||||
|
||||
# ==========================================================================
|
||||
#
|
||||
# Wanscam Control Protocol
|
||||
#
|
||||
# ==========================================================================
|
||||
|
||||
use ZoneMinder::Logger qw(:all);
|
||||
use ZoneMinder::Config qw(:all);
|
||||
|
||||
use Time::HiRes qw( usleep );
|
||||
|
||||
sub new
|
||||
{
|
||||
my $class = shift;
|
||||
my $id = shift;
|
||||
my $self = ZoneMinder::Control->new( $id );
|
||||
my $logindetails = "";
|
||||
bless( $self, $class );
|
||||
srand( time() );
|
||||
return $self;
|
||||
}
|
||||
|
||||
our $AUTOLOAD;
|
||||
|
||||
sub AUTOLOAD
|
||||
{
|
||||
my $self = shift;
|
||||
my $class = ref($self) || croak( "$self not object" );
|
||||
my $name = $AUTOLOAD;
|
||||
$name =~ s/.*://;
|
||||
if ( exists($self->{$name}) )
|
||||
{
|
||||
return( $self->{$name} );
|
||||
}
|
||||
Fatal( "Can't access $name member of object of class $class" );
|
||||
}
|
||||
|
||||
sub open
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
$self->loadMonitor();
|
||||
|
||||
use LWP::UserAgent;
|
||||
$self->{ua} = LWP::UserAgent->new;
|
||||
$self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION );
|
||||
|
||||
$self->{state} = 'open';
|
||||
}
|
||||
|
||||
sub close
|
||||
{
|
||||
my $self = shift;
|
||||
$self->{state} = 'closed';
|
||||
}
|
||||
|
||||
sub printMsg
|
||||
{
|
||||
my $self = shift;
|
||||
my $msg = shift;
|
||||
my $msg_len = length($msg);
|
||||
|
||||
Debug( $msg."[".$msg_len."]" );
|
||||
}
|
||||
|
||||
sub sendCmd
|
||||
{
|
||||
my $self = shift;
|
||||
my $cmd = shift;
|
||||
my $result = undef;
|
||||
printMsg( $cmd, "Tx" );
|
||||
|
||||
my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd".$self->{Monitor}->{ControlDevice} );
|
||||
my $res = $self->{ua}->request($req);
|
||||
|
||||
if ( $res->is_success )
|
||||
{
|
||||
$result = $res->decoded_content;
|
||||
}
|
||||
else
|
||||
{
|
||||
Error( "Error check failed:'".$res->status_line()."'" );
|
||||
}
|
||||
|
||||
return( $result );
|
||||
}
|
||||
|
||||
# Turn IO on (can be internally wired to IR's)
|
||||
sub wake
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Wake - IO on" );
|
||||
my $cmd = "decoder_control.cgi?command=94&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
# Turn IO off (can be internally wired to IR's)
|
||||
sub sleep
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Sleep - IO off" );
|
||||
my $cmd = "decoder_control.cgi?command=95&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub reset
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Camera Reset" );
|
||||
my $cmd = "reboot.cgi?";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub moveConUp
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Move Up" );
|
||||
my $cmd = "decoder_control.cgi?command=0&";
|
||||
$self->sendCmd( $cmd );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
{
|
||||
usleep( $self->{Monitor}->{AutoStopTimeout} );
|
||||
$self->moveStop( $params );
|
||||
}
|
||||
}
|
||||
|
||||
sub moveConDown
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Move Down" );
|
||||
my $cmd = "decoder_control.cgi?command=2&";
|
||||
$self->sendCmd( $cmd );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
{
|
||||
usleep( $self->{Monitor}->{AutoStopTimeout} );
|
||||
$self->moveStop( $params );
|
||||
}
|
||||
}
|
||||
|
||||
sub moveConRight
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Move Right" );
|
||||
my $cmd = "decoder_control.cgi?command=4&";
|
||||
$self->sendCmd( $cmd );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
{
|
||||
usleep( $self->{Monitor}->{AutoStopTimeout} );
|
||||
$self->moveStop( $params );
|
||||
}
|
||||
}
|
||||
|
||||
sub moveConLeft
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Move Left" );
|
||||
my $cmd = "decoder_control.cgi?command=6&";
|
||||
$self->sendCmd( $cmd );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
{
|
||||
usleep( $self->{Monitor}->{AutoStopTimeout} );
|
||||
$self->moveStop( $params );
|
||||
}
|
||||
}
|
||||
|
||||
sub moveConUpLeft
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Move Diagonally Up Left" );
|
||||
my $cmd = "decoder_control.cgi?command=91&";
|
||||
$self->sendCmd( $cmd );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
{
|
||||
usleep( $self->{Monitor}->{AutoStopTimeout} );
|
||||
$self->moveStop( $params );
|
||||
}
|
||||
}
|
||||
|
||||
sub moveConDownLeft
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Move Diagonally Down Left" );
|
||||
my $cmd = "decoder_control.cgi?command=93&";
|
||||
$self->sendCmd( $cmd );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
{
|
||||
usleep( $self->{Monitor}->{AutoStopTimeout} );
|
||||
$self->moveStop( $params );
|
||||
}
|
||||
}
|
||||
|
||||
sub moveConUpRight
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Move Diagonally Up Right" );
|
||||
my $cmd = "decoder_control.cgi?command=90&";
|
||||
$self->sendCmd( $cmd );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
{
|
||||
usleep( $self->{Monitor}->{AutoStopTimeout} );
|
||||
$self->moveStop( $params );
|
||||
}
|
||||
}
|
||||
|
||||
sub moveConDownRight
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Move Diagonally Down Right" );
|
||||
my $cmd = "decoder_control.cgi?command=92&";
|
||||
$self->sendCmd( $cmd );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
{
|
||||
usleep( $self->{Monitor}->{AutoStopTimeout} );
|
||||
$self->moveStop( $params );
|
||||
}
|
||||
}
|
||||
|
||||
# command=1 is technically Up Stop but seems to work for all stops.
|
||||
sub moveStop
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Move Stop" );
|
||||
print("autostop\n");
|
||||
my $cmd = "decoder_control.cgi?command=1&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub zoomConTele
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Zoom Tele" );
|
||||
my $cmd = "decoder_control.cgi?command=16&";
|
||||
$self->sendCmd( $cmd );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
{
|
||||
usleep( $self->{Monitor}->{AutoStopTimeout} );
|
||||
$cmd = "decoder_control.cgi?command=17&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
}
|
||||
|
||||
sub zoomConWide
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Zoom Wide" );
|
||||
my $cmd = "decoder_control.cgi?command=18&";
|
||||
$self->sendCmd( $cmd );
|
||||
my $autostop = $self->getParam( $params, 'autostop', 0 );
|
||||
if ( $autostop && $self->{Monitor}->{AutoStopTimeout} )
|
||||
{
|
||||
usleep( $self->{Monitor}->{AutoStopTimeout} );
|
||||
$cmd = "decoder_control.cgi?command=19&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
}
|
||||
|
||||
sub zoomConStop
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
Debug( "Zoom Stop" );
|
||||
my $cmd = "decoder_control.cgi?command=17&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
# Increase Brightness
|
||||
sub irisAbsOpen
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
my $brightness = 100;
|
||||
|
||||
my $cmd = "get_camera_params.cgi?";
|
||||
my $resp = $self->sendCmd( $cmd );
|
||||
|
||||
$brightness = int($1) if ( $resp =~ m/var brightness=([0-9]*);/ );
|
||||
$brightness += $step * 16;
|
||||
$brightness = 255 if ($brightness > 255);
|
||||
Debug( "Iris Open $brightness" );
|
||||
$cmd = "camera_control.cgi?param=1&value=".$brightness."&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
# Decrease Brightness
|
||||
sub irisAbsClose
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
my $brightness = 100;
|
||||
|
||||
my $cmd = "get_camera_params.cgi?";
|
||||
my $resp = $self->sendCmd( $cmd );
|
||||
|
||||
$brightness = int($1) if ( $resp =~ m/var brightness=([0-9]*);/ );
|
||||
$brightness -= $step * 16;
|
||||
$brightness = 0 if ($brightness < 0);
|
||||
Debug( "Iris Close $brightness" );
|
||||
$cmd = "camera_control.cgi?param=1&value=".$brightness."&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
# Increase Contrast
|
||||
sub whiteAbsIn
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
my $contrast = 5;
|
||||
|
||||
my $cmd = "get_camera_params.cgi?";
|
||||
my $resp = $self->sendCmd( $cmd );
|
||||
|
||||
$contrast = int($1) if ( $resp =~ m/var contrast=([0-9]*);/ );
|
||||
$contrast += $step;
|
||||
$contrast = 6 if ($contrast > 6);
|
||||
Debug( "White In $contrast" );
|
||||
$cmd = "camera_control.cgi?param=2&value=".$contrast."&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
# Decrease Contrast
|
||||
sub whiteAbsOut
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $step = $self->getParam( $params, 'step' );
|
||||
my $contrast = 5;
|
||||
|
||||
my $cmd = "get_camera_params.cgi?";
|
||||
my $resp = $self->sendCmd( $cmd );
|
||||
|
||||
$contrast = int($1) if ( $resp =~ m/var contrast=([0-9]*);/ );
|
||||
$contrast -= $step;
|
||||
$contrast = 0 if ($contrast < 0);
|
||||
Debug( "White Out $contrast" );
|
||||
$cmd = "camera_control.cgi?param=2&value=".$contrast."&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub presetHome
|
||||
{
|
||||
my $self = shift;
|
||||
Debug( "Home Preset" );
|
||||
my $cmd = "decoder_control.cgi?command=25&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub presetSet
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam( $params, 'preset' );
|
||||
my $presetCmd = 30 + (($preset-1)*2);
|
||||
Debug( "Set Preset $preset with cmd $presetCmd" );
|
||||
my $cmd = "decoder_control.cgi?command=$presetCmd&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
|
||||
sub presetGoto
|
||||
{
|
||||
my $self = shift;
|
||||
my $params = shift;
|
||||
my $preset = $self->getParam( $params, 'preset' );
|
||||
my $presetCmd = 31 + (($preset-1)*2);
|
||||
Debug( "Goto Preset $preset with cmd $presetCmd" );
|
||||
my $cmd = "decoder_control.cgi?command=$presetCmd&";
|
||||
$self->sendCmd( $cmd );
|
||||
}
|
||||
1;
|
||||
__END__
|
||||
# Below is stub documentation for your module. You'd better edit it!
|
||||
|
||||
=head1 NAME
|
||||
|
||||
ZoneMinder::Database - Perl extension for blah blah blah
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use ZoneMinder::Control::Wanscam
|
||||
blah blah blah
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Stub documentation for ZoneMinder, created by h2xs. It looks like the
|
||||
author of the extension was negligent enough to leave the stub
|
||||
unedited.
|
||||
|
||||
Blah blah blah.
|
||||
|
||||
=head2 EXPORT
|
||||
|
||||
None by default.
|
||||
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
Mention other useful documentation such as the documentation of
|
||||
related modules or operating system documentation (such as man pages
|
||||
in UNIX), or any relevant external documentation such as RFCs or
|
||||
standards.
|
||||
|
||||
If you have a mailing list set up for your module, mention it here.
|
||||
|
||||
If you have a web site set up for your module, mention it here.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Philip Coombes, <philip.coombes@zoneminder.com>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2001-2008 Philip Coombes
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the same terms as Perl itself, either Perl version 5.8.3 or,
|
||||
at your option, any later version of Perl 5 you may have available.
|
||||
|
||||
|
||||
=cut
|
|
@ -0,0 +1,404 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# ==========================================================================
|
||||
#
|
||||
# ZoneMinder Update Script, $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ==========================================================================
|
||||
#
|
||||
# This script provides a way to import new ptz camera controls & camera presets
|
||||
# into existing zoneminder systems. This script also provides a way to export
|
||||
# ptz camera controls & camera presets from an existing zoneminder system into
|
||||
# a sql file, which can then be easily imported to another zoneminder system.
|
||||
#
|
||||
use strict;
|
||||
use bytes;
|
||||
|
||||
@EXTRA_PERL_LIB@
|
||||
use ZoneMinder::Config qw(:all);
|
||||
use ZoneMinder::Logger qw(:all);
|
||||
use ZoneMinder::Database qw(:all);
|
||||
use DBI;
|
||||
use Getopt::Long;
|
||||
|
||||
$ENV{PATH} = '/bin:/usr/bin:/usr/local/bin';
|
||||
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
|
||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
||||
|
||||
my $web_uid = (getpwnam( $Config{ZM_WEB_USER} ))[2];
|
||||
my $use_log = (($> == 0) || ($> == $web_uid));
|
||||
|
||||
logInit( toFile=>$use_log?DEBUG:NOLOG );
|
||||
logSetSignal();
|
||||
|
||||
my $export = 0;
|
||||
my $import = 0;
|
||||
my $overwrite = 0;
|
||||
my $help = 0;
|
||||
my $topreset = 0;
|
||||
my $noregex = 0;
|
||||
my $sqlfile = '';
|
||||
my $dbUser = $Config{ZM_DB_USER};
|
||||
my $dbPass = $Config{ZM_DB_PASS};
|
||||
|
||||
# Process commandline parameters with getopt long
|
||||
if ( !GetOptions( 'export'=>\$export, 'import'=>\$import, 'overwrite'=>\$overwrite, 'help'=>\$help, 'topreset'=>\$topreset, 'noregex'=>\$noregex, 'user:s'=>\$dbUser, 'pass:s'=>\$dbPass ) ) {
|
||||
Usage();
|
||||
}
|
||||
|
||||
$Config{ZM_DB_USER} = $dbUser;
|
||||
$Config{ZM_DB_PASS} = $dbPass;
|
||||
|
||||
# Check to make sure commandline params make sense
|
||||
if ( ((!$help) && ($import + $export + $topreset) != 1 )) {
|
||||
print( STDERR qq/Please give only one of the following: "import", "export", or "topreset".\n/ );
|
||||
Usage();
|
||||
}
|
||||
|
||||
if ( ($export)&&($overwrite) ) {
|
||||
print( "Warning: Overwrite parameter ignored during an export.\n");
|
||||
}
|
||||
|
||||
if ( ($noregex)&&(!$topreset) ) {
|
||||
print( qq/Warning: Noregex parameter only applies when "topreset" parameter is also set. Ignoring.\n/);
|
||||
}
|
||||
|
||||
if ( ($topreset)&&($ARGV[0] !~ /\d\d*/) ) {
|
||||
print( STDERR qq/Parameter "topreset" requires a valid monitor ID.\n/ );
|
||||
Usage();
|
||||
}
|
||||
|
||||
# Call the appropriate subroutine based on the params given on the commandline
|
||||
if ($help) {
|
||||
Usage();
|
||||
}
|
||||
|
||||
if ($export) {
|
||||
exportsql();
|
||||
}
|
||||
|
||||
if ($import) {
|
||||
importsql();
|
||||
}
|
||||
|
||||
if ($topreset) {
|
||||
toPreset();
|
||||
}
|
||||
|
||||
###############
|
||||
# SUBROUTINES #
|
||||
###############
|
||||
|
||||
# Usage subroutine help text
|
||||
sub Usage
|
||||
{
|
||||
die("
|
||||
USAGE:
|
||||
zmcamtool.pl [--user=<dbuser> --pass=<dbpass>]
|
||||
[--import [file.sql] [--overwrite]]
|
||||
[--export [name]]
|
||||
[--topreset id [--noregex]]
|
||||
|
||||
PARAMETERS:
|
||||
--export - Export all camera controls and presets to STDOUT.
|
||||
Optionally specify a control or preset name.
|
||||
--import [file.sql] - Import new camera controls and presets found in
|
||||
zm_create.sql into the ZoneMinder dB.
|
||||
Optionally specify an alternate sql file to read from.
|
||||
--overwrite - Overwrite any existing controls or presets.
|
||||
with the same name as the new controls or presets.
|
||||
--topreset id - Copy a monitor to a Camera Preset given the monitor id.
|
||||
--noregex - Do not try to find and replace fields such as usernames,
|
||||
passwords, ip addresses, etc with generic placeholders
|
||||
when converting a monitor to a preset.
|
||||
--help - Print usage information.
|
||||
--user=<dbuser> - Alternate dB user with privileges to alter dB.
|
||||
--pass=<dbpass> - Password of alternate dB user with privileges to alter dB.
|
||||
\n");
|
||||
}
|
||||
|
||||
# Execute a pre-built sql select query
|
||||
sub selectQuery
|
||||
{
|
||||
my $dbh = shift;
|
||||
my $sql = shift;
|
||||
my $monitorid = shift;
|
||||
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute($monitorid) or die( "Can't execute: ".$sth->errstr() );
|
||||
|
||||
my @data = $sth->fetchrow_array();
|
||||
$sth->finish();
|
||||
|
||||
return @data;
|
||||
}
|
||||
|
||||
# Exectute a pre-built sql query
|
||||
sub runQuery
|
||||
{
|
||||
my $dbh = shift;
|
||||
my $sql = shift;
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
|
||||
$sth->finish();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
# Build and execute a sql insert query
|
||||
sub insertQuery
|
||||
{
|
||||
my $dbh = shift;
|
||||
my $tablename = shift;
|
||||
my @data = @_;
|
||||
|
||||
my $sql = "insert into $tablename values (NULL,".(join ", ", ("?") x @data).")"; # Add "?" for each array element
|
||||
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute(@data) or die( "Can't execute: ".$sth->errstr() );
|
||||
$sth->finish();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
# Build and execute a sql delete query
|
||||
sub deleteQuery
|
||||
{
|
||||
my $dbh = shift;
|
||||
my $sqltable = shift;
|
||||
my $sqlname = shift;
|
||||
|
||||
my $sql = "delete from $sqltable where Name = ?";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute($sqlname) or die( "Can't execute: ".$sth->errstr() );
|
||||
$sth->finish();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
# Build and execute a sql select count query
|
||||
sub checkExists
|
||||
{
|
||||
my $dbh = shift;
|
||||
my $sqltable = shift;
|
||||
my $sqlname = shift;
|
||||
my $result = 0;
|
||||
|
||||
my $sql = "select count(*) from $sqltable where Name = ?";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute($sqlname) or die( "Can't execute: ".$sth->errstr() );
|
||||
|
||||
my $rows = $sth->fetchrow_arrayref();
|
||||
$sth->finish();
|
||||
|
||||
if ($rows->[0] > 0) {
|
||||
$result = 1;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
# Import camera control & presets into the zoneminder dB
|
||||
sub importsql
|
||||
{
|
||||
my @newcontrols;
|
||||
my @overwritecontrols;
|
||||
my @skippedcontrols;
|
||||
my @newpresets;
|
||||
my @overwritepresets;
|
||||
my @skippedpresets;
|
||||
my %controls;
|
||||
my %monitorpresets;
|
||||
|
||||
if ($ARGV[0]) {
|
||||
$sqlfile = $ARGV[0];
|
||||
} else {
|
||||
$sqlfile = $Config{ZM_PATH_DATA}.'/db/zm_create.sql';
|
||||
}
|
||||
|
||||
open(my $SQLFILE,"<",$sqlfile) or die( "Can't Open file: $!\n" );
|
||||
|
||||
# Find and extract ptz control and monitor preset records
|
||||
while (<$SQLFILE>) {
|
||||
# Our regex replaces the primary key with NULL
|
||||
if (s/^(INSERT INTO .*?Controls.*? VALUES \().*?(,')(.*?)(',.*)/$1NULL$2$3$4/i) {
|
||||
$controls{$3} = $_;
|
||||
} elsif (s/^(INSERT INTO .*?MonitorPresets.*? VALUES \().*?(,')(.*?)(',.*)/$1NULL$2$3$4/i) {
|
||||
$monitorpresets{$3} = $_;
|
||||
}
|
||||
}
|
||||
close $SQLFILE;
|
||||
|
||||
if ( ! (%controls || %monitorpresets) ) {
|
||||
die( "Error: No relevant data found in $sqlfile.\n" );
|
||||
}
|
||||
|
||||
# Now that we've got what we were looking for, compare to what is already in the dB
|
||||
|
||||
my $dbh = zmDbConnect();
|
||||
foreach (keys %controls) {
|
||||
if (!checkExists($dbh,"Controls",$_)) {
|
||||
# No existing Control was found. Add new control to dB.
|
||||
runQuery($dbh,$controls{$_});
|
||||
push @newcontrols, $_;
|
||||
} elsif ($overwrite) {
|
||||
# An existing Control was found and the overwrite flag is set. Overwrite the control.
|
||||
deleteQuery($dbh,"Controls",$_);
|
||||
runQuery($dbh,$controls{$_});
|
||||
push @overwritecontrols, $_;
|
||||
} else {
|
||||
# An existing Control was found and the overwrite flag was not set. Do nothing.
|
||||
push @skippedcontrols, $_;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (keys %monitorpresets) {
|
||||
if (!checkExists($dbh,"MonitorPresets",$_)) {
|
||||
# No existing MonitorPreset was found. Add new MonitorPreset to dB.
|
||||
runQuery($dbh,$monitorpresets{$_});
|
||||
push @newpresets, $_;
|
||||
} elsif ($overwrite) {
|
||||
# An existing MonitorPreset was found and the overwrite flag is set. Overwrite the MonitorPreset.
|
||||
deleteQuery($dbh,"MonitorPresets",$_);
|
||||
runQuery($dbh,$monitorpresets{$_});
|
||||
push @overwritepresets, $_;
|
||||
} else {
|
||||
# An existing MonitorPreset was found and the overwrite flag was not set. Do nothing.
|
||||
push @skippedpresets, $_;
|
||||
}
|
||||
}
|
||||
|
||||
if (@newcontrols) {
|
||||
print "Number of ptz camera controls added: ".scalar(@newcontrols)."\n";
|
||||
}
|
||||
if (@overwritecontrols) {
|
||||
print "Number of existing ptz camera controls overwritten: ".scalar(@overwritecontrols)."\n";
|
||||
}
|
||||
if (@skippedcontrols) {
|
||||
print "Number of existing ptz camera controls skipped: ".scalar(@skippedcontrols)."\n";
|
||||
}
|
||||
|
||||
if (@newpresets) {
|
||||
print "Number of monitor presets added: ".scalar(@newpresets)."\n";
|
||||
}
|
||||
if (@overwritepresets) {
|
||||
print "Number of existing monitor presets overwritten: ".scalar(@overwritepresets)."\n";
|
||||
}
|
||||
if (@skippedpresets) {
|
||||
print "Number of existing presets skipped: ".scalar(@skippedpresets)."\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Export camera controls & presets from the zoneminder dB to STDOUT
|
||||
sub exportsql
|
||||
{
|
||||
|
||||
my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
|
||||
my $command = "mysqldump -t --skip-opt --compact -h".$host;
|
||||
$command .= " -P".$port if defined($port);
|
||||
if ( $dbUser ) {
|
||||
$command .= " -u".$dbUser;
|
||||
if ( $dbPass ) {
|
||||
$command .= " -p".$dbPass;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ARGV[0]) {
|
||||
$command .= qq( --where="Name = '$ARGV[0]'");
|
||||
}
|
||||
|
||||
$command .= " zm Controls MonitorPresets";
|
||||
|
||||
my $output = qx($command);
|
||||
my $status = $? >> 8;
|
||||
if ( $status || logDebugging() ) {
|
||||
chomp( $output );
|
||||
print( "Output: $output\n" );
|
||||
}
|
||||
if ( $status ) {
|
||||
die( "Command '$command' exited with status: $status\n" );
|
||||
} else {
|
||||
# NULLify the primary keys before printing the output to STDOUT
|
||||
$output =~ s/VALUES \((.*?),'/VALUES \(NULL,'/ig;
|
||||
print $output;
|
||||
}
|
||||
}
|
||||
|
||||
sub toPreset
|
||||
{
|
||||
my $dbh = zmDbConnect();
|
||||
my $monitorid = $ARGV[0];
|
||||
|
||||
# Grap the following fields from the Monitors table
|
||||
my $sql = "select
|
||||
Name,
|
||||
Type,
|
||||
Device,
|
||||
Channel,
|
||||
Format,
|
||||
Protocol,
|
||||
Method,
|
||||
Host,
|
||||
Port,
|
||||
Path,
|
||||
SubPath,
|
||||
Width,
|
||||
Height,
|
||||
Palette,
|
||||
MaxFPS,
|
||||
Controllable,
|
||||
ControlId,
|
||||
ControlDevice,
|
||||
ControlAddress,
|
||||
DefaultRate,
|
||||
DefaultScale
|
||||
from Monitors where Id = ?";
|
||||
my @data = selectQuery($dbh,$sql,$monitorid);
|
||||
|
||||
if (!@data) {
|
||||
die( "Error: Monitor Id $monitorid does not appear to exist in the database.\n" );
|
||||
}
|
||||
|
||||
# Attempt to search for and replace system specific values such as ip addresses, ports, usernames, etc. with generic placeholders
|
||||
if (!$noregex) {
|
||||
foreach (@data) {
|
||||
s/\b(?:\d{1,3}\.){3}\d{1,3}\b/<ip-address>/; # ip address
|
||||
s/<ip-address>:(6553[0-5]|655[0-2]\d|65[0-4]\d\d|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)$/<ip-address>:<port>/; # tcpip port
|
||||
s/\/\/.*:.*@/\/\/<username>:<pwd>@/; # user & pwd preceeding an ip address
|
||||
s/(&|\?)(user|username)=\w\w*(&|\?)/$1$2=<username>$3/i; # username embeded in url
|
||||
s/(&|\?)(pwd|password)=\w\w*(&|\?)/$1$2=<pwd>$3/i; # password embeded in url
|
||||
s/\w\w*:\w\w*/<username>:<pwd>/; # user & pwd in their own field
|
||||
s/\/dev\/video\d\d*/\/dev\/video<?>/; # local video devices
|
||||
}
|
||||
}
|
||||
|
||||
if (!checkExists($dbh,"MonitorPresets",$data[0])) {
|
||||
# No existing Preset was found. Add new Preset to dB.
|
||||
print "Adding new preset: $data[0]\n";
|
||||
insertQuery($dbh,"MonitorPresets",@data);
|
||||
} elsif ($overwrite) {
|
||||
# An existing Control was found and the overwrite flag is set. Overwrite the control.
|
||||
print "Existing preset $data[0] detected.\nOverwriting...\n";
|
||||
deleteQuery($dbh,"MonitorPresets",$data[0]);
|
||||
insertQuery($dbh,"MonitorPresets",@data);
|
||||
} else {
|
||||
# An existing Control was found and the overwrite flag was not set. Do nothing.
|
||||
print "Existing preset $data[0] detected and overwrite flag not set.\nSkipping...\n";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,563 @@
|
|||
//
|
||||
// ZoneMinder cURL Camera Class Implementation, $Date: 2009-01-16 12:18:50 +0000 (Fri, 16 Jan 2009) $, $Revision: 2713 $
|
||||
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
|
||||
#include "zm.h"
|
||||
#include "zm_curl_camera.h"
|
||||
|
||||
#if HAVE_LIBCURL
|
||||
|
||||
#define CURL_MAXRETRY 5
|
||||
#define CURL_BUFFER_INITIAL_SIZE 65536
|
||||
|
||||
const char* content_length_match = "Content-Length:";
|
||||
const char* content_type_match = "Content-Type:";
|
||||
size_t content_length_match_len;
|
||||
size_t content_type_match_len;
|
||||
|
||||
cURLCamera::cURLCamera( int p_id, const std::string &p_path, const std::string &p_user, const std::string &p_pass, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
|
||||
Camera( p_id, CURL_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture ),
|
||||
mPath( p_path ), mUser( p_user ), mPass ( p_pass ), bTerminate( false ), bReset( false ), mode ( MODE_UNSET )
|
||||
{
|
||||
|
||||
if ( capture )
|
||||
{
|
||||
Initialise();
|
||||
}
|
||||
}
|
||||
|
||||
cURLCamera::~cURLCamera()
|
||||
{
|
||||
if ( capture )
|
||||
{
|
||||
|
||||
Terminate();
|
||||
}
|
||||
}
|
||||
|
||||
void cURLCamera::Initialise()
|
||||
{
|
||||
content_length_match_len = strlen(content_length_match);
|
||||
content_type_match_len = strlen(content_type_match);
|
||||
|
||||
databuffer.expand(CURL_BUFFER_INITIAL_SIZE);
|
||||
|
||||
/* cURL initialization */
|
||||
cRet = curl_global_init(CURL_GLOBAL_ALL);
|
||||
if(cRet != CURLE_OK) {
|
||||
Fatal("libcurl initialization failed: ", curl_easy_strerror(cRet));
|
||||
}
|
||||
|
||||
Debug(2,"libcurl version: %s",curl_version());
|
||||
|
||||
/* Create the shared data mutex */
|
||||
nRet = pthread_mutex_init(&shareddata_mutex, NULL);
|
||||
if(nRet != 0) {
|
||||
Fatal("Shared data mutex creation failed: %s",strerror(nRet));
|
||||
}
|
||||
/* Create the data available condition variable */
|
||||
nRet = pthread_cond_init(&data_available_cond, NULL);
|
||||
if(nRet != 0) {
|
||||
Fatal("Data available condition variable creation failed: %s",strerror(nRet));
|
||||
}
|
||||
/* Create the request complete condition variable */
|
||||
nRet = pthread_cond_init(&request_complete_cond, NULL);
|
||||
if(nRet != 0) {
|
||||
Fatal("Request complete condition variable creation failed: %s",strerror(nRet));
|
||||
}
|
||||
|
||||
/* Create the thread */
|
||||
nRet = pthread_create(&thread, NULL, thread_func_dispatcher, this);
|
||||
if(nRet != 0) {
|
||||
Fatal("Thread creation failed: %s",strerror(nRet));
|
||||
}
|
||||
}
|
||||
|
||||
void cURLCamera::Terminate()
|
||||
{
|
||||
/* Signal the thread to terminate */
|
||||
bTerminate = true;
|
||||
|
||||
/* Wait for thread termination */
|
||||
pthread_join(thread, NULL);
|
||||
|
||||
/* Destroy condition variables */
|
||||
pthread_cond_destroy(&request_complete_cond);
|
||||
pthread_cond_destroy(&data_available_cond);
|
||||
|
||||
/* Destroy mutex */
|
||||
pthread_mutex_destroy(&shareddata_mutex);
|
||||
|
||||
/* cURL cleanup */
|
||||
curl_global_cleanup();
|
||||
|
||||
}
|
||||
|
||||
int cURLCamera::PrimeCapture()
|
||||
{
|
||||
//Info( "Priming capture from %s", mPath.c_str() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cURLCamera::PreCapture()
|
||||
{
|
||||
// Nothing to do here
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int cURLCamera::Capture( Image &image )
|
||||
{
|
||||
bool frameComplete = false;
|
||||
uint8_t* directbuffer;
|
||||
|
||||
/* MODE_STREAM specific variables */
|
||||
bool SubHeadersParsingComplete = false;
|
||||
unsigned int frame_content_length = 0;
|
||||
std::string frame_content_type;
|
||||
bool need_more_data = false;
|
||||
|
||||
/* Request a writeable buffer of the target image */
|
||||
directbuffer = image.WriteBuffer(width, height, colours, subpixelorder);
|
||||
if(directbuffer == NULL) {
|
||||
Error("Failed requesting writeable buffer for the captured image");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Grab the mutex to ensure exclusive access to the shared data */
|
||||
lock();
|
||||
|
||||
while (!frameComplete) {
|
||||
|
||||
/* If the work thread did a reset, reset our local variables */
|
||||
if(bReset) {
|
||||
SubHeadersParsingComplete = false;
|
||||
frame_content_length = 0;
|
||||
frame_content_type.clear();
|
||||
need_more_data = false;
|
||||
bReset = false;
|
||||
}
|
||||
|
||||
if(mode == MODE_UNSET) {
|
||||
/* Don't have a mode yet. Sleep while waiting for data */
|
||||
nRet = pthread_cond_wait(&data_available_cond,&shareddata_mutex);
|
||||
if(nRet != 0) {
|
||||
Error("Failed waiting for available data condition variable: %s",strerror(nRet));
|
||||
return -20;
|
||||
}
|
||||
}
|
||||
|
||||
if(mode == MODE_STREAM) {
|
||||
|
||||
/* Subheader parsing */
|
||||
while(!SubHeadersParsingComplete && !need_more_data) {
|
||||
|
||||
size_t crlf_start, crlf_end, crlf_size;
|
||||
std::string subheader;
|
||||
|
||||
/* Check if the buffer contains something */
|
||||
if(databuffer.empty()) {
|
||||
/* Empty buffer, wait for data */
|
||||
need_more_data = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Find crlf start */
|
||||
crlf_start = memcspn(databuffer,"\r\n",databuffer.size());
|
||||
if(crlf_start == databuffer.size()) {
|
||||
/* Not found, wait for more data */
|
||||
need_more_data = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/* See if we have enough data for determining crlf length */
|
||||
if(databuffer.size() < crlf_start+5) {
|
||||
/* Need more data */
|
||||
need_more_data = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Find crlf end and calculate crlf size */
|
||||
crlf_end = memspn(((const char*)databuffer.head())+crlf_start,"\r\n",5);
|
||||
crlf_size = (crlf_start + crlf_end) - crlf_start;
|
||||
|
||||
/* Is this the end of a previous stream? (This is just before the boundary) */
|
||||
if(crlf_start == 0) {
|
||||
databuffer.consume(crlf_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Check for invalid CRLF size */
|
||||
if(crlf_size > 4) {
|
||||
Error("Invalid CRLF length");
|
||||
}
|
||||
|
||||
/* Check if the crlf is \n\n or \r\n\r\n (marks end of headers, this is the last header) */
|
||||
if( (crlf_size == 2 && memcmp(((const char*)databuffer.head())+crlf_start,"\n\n",2) == 0) || (crlf_size == 4 && memcmp(((const char*)databuffer.head())+crlf_start,"\r\n\r\n",4) == 0) ) {
|
||||
/* This is the last header */
|
||||
SubHeadersParsingComplete = true;
|
||||
}
|
||||
|
||||
/* Copy the subheader, excluding the crlf */
|
||||
subheader.assign(databuffer, crlf_start);
|
||||
|
||||
/* Advance the buffer past this one */
|
||||
databuffer.consume(crlf_start+crlf_size);
|
||||
|
||||
Debug(7,"Got subheader: %s",subheader.c_str());
|
||||
|
||||
/* Find where the data in this header starts */
|
||||
size_t subheader_data_start = subheader.rfind(' ');
|
||||
if(subheader_data_start == std::string::npos) {
|
||||
subheader_data_start = subheader.find(':');
|
||||
}
|
||||
|
||||
/* Extract the data into a string */
|
||||
std::string subheader_data = subheader.substr(subheader_data_start+1, std::string::npos);
|
||||
|
||||
Debug(8,"Got subheader data: %s",subheader_data.c_str());
|
||||
|
||||
/* Check the header */
|
||||
if(strncasecmp(subheader.c_str(),content_length_match,content_length_match_len) == 0) {
|
||||
/* Found the content-length header */
|
||||
frame_content_length = atoi(subheader_data.c_str());
|
||||
Debug(6,"Got content-length subheader: %d",frame_content_length);
|
||||
} else if(strncasecmp(subheader.c_str(),content_type_match,content_type_match_len) == 0) {
|
||||
/* Found the content-type header */
|
||||
frame_content_type = subheader_data;
|
||||
Debug(6,"Got content-type subheader: %s",frame_content_type.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Attempt to extract the frame */
|
||||
if(!need_more_data) {
|
||||
if(!SubHeadersParsingComplete) {
|
||||
/* We haven't parsed all headers yet */
|
||||
need_more_data = true;
|
||||
} else if(frame_content_length <= 0) {
|
||||
/* Invalid frame */
|
||||
Error("Invalid frame: invalid content length");
|
||||
} else if(frame_content_type != "image/jpeg") {
|
||||
/* Unsupported frame type */
|
||||
Error("Unsupported frame: %s",frame_content_type.c_str());
|
||||
} else if(frame_content_length > databuffer.size()) {
|
||||
/* Incomplete frame, wait for more data */
|
||||
need_more_data = true;
|
||||
} else {
|
||||
/* All good. decode the image */
|
||||
image.DecodeJpeg(databuffer.extract(frame_content_length), frame_content_length, colours, subpixelorder);
|
||||
frameComplete = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Attempt to get more data */
|
||||
if(need_more_data) {
|
||||
nRet = pthread_cond_wait(&data_available_cond,&shareddata_mutex);
|
||||
if(nRet != 0) {
|
||||
Error("Failed waiting for available data condition variable: %s",strerror(nRet));
|
||||
return -18;
|
||||
}
|
||||
need_more_data = false;
|
||||
}
|
||||
|
||||
} else if(mode == MODE_SINGLE) {
|
||||
/* Check if we have anything */
|
||||
if (!single_offsets.empty()) {
|
||||
if( (single_offsets.front() > 0) && (databuffer.size() >= single_offsets.front()) ) {
|
||||
/* Extract frame */
|
||||
image.DecodeJpeg(databuffer.extract(single_offsets.front()), single_offsets.front(), colours, subpixelorder);
|
||||
single_offsets.pop_front();
|
||||
frameComplete = true;
|
||||
} else {
|
||||
/* This shouldn't happen */
|
||||
Error("Internal error. Attempting recovery");
|
||||
databuffer.consume(single_offsets.front());
|
||||
single_offsets.pop_front();
|
||||
}
|
||||
} else {
|
||||
/* Don't have a frame yet, wait for the request complete condition variable */
|
||||
nRet = pthread_cond_wait(&request_complete_cond,&shareddata_mutex);
|
||||
if(nRet != 0) {
|
||||
Error("Failed waiting for request complete condition variable: %s",strerror(nRet));
|
||||
return -19;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Failed to match content-type */
|
||||
Fatal("Unable to match Content-Type. Check URL, username and password");
|
||||
} /* mode */
|
||||
|
||||
} /* frameComplete loop */
|
||||
|
||||
/* Release the mutex */
|
||||
unlock();
|
||||
|
||||
if(!frameComplete)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cURLCamera::PostCapture()
|
||||
{
|
||||
// Nothing to do here
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
size_t cURLCamera::data_callback(void *buffer, size_t size, size_t nmemb, void *userdata)
|
||||
{
|
||||
lock();
|
||||
|
||||
/* Append the data we just received to our buffer */
|
||||
databuffer.append((const char*)buffer, size*nmemb);
|
||||
|
||||
/* Signal data available */
|
||||
nRet = pthread_cond_signal(&data_available_cond);
|
||||
if(nRet != 0) {
|
||||
Error("Failed signaling data available condition variable: %s",strerror(nRet));
|
||||
return -16;
|
||||
}
|
||||
|
||||
unlock();
|
||||
|
||||
/* Return bytes processed */
|
||||
return size*nmemb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
size_t cURLCamera::header_callback( void *buffer, size_t size, size_t nmemb, void *userdata)
|
||||
{
|
||||
std::string header;
|
||||
header.assign((const char*)buffer, size*nmemb);
|
||||
|
||||
Debug(4,"Got header: %s",header.c_str());
|
||||
|
||||
/* Check Content-Type header */
|
||||
if(strncasecmp(header.c_str(),content_type_match,content_type_match_len) == 0) {
|
||||
size_t pos = header.find(';');
|
||||
if(pos != std::string::npos) {
|
||||
header.erase(pos, std::string::npos);
|
||||
}
|
||||
|
||||
pos = header.rfind(' ');
|
||||
if(pos == std::string::npos) {
|
||||
pos = header.find(':');
|
||||
}
|
||||
|
||||
std::string content_type = header.substr(pos+1, std::string::npos);
|
||||
Debug(6,"Content-Type is: %s",content_type.c_str());
|
||||
|
||||
lock();
|
||||
|
||||
const char* multipart_match = "multipart/x-mixed-replace";
|
||||
const char* image_jpeg_match = "image/jpeg";
|
||||
if(strncasecmp(content_type.c_str(),multipart_match,strlen(multipart_match)) == 0) {
|
||||
Debug(7,"Content type matched as multipart/x-mixed-replace");
|
||||
mode = MODE_STREAM;
|
||||
} else if(strncasecmp(content_type.c_str(),image_jpeg_match,strlen(image_jpeg_match)) == 0) {
|
||||
Debug(7,"Content type matched as image/jpeg");
|
||||
mode = MODE_SINGLE;
|
||||
}
|
||||
|
||||
unlock();
|
||||
}
|
||||
|
||||
/* Return bytes processed */
|
||||
return size*nmemb;
|
||||
}
|
||||
|
||||
void* cURLCamera::thread_func()
|
||||
{
|
||||
int tRet;
|
||||
double dSize;
|
||||
|
||||
c = curl_easy_init();
|
||||
if(c == NULL) {
|
||||
Fatal("Failed getting easy handle from libcurl");
|
||||
}
|
||||
|
||||
/* Set URL */
|
||||
cRet = curl_easy_setopt(c, CURLOPT_URL, mPath.c_str());
|
||||
if(cRet != CURLE_OK)
|
||||
Fatal("Failed setting libcurl URL: %s", curl_easy_strerror(cRet));
|
||||
|
||||
/* Header callback */
|
||||
cRet = curl_easy_setopt(c, CURLOPT_HEADERFUNCTION, &header_callback_dispatcher);
|
||||
if(cRet != CURLE_OK)
|
||||
Fatal("Failed setting libcurl header callback function: %s", curl_easy_strerror(cRet));
|
||||
cRet = curl_easy_setopt(c, CURLOPT_HEADERDATA, this);
|
||||
if(cRet != CURLE_OK)
|
||||
Fatal("Failed setting libcurl header callback object: %s", curl_easy_strerror(cRet));
|
||||
|
||||
/* Data callback */
|
||||
cRet = curl_easy_setopt(c, CURLOPT_WRITEFUNCTION, &data_callback_dispatcher);
|
||||
if(cRet != CURLE_OK)
|
||||
Fatal("Failed setting libcurl data callback function: %s", curl_easy_strerror(cRet));
|
||||
cRet = curl_easy_setopt(c, CURLOPT_WRITEDATA, this);
|
||||
if(cRet != CURLE_OK)
|
||||
Fatal("Failed setting libcurl data callback object: %s", curl_easy_strerror(cRet));
|
||||
|
||||
/* Progress callback */
|
||||
cRet = curl_easy_setopt(c, CURLOPT_NOPROGRESS, 0);
|
||||
if(cRet != CURLE_OK)
|
||||
Fatal("Failed enabling libcurl progress callback function: %s", curl_easy_strerror(cRet));
|
||||
cRet = curl_easy_setopt(c, CURLOPT_PROGRESSFUNCTION, &progress_callback_dispatcher);
|
||||
if(cRet != CURLE_OK)
|
||||
Fatal("Failed setting libcurl progress callback function: %s", curl_easy_strerror(cRet));
|
||||
cRet = curl_easy_setopt(c, CURLOPT_PROGRESSDATA, this);
|
||||
if(cRet != CURLE_OK)
|
||||
Fatal("Failed setting libcurl progress callback object: %s", curl_easy_strerror(cRet));
|
||||
|
||||
/* Set username and password */
|
||||
if(!mUser.empty()) {
|
||||
cRet = curl_easy_setopt(c, CURLOPT_USERNAME, mUser.c_str());
|
||||
if(cRet != CURLE_OK)
|
||||
Error("Failed setting username: %s", curl_easy_strerror(cRet));
|
||||
}
|
||||
if(!mPass.empty()) {
|
||||
cRet = curl_easy_setopt(c, CURLOPT_PASSWORD, mPass.c_str());
|
||||
if(cRet != CURLE_OK)
|
||||
Error("Failed setting password: %s", curl_easy_strerror(cRet));
|
||||
}
|
||||
|
||||
/* Authenication preference */
|
||||
cRet = curl_easy_setopt(c, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
||||
if(cRet != CURLE_OK)
|
||||
Warning("Failed setting libcurl acceptable http authenication methods: %s", curl_easy_strerror(cRet));
|
||||
|
||||
|
||||
/* Work loop */
|
||||
for(int attempt=1;attempt<=CURL_MAXRETRY;attempt++) {
|
||||
tRet = 0;
|
||||
while(!bTerminate) {
|
||||
/* Do the work */
|
||||
cRet = curl_easy_perform(c);
|
||||
|
||||
if(mode == MODE_SINGLE) {
|
||||
if(cRet != CURLE_OK) {
|
||||
break;
|
||||
}
|
||||
/* Attempt to get the size of the file */
|
||||
cRet = curl_easy_getinfo(c, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &dSize);
|
||||
if(cRet != CURLE_OK) {
|
||||
break;
|
||||
}
|
||||
/* We need to lock for the offsets array and the condition variable */
|
||||
lock();
|
||||
/* Push the size into our offsets array */
|
||||
if(dSize > 0) {
|
||||
single_offsets.push_back(dSize);
|
||||
} else {
|
||||
Fatal("Unable to get the size of the image");
|
||||
}
|
||||
/* Signal the request complete condition variable */
|
||||
tRet = pthread_cond_signal(&request_complete_cond);
|
||||
if(tRet != 0) {
|
||||
Error("Failed signaling request completed condition variable: %s",strerror(tRet));
|
||||
}
|
||||
/* Unlock */
|
||||
unlock();
|
||||
|
||||
} else if (mode == MODE_STREAM) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return value checking */
|
||||
if(cRet == CURLE_ABORTED_BY_CALLBACK || bTerminate) {
|
||||
/* Aborted */
|
||||
break;
|
||||
} else if (cRet != CURLE_OK) {
|
||||
/* Some error */
|
||||
Error("cURL Request failed: %s",curl_easy_strerror(cRet));
|
||||
if(attempt < CURL_MAXRETRY) {
|
||||
Error("Retrying.. Attempt %d of %d",attempt,CURL_MAXRETRY);
|
||||
/* Do a reset */
|
||||
lock();
|
||||
databuffer.clear();
|
||||
single_offsets.clear();
|
||||
mode = MODE_UNSET;
|
||||
bReset = true;
|
||||
unlock();
|
||||
}
|
||||
tRet = -50;
|
||||
}
|
||||
}
|
||||
|
||||
/* Cleanup */
|
||||
curl_easy_cleanup(c);
|
||||
c = NULL;
|
||||
|
||||
return (void*)tRet;
|
||||
}
|
||||
|
||||
int cURLCamera::lock() {
|
||||
int nRet;
|
||||
|
||||
/* Lock shared data */
|
||||
nRet = pthread_mutex_lock(&shareddata_mutex);
|
||||
if(nRet != 0) {
|
||||
Error("Failed locking shared data mutex: %s",strerror(nRet));
|
||||
}
|
||||
return nRet;
|
||||
}
|
||||
|
||||
int cURLCamera::unlock() {
|
||||
int nRet;
|
||||
|
||||
/* Unlock shared data */
|
||||
nRet = pthread_mutex_unlock(&shareddata_mutex);
|
||||
if(nRet != 0) {
|
||||
Error("Failed unlocking shared data mutex: %s",strerror(nRet));
|
||||
}
|
||||
return nRet;
|
||||
}
|
||||
|
||||
int cURLCamera::progress_callback(void *userdata, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
{
|
||||
/* Signal the curl thread to terminate */
|
||||
if(bTerminate)
|
||||
return -10;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* These functions call the functions in the class for the correct object */
|
||||
size_t data_callback_dispatcher(void *buffer, size_t size, size_t nmemb, void *userdata)
|
||||
{
|
||||
return ((cURLCamera*)userdata)->data_callback(buffer,size,nmemb,userdata);
|
||||
}
|
||||
|
||||
size_t header_callback_dispatcher(void *buffer, size_t size, size_t nmemb, void *userdata)
|
||||
{
|
||||
return ((cURLCamera*)userdata)->header_callback(buffer,size,nmemb,userdata);
|
||||
}
|
||||
|
||||
int progress_callback_dispatcher(void *userdata, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
{
|
||||
return ((cURLCamera*)userdata)->progress_callback(userdata,dltotal,dlnow,ultotal,ulnow);
|
||||
}
|
||||
|
||||
void* thread_func_dispatcher(void* object) {
|
||||
return ((cURLCamera*)object)->thread_func();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // HAVE_LIBCURL
|
|
@ -0,0 +1,105 @@
|
|||
//
|
||||
// ZoneMinder cURL Class Interface, $Date: 2008-07-25 10:33:23 +0100 (Fri, 25 Jul 2008) $, $Revision: 2611 $
|
||||
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
|
||||
#ifndef ZM_CURL_CAMERA_H
|
||||
#define ZM_CURL_CAMERA_H
|
||||
|
||||
#if HAVE_LIBCURL
|
||||
|
||||
#include "zm_camera.h"
|
||||
#include "zm_ffmpeg.h"
|
||||
#include "zm_buffer.h"
|
||||
#include "zm_regexp.h"
|
||||
#include "zm_utils.h"
|
||||
#include "zm_signal.h"
|
||||
#include <string>
|
||||
#include <deque>
|
||||
|
||||
#if HAVE_CURL_CURL_H
|
||||
#include <curl/curl.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
// Class representing 'curl' cameras, i.e. those which are
|
||||
// accessed using the curl library
|
||||
//
|
||||
class cURLCamera : public Camera
|
||||
{
|
||||
protected:
|
||||
typedef enum {MODE_UNSET, MODE_SINGLE, MODE_STREAM} mode_t;
|
||||
|
||||
std::string mPath;
|
||||
std::string mUser;
|
||||
std::string mPass;
|
||||
|
||||
/* cURL object(s) */
|
||||
CURL* c;
|
||||
|
||||
/* Shared data */
|
||||
volatile bool bTerminate;
|
||||
volatile bool bReset;
|
||||
volatile mode_t mode;
|
||||
Buffer databuffer;
|
||||
std::deque<size_t> single_offsets;
|
||||
|
||||
/* pthread objects */
|
||||
pthread_t thread;
|
||||
pthread_mutex_t shareddata_mutex;
|
||||
pthread_cond_t data_available_cond;
|
||||
pthread_cond_t request_complete_cond;
|
||||
|
||||
public:
|
||||
cURLCamera( int p_id, const std::string &path, const std::string &username, const std::string &password, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
||||
~cURLCamera();
|
||||
|
||||
const std::string &Path() const { return( mPath ); }
|
||||
const std::string &Username() const { return( mUser ); }
|
||||
const std::string &Password() const { return( mPass ); }
|
||||
|
||||
void Initialise();
|
||||
void Terminate();
|
||||
|
||||
int PrimeCapture();
|
||||
int PreCapture();
|
||||
int Capture( Image &image );
|
||||
int PostCapture();
|
||||
|
||||
size_t data_callback(void *buffer, size_t size, size_t nmemb, void *userdata);
|
||||
size_t header_callback(void *buffer, size_t size, size_t nmemb, void *userdata);
|
||||
int progress_callback(void *userdata, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
int debug_callback(CURL* handle, curl_infotype type, char* str, size_t strsize, void* data);
|
||||
void* thread_func();
|
||||
int lock();
|
||||
int unlock();
|
||||
|
||||
private:
|
||||
int nRet;
|
||||
CURLcode cRet;
|
||||
|
||||
};
|
||||
|
||||
/* Dispatchers */
|
||||
size_t header_callback_dispatcher(void *buffer, size_t size, size_t nmemb, void *userdata);
|
||||
size_t data_callback_dispatcher(void *buffer, size_t size, size_t nmemb, void *userdata);
|
||||
int progress_callback_dispatcher(void *userdata, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
void* thread_func_dispatcher(void* object);
|
||||
|
||||
#endif // HAVE_LIBCURL
|
||||
|
||||
#endif // ZM_CURL_CAMERA_H
|
|
@ -0,0 +1,192 @@
|
|||
/*
|
||||
* ZoneMinder Libvlc Camera Class Implementation, $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "zm.h"
|
||||
#include "zm_libvlc_camera.h"
|
||||
|
||||
#if HAVE_LIBVLC
|
||||
|
||||
// Do all the buffer checking work here to avoid unnecessary locking
|
||||
void* LibvlcLockBuffer(void* opaque, void** planes)
|
||||
{
|
||||
LibvlcPrivateData* data = (LibvlcPrivateData*)opaque;
|
||||
data->mutex.lock();
|
||||
|
||||
uint8_t* buffer = data->buffer;
|
||||
data->buffer = data->prevBuffer;
|
||||
data->prevBuffer = buffer;
|
||||
|
||||
*planes = data->buffer;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void LibvlcUnlockBuffer(void* opaque, void* picture, void *const *planes)
|
||||
{
|
||||
LibvlcPrivateData* data = (LibvlcPrivateData*)opaque;
|
||||
|
||||
bool newFrame = false;
|
||||
for(uint32_t i = 0; i < data->bufferSize; i++)
|
||||
{
|
||||
if(data->buffer[i] != data->prevBuffer[i])
|
||||
{
|
||||
newFrame = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
data->mutex.unlock();
|
||||
|
||||
time_t now;
|
||||
time(&now);
|
||||
// Return frames slightly faster than 1fps (if time() supports greater than one second resolution)
|
||||
if(newFrame || difftime(now, data->prevTime) >= 0.8)
|
||||
{
|
||||
data->prevTime = now;
|
||||
data->newImage.updateValueSignal(true);
|
||||
}
|
||||
}
|
||||
|
||||
LibvlcCamera::LibvlcCamera( int p_id, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
|
||||
Camera( p_id, LIBVLC_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture ),
|
||||
mPath( p_path )
|
||||
{
|
||||
mLibvlcInstance = NULL;
|
||||
mLibvlcMedia = NULL;
|
||||
mLibvlcMediaPlayer = NULL;
|
||||
mLibvlcData.buffer = NULL;
|
||||
mLibvlcData.prevBuffer = NULL;
|
||||
|
||||
/* Has to be located inside the constructor so other components such as zma will receive correct colours and subpixel order */
|
||||
if(colours == ZM_COLOUR_RGB32) {
|
||||
subpixelorder = ZM_SUBPIX_ORDER_BGRA;
|
||||
mTargetChroma = "RV32";
|
||||
mBpp = 4;
|
||||
} else if(colours == ZM_COLOUR_RGB24) {
|
||||
subpixelorder = ZM_SUBPIX_ORDER_BGR;
|
||||
mTargetChroma = "RV24";
|
||||
mBpp = 3;
|
||||
} else if(colours == ZM_COLOUR_GRAY8) {
|
||||
subpixelorder = ZM_SUBPIX_ORDER_NONE;
|
||||
mTargetChroma = "GREY";
|
||||
mBpp = 1;
|
||||
} else {
|
||||
Panic("Unexpected colours: %d",colours);
|
||||
}
|
||||
|
||||
if ( capture )
|
||||
{
|
||||
Initialise();
|
||||
}
|
||||
}
|
||||
|
||||
LibvlcCamera::~LibvlcCamera()
|
||||
{
|
||||
if ( capture )
|
||||
{
|
||||
Terminate();
|
||||
}
|
||||
if(mLibvlcMediaPlayer != NULL)
|
||||
{
|
||||
libvlc_media_player_release(mLibvlcMediaPlayer);
|
||||
mLibvlcMediaPlayer = NULL;
|
||||
}
|
||||
if(mLibvlcMedia != NULL)
|
||||
{
|
||||
libvlc_media_release(mLibvlcMedia);
|
||||
mLibvlcMedia = NULL;
|
||||
}
|
||||
if(mLibvlcInstance != NULL)
|
||||
{
|
||||
libvlc_release(mLibvlcInstance);
|
||||
mLibvlcInstance = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void LibvlcCamera::Initialise()
|
||||
{
|
||||
}
|
||||
|
||||
void LibvlcCamera::Terminate()
|
||||
{
|
||||
libvlc_media_player_stop(mLibvlcMediaPlayer);
|
||||
if(mLibvlcData.buffer != NULL)
|
||||
{
|
||||
zm_freealigned(mLibvlcData.buffer);
|
||||
}
|
||||
if(mLibvlcData.prevBuffer != NULL)
|
||||
{
|
||||
zm_freealigned(mLibvlcData.prevBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
int LibvlcCamera::PrimeCapture()
|
||||
{
|
||||
Info("Priming capture from %s", mPath.c_str());
|
||||
|
||||
mLibvlcInstance = libvlc_new (0, NULL);
|
||||
if(mLibvlcInstance == NULL)
|
||||
Fatal("Unable to create libvlc instance due to: %s", libvlc_errmsg());
|
||||
|
||||
mLibvlcMedia = libvlc_media_new_location(mLibvlcInstance, mPath.c_str());
|
||||
if(mLibvlcMedia == NULL)
|
||||
Fatal("Unable to open input %s due to: %s", mPath.c_str(), libvlc_errmsg());
|
||||
|
||||
mLibvlcMediaPlayer = libvlc_media_player_new_from_media(mLibvlcMedia);
|
||||
if(mLibvlcMediaPlayer == NULL)
|
||||
Fatal("Unable to create player for %s due to: %s", mPath.c_str(), libvlc_errmsg());
|
||||
|
||||
libvlc_video_set_format(mLibvlcMediaPlayer, mTargetChroma.c_str(), width, height, width * mBpp);
|
||||
libvlc_video_set_callbacks(mLibvlcMediaPlayer, &LibvlcLockBuffer, &LibvlcUnlockBuffer, NULL, &mLibvlcData);
|
||||
|
||||
mLibvlcData.bufferSize = width * height * mBpp;
|
||||
// Libvlc wants 32 byte alignment for images (should in theory do this for all image lines)
|
||||
mLibvlcData.buffer = (uint8_t*)zm_mallocaligned(32, mLibvlcData.bufferSize);
|
||||
mLibvlcData.prevBuffer = (uint8_t*)zm_mallocaligned(32, mLibvlcData.bufferSize);
|
||||
|
||||
mLibvlcData.newImage.setValueImmediate(false);
|
||||
|
||||
libvlc_media_player_play(mLibvlcMediaPlayer);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int LibvlcCamera::PreCapture()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
// Should not return -1 as cancels capture. Always wait for image if available.
|
||||
int LibvlcCamera::Capture( Image &image )
|
||||
{
|
||||
while(!mLibvlcData.newImage.getValueImmediate())
|
||||
mLibvlcData.newImage.getUpdatedValue(1);
|
||||
|
||||
mLibvlcData.mutex.lock();
|
||||
image.Assign(width, height, colours, subpixelorder, mLibvlcData.buffer, width * height * mBpp);
|
||||
mLibvlcData.newImage.setValueImmediate(false);
|
||||
mLibvlcData.mutex.unlock();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int LibvlcCamera::PostCapture()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
#endif // HAVE_LIBVLC
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* ZoneMinder Libvlc Camera Class Interface, $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef ZM_LIBVLC_CAMERA_H
|
||||
#define ZM_LIBVLC_CAMERA_H
|
||||
|
||||
#include "zm_buffer.h"
|
||||
#include "zm_camera.h"
|
||||
#include "zm_thread.h"
|
||||
|
||||
#if HAVE_LIBVLC
|
||||
|
||||
#if HAVE_VLC_VLC_H
|
||||
#include "vlc/vlc.h"
|
||||
#endif
|
||||
|
||||
// Used by libvlc callbacks
|
||||
struct LibvlcPrivateData
|
||||
{
|
||||
uint8_t* buffer;
|
||||
uint8_t* prevBuffer;
|
||||
time_t prevTime;
|
||||
uint32_t bufferSize;
|
||||
Mutex mutex;
|
||||
ThreadData<bool> newImage;
|
||||
};
|
||||
|
||||
class LibvlcCamera : public Camera
|
||||
{
|
||||
protected:
|
||||
std::string mPath;
|
||||
|
||||
LibvlcPrivateData mLibvlcData;
|
||||
std::string mTargetChroma;
|
||||
uint8_t mBpp;
|
||||
|
||||
libvlc_instance_t *mLibvlcInstance;
|
||||
libvlc_media_t *mLibvlcMedia;
|
||||
libvlc_media_player_t *mLibvlcMediaPlayer;
|
||||
|
||||
public:
|
||||
LibvlcCamera( int p_id, const std::string &path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
||||
~LibvlcCamera();
|
||||
|
||||
const std::string &Path() const { return( mPath ); }
|
||||
|
||||
void Initialise();
|
||||
void Terminate();
|
||||
|
||||
int PrimeCapture();
|
||||
int PreCapture();
|
||||
int Capture( Image &image );
|
||||
int PostCapture();
|
||||
};
|
||||
|
||||
#endif // HAVE_LIBVLC
|
||||
#endif // ZM_LIBVLC_CAMERA_H
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
# This script will bump the version number in any files listed in the below
|
||||
# @files array. It can only bump versions up, and does so by use of sed.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
my @files = (
|
||||
"../version",
|
||||
"../configure.ac",
|
||||
"../CMakeLists.txt"
|
||||
);
|
||||
|
||||
|
||||
my ($new, $current);
|
||||
|
||||
open my $file, "../version" or die $!;
|
||||
chomp($current = <$file>);
|
||||
close $file;
|
||||
|
||||
sub usage {
|
||||
print "Usage: bump-version.sh -n <new-version>\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub bump_version {
|
||||
foreach my $file (@files) {
|
||||
system("sed -i \"s/$current/$new/g\" $file");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GetOptions ("n=s" => \$new) or usage;
|
||||
usage if ! $new;
|
||||
die("New version ($new) is not greater than old version ($current)!") if ( $new le $current);
|
||||
|
||||
bump_version;
|
|
@ -0,0 +1,21 @@
|
|||
# Overview
|
||||
|
||||
Docker allows you to quickly spin up containers. The ZoneMinder dockerfile will spin
|
||||
up an Ubuntu 12.04 container with mysql, apache, php and then compile and install ZoneMinder (from master).
|
||||
|
||||
Afterwards you can connect to this container over SSH to check out the latest code.
|
||||
|
||||
This is still a bit of a work in progress.
|
||||
|
||||
## How To Use
|
||||
|
||||
1. Pull it
|
||||
```sudo docker pull ubuntu:precise```
|
||||
2. Built it
|
||||
```sudo docker build -t yourname/zoneminder github.com/ZoneMinder/ZoneMinder```
|
||||
3. Run it
|
||||
```CID=$(sudo docker run -d -p 222:22 -p 8080:80 -name zoneminder yourname/zoneminder)```
|
||||
4. Use it -- you can now SSH to port 222 on your host as user root with password root.
|
||||
You can also browse to your host on port 8080 to access the zoneminder web interface
|
||||
|
||||
## Use Cases
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Start MySQL
|
||||
/usr/bin/mysqld_safe &
|
||||
sleep 5
|
||||
|
||||
# Create the ZoneMinder database
|
||||
mysql -u root < db/zm_create.sql
|
||||
|
||||
# Add the ZoneMinder DB user
|
||||
mysql -u root -e "grant insert,select,update,delete,lock tables,alter on zm.* to 'zm'@'localhost' identified by 'zm'"
|
||||
|
||||
# Install the ZoneMinder apache vhost file
|
||||
wget --quiet https://raw.github.com/kylejohnson/puppet-zoneminder/master/files/zoneminder -O /etc/apache2/sites-enabled/000-default
|
||||
|
||||
# Restart apache
|
||||
service apache2 restart
|
||||
|
||||
# Start ZoneMinder
|
||||
/usr/local/bin/zmpkg.pl start
|
||||
|
||||
# Start SSHD
|
||||
mkdir /var/run/sshd
|
||||
/usr/sbin/sshd -D
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my @tests = (
|
||||
'zmpkg.pl start',
|
||||
'zmfilter.pl -f purgewhenfull',
|
||||
);
|
||||
|
||||
sub run_test {
|
||||
my $test = $_[0];
|
||||
print "Running test: '$test'";
|
||||
|
||||
my @args = ('sudo', $test);
|
||||
system(@args) == 0 or die "'$test' failed to run!";
|
||||
}
|
||||
|
||||
foreach my $test (@tests) {
|
||||
run_test($test);
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
# While this script is running, it will print out the state of each alarm on the system.
|
||||
# This script is an example of calling external scripts in reaction to a
|
||||
# monitor changing state. Simply replace the print() commands with system(),
|
||||
# for example, to call external scripts.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use ZoneMinder;
|
||||
use Switch;
|
||||
|
||||
$| = 1;
|
||||
|
||||
my @monitors;
|
||||
my $dbh = zmDbConnect();
|
||||
my $sql = "SELECT * FROM Monitors";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute() or die( "Can't execute '$sql': ".$sth->errstr() );
|
||||
|
||||
while ( my $monitor = $sth->fetchrow_hashref() ) {
|
||||
push( @monitors, $monitor );
|
||||
}
|
||||
|
||||
while (1) {
|
||||
foreach my $monitor (@monitors) {
|
||||
my $monitorState = zmGetMonitorState($monitor);
|
||||
printState($monitor->{Id}, $monitor->{Name}, $monitorState);
|
||||
}
|
||||
sleep 1;
|
||||
}
|
||||
|
||||
sub printState {
|
||||
my ($monitor_id, $monitor_name, $state) = @_;
|
||||
my $time = localtime();
|
||||
|
||||
switch ($state) {
|
||||
case 0 { print "$time - $monitor_name:\t Idle!\n" }
|
||||
case 1 { print "$time - $monitor_name:\t Prealarm!\n" }
|
||||
case 2 { print "$time - $monitor_name:\t Alarm!\n" }
|
||||
case 3 { print "$time - $monitor_name:\t Alert!\n" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
AUTOMAKE_OPTIONS = gnu
|
||||
|
||||
# This should be set to your web directory
|
||||
webdir = @WEB_PREFIX@
|
||||
# And these to the user and group of your webserver
|
||||
webuser = @WEB_USER@
|
||||
webgroup = @WEB_GROUP@
|
||||
|
||||
SUBDIRS = \
|
||||
ajax \
|
||||
css \
|
||||
graphics \
|
||||
includes \
|
||||
js \
|
||||
lang \
|
||||
skins \
|
||||
tools \
|
||||
views
|
||||
|
||||
dist_web_DATA = \
|
||||
index.php
|
||||
|
||||
# Yes, you are correct. This is a HACK!
|
||||
install-data-hook:
|
||||
( cd $(DESTDIR)$(webdir); chown $(webuser):$(webgroup) $(dist_web_DATA) )
|
||||
( cd $(DESTDIR)$(webdir); chown -R $(webuser):$(webgroup) $(SUBDIRS) )
|
||||
@-( cd $(DESTDIR)$(webdir); if ! test -e events; then mkdir events; fi; chown $(webuser):$(webgroup) events; chmod u+w events )
|
||||
@-( cd $(DESTDIR)$(webdir); if ! test -e images; then mkdir images; fi; chown $(webuser):$(webgroup) images; chmod u+w images )
|
||||
@-( cd $(DESTDIR)$(webdir); if ! test -e sounds; then mkdir sounds; fi; chown $(webuser):$(webgroup) sounds; chmod u+w sounds )
|
||||
@-( cd $(DESTDIR)$(webdir); if ! test -e tools; then mkdir tools; fi; chown $(webuser):$(webgroup) tools; chmod u+w tools )
|
||||
@-( cd $(DESTDIR)$(webdir); if ! test -e temp; then mkdir temp; fi; chown $(webuser):$(webgroup) temp; chmod u+w temp )
|
||||
|
||||
uninstall-hook:
|
||||
@-( cd $(DESTDIR)$(webdir); rm -rf $(SUBDIRS) )
|
||||
@-( cd $(DESTDIR)$(webdir); rm -rf events images sounds tools temp )
|
|
@ -0,0 +1,12 @@
|
|||
AUTOMAKE_OPTIONS = gnu
|
||||
|
||||
webdir = @WEB_PREFIX@/ajax
|
||||
|
||||
dist_web_DATA = \
|
||||
alarm.php \
|
||||
control.php \
|
||||
event.php \
|
||||
log.php \
|
||||
status.php \
|
||||
stream.php \
|
||||
zone.php
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
define( "MSG_TIMEOUT", 2.0 );
|
||||
define( "MSG_DATA_SIZE", 4+256 );
|
||||
|
||||
if ( canEdit( 'Monitors' ) )
|
||||
{
|
||||
$zmuCommand = getZmuCommand( " -m ".validInt($_REQUEST['id']) );
|
||||
|
||||
switch ( validJsStr($_REQUEST['command']) )
|
||||
{
|
||||
case "disableAlarms" :
|
||||
{
|
||||
$zmuCommand .= " -n";
|
||||
break;
|
||||
}
|
||||
case "enableAlarms" :
|
||||
{
|
||||
$zmuCommand .= " -c";
|
||||
break;
|
||||
}
|
||||
case "forceAlarm" :
|
||||
{
|
||||
$zmuCommand .= " -a";
|
||||
break;
|
||||
}
|
||||
case "cancelForcedAlarm" :
|
||||
{
|
||||
$zmuCommand .= " -c";
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
ajaxError( "Unexpected command '".validJsStr($_REQUEST['command'])."'" );
|
||||
}
|
||||
}
|
||||
ajaxResponse( exec( escapeshellcmd( $zmuCommand ) ) );
|
||||
}
|
||||
|
||||
ajaxError( 'Unrecognised action or insufficient permissions' );
|
||||
|
||||
?>
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
require_once( 'includes/control_functions.php' );
|
||||
|
||||
// Monitor control actions, require a monitor id and control view permissions for that monitor
|
||||
if ( empty($_REQUEST['id']) )
|
||||
ajaxError( "No monitor id supplied" );
|
||||
|
||||
if ( canView( 'Control', $_REQUEST['id'] ) )
|
||||
{
|
||||
$monitor = dbFetchOne( 'select C.*,M.* from Monitors as M inner join Controls as C on (M.ControlId = C.Id ) where M.Id = ?', NULL, array($_REQUEST['id']) );
|
||||
|
||||
$ctrlCommand = buildControlCommand( $monitor );
|
||||
|
||||
if ( $ctrlCommand )
|
||||
{
|
||||
$socket = socket_create( AF_UNIX, SOCK_STREAM, 0 );
|
||||
if ( !$socket )
|
||||
ajaxError( "socket_create() failed: ".socket_strerror(socket_last_error()) );
|
||||
|
||||
$sock_file = ZM_PATH_SOCKS.'/zmcontrol-'.$monitor['Id'].'.sock';
|
||||
if ( @socket_connect( $socket, $sock_file ) )
|
||||
{
|
||||
$options = array();
|
||||
foreach ( explode( " ", $ctrlCommand ) as $option )
|
||||
{
|
||||
if ( preg_match( '/--([^=]+)(?:=(.+))?/', $option, $matches ) )
|
||||
{
|
||||
$options[$matches[1]] = !empty($matches[2])?$matches[2]:1;
|
||||
}
|
||||
}
|
||||
$option_string = jsonEncode( $options );
|
||||
if ( !socket_write( $socket, $option_string ) )
|
||||
ajaxError( "socket_write() failed: ".socket_strerror(socket_last_error()) );
|
||||
ajaxResponse( 'Used socket' );
|
||||
//socket_close( $socket );
|
||||
}
|
||||
else
|
||||
{
|
||||
$ctrlCommand .= " --id=".$monitor['Id'];
|
||||
|
||||
// Can't connect so use script
|
||||
$ctrlStatus = '';
|
||||
$ctrlOutput = array();
|
||||
exec( escapeshellcmd( $ctrlCommand ), $ctrlOutput, $ctrlStatus );
|
||||
if ( $ctrlStatus )
|
||||
ajaxError( $ctrlCommand.'=>'.join( ' // ', $ctrlOutput ) );
|
||||
ajaxResponse( 'Used script' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ajaxError( "No command received" );
|
||||
}
|
||||
}
|
||||
|
||||
ajaxError( 'Unrecognised action or insufficient permissions' );
|
||||
|
||||
function ajaxCleanup()
|
||||
{
|
||||
global $socket;
|
||||
if ( !empty( $socket ) )
|
||||
@socket_close( $socket );
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
|
||||
if ( empty($_REQUEST['id']) && empty($_REQUEST['eids']) ) {
|
||||
ajaxError( "No event id(s) supplied" );
|
||||
}
|
||||
|
||||
if ( canView( 'Events' ) ) {
|
||||
switch ( $_REQUEST['action'] ) {
|
||||
case "video" : {
|
||||
if ( empty($_REQUEST['videoFormat']) ) {
|
||||
ajaxError( "Video Generation Failure, no format given" );
|
||||
} elseif ( empty($_REQUEST['rate']) ) {
|
||||
ajaxError( "Video Generation Failure, no rate given" );
|
||||
} elseif ( empty($_REQUEST['scale']) ) {
|
||||
ajaxError( "Video Generation Failure, no scale given" );
|
||||
} else {
|
||||
$sql = 'select E.*,M.Name as MonitorName,M.DefaultRate,M.DefaultScale from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.Id = ?'.monitorLimitSql();
|
||||
if ( !($event = dbFetchOne( $sql, NULL, array( $_REQUEST['id'] ) )) )
|
||||
ajaxError( "Video Generation Failure, can't load event" );
|
||||
else
|
||||
if ( $videoFile = createVideo( $event, $_REQUEST['videoFormat'], $_REQUEST['rate'], $_REQUEST['scale'], !empty($_REQUEST['overwrite']) ) )
|
||||
ajaxResponse( array( 'response'=>$videoFile ) );
|
||||
else
|
||||
ajaxError( "Video Generation Failed" );
|
||||
}
|
||||
$ok = true;
|
||||
break;
|
||||
}
|
||||
case 'deleteVideo' :
|
||||
{
|
||||
unlink( $videoFiles[$_REQUEST['id']] );
|
||||
unset( $videoFiles[$_REQUEST['id']] );
|
||||
ajaxResponse();
|
||||
break;
|
||||
}
|
||||
case "export" :
|
||||
{
|
||||
require_once( ZM_SKIN_PATH.'/includes/export_functions.php' );
|
||||
|
||||
if ( !empty($_REQUEST['exportDetail']) )
|
||||
$exportDetail = $_SESSION['export']['detail'] = $_REQUEST['exportDetail'];
|
||||
else
|
||||
$exportDetail = false;
|
||||
if ( !empty($_REQUEST['exportFrames']) )
|
||||
$exportFrames = $_SESSION['export']['frames'] = $_REQUEST['exportFrames'];
|
||||
else
|
||||
$exportFrames = false;
|
||||
if ( !empty($_REQUEST['exportImages']) )
|
||||
$exportImages = $_SESSION['export']['images'] = $_REQUEST['exportImages'];
|
||||
else
|
||||
$exportImages = false;
|
||||
if ( !empty($_REQUEST['exportVideo']) )
|
||||
$exportVideo = $_SESSION['export']['video'] = $_REQUEST['exportVideo'];
|
||||
else
|
||||
$exportVideo = false;
|
||||
if ( !empty($_REQUEST['exportMisc']) )
|
||||
$exportMisc = $_SESSION['export']['misc'] = $_REQUEST['exportMisc'];
|
||||
else
|
||||
$exportMisc = false;
|
||||
if ( !empty($_REQUEST['exportFormat']) )
|
||||
$exportFormat = $_SESSION['export']['format'] = $_REQUEST['exportFormat'];
|
||||
else
|
||||
$exportFormat = '';
|
||||
|
||||
$exportIds = !empty($_REQUEST['eids'])?$_REQUEST['eids']:$_REQUEST['id'];
|
||||
if ( $exportFile = exportEvents( $exportIds, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc, $exportFormat ) )
|
||||
ajaxResponse( array( 'exportFile'=>$exportFile ) );
|
||||
else
|
||||
ajaxError( "Export Failed" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( canEdit( 'Events' ) )
|
||||
{
|
||||
switch ( $_REQUEST['action'] )
|
||||
{
|
||||
case "rename" :
|
||||
{
|
||||
if ( !empty($_REQUEST['eventName']) )
|
||||
dbQuery( 'UPDATE Events SET Name = ? WHERE Id = ?', array( $_REQUEST['eventName'], $_REQUEST['id'] ) );
|
||||
else
|
||||
ajaxError( "No new event name supplied" );
|
||||
ajaxResponse( array( 'refreshEvent'=>true, 'refreshParent'=>true ) );
|
||||
break;
|
||||
}
|
||||
case "eventdetail" :
|
||||
{
|
||||
dbQuery( 'UPDATE Events SET Cause = ?, Notes = ? WHERE Id = ?', array( $_REQUEST['newEvent']['Cause'], $_REQUEST['newEvent']['Notes'], $_REQUEST['id'] ) );
|
||||
ajaxResponse( array( 'refreshEvent'=>true, 'refreshParent'=>true ) );
|
||||
break;
|
||||
}
|
||||
case "archive" :
|
||||
case "unarchive" :
|
||||
{
|
||||
$archiveVal = ($_REQUEST['action'] == "archive")?1:0;
|
||||
dbQuery( 'UPDATE Events SET Archived = ? WHERE Id = ?', array( $archiveVal, $_REQUEST['id']) );
|
||||
ajaxResponse( array( 'refreshEvent'=>true, 'refreshParent'=>false ) );
|
||||
break;
|
||||
}
|
||||
case "delete" :
|
||||
{
|
||||
deleteEvent( $_REQUEST['id'] );
|
||||
ajaxResponse( array( 'refreshEvent'=>false, 'refreshParent'=>true ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ajaxError( 'Unrecognised action or insufficient permissions' );
|
||||
|
||||
?>
|
|
@ -0,0 +1,384 @@
|
|||
<?php
|
||||
|
||||
switch ( $_REQUEST['task'] )
|
||||
{
|
||||
case 'create' :
|
||||
{
|
||||
// Silently ignore bogus requests
|
||||
if ( !empty($_POST['level']) && !empty($_POST['message']) )
|
||||
{
|
||||
logInit( array( 'id' => "web_js" ) );
|
||||
|
||||
$string = $_POST['message'];
|
||||
$file = preg_replace( '/\w+:\/\/\w+\//', '', $_POST['file'] );
|
||||
if ( !empty( $_POST['line'] ) )
|
||||
$line = $_POST['line'];
|
||||
else
|
||||
$line = NULL;
|
||||
|
||||
$levels = array_flip(Logger::$codes);
|
||||
if ( !isset($levels[$_POST['level']]) )
|
||||
Panic( "Unexpected logger level '".$_POST['level']."'" );
|
||||
$level = $levels[$_POST['level']];
|
||||
Logger::fetch()->logPrint( $level, $string, $file, $line );
|
||||
}
|
||||
ajaxResponse();
|
||||
break;
|
||||
}
|
||||
case 'query' :
|
||||
{
|
||||
if ( !canView( 'System' ) )
|
||||
ajaxError( 'Insufficient permissions to view log entries' );
|
||||
|
||||
$minTime = isset($_POST['minTime'])?$_POST['minTime']:NULL;
|
||||
$maxTime = isset($_POST['maxTime'])?$_POST['maxTime']:NULL;
|
||||
$limit = isset($_POST['limit'])?$_POST['limit']:100;
|
||||
$filter = isset($_POST['filter'])?$_POST['filter']:array();
|
||||
$sortField = isset($_POST['sortField'])?$_POST['sortField']:'TimeKey';
|
||||
$sortOrder = isset($_POST['sortOrder']) and $_POST['sortOrder'] == 'asc' ? 'asc':'desc';
|
||||
|
||||
$filterFields = array( 'Component', 'Pid', 'Level', 'File', 'Line' );
|
||||
|
||||
//$filterSql = $filter?' where
|
||||
$total = dbFetchOne( "select count(*) as Total from Logs", 'Total' );
|
||||
$sql = "select * from Logs";
|
||||
$where = array();
|
||||
$values = array();
|
||||
if ( $minTime ) {
|
||||
$where[] = "TimeKey > ?";
|
||||
$values[] = $minTime;
|
||||
} elseif ( $maxTime ) {
|
||||
$where[] = "TimeKey < ?";
|
||||
$values[] = $maxTime;
|
||||
}
|
||||
foreach ( $filter as $field=>$value ) {
|
||||
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'] );
|
||||
$logs[] = $log;
|
||||
}
|
||||
$options = array();
|
||||
$where = array();
|
||||
$values = array();
|
||||
foreach( $filter as $field=>$value ) {
|
||||
if ( $field == 'Level' ) {
|
||||
$where[$field] = $field." <= ?";
|
||||
$values[$field] = $value;
|
||||
} else {
|
||||
$where[$field] = $field." = ?";
|
||||
$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 ) );
|
||||
if ( count($fieldWhere) )
|
||||
$sql.= " and ".join( " and ", $fieldWhere );
|
||||
$sql.= " order by $field asc";
|
||||
if ( $field == 'Level' )
|
||||
{
|
||||
foreach( dbFetchAll( $sql, $field, $fieldValues ) as $value )
|
||||
if ( $value <= Logger::INFO )
|
||||
$options[$field][$value] = Logger::$codes[$value];
|
||||
else
|
||||
$options[$field][$value] = "DB".$value;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( dbFetchAll( $sql, $field ) as $value )
|
||||
if ( $value != '' )
|
||||
$options[$field][] = $value;
|
||||
}
|
||||
}
|
||||
if ( count($filter) )
|
||||
{
|
||||
$sql = "select count(*) as Available from Logs where ".join( " and ", $where );
|
||||
$available = dbFetchOne( $sql, 'Available', $values );
|
||||
}
|
||||
ajaxResponse( array(
|
||||
'updated' => preg_match( '/%/', DATE_FMT_CONSOLE_LONG )?strftime( DATE_FMT_CONSOLE_LONG ):date( DATE_FMT_CONSOLE_LONG ),
|
||||
'total' => $total,
|
||||
'available' => isset($available)?$available:$total,
|
||||
'logs' => $logs,
|
||||
'state' => logState(),
|
||||
'options' => $options
|
||||
) );
|
||||
break;
|
||||
}
|
||||
case 'export' :
|
||||
{
|
||||
if ( !canView( 'System' ) )
|
||||
ajaxError( 'Insufficient permissions to export logs' );
|
||||
|
||||
$minTime = isset($_POST['minTime'])?$_POST['minTime']:NULL;
|
||||
$maxTime = isset($_POST['maxTime'])?$_POST['maxTime']:NULL;
|
||||
if ( !is_null($minTime) && !is_null($maxTime) && $minTime > $maxTime )
|
||||
{
|
||||
$tempTime = $minTime;
|
||||
$minTime = $maxTime;
|
||||
$maxTime = $tempTime;
|
||||
}
|
||||
//$limit = isset($_POST['limit'])?$_POST['limit']:1000;
|
||||
$filter = isset($_POST['filter'])?$_POST['filter']:array();
|
||||
$sortField = isset($_POST['sortField'])?$_POST['sortField']:'TimeKey';
|
||||
$sortOrder = isset($_POST['sortOrder'])?$_POST['sortOrder']:'asc';
|
||||
|
||||
$sql = "select * from Logs";
|
||||
$where = array();
|
||||
$values = array();
|
||||
if ( $minTime )
|
||||
{
|
||||
preg_match( '/(.+)(\.\d+)/', $minTime, $matches );
|
||||
$minTime = strtotime($matches[1]).$matches[2];
|
||||
$where[] = "TimeKey >= ?";
|
||||
$values[] = $minTime;
|
||||
}
|
||||
if ( $maxTime )
|
||||
{
|
||||
preg_match( '/(.+)(\.\d+)/', $maxTime, $matches );
|
||||
$maxTime = strtotime($matches[1]).$matches[2];
|
||||
$where[] = "TimeKey <= ?";
|
||||
$values[] = $maxTime;
|
||||
}
|
||||
foreach ( $filter as $field=>$value ) {
|
||||
if ( $value != '' ) {
|
||||
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;
|
||||
//$sql .= " limit ".dbEscape($limit);
|
||||
$format = isset($_POST['format'])?$_POST['format']:'text';
|
||||
switch( $format )
|
||||
{
|
||||
case 'text' :
|
||||
$exportExt = "txt";
|
||||
break;
|
||||
case 'tsv' :
|
||||
$exportExt = "tsv";
|
||||
break;
|
||||
case 'html' :
|
||||
$exportExt = "html";
|
||||
break;
|
||||
case 'xml' :
|
||||
$exportExt = "xml";
|
||||
break;
|
||||
default :
|
||||
Fatal( "Unrecognised log export format '$format'" );
|
||||
}
|
||||
$exportKey = substr(md5(rand()),0,8);
|
||||
$exportFile = "zm-log.$exportExt";
|
||||
$exportPath = "temp/zm-log-$exportKey.$exportExt";
|
||||
if ( !($exportFP = fopen( $exportPath, "w" )) )
|
||||
Fatal( "Unable to open log export file $exportFile" );
|
||||
$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'] );
|
||||
$logs[] = $log;
|
||||
}
|
||||
switch( $format )
|
||||
{
|
||||
case 'text' :
|
||||
{
|
||||
foreach ( $logs as $log )
|
||||
{
|
||||
if ( $log['Line'] )
|
||||
fprintf( $exportFP, "%s %s[%d].%s-%s/%d [%s]\n", $log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], $log['File'], $log['Line'], $log['Message'] );
|
||||
else
|
||||
fprintf( $exportFP, "%s %s[%d].%s-%s [%s]\n", $log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], $log['File'], $log['Message'] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'tsv' :
|
||||
{
|
||||
fprintf( $exportFP, $SLANG['DateTime']."\t".$SLANG['Component']."\t".$SLANG['Pid']."\t".$SLANG['Level']."\t".$SLANG['Message']."\t".$SLANG['File']."\t".$SLANG['Line']."\n" );
|
||||
foreach ( $logs as $log )
|
||||
{
|
||||
fprintf( $exportFP, "%s\t%s\t%d\t%s\t%s\t%s\t%s\n", $log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'html' :
|
||||
{
|
||||
fwrite( $exportFP,
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>'.$SLANG['ZoneMinderLog'].'</title>
|
||||
<style type="text/css">
|
||||
body, h3, p, table, td {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 11px;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
th {
|
||||
font-weight: bold;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #888888;
|
||||
padding: 1px 2px;
|
||||
}
|
||||
tr.log-fat td {
|
||||
background-color:#ffcccc;
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
tr.log-err td {
|
||||
background-color:#ffcccc;
|
||||
}
|
||||
tr.log-war td {
|
||||
background-color: #ffe4b5;
|
||||
}
|
||||
tr.log-dbg td {
|
||||
color: #666666;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h3>'.$SLANG['ZoneMinderLog'].'</h3>
|
||||
<p>'.htmlspecialchars(preg_match( '/%/', DATE_FMT_CONSOLE_LONG )?strftime( DATE_FMT_CONSOLE_LONG ):date( DATE_FMT_CONSOLE_LONG )).'</p>
|
||||
<p>'.count($logs).' '.$SLANG['Logs'].'</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><th>'.$SLANG['DateTime'].'</th><th>'.$SLANG['Component'].'</th><th>'.$SLANG['Pid'].'</th><th>'.$SLANG['Level'].'</th><th>'.$SLANG['Message'].'</th><th>'.$SLANG['File'].'</th><th>'.$SLANG['Line'].'</th></tr>
|
||||
' );
|
||||
foreach ( $logs as $log )
|
||||
{
|
||||
$classLevel = $log['Level'];
|
||||
if ( $classLevel < Logger::FATAL )
|
||||
$classLevel = Logger::FATAL;
|
||||
elseif ( $classLevel > Logger::DEBUG )
|
||||
$classLevel = Logger::DEBUG;
|
||||
$logClass = 'log-'.strtolower(Logger::$codes[$classLevel]);
|
||||
fprintf( $exportFP, " <tr class=\"%s\"><td>%s</td><td>%s</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $logClass, $log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
|
||||
}
|
||||
fwrite( $exportFP,
|
||||
' </tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>' );
|
||||
break;
|
||||
}
|
||||
case 'xml' :
|
||||
{
|
||||
fwrite( $exportFP,
|
||||
'<?xml version="1.0" encoding="utf-8"?>
|
||||
<logexport title="'.$SLANG['ZoneMinderLog'].'" date="'.htmlspecialchars(preg_match( '/%/', DATE_FMT_CONSOLE_LONG )?strftime( DATE_FMT_CONSOLE_LONG ):date( DATE_FMT_CONSOLE_LONG )).'">
|
||||
<selector>'.$_POST['selector'].'</selector>' );
|
||||
foreach ( $filter as $field=>$value )
|
||||
if ( $value != '' )
|
||||
fwrite( $exportFP,
|
||||
' <filter>
|
||||
<'.strtolower($field).'>'.htmlspecialchars($value).'</'.strtolower($field).'>
|
||||
</filter>' );
|
||||
fwrite( $exportFP,
|
||||
' <columns>
|
||||
<column field="datetime">'.$SLANG['DateTime'].'</column><column field="component">'.$SLANG['Component'].'</column><column field="pid">'.$SLANG['Pid'].'</column><column field="level">'.$SLANG['Level'].'</column><column field="message">'.$SLANG['Message'].'</column><column field="file">'.$SLANG['File'].'</column><column field="line">'.$SLANG['Line'].'</column>
|
||||
</columns>
|
||||
<logs count="'.count($logs).'">
|
||||
' );
|
||||
foreach ( $logs as $log )
|
||||
{
|
||||
fprintf( $exportFP,
|
||||
" <log>
|
||||
<datetime>%s</datetime>
|
||||
<component>%s</component>
|
||||
<pid>%d</pid>
|
||||
<level>%s</level>
|
||||
<message><![CDATA[%s]]></message>
|
||||
<file>%s</file>
|
||||
<line>%d</line>
|
||||
</log>\n", $log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], utf8_decode( $log['Message'] ), $log['File'], $log['Line'] );
|
||||
}
|
||||
fwrite( $exportFP,
|
||||
' </logs>
|
||||
</logexport>' );
|
||||
break;
|
||||
}
|
||||
$exportExt = "xml";
|
||||
break;
|
||||
}
|
||||
fclose( $exportFP );
|
||||
ajaxResponse( array(
|
||||
'key' => $exportKey,
|
||||
'format' => $format,
|
||||
) );
|
||||
break;
|
||||
}
|
||||
case 'download' :
|
||||
{
|
||||
if ( !canView( 'System' ) )
|
||||
ajaxError( 'Insufficient permissions to download logs' );
|
||||
|
||||
if ( empty($_REQUEST['key']) )
|
||||
Fatal( "No log export key given" );
|
||||
$exportKey = $_REQUEST['key'];
|
||||
if ( empty($_REQUEST['format']) )
|
||||
Fatal( "No log export format given" );
|
||||
$format = $_REQUEST['format'];
|
||||
|
||||
switch( $format )
|
||||
{
|
||||
case 'text' :
|
||||
$exportExt = "txt";
|
||||
break;
|
||||
case 'tsv' :
|
||||
$exportExt = "tsv";
|
||||
break;
|
||||
case 'html' :
|
||||
$exportExt = "html";
|
||||
break;
|
||||
case 'xml' :
|
||||
$exportExt = "xml";
|
||||
break;
|
||||
default :
|
||||
Fatal( "Unrecognised log export format '$format'" );
|
||||
}
|
||||
|
||||
$exportFile = "zm-log.$exportExt";
|
||||
$exportPath = "temp/zm-log-$exportKey.$exportExt";
|
||||
|
||||
header( "Pragma: public" );
|
||||
header( "Expires: 0" );
|
||||
header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
|
||||
header( "Cache-Control: private", false ); // required by certain browsers
|
||||
header( "Content-Description: File Transfer" );
|
||||
header( 'Content-Disposition: attachment; filename="'.$exportFile.'"' );
|
||||
header( "Content-Transfer-Encoding: binary" );
|
||||
header( "Content-Type: application/force-download" );
|
||||
header( "Content-Length: ".filesize($exportPath) );
|
||||
readfile( $exportPath );
|
||||
exit( 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ajaxError( 'Unrecognised action or insufficient permissions' );
|
||||
|
||||
?>
|
|
@ -0,0 +1,413 @@
|
|||
<?php
|
||||
|
||||
$statusData = array(
|
||||
"system" => array(
|
||||
"permission" => "System",
|
||||
"table" => "Monitors",
|
||||
"limit" => 1,
|
||||
"elements" => array(
|
||||
"MonitorCount" => array( "sql" => "count(*)" ),
|
||||
"ActiveMonitorCount" => array( "sql" => "count(if(Function != 'None',1,NULL))" ),
|
||||
"State" => array( "func" => "daemonCheck()?".$SLANG['Running'].":".$SLANG['Stopped'] ),
|
||||
"Load" => array( "func" => "getLoad()" ),
|
||||
"Disk" => array( "func" => "getDiskPercent()" ),
|
||||
),
|
||||
),
|
||||
"monitor" => array(
|
||||
"permission" => "Monitors",
|
||||
"table" => "Monitors",
|
||||
"limit" => 1,
|
||||
"selector" => "Monitors.Id",
|
||||
"elements" => array(
|
||||
"Id" => array( "sql" => "Monitors.Id" ),
|
||||
"Name" => array( "sql" => "Monitors.Name" ),
|
||||
"Type" => true,
|
||||
"Function" => true,
|
||||
"Enabled" => true,
|
||||
"LinkedMonitors" => true,
|
||||
"Triggers" => true,
|
||||
"Device" => true,
|
||||
"Channel" => true,
|
||||
"Format" => true,
|
||||
"Host" => true,
|
||||
"Port" => true,
|
||||
"Path" => true,
|
||||
"Width" => array( "sql" => "Monitors.Width" ),
|
||||
"Height" => array( "sql" => "Monitors.Height" ),
|
||||
"Palette" => true,
|
||||
"Orientation" => true,
|
||||
"Brightness" => true,
|
||||
"Contrast" => true,
|
||||
"Hue" => true,
|
||||
"Colour" => true,
|
||||
"EventPrefix" => true,
|
||||
"LabelFormat" => true,
|
||||
"LabelX" => true,
|
||||
"LabelY" => true,
|
||||
"ImageBufferCount" => true,
|
||||
"WarmupCount" => true,
|
||||
"PreEventCount" => true,
|
||||
"PostEventCount" => true,
|
||||
"AlarmFrameCount" => true,
|
||||
"SectionLength" => true,
|
||||
"FrameSkip" => true,
|
||||
"MotionFrameSkip" => true,
|
||||
"MaxFPS" => true,
|
||||
"AlarmMaxFPS" => true,
|
||||
"FPSReportInterval" => true,
|
||||
"RefBlendPerc" => true,
|
||||
"Controllable" => true,
|
||||
"ControlId" => true,
|
||||
"ControlDevice" => true,
|
||||
"ControlAddress" => true,
|
||||
"AutoStopTimeout" => true,
|
||||
"TrackMotion" => true,
|
||||
"TrackDelay" => true,
|
||||
"ReturnLocation" => true,
|
||||
"ReturnDelay" => true,
|
||||
"DefaultView" => true,
|
||||
"DefaultRate" => true,
|
||||
"DefaultScale" => true,
|
||||
"WebColour" => true,
|
||||
"Sequence" => true,
|
||||
"MinEventId" => array( "sql" => "min(Events.Id)", "table" => "Events", "join" => "Events.MonitorId = Monitors.Id", "group" => "Events.MonitorId" ),
|
||||
"MaxEventId" => array( "sql" => "max(Events.Id)", "table" => "Events", "join" => "Events.MonitorId = Monitors.Id", "group" => "Events.MonitorId" ),
|
||||
"TotalEvents" => array( "sql" => "count(Events.Id)", "table" => "Events", "join" => "Events.MonitorId = Monitors.Id", "group" => "Events.MonitorId" ),
|
||||
"Status" => array( "zmu" => "-m ".escapeshellarg($_REQUEST['id'][0])." -s" ),
|
||||
"FrameRate" => array( "zmu" => "-m ".escapeshellarg($_REQUEST['id'][0])." -f" ),
|
||||
),
|
||||
),
|
||||
"events" => array(
|
||||
"permission" => "Events",
|
||||
"table" => "Events",
|
||||
"selector" => "Events.MonitorId",
|
||||
"elements" => array(
|
||||
"Id" => true,
|
||||
"Name" => true,
|
||||
"Cause" => true,
|
||||
"Notes" => true,
|
||||
"StartTime" => true,
|
||||
"StartTimeShort" => array( "sql" => "date_format( StartTime, '".MYSQL_FMT_DATETIME_SHORT."' )" ),
|
||||
"EndTime" => true,
|
||||
"Width" => true,
|
||||
"Height" => true,
|
||||
"Length" => true,
|
||||
"Frames" => true,
|
||||
"AlarmFrames" => true,
|
||||
"TotScore" => true,
|
||||
"AvgScore" => true,
|
||||
"MaxScore" => true,
|
||||
),
|
||||
),
|
||||
"event" => array(
|
||||
"permission" => "Events",
|
||||
"table" => "Events",
|
||||
"limit" => 1,
|
||||
"selector" => "Events.Id",
|
||||
"elements" => array(
|
||||
"Id" => array( "sql" => "Events.Id" ),
|
||||
"MonitorId" => true,
|
||||
"Name" => true,
|
||||
"Cause" => true,
|
||||
"StartTime" => true,
|
||||
"StartTimeShort" => array( "sql" => "date_format( StartTime, '".MYSQL_FMT_DATETIME_SHORT."' )" ),
|
||||
"EndTime" => true,
|
||||
"Width" => true,
|
||||
"Height" => true,
|
||||
"Length" => true,
|
||||
"Frames" => true,
|
||||
"AlarmFrames" => true,
|
||||
"TotScore" => true,
|
||||
"AvgScore" => true,
|
||||
"MaxScore" => true,
|
||||
"Archived" => true,
|
||||
"Videoed" => true,
|
||||
"Uploaded" => true,
|
||||
"Emailed" => true,
|
||||
"Messaged" => true,
|
||||
"Executed" => true,
|
||||
"Notes" => true,
|
||||
"MinFrameId" => array( "sql" => "min(Frames.FrameId)", "table" => "Frames", "join" => "Events.Id = Frames.EventId", "group" => "Frames.EventId" ),
|
||||
"MaxFrameId" => array( "sql" => "max(Frames.FrameId)", "table" => "Frames", "join" => "Events.Id = Frames.EventId", "group" => "Frames.EventId" ),
|
||||
"MinFrameDelta" => array( "sql" => "min(Frames.Delta)", "table" => "Frames", "join" => "Events.Id = Frames.EventId", "group" => "Frames.EventId" ),
|
||||
"MaxFrameDelta" => array( "sql" => "max(Frames.Delta)", "table" => "Frames", "join" => "Events.Id = Frames.EventId", "group" => "Frames.EventId" ),
|
||||
//"Path" => array( "postFunc" => "getEventPath" ),
|
||||
),
|
||||
),
|
||||
"frame" => array(
|
||||
"permission" => "Events",
|
||||
"table" => "Frames",
|
||||
"limit" => 1,
|
||||
"selector" => array( array( "table" => "Events", "join" => "Events.Id = Frames.EventId", "selector"=>"Events.Id" ), "Frames.FrameId" ),
|
||||
"elements" => array(
|
||||
//"Id" => array( "sql" => "Frames.FrameId" ),
|
||||
"FrameId" => true,
|
||||
"EventId" => true,
|
||||
"Type" => true,
|
||||
"TimeStamp" => true,
|
||||
"TimeStampShort" => array( "sql" => "date_format( StartTime, '".MYSQL_FMT_DATETIME_SHORT."' )" ),
|
||||
"Delta" => true,
|
||||
"Score" => true,
|
||||
//"Image" => array( "postFunc" => "getFrameImage" ),
|
||||
),
|
||||
),
|
||||
"frameimage" => array(
|
||||
"permission" => "Events",
|
||||
"func" => "getFrameImage()"
|
||||
),
|
||||
"nearframe" => array(
|
||||
"permission" => "Events",
|
||||
"func" => "getNearFrame()"
|
||||
),
|
||||
"nearevents" => array(
|
||||
"permission" => "Events",
|
||||
"func" => "getNearEvents()"
|
||||
)
|
||||
);
|
||||
|
||||
function collectData()
|
||||
{
|
||||
global $statusData;
|
||||
|
||||
$entitySpec = &$statusData[strtolower(validJsStr($_REQUEST['entity']))];
|
||||
#print_r( $entitySpec );
|
||||
if ( !canView( $entitySpec['permission'] ) )
|
||||
ajaxError( 'Unrecognised action or insufficient permissions' );
|
||||
|
||||
if ( !empty($entitySpec['func']) )
|
||||
{
|
||||
$data = eval( "return( ".$entitySpec['func']." );" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = array();
|
||||
$postFuncs = array();
|
||||
|
||||
$fieldSql = array();
|
||||
$joinSql = array();
|
||||
$groupSql = array();
|
||||
|
||||
$elements = &$entitySpec['elements'];
|
||||
$lc_elements = array_change_key_case( $elements );
|
||||
|
||||
$id = false;
|
||||
if ( isset($_REQUEST['id']) )
|
||||
if ( !is_array($_REQUEST['id']) )
|
||||
$id = array( validJsStr($_REQUEST['id']) );
|
||||
else
|
||||
$id = array_values( $_REQUEST['id'] );
|
||||
|
||||
if ( !isset($_REQUEST['element']) )
|
||||
$_REQUEST['element'] = array_keys( $elements );
|
||||
else if ( !is_array($_REQUEST['element']) )
|
||||
$_REQUEST['element'] = array( validJsStr($_REQUEST['element']) );
|
||||
|
||||
if ( isset($entitySpec['selector']) )
|
||||
{
|
||||
if ( !is_array($entitySpec['selector']) )
|
||||
$entitySpec['selector'] = array( $entitySpec['selector'] );
|
||||
foreach( $entitySpec['selector'] as $selector )
|
||||
if ( is_array( $selector ) && isset($selector['table']) && isset($selector['join']) )
|
||||
$joinSql[] = "left join ".$selector['table']." on ".$selector['join'];
|
||||
}
|
||||
|
||||
foreach ( $_REQUEST['element'] as $element )
|
||||
{
|
||||
if ( !($elementData = $lc_elements[strtolower($element)]) )
|
||||
ajaxError( "Bad ".validJsStr($_REQUEST['entity'])." element ".$element );
|
||||
if ( isset($elementData['func']) )
|
||||
$data[$element] = eval( "return( ".$elementData['func']." );" );
|
||||
else if ( isset($elementData['postFunc']) )
|
||||
$postFuncs[$element] = $elementData['postFunc'];
|
||||
else if ( isset($elementData['zmu']) )
|
||||
$data[$element] = exec( escapeshellcmd( getZmuCommand( " ".$elementData['zmu'] ) ) );
|
||||
else
|
||||
{
|
||||
if ( isset($elementData['sql']) )
|
||||
$fieldSql[] = $elementData['sql']." as ".$element;
|
||||
else
|
||||
$fieldSql[] = $element;
|
||||
if ( isset($elementData['table']) && isset($elementData['join']) )
|
||||
{
|
||||
$joinSql[] = "left join ".$elementData['table']." on ".$elementData['join'];
|
||||
}
|
||||
if ( isset($elementData['group']) )
|
||||
{
|
||||
$groupSql[] = $elementData['group'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( count($fieldSql) )
|
||||
{
|
||||
$sql = "select ".join( ", ", $fieldSql )." from ".$entitySpec['table'];
|
||||
if ( $joinSql )
|
||||
$sql .= " ".join( " ", array_unique( $joinSql ) );
|
||||
if ( $id && !empty($entitySpec['selector']) )
|
||||
{
|
||||
$index = 0;
|
||||
$where = array();
|
||||
$values = array();
|
||||
foreach( $entitySpec['selector'] as $selector )
|
||||
{
|
||||
if ( is_array( $selector ) ) {
|
||||
$where[] = $selector['selector'].' = ?';
|
||||
$values[] = $id[$index];
|
||||
} else {
|
||||
$where[] = $selector.' = ?';
|
||||
$values[] = $id[$index];
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$sql .= " where ".join( " and ", $where );
|
||||
}
|
||||
if ( $groupSql )
|
||||
$sql .= " group by ".join( ",", array_unique( $groupSql ) );
|
||||
if ( !empty($_REQUEST['sort']) )
|
||||
$sql .= " order by ".$_REQUEST['sort'];
|
||||
if ( !empty($entitySpec['limit']) )
|
||||
$limit = $entitySpec['limit'];
|
||||
elseif ( !empty($_REQUEST['count']) )
|
||||
$limit = $_REQUEST['count'];
|
||||
if ( !empty( $limit ) )
|
||||
$sql .= " limit ".$limit;
|
||||
if ( isset($limit) && $limit == 1 ) {
|
||||
if ( $sqlData = dbFetchOne( $sql, NULL, $values ) ) {
|
||||
foreach ( $postFuncs as $element=>$func )
|
||||
$sqlData[$element] = eval( 'return( '.$func.'( $sqlData ) );' );
|
||||
$data = array_merge( $data, $sqlData );
|
||||
}
|
||||
} else {
|
||||
$count = 0;
|
||||
foreach( dbFetchAll( $sql, NULL, $values ) as $sqlData ) {
|
||||
foreach ( $postFuncs as $element=>$func )
|
||||
$sqlData[$element] = eval( 'return( '.$func.'( $sqlData ) );' );
|
||||
$data[] = $sqlData;
|
||||
if ( isset($limi) && ++$count >= $limit )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#print_r( $data );
|
||||
return( $data );
|
||||
}
|
||||
|
||||
$data = collectData();
|
||||
|
||||
if ( !isset($_REQUEST['layout']) )
|
||||
{
|
||||
$_REQUEST['layout'] = "json";
|
||||
}
|
||||
switch( $_REQUEST['layout'] )
|
||||
{
|
||||
case 'xml NOT CURRENTLY SUPPORTED' :
|
||||
{
|
||||
header("Content-type: application/xml" );
|
||||
echo( '<?xml version="1.0" encoding="iso-8859-1"?>'."\n" );
|
||||
echo "<".strtolower($_REQUEST['entity']).">\n";
|
||||
foreach ( $data as $key=>$value )
|
||||
{
|
||||
$key = strtolower( $key );
|
||||
echo "<$key>".htmlentities($value)."</$key>\n";
|
||||
}
|
||||
echo "</".strtolower($_REQUEST['entity']).">\n";
|
||||
break;
|
||||
}
|
||||
case 'json' :
|
||||
{
|
||||
$response = array( strtolower(validJsStr($_REQUEST['entity'])) => $data );
|
||||
if ( isset($_REQUEST['loopback']) )
|
||||
$response['loopback'] = validJsStr($_REQUEST['loopback']);
|
||||
ajaxResponse( $response );
|
||||
break;
|
||||
}
|
||||
case 'text' :
|
||||
{
|
||||
header("Content-type: text/plain" );
|
||||
echo join( " ", array_values( $data ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getFrameImage()
|
||||
{
|
||||
$eventId = $_REQUEST['id'][0];
|
||||
$frameId = $_REQUEST['id'][1];
|
||||
|
||||
$sql = 'select * from Frames where EventId = ? and FrameId = ?';
|
||||
if ( !($frame = dbFetchOne( $sql, NULL, array( $eventId, $frameId ) )) )
|
||||
{
|
||||
$frame = array();
|
||||
$frame['EventId'] = $eventId;
|
||||
$frame['FrameId'] = $frameId;
|
||||
$frame['Type'] = "Virtual";
|
||||
}
|
||||
$event = dbFetchOne( 'select * from Events where Id = ?', NULL, array( $frame['EventId'] ) );
|
||||
$frame['Image'] = getImageSrc( $event, $frame, SCALE_BASE );
|
||||
return( $frame );
|
||||
}
|
||||
|
||||
function getNearFrame()
|
||||
{
|
||||
$eventId = $_REQUEST['id'][0];
|
||||
$frameId = $_REQUEST['id'][1];
|
||||
|
||||
$sql = 'select FrameId from Frames where EventId = ? and FrameId <= ? order by FrameId desc limit 1';
|
||||
if ( !$nearFrameId = dbFetchOne( $sql, 'FrameId', array( $eventId, $frameId ) ) )
|
||||
{
|
||||
$sql = 'select * from Frames where EventId = ? and FrameId > ? order by FrameId asc limit 1';
|
||||
if ( !$nearFrameId = dbFetchOne( $sql, 'FrameId', array( $eventId, $frameId ) ) )
|
||||
{
|
||||
return( array() );
|
||||
}
|
||||
}
|
||||
$_REQUEST['entity'] = "frame";
|
||||
$_REQUEST['id'][1] = $nearFrameId;
|
||||
return( collectData() );
|
||||
}
|
||||
|
||||
function getNearEvents()
|
||||
{
|
||||
global $user, $sortColumn, $sortOrder;
|
||||
|
||||
$eventId = $_REQUEST['id'];
|
||||
$event = dbFetchOne( 'select * from Events where Id = ?', NULL, array( $eventId ) );
|
||||
|
||||
parseFilter( $_REQUEST['filter'] );
|
||||
parseSort();
|
||||
|
||||
if ( $user['MonitorIds'] )
|
||||
$midSql = " and MonitorId in (".join( ",", preg_split( '/["\'\s]*,["\'\s]*/', $user['MonitorIds'] ) ).")";
|
||||
else
|
||||
$midSql = '';
|
||||
|
||||
$sql = "select E.Id as Id from Events as E inner join Monitors as M on E.MonitorId = M.Id where ".dbEscape($sortColumn)." ".($sortOrder=='asc'?'<=':'>=')." '".$event[$_REQUEST['sort_field']]."'".$_REQUEST['filter']['sql'].$midSql." order by $sortColumn ".($sortOrder=='asc'?'desc':'asc');
|
||||
$result = dbQuery( $sql );
|
||||
while ( $id = dbFetchNext( $result, 'Id' ) )
|
||||
{
|
||||
if ( $id == $eventId )
|
||||
{
|
||||
$prevId = dbFetchNext( $result, 'Id' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "select E.Id as Id from Events as E inner join Monitors as M on E.MonitorId = M.Id where $sortColumn ".($sortOrder=='asc'?'>=':'<=')." '".$event[$_REQUEST['sort_field']]."'".$_REQUEST['filter']['sql'].$midSql." order by $sortColumn $sortOrder";
|
||||
$result = dbQuery( $sql );
|
||||
while ( $id = dbFetchNext( $result, 'Id' ) )
|
||||
{
|
||||
if ( $id == $eventId )
|
||||
{
|
||||
$nextId = dbFetchNext( $result, 'Id' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$result = array( 'EventId'=>$eventId );
|
||||
$result['PrevEventId'] = empty($prevId)?0:$prevId;
|
||||
$result['NextEventId'] = empty($nextId)?0:$nextId;
|
||||
return( $result );
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,139 @@
|
|||
<?php
|
||||
|
||||
define( "MSG_TIMEOUT", ZM_WEB_AJAX_TIMEOUT );
|
||||
define( "MSG_DATA_SIZE", 4+256 );
|
||||
|
||||
if ( !($_REQUEST['connkey'] && $_REQUEST['command']) )
|
||||
{
|
||||
ajaxError( "Unexpected received message type '$type'" );
|
||||
}
|
||||
|
||||
if ( !($socket = @socket_create( AF_UNIX, SOCK_DGRAM, 0 )) )
|
||||
{
|
||||
ajaxError( "socket_create() failed: ".socket_strerror(socket_last_error()) );
|
||||
}
|
||||
$locSockFile = ZM_PATH_SOCKS.'/zms-'.sprintf("%06d",$_REQUEST['connkey']).'w.sock';
|
||||
if ( !@socket_bind( $socket, $locSockFile ) )
|
||||
{
|
||||
ajaxError( "socket_bind( $locSockFile ) failed: ".socket_strerror(socket_last_error()) );
|
||||
}
|
||||
|
||||
switch ( $_REQUEST['command'] )
|
||||
{
|
||||
case CMD_VARPLAY :
|
||||
Debug( "Varplaying to ".$_REQUEST['rate'] );
|
||||
$msg = pack( "lcn", MSG_CMD, $_REQUEST['command'], $_REQUEST['rate']+32768 );
|
||||
break;
|
||||
case CMD_ZOOMIN :
|
||||
Debug( "Zooming to ".$_REQUEST['x'].",".$_REQUEST['y'] );
|
||||
$msg = pack( "lcnn", MSG_CMD, $_REQUEST['command'], $_REQUEST['x'], $_REQUEST['y'] );
|
||||
break;
|
||||
case CMD_PAN :
|
||||
Debug( "Panning to ".$_REQUEST['x'].",".$_REQUEST['y'] );
|
||||
$msg = pack( "lcnn", MSG_CMD, $_REQUEST['command'], $_REQUEST['x'], $_REQUEST['y'] );
|
||||
break;
|
||||
case CMD_SCALE :
|
||||
Debug( "Scaling to ".$_REQUEST['scale'] );
|
||||
$msg = pack( "lcn", MSG_CMD, $_REQUEST['command'], $_REQUEST['scale'] );
|
||||
break;
|
||||
case CMD_SEEK :
|
||||
Debug( "Seeking to ".$_REQUEST['offset'] );
|
||||
$msg = pack( "lcN", MSG_CMD, $_REQUEST['command'], $_REQUEST['offset'] );
|
||||
break;
|
||||
default :
|
||||
$msg = pack( "lc", MSG_CMD, $_REQUEST['command'] );
|
||||
break;
|
||||
}
|
||||
|
||||
$remSockFile = ZM_PATH_SOCKS.'/zms-'.sprintf("%06d",$_REQUEST['connkey']).'s.sock';
|
||||
$max_socket_tries = 3;
|
||||
while ( !file_exists($remSockFile) && $max_socket_tries-- ) //sometimes we are too fast for our own good, if it hasn't been setup yet give it a second.
|
||||
sleep(1);
|
||||
|
||||
if ( !@socket_sendto( $socket, $msg, strlen($msg), 0, $remSockFile ) )
|
||||
{
|
||||
ajaxError( "socket_sendto( $remSockFile ) failed: ".socket_strerror(socket_last_error()) );
|
||||
}
|
||||
|
||||
$rSockets = array( $socket );
|
||||
$wSockets = NULL;
|
||||
$eSockets = NULL;
|
||||
$numSockets = @socket_select( $rSockets, $wSockets, $eSockets, intval(MSG_TIMEOUT/1000), (MSG_TIMEOUT%1000)*1000 );
|
||||
|
||||
if ( $numSockets === false )
|
||||
{
|
||||
ajaxError( "socket_select failed: ".socket_strerror(socket_last_error()) );
|
||||
}
|
||||
else if ( $numSockets < 0 )
|
||||
{
|
||||
ajaxError( "Socket closed $remSocketFile" );
|
||||
}
|
||||
else if ( $numSockets == 0 )
|
||||
{
|
||||
ajaxError( "Timed out waiting for msg $remSocketFile" );
|
||||
}
|
||||
else if ( $numSockets > 0 )
|
||||
{
|
||||
if ( count($rSockets) != 1 )
|
||||
ajaxError( "Bogus return from select, ".count($rSockets)." sockets available" );
|
||||
}
|
||||
|
||||
switch( $nbytes = @socket_recvfrom( $socket, $msg, MSG_DATA_SIZE, 0, $remSockFile ) )
|
||||
{
|
||||
case -1 :
|
||||
{
|
||||
ajaxError( "socket_recvfrom( $remSockFile ) failed: ".socket_strerror(socket_last_error()) );
|
||||
break;
|
||||
}
|
||||
case 0 :
|
||||
{
|
||||
ajaxError( "No data to read from socket" );
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
if ( $nbytes != MSG_DATA_SIZE )
|
||||
ajaxError( "Got unexpected message size, got $nbytes, expected ".MSG_DATA_SIZE );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$data = unpack( "ltype", $msg );
|
||||
switch ( $data['type'] )
|
||||
{
|
||||
case MSG_DATA_WATCH :
|
||||
{
|
||||
$data = unpack( "ltype/imonitor/istate/dfps/ilevel/irate/ddelay/izoom/Cdelayed/Cpaused/Cenabled/Cforced", $msg );
|
||||
$data['fps'] = sprintf( "%.2f", $data['fps'] );
|
||||
$data['rate'] /= RATE_BASE;
|
||||
$data['delay'] = sprintf( "%.2f", $data['delay'] );
|
||||
$data['zoom'] = sprintf( "%.1f", $data['zoom']/SCALE_BASE );
|
||||
ajaxResponse( array( 'status'=>$data ) );
|
||||
break;
|
||||
}
|
||||
case MSG_DATA_EVENT :
|
||||
{
|
||||
$data = unpack( "ltype/ievent/iprogress/irate/izoom/Cpaused", $msg );
|
||||
//$data['progress'] = sprintf( "%.2f", $data['progress'] );
|
||||
$data['rate'] /= RATE_BASE;
|
||||
$data['zoom'] = sprintf( "%.1f", $data['zoom']/SCALE_BASE );
|
||||
ajaxResponse( array( 'status'=>$data ) );
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
ajaxError( "Unexpected received message type '$type'" );
|
||||
}
|
||||
}
|
||||
|
||||
ajaxError( 'Unrecognised action or insufficient permissions' );
|
||||
|
||||
function ajaxCleanup()
|
||||
{
|
||||
global $socket, $locSockFile;
|
||||
if ( !empty( $socket ) )
|
||||
@socket_close( $socket );
|
||||
if ( !empty( $locSockFile ) )
|
||||
@unlink( $locSockFile );
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
if ( empty($_REQUEST['mid']) )
|
||||
{
|
||||
ajaxError( 'No monitor id supplied' );
|
||||
}
|
||||
elseif ( !isset($_REQUEST['zid']) )
|
||||
{
|
||||
ajaxError( 'No zone id(s) supplied' );
|
||||
}
|
||||
|
||||
if ( canView( 'Monitors' ) )
|
||||
{
|
||||
switch ( $_REQUEST['action'] )
|
||||
{
|
||||
case "zoneImage" :
|
||||
{
|
||||
$wd = getcwd();
|
||||
chdir( ZM_DIR_IMAGES );
|
||||
$hiColor = "0x00ff00";
|
||||
|
||||
$command = getZmuCommand( " -m ".$_REQUEST['mid']." -z" );
|
||||
if ( !isset($_REQUEST['zid']) )
|
||||
$_REQUEST['zid'] = 0;
|
||||
$command .= "'".$_REQUEST['zid'].' '.$hiColor.' '.$_REQUEST['coords']."'";
|
||||
$status = exec( escapeshellcmd($command) );
|
||||
chdir( $wd );
|
||||
|
||||
$monitor = dbFetchOne( 'SELECT * FROM Monitors WHERE Id = ?', NULL, array($_REQUEST['mid']) );
|
||||
$points = coordsToPoints( $_REQUEST['coords'] );
|
||||
|
||||
ajaxResponse( array(
|
||||
'zoneImage' => ZM_DIR_IMAGES.'/Zones'.$monitor['Id'].'.jpg?'.time(),
|
||||
'selfIntersecting' => isSelfIntersecting( $points ),
|
||||
'area' => getPolyArea( $points )
|
||||
) );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ajaxError( 'Unrecognised action or insufficient permissions' );
|
||||
|
||||
?>
|
|
@ -0,0 +1,13 @@
|
|||
; This file is for unifying the coding style for different editors and IDEs.
|
||||
; More information at http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.bat]
|
||||
end_of_line = crlf
|
|
@ -0,0 +1,33 @@
|
|||
# Define the line ending behavior of the different file extensions
|
||||
# Set default behaviour, in case users don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files we want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.php text
|
||||
*.default text
|
||||
*.ctp text
|
||||
*.sql text
|
||||
*.md text
|
||||
*.po text
|
||||
*.js text
|
||||
*.css text
|
||||
*.ini text
|
||||
*.properties text
|
||||
*.txt text
|
||||
*.xml text
|
||||
*.yml text
|
||||
.htaccess text
|
||||
|
||||
# Declare files that will always have CRLF line endings on checkout.
|
||||
*.bat eol=crlf
|
||||
|
||||
# Declare files that will always have LF line endings on checkout.
|
||||
*.pem eol=lf
|
||||
|
||||
# Denote all files that are truly binary and should not be modified.
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.gif binary
|
||||
*.ico binary
|
||||
*.mo binary
|
|
@ -0,0 +1,21 @@
|
|||
# User specific & automatically generated files #
|
||||
#################################################
|
||||
/app/Config/database.php
|
||||
/app/tmp
|
||||
/lib/Cake/Console/Templates/skel/tmp/
|
||||
/plugins
|
||||
/vendors
|
||||
/build
|
||||
/dist
|
||||
/tags
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
Icon?
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
|
@ -0,0 +1,5 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
RewriteRule ^$ app/webroot/ [L]
|
||||
RewriteRule (.*) app/webroot/$1 [L]
|
||||
</IfModule>
|
|
@ -0,0 +1,12 @@
|
|||
# CMakeLists.txt for the ZoneMinder web API files
|
||||
# The only purpose of this file is to configure the required files
|
||||
|
||||
# Generate random salt and seed for the API
|
||||
string(RANDOM LENGTH 40 ZM_API_SALT)
|
||||
string(RANDOM LENGTH 29 ALPHABET 0123456789 ZM_API_SEED)
|
||||
|
||||
# Configure database.php
|
||||
configure_file(app/Config/database.php.default "${CMAKE_CURRENT_BINARY_DIR}/app/Config/database.php" @ONLY)
|
||||
|
||||
# Configure core.php
|
||||
configure_file(app/Config/core.php.default "${CMAKE_CURRENT_BINARY_DIR}/app/Config/core.php" @ONLY)
|
|
@ -0,0 +1,73 @@
|
|||
# How to contribute
|
||||
|
||||
CakePHP loves to welcome your contributions. There are several ways to help out:
|
||||
* Create an [issue](https://github.com/cakephp/cakephp/issues) on GitHub, if you have found a bug
|
||||
* Write test cases for open bug issues
|
||||
* Write patches for open bug/feature issues, preferably with test cases included
|
||||
* Contribute to the [documentation](https://github.com/cakephp/docs)
|
||||
|
||||
There are a few guidelines that we need contributors to follow so that we have a
|
||||
chance of keeping on top of things.
|
||||
|
||||
## Getting Started
|
||||
|
||||
* Make sure you have a [GitHub account](https://github.com/signup/free).
|
||||
* Submit an [issue](https://github.com/cakephp/cakephp/issues), assuming one does not already exist.
|
||||
* Clearly describe the issue including steps to reproduce when it is a bug.
|
||||
* Make sure you fill in the earliest version that you know has the issue.
|
||||
* Fork the repository on GitHub.
|
||||
|
||||
## Making Changes
|
||||
|
||||
* Create a topic branch from where you want to base your work.
|
||||
* This is usually the master branch.
|
||||
* Only target release branches if you are certain your fix must be on that
|
||||
branch.
|
||||
* To quickly create a topic branch based on master; `git branch
|
||||
master/my_contribution master` then checkout the new branch with `git
|
||||
checkout master/my_contribution`. Better avoid working directly on the
|
||||
`master` branch, to avoid conflicts if you pull in updates from origin.
|
||||
* Make commits of logical units.
|
||||
* Check for unnecessary whitespace with `git diff --check` before committing.
|
||||
* Use descriptive commit messages and reference the #issue number.
|
||||
* Core test cases should continue to pass. You can run tests locally or enable
|
||||
[travis-ci](https://travis-ci.org/) for your fork, so all tests and codesniffs
|
||||
will be executed.
|
||||
* Your work should apply the CakePHP coding standards.
|
||||
|
||||
## Which branch to base the work
|
||||
|
||||
* Bugfix branches will be based on master.
|
||||
* New features that are backwards compatible will be based on next minor release
|
||||
branch.
|
||||
* New features or other non-BC changes will go in the next major release branch.
|
||||
|
||||
## Submitting Changes
|
||||
|
||||
* Push your changes to a topic branch in your fork of the repository.
|
||||
* Submit a pull request to the repository in the cakephp organization, with the
|
||||
correct target branch.
|
||||
|
||||
## Test cases and codesniffer
|
||||
|
||||
CakePHP tests requires [PHPUnit](http://www.phpunit.de/manual/current/en/installation.html)
|
||||
3.5 or higher. To run the test cases locally use the following command:
|
||||
|
||||
./lib/Cake/Console/cake test core AllTests --stderr
|
||||
|
||||
To run the sniffs for CakePHP coding standards:
|
||||
|
||||
phpcs -p --extensions=php --standard=CakePHP ./lib/Cake
|
||||
|
||||
Check the [cakephp-codesniffer](https://github.com/cakephp/cakephp-codesniffer)
|
||||
repository to setup the CakePHP standard. The README contains installation info
|
||||
for the sniff and phpcs.
|
||||
|
||||
# Additional Resources
|
||||
|
||||
* [CakePHP coding standards](http://book.cakephp.org/2.0/en/contributing/cakephp-coding-conventions.html)
|
||||
* [Existing issues](https://github.com/cakephp/cakephp/issues)
|
||||
* [Development Roadmaps](https://github.com/cakephp/cakephp/wiki#roadmaps)
|
||||
* [General GitHub documentation](https://help.github.com/)
|
||||
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
|
||||
* #cakephp IRC channel on freenode.org
|
|
@ -0,0 +1,14 @@
|
|||
ZoneMinder API
|
||||
==============
|
||||
|
||||
This is the ZoneMinder API. It should be, for now, installed under the webroot
|
||||
e.g. /api.
|
||||
|
||||
app/Config/database.php.default must be configured and copied to
|
||||
app/Config/database.php
|
||||
|
||||
In adition, Security.salt and Security.cipherSeed in app/Config/core.php should
|
||||
be changed.
|
||||
|
||||
The API can run on a dedicated / separate instance, so long as it can access
|
||||
the database as ocnfigured in app/Config/database.php
|
|
@ -0,0 +1,5 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
RewriteRule ^$ webroot/ [L]
|
||||
RewriteRule (.*) webroot/$1 [L]
|
||||
</IfModule>
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
/**
|
||||
* This is Acl Schema file
|
||||
*
|
||||
* Use it to configure database for ACL
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config.Schema
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Using the Schema command line utility
|
||||
* cake schema run create DbAcl
|
||||
*
|
||||
*/
|
||||
class DbAclSchema extends CakeSchema {
|
||||
|
||||
public function before($event = array()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function after($event = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
* ACO - Access Control Object - Something that is wanted
|
||||
*/
|
||||
public $acos = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
|
||||
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'model' => array('type' => 'string', 'null' => true),
|
||||
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'alias' => array('type' => 'string', 'null' => true),
|
||||
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||
);
|
||||
|
||||
/**
|
||||
* ARO - Access Request Object - Something that wants something
|
||||
*/
|
||||
public $aros = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
|
||||
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'model' => array('type' => 'string', 'null' => true),
|
||||
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'alias' => array('type' => 'string', 'null' => true),
|
||||
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||
);
|
||||
|
||||
/**
|
||||
* Used by the Cake::Model:Permission class.
|
||||
* Checks if the given $aro has access to action $action in $aco.
|
||||
*/
|
||||
public $aros_acos = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
|
||||
'aro_id' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
|
||||
'aco_id' => array('type' => 'integer', 'null' => false, 'length' => 10),
|
||||
'_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
|
||||
'_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
|
||||
'_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
|
||||
'_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1))
|
||||
);
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
# $Id$
|
||||
#
|
||||
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
#
|
||||
# Licensed under The MIT License
|
||||
# For full copyright and license information, please see the LICENSE.txt
|
||||
# Redistributions of files must retain the above copyright notice.
|
||||
# MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
|
||||
CREATE TABLE acos (
|
||||
id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
parent_id INTEGER(10) DEFAULT NULL,
|
||||
model VARCHAR(255) DEFAULT '',
|
||||
foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
|
||||
alias VARCHAR(255) DEFAULT '',
|
||||
lft INTEGER(10) DEFAULT NULL,
|
||||
rght INTEGER(10) DEFAULT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE aros_acos (
|
||||
id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
aro_id INTEGER(10) UNSIGNED NOT NULL,
|
||||
aco_id INTEGER(10) UNSIGNED NOT NULL,
|
||||
_create CHAR(2) NOT NULL DEFAULT 0,
|
||||
_read CHAR(2) NOT NULL DEFAULT 0,
|
||||
_update CHAR(2) NOT NULL DEFAULT 0,
|
||||
_delete CHAR(2) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
CREATE TABLE aros (
|
||||
id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
parent_id INTEGER(10) DEFAULT NULL,
|
||||
model VARCHAR(255) DEFAULT '',
|
||||
foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
|
||||
alias VARCHAR(255) DEFAULT '',
|
||||
lft INTEGER(10) DEFAULT NULL,
|
||||
rght INTEGER(10) DEFAULT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* This is i18n Schema file
|
||||
*
|
||||
* Use it to configure database for i18n
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config.Schema
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Using the Schema command line utility
|
||||
*
|
||||
* Use it to configure database for i18n
|
||||
*
|
||||
* cake schema run create i18n
|
||||
*/
|
||||
class I18nSchema extends CakeSchema {
|
||||
|
||||
public $name = 'i18n';
|
||||
|
||||
public function before($event = array()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function after($event = array()) {
|
||||
}
|
||||
|
||||
public $i18n = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
|
||||
'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),
|
||||
'model' => array('type' => 'string', 'null' => false, 'key' => 'index'),
|
||||
'foreign_key' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
|
||||
'field' => array('type' => 'string', 'null' => false, 'key' => 'index'),
|
||||
'content' => array('type' => 'text', 'null' => true, 'default' => null),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
|
||||
);
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
# $Id$
|
||||
#
|
||||
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
#
|
||||
# Licensed under The MIT License
|
||||
# For full copyright and license information, please see the LICENSE.txt
|
||||
# Redistributions of files must retain the above copyright notice.
|
||||
# MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
|
||||
CREATE TABLE i18n (
|
||||
id int(10) NOT NULL auto_increment,
|
||||
locale varchar(6) NOT NULL,
|
||||
model varchar(255) NOT NULL,
|
||||
foreign_key int(10) NOT NULL,
|
||||
field varchar(255) NOT NULL,
|
||||
content mediumtext,
|
||||
PRIMARY KEY (id),
|
||||
# UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field),
|
||||
# INDEX I18N_LOCALE_ROW(locale, model, foreign_key),
|
||||
# INDEX I18N_LOCALE_MODEL(locale, model),
|
||||
# INDEX I18N_FIELD(model, foreign_key, field),
|
||||
# INDEX I18N_ROW(model, foreign_key),
|
||||
INDEX locale (locale),
|
||||
INDEX model (model),
|
||||
INDEX row_id (foreign_key),
|
||||
INDEX field (field)
|
||||
);
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* This is Sessions Schema file
|
||||
*
|
||||
* Use it to configure database for Sessions
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config.Schema
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Using the Schema command line utility
|
||||
* cake schema run create Sessions
|
||||
*
|
||||
*/
|
||||
class SessionsSchema extends CakeSchema {
|
||||
|
||||
public $name = 'Sessions';
|
||||
|
||||
public function before($event = array()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function after($event = array()) {
|
||||
}
|
||||
|
||||
public $cake_sessions = array(
|
||||
'id' => array('type' => 'string', 'null' => false, 'key' => 'primary'),
|
||||
'data' => array('type' => 'text', 'null' => true, 'default' => null),
|
||||
'expires' => array('type' => 'integer', 'null' => true, 'default' => null),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||
);
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
# $Id$
|
||||
#
|
||||
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
# 1785 E. Sahara Avenue, Suite 490-204
|
||||
# Las Vegas, Nevada 89104
|
||||
#
|
||||
# Licensed under The MIT License
|
||||
# For full copyright and license information, please see the LICENSE.txt
|
||||
# Redistributions of files must retain the above copyright notice.
|
||||
# MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
|
||||
CREATE TABLE cake_sessions (
|
||||
id varchar(255) NOT NULL default '',
|
||||
data text,
|
||||
expires int(11) default NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
|
@ -0,0 +1,65 @@
|
|||
;<?php exit() ?>
|
||||
;/**
|
||||
; * ACL Configuration
|
||||
; *
|
||||
; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
; * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
; *
|
||||
; * Licensed under The MIT License
|
||||
; * Redistributions of files must retain the above copyright notice.
|
||||
; *
|
||||
; * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
; * @link http://cakephp.org CakePHP(tm) Project
|
||||
; * @package app.Config
|
||||
; * @since CakePHP(tm) v 0.10.0.1076
|
||||
; * @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
; */
|
||||
|
||||
; acl.ini.php - Cake ACL Configuration
|
||||
; ---------------------------------------------------------------------
|
||||
; Use this file to specify user permissions.
|
||||
; aco = access control object (something in your application)
|
||||
; aro = access request object (something requesting access)
|
||||
;
|
||||
; User records are added as follows:
|
||||
;
|
||||
; [uid]
|
||||
; groups = group1, group2, group3
|
||||
; allow = aco1, aco2, aco3
|
||||
; deny = aco4, aco5, aco6
|
||||
;
|
||||
; Group records are added in a similar manner:
|
||||
;
|
||||
; [gid]
|
||||
; allow = aco1, aco2, aco3
|
||||
; deny = aco4, aco5, aco6
|
||||
;
|
||||
; The allow, deny, and groups sections are all optional.
|
||||
; NOTE: groups names *cannot* ever be the same as usernames!
|
||||
;
|
||||
; ACL permissions are checked in the following order:
|
||||
; 1. Check for user denies (and DENY if specified)
|
||||
; 2. Check for user allows (and ALLOW if specified)
|
||||
; 3. Gather user's groups
|
||||
; 4. Check group denies (and DENY if specified)
|
||||
; 5. Check group allows (and ALLOW if specified)
|
||||
; 6. If no aro, aco, or group information is found, DENY
|
||||
;
|
||||
; ---------------------------------------------------------------------
|
||||
|
||||
;-------------------------------------
|
||||
;Users
|
||||
;-------------------------------------
|
||||
|
||||
[username-goes-here]
|
||||
groups = group1, group2
|
||||
deny = aco1, aco2
|
||||
allow = aco3, aco4
|
||||
|
||||
;-------------------------------------
|
||||
;Groups
|
||||
;-------------------------------------
|
||||
|
||||
[groupname-goes-here]
|
||||
deny = aco5, aco6
|
||||
allow = aco7, aco8
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
/**
|
||||
* This is the PHP base ACL configuration file.
|
||||
*
|
||||
* Use it to configure access control of your CakePHP application.
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 2.1
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Example
|
||||
* -------
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
* 1. In your application you created a User model with the following properties:
|
||||
* username, group_id, password, email, firstname, lastname and so on.
|
||||
* 2. You configured AuthComponent to authorize actions via
|
||||
* $this->Auth->authorize = array('Actions' => array('actionPath' => 'controllers/'),...)
|
||||
*
|
||||
* Now, when a user (i.e. jeff) authenticates successfully and requests a controller action (i.e. /invoices/delete)
|
||||
* that is not allowed by default (e.g. via $this->Auth->allow('edit') in the Invoices controller) then AuthComponent
|
||||
* will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be
|
||||
* done via a call to Acl->check() with
|
||||
*
|
||||
* array('User' => array('username' => 'jeff', 'group_id' => 4, ...))
|
||||
*
|
||||
* as ARO and
|
||||
*
|
||||
* '/controllers/invoices/delete'
|
||||
*
|
||||
* as ACO.
|
||||
*
|
||||
* If the configured map looks like
|
||||
*
|
||||
* $config['map'] = array(
|
||||
* 'User' => 'User/username',
|
||||
* 'Role' => 'User/group_id',
|
||||
* );
|
||||
*
|
||||
* then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to
|
||||
* find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to
|
||||
* check rules for the given ACO. The search can be expanded by defining aliases in the alias configuration.
|
||||
* E.g. if you want to use a more readable name than Role/4 in your definitions you can define an alias like
|
||||
*
|
||||
* $config['alias'] = array(
|
||||
* 'Role/4' => 'Role/editor',
|
||||
* );
|
||||
*
|
||||
* In the roles configuration you can define roles on the lhs and inherited roles on the rhs:
|
||||
*
|
||||
* $config['roles'] = array(
|
||||
* 'Role/admin' => null,
|
||||
* 'Role/accountant' => null,
|
||||
* 'Role/editor' => null,
|
||||
* 'Role/manager' => 'Role/editor, Role/accountant',
|
||||
* 'User/jeff' => 'Role/manager',
|
||||
* );
|
||||
*
|
||||
* In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role.
|
||||
* Lets define some rules:
|
||||
*
|
||||
* $config['rules'] = array(
|
||||
* 'allow' => array(
|
||||
* '*' => 'Role/admin',
|
||||
* 'controllers/users/(dashboard|profile)' => 'Role/default',
|
||||
* 'controllers/invoices/*' => 'Role/accountant',
|
||||
* 'controllers/articles/*' => 'Role/editor',
|
||||
* 'controllers/users/*' => 'Role/manager',
|
||||
* 'controllers/invoices/delete' => 'Role/manager',
|
||||
* ),
|
||||
* 'deny' => array(
|
||||
* 'controllers/invoices/delete' => 'Role/accountant, User/jeff',
|
||||
* 'controllers/articles/(delete|publish)' => 'Role/editor',
|
||||
* ),
|
||||
* );
|
||||
*
|
||||
* Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager,
|
||||
* Role/editor, Role/accountant and Role/default. However, for jeff, rules for User/jeff are more specific than
|
||||
* rules for Role/manager, rules for Role/manager are more specific than rules for Role/editor and so on.
|
||||
* This is important when allow and deny rules match for a role. E.g. Role/accountant is allowed
|
||||
* controllers/invoices/* but at the same time controllers/invoices/delete is denied. But there is a more
|
||||
* specific rule defined for Role/manager which is allowed controllers/invoices/delete. However, the most specific
|
||||
* rule denies access to the delete action explicitly for User/jeff, so he'll be denied access to the resource.
|
||||
*
|
||||
* If we would remove the role definition for User/jeff, then jeff would be granted access as he would be resolved
|
||||
* to Role/manager and Role/manager has an allow rule.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The role map defines how to resolve the user record from your application
|
||||
* to the roles you defined in the roles configuration.
|
||||
*/
|
||||
$config['map'] = array(
|
||||
'User' => 'User/username',
|
||||
'Role' => 'User/group_id',
|
||||
);
|
||||
|
||||
/**
|
||||
* define aliases to map your model information to
|
||||
* the roles defined in your role configuration.
|
||||
*/
|
||||
$config['alias'] = array(
|
||||
'Role/4' => 'Role/editor',
|
||||
);
|
||||
|
||||
/**
|
||||
* role configuration
|
||||
*/
|
||||
$config['roles'] = array(
|
||||
'Role/admin' => null,
|
||||
);
|
||||
|
||||
/**
|
||||
* rule configuration
|
||||
*/
|
||||
$config['rules'] = array(
|
||||
'allow' => array(
|
||||
'*' => 'Role/admin',
|
||||
),
|
||||
'deny' => array(),
|
||||
);
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is loaded automatically by the app/webroot/index.php file after core.php
|
||||
*
|
||||
* This file should load/create any application wide configuration settings, such as
|
||||
* Caching, Logging, loading additional configuration files.
|
||||
*
|
||||
* You should also use this file to include any files that provide global functions/constants
|
||||
* that your application uses.
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 0.10.8.2117
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
// Setup a 'default' cache configuration for use in the application.
|
||||
Cache::config('default', array('engine' => 'File'));
|
||||
|
||||
/**
|
||||
* The settings below can be used to set additional paths to models, views and controllers.
|
||||
*
|
||||
* App::build(array(
|
||||
* 'Model' => array('/path/to/models/', '/next/path/to/models/'),
|
||||
* 'Model/Behavior' => array('/path/to/behaviors/', '/next/path/to/behaviors/'),
|
||||
* 'Model/Datasource' => array('/path/to/datasources/', '/next/path/to/datasources/'),
|
||||
* 'Model/Datasource/Database' => array('/path/to/databases/', '/next/path/to/database/'),
|
||||
* 'Model/Datasource/Session' => array('/path/to/sessions/', '/next/path/to/sessions/'),
|
||||
* 'Controller' => array('/path/to/controllers/', '/next/path/to/controllers/'),
|
||||
* 'Controller/Component' => array('/path/to/components/', '/next/path/to/components/'),
|
||||
* 'Controller/Component/Auth' => array('/path/to/auths/', '/next/path/to/auths/'),
|
||||
* 'Controller/Component/Acl' => array('/path/to/acls/', '/next/path/to/acls/'),
|
||||
* 'View' => array('/path/to/views/', '/next/path/to/views/'),
|
||||
* 'View/Helper' => array('/path/to/helpers/', '/next/path/to/helpers/'),
|
||||
* 'Console' => array('/path/to/consoles/', '/next/path/to/consoles/'),
|
||||
* 'Console/Command' => array('/path/to/commands/', '/next/path/to/commands/'),
|
||||
* 'Console/Command/Task' => array('/path/to/tasks/', '/next/path/to/tasks/'),
|
||||
* 'Lib' => array('/path/to/libs/', '/next/path/to/libs/'),
|
||||
* 'Locale' => array('/path/to/locales/', '/next/path/to/locales/'),
|
||||
* 'Vendor' => array('/path/to/vendors/', '/next/path/to/vendors/'),
|
||||
* 'Plugin' => array('/path/to/plugins/', '/next/path/to/plugins/'),
|
||||
* ));
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Custom Inflector rules can be set to correctly pluralize or singularize table, model, controller names or whatever other
|
||||
* string is passed to the inflection functions
|
||||
*
|
||||
* Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
|
||||
* Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
|
||||
* Uncomment one of the lines below, as you need. Make sure you read the documentation on CakePlugin to use more
|
||||
* advanced ways of loading plugins
|
||||
*
|
||||
* CakePlugin::loadAll(); // Loads all plugins at once
|
||||
* CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters:
|
||||
*
|
||||
* - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
|
||||
* - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
|
||||
*
|
||||
* Feel free to remove or add filters as you see fit for your application. A few examples:
|
||||
*
|
||||
* Configure::write('Dispatcher.filters', array(
|
||||
* 'MyCacheFilter', // will use MyCacheFilter class from the Routing/Filter package in your app.
|
||||
* 'MyCacheFilter' => array('prefix' => 'my_cache_'), // will use MyCacheFilter class from the Routing/Filter package in your app with settings array.
|
||||
* 'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
|
||||
* array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
|
||||
* array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
|
||||
*
|
||||
* ));
|
||||
*/
|
||||
Configure::write('Dispatcher.filters', array(
|
||||
'AssetDispatcher',
|
||||
'CacheDispatcher'
|
||||
));
|
||||
|
||||
/**
|
||||
* Configures default file logging options
|
||||
*/
|
||||
App::uses('CakeLog', 'Log');
|
||||
CakeLog::config('debug', array(
|
||||
'engine' => 'File',
|
||||
'types' => array('notice', 'info', 'debug'),
|
||||
'file' => 'debug',
|
||||
));
|
||||
CakeLog::config('error', array(
|
||||
'engine' => 'File',
|
||||
'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
|
||||
'file' => 'error',
|
||||
));
|
|
@ -0,0 +1,387 @@
|
|||
<?php
|
||||
/**
|
||||
* This is core configuration file.
|
||||
*
|
||||
* Use it to configure core behavior of Cake.
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* CakePHP Debug Level:
|
||||
*
|
||||
* Production Mode:
|
||||
* 0: No error messages, errors, or warnings shown. Flash messages redirect.
|
||||
*
|
||||
* Development Mode:
|
||||
* 1: Errors and warnings shown, model caches refreshed, flash messages halted.
|
||||
* 2: As in 1, but also with full debug messages and SQL output.
|
||||
*
|
||||
* 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 the Error handler used to handle errors for your application. By default
|
||||
* ErrorHandler::handleError() is used. It will display errors using Debugger, when debug > 0
|
||||
* and log errors with CakeLog when debug = 0.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `handler` - callback - The callback to handle errors. You can set this to any callable type,
|
||||
* including anonymous functions.
|
||||
* Make sure you add App::uses('MyHandler', 'Error'); when using a custom handler class
|
||||
* - `level` - integer - The level of errors you are interested in capturing.
|
||||
* - `trace` - boolean - Include stack traces for errors in log files.
|
||||
*
|
||||
* @see ErrorHandler for more information on error handling and configuration.
|
||||
*/
|
||||
Configure::write('Error', array(
|
||||
'handler' => 'ErrorHandler::handleError',
|
||||
'level' => E_ALL & ~E_DEPRECATED,
|
||||
'trace' => true
|
||||
));
|
||||
|
||||
/**
|
||||
* Configure the Exception handler used for uncaught exceptions. By default,
|
||||
* ErrorHandler::handleException() is used. It will display a HTML page for the exception, and
|
||||
* while debug > 0, framework errors like Missing Controller will be displayed. When debug = 0,
|
||||
* framework errors will be coerced into generic HTTP errors.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
|
||||
* including anonymous functions.
|
||||
* Make sure you add App::uses('MyHandler', 'Error'); when using a custom handler class
|
||||
* - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you
|
||||
* should place the file for that class in app/Lib/Error. This class needs to implement a render method.
|
||||
* - `log` - boolean - Should Exceptions be logged?
|
||||
* - `skipLog` - array - list of exceptions to skip for logging. Exceptions that
|
||||
* extend one of the listed exceptions will also be skipped for logging.
|
||||
* Example: `'skipLog' => array('NotFoundException', 'UnauthorizedException')`
|
||||
*
|
||||
* @see ErrorHandler for more information on exception handling and configuration.
|
||||
*/
|
||||
Configure::write('Exception', array(
|
||||
'handler' => 'ErrorHandler::handleException',
|
||||
'renderer' => 'ExceptionRenderer',
|
||||
'log' => true
|
||||
));
|
||||
|
||||
/**
|
||||
* Application wide charset encoding
|
||||
*/
|
||||
Configure::write('App.encoding', 'UTF-8');
|
||||
|
||||
/**
|
||||
* To configure CakePHP *not* to use mod_rewrite and to
|
||||
* use CakePHP pretty URLs, remove these .htaccess
|
||||
* files:
|
||||
*
|
||||
* /.htaccess
|
||||
* /app/.htaccess
|
||||
* /app/webroot/.htaccess
|
||||
*
|
||||
* And uncomment the App.baseUrl below. But keep in mind
|
||||
* that plugin assets such as images, CSS and JavaScript files
|
||||
* will not work without URL rewriting!
|
||||
* To work around this issue you should either symlink or copy
|
||||
* the plugin assets into you app's webroot directory. This is
|
||||
* recommended even when you are using mod_rewrite. Handling static
|
||||
* assets through the Dispatcher is incredibly inefficient and
|
||||
* included primarily as a development convenience - and
|
||||
* thus not recommended for production applications.
|
||||
*/
|
||||
//Configure::write('App.baseUrl', env('SCRIPT_NAME'));
|
||||
|
||||
/**
|
||||
* To configure CakePHP to use a particular domain URL
|
||||
* for any URL generation inside the application, set the following
|
||||
* configuration variable to the http(s) address to your domain. This
|
||||
* will override the automatic detection of full base URL and can be
|
||||
* useful when generating links from the CLI (e.g. sending emails)
|
||||
*/
|
||||
//Configure::write('App.fullBaseUrl', 'http://example.com');
|
||||
|
||||
/**
|
||||
* Web path to the public images directory under webroot.
|
||||
* If not set defaults to 'img/'
|
||||
*/
|
||||
//Configure::write('App.imageBaseUrl', 'img/');
|
||||
|
||||
/**
|
||||
* Web path to the CSS files directory under webroot.
|
||||
* If not set defaults to 'css/'
|
||||
*/
|
||||
//Configure::write('App.cssBaseUrl', 'css/');
|
||||
|
||||
/**
|
||||
* Web path to the js files directory under webroot.
|
||||
* If not set defaults to 'js/'
|
||||
*/
|
||||
//Configure::write('App.jsBaseUrl', 'js/');
|
||||
|
||||
/**
|
||||
* Uncomment the define below to use CakePHP prefix routes.
|
||||
*
|
||||
* The value of the define determines the names of the routes
|
||||
* and their associated controller actions:
|
||||
*
|
||||
* Set to an array of prefixes you want to use in your application. Use for
|
||||
* admin or other prefixed routes.
|
||||
*
|
||||
* Routing.prefixes = array('admin', 'manager');
|
||||
*
|
||||
* Enables:
|
||||
* `admin_index()` and `/admin/controller/index`
|
||||
* `manager_index()` and `/manager/controller/index`
|
||||
*
|
||||
*/
|
||||
//Configure::write('Routing.prefixes', array('admin'));
|
||||
|
||||
/**
|
||||
* Turn off all caching application-wide.
|
||||
*
|
||||
*/
|
||||
//Configure::write('Cache.disable', true);
|
||||
|
||||
/**
|
||||
* Enable cache checking.
|
||||
*
|
||||
* If set to true, for view caching you must still use the controller
|
||||
* public $cacheAction inside your controllers to define caching settings.
|
||||
* You can either set it controller-wide by setting public $cacheAction = true,
|
||||
* or in each action using $this->cacheAction = true.
|
||||
*
|
||||
*/
|
||||
//Configure::write('Cache.check', true);
|
||||
|
||||
/**
|
||||
* Enable cache view prefixes.
|
||||
*
|
||||
* If set it will be prepended to the cache name for view file caching. This is
|
||||
* helpful if you deploy the same application via multiple subdomains and languages,
|
||||
* for instance. Each version can then have its own view cache namespace.
|
||||
* Note: The final cache file name will then be `prefix_cachefilename`.
|
||||
*/
|
||||
//Configure::write('Cache.viewPrefix', 'prefix');
|
||||
|
||||
/**
|
||||
* Session configuration.
|
||||
*
|
||||
* Contains an array of settings to use for session configuration. The defaults key is
|
||||
* used to define a default preset to use for sessions, any settings declared here will override
|
||||
* the settings of the default config.
|
||||
*
|
||||
* ## Options
|
||||
*
|
||||
* - `Session.cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'
|
||||
* - `Session.timeout` - The number of minutes you want sessions to live for. This timeout is handled by CakePHP
|
||||
* - `Session.cookieTimeout` - The number of minutes you want session cookies to live for.
|
||||
* - `Session.checkAgent` - Do you want the user agent to be checked when starting sessions? You might want to set the
|
||||
* value to false, when dealing with older versions of IE, Chrome Frame or certain web-browsing devices and AJAX
|
||||
* - `Session.defaults` - The default configuration set to use as a basis for your session.
|
||||
* There are four builtins: php, cake, cache, database.
|
||||
* - `Session.handler` - Can be used to enable a custom session handler. Expects an array of callables,
|
||||
* that can be used with `session_save_handler`. Using this option will automatically add `session.save_handler`
|
||||
* to the ini array.
|
||||
* - `Session.autoRegenerate` - Enabling this setting, turns on automatic renewal of sessions, and
|
||||
* sessionids that change frequently. See CakeSession::$requestCountdown.
|
||||
* - `Session.ini` - An associative array of additional ini values to set.
|
||||
*
|
||||
* The built in defaults are:
|
||||
*
|
||||
* - 'php' - Uses settings defined in your php.ini.
|
||||
* - 'cake' - Saves session files in CakePHP's /tmp directory.
|
||||
* - 'database' - Uses CakePHP's database sessions.
|
||||
* - 'cache' - Use the Cache class to save sessions.
|
||||
*
|
||||
* To define a custom session handler, save it at /app/Model/Datasource/Session/<name>.php.
|
||||
* Make sure the class implements `CakeSessionHandlerInterface` and set Session.handler to <name>
|
||||
*
|
||||
* To use database sessions, run the app/Config/Schema/sessions.php schema using
|
||||
* the cake shell command: cake schema create Sessions
|
||||
*
|
||||
*/
|
||||
Configure::write('Session', array(
|
||||
'defaults' => 'php'
|
||||
));
|
||||
|
||||
/**
|
||||
* A random string used in security hashing methods.
|
||||
*/
|
||||
Configure::write('Security.salt', '@ZM_API_SALT@');
|
||||
|
||||
/**
|
||||
* A random numeric string (digits only) used to encrypt/decrypt strings.
|
||||
*/
|
||||
Configure::write('Security.cipherSeed', '@ZM_API_SEED@');
|
||||
|
||||
/**
|
||||
* Apply timestamps with the last modified time to static assets (js, css, images).
|
||||
* Will append a query string parameter containing the time the file was modified. This is
|
||||
* useful for invalidating browser caches.
|
||||
*
|
||||
* Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable
|
||||
* timestamping regardless of debug value.
|
||||
*/
|
||||
//Configure::write('Asset.timestamp', true);
|
||||
|
||||
/**
|
||||
* Compress CSS output by removing comments, whitespace, repeating tags, etc.
|
||||
* This requires a/var/cache directory to be writable by the web server for caching.
|
||||
* and /vendors/csspp/csspp.php
|
||||
*
|
||||
* To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css().
|
||||
*/
|
||||
//Configure::write('Asset.filter.css', 'css.php');
|
||||
|
||||
/**
|
||||
* Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the
|
||||
* output, and setting the config below to the name of the script.
|
||||
*
|
||||
* To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JsHelper::link().
|
||||
*/
|
||||
//Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
|
||||
|
||||
/**
|
||||
* The class name and database used in CakePHP's
|
||||
* access control lists.
|
||||
*/
|
||||
Configure::write('Acl.classname', 'DbAcl');
|
||||
Configure::write('Acl.database', 'default');
|
||||
|
||||
/**
|
||||
* Uncomment this line and correct your server timezone to fix
|
||||
* any date & time related errors.
|
||||
*/
|
||||
//date_default_timezone_set('UTC');
|
||||
|
||||
/**
|
||||
* `Config.timezone` is available in which you can set users' timezone string.
|
||||
* If a method of CakeTime class is called with $timezone parameter as null and `Config.timezone` is set,
|
||||
* then the value of `Config.timezone` will be used. This feature allows you to set users' timezone just
|
||||
* once instead of passing it each time in function calls.
|
||||
*/
|
||||
//Configure::write('Config.timezone', 'Europe/Paris');
|
||||
|
||||
/**
|
||||
*
|
||||
* Cache Engine Configuration
|
||||
* Default settings provided below
|
||||
*
|
||||
* File storage engine.
|
||||
*
|
||||
* Cache::config('default', array(
|
||||
* 'engine' => 'File', //[required]
|
||||
* 'duration' => 3600, //[optional]
|
||||
* 'probability' => 100, //[optional]
|
||||
* 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path
|
||||
* 'prefix' => 'cake_', //[optional] prefix every cache file with this string
|
||||
* 'lock' => false, //[optional] use file locking
|
||||
* 'serialize' => true, //[optional]
|
||||
* 'mask' => 0664, //[optional]
|
||||
* ));
|
||||
*
|
||||
* APC (http://pecl.php.net/package/APC)
|
||||
*
|
||||
* Cache::config('default', array(
|
||||
* 'engine' => 'Apc', //[required]
|
||||
* 'duration' => 3600, //[optional]
|
||||
* 'probability' => 100, //[optional]
|
||||
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
||||
* ));
|
||||
*
|
||||
* Xcache (http://xcache.lighttpd.net/)
|
||||
*
|
||||
* Cache::config('default', array(
|
||||
* 'engine' => 'Xcache', //[required]
|
||||
* 'duration' => 3600, //[optional]
|
||||
* 'probability' => 100, //[optional]
|
||||
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
||||
* 'user' => 'user', //user from xcache.admin.user settings
|
||||
* 'password' => 'password', //plaintext password (xcache.admin.pass)
|
||||
* ));
|
||||
*
|
||||
* Memcached (http://www.danga.com/memcached/)
|
||||
*
|
||||
* Uses the memcached extension. See http://php.net/memcached
|
||||
*
|
||||
* Cache::config('default', array(
|
||||
* 'engine' => 'Memcached', //[required]
|
||||
* 'duration' => 3600, //[optional]
|
||||
* 'probability' => 100, //[optional]
|
||||
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
||||
* 'servers' => array(
|
||||
* '127.0.0.1:11211' // localhost, default port 11211
|
||||
* ), //[optional]
|
||||
* 'persistent' => 'my_connection', // [optional] The name of the persistent connection.
|
||||
* 'compress' => false, // [optional] compress data in Memcached (slower, but uses less memory)
|
||||
* ));
|
||||
*
|
||||
* Wincache (http://php.net/wincache)
|
||||
*
|
||||
* Cache::config('default', array(
|
||||
* 'engine' => 'Wincache', //[required]
|
||||
* 'duration' => 3600, //[optional]
|
||||
* 'probability' => 100, //[optional]
|
||||
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
||||
* ));
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configure the cache handlers that CakePHP will use for internal
|
||||
* metadata like class maps, and model schema.
|
||||
*
|
||||
* By default File is used, but for improved performance you should use APC.
|
||||
*
|
||||
* Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
|
||||
* Please check the comments in bootstrap.php for more info on the cache engines available
|
||||
* and their settings.
|
||||
*/
|
||||
$engine = 'File';
|
||||
|
||||
// In development mode, caches should expire quickly.
|
||||
$duration = '+999 days';
|
||||
if (Configure::read('debug') > 0) {
|
||||
$duration = '+10 seconds';
|
||||
}
|
||||
|
||||
// Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts.
|
||||
$prefix = 'myapp_';
|
||||
|
||||
/**
|
||||
* Configure the cache used for general framework caching. Path information,
|
||||
* object listings, and translation cache files are stored with this configuration.
|
||||
*/
|
||||
Cache::config('_cake_core_', array(
|
||||
'engine' => $engine,
|
||||
'prefix' => $prefix . 'cake_core_',
|
||||
'path' => CACHE . 'persistent' . DS,
|
||||
'serialize' => ($engine === 'File'),
|
||||
'duration' => $duration
|
||||
));
|
||||
|
||||
/**
|
||||
* Configure the cache for model and datasource caches. This cache configuration
|
||||
* is used to store schema descriptions, and table listings in connections.
|
||||
*/
|
||||
Cache::config('_cake_model_', array(
|
||||
'engine' => $engine,
|
||||
'prefix' => $prefix . 'cake_model_',
|
||||
'path' => CACHE . 'models' . DS,
|
||||
'serialize' => ($engine === 'File'),
|
||||
'duration' => $duration
|
||||
));
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Database configuration class.
|
||||
*
|
||||
* You can specify multiple configurations for production, development and testing.
|
||||
*
|
||||
* datasource => The name of a supported datasource; valid options are as follows:
|
||||
* Database/Mysql - MySQL 4 & 5,
|
||||
* Database/Sqlite - SQLite (PHP5 only),
|
||||
* Database/Postgres - PostgreSQL 7 and higher,
|
||||
* Database/Sqlserver - Microsoft SQL Server 2005 and higher
|
||||
*
|
||||
* You can add custom database datasources (or override existing datasources) by adding the
|
||||
* appropriate file to app/Model/Datasource/Database. Datasources should be named 'MyDatasource.php',
|
||||
*
|
||||
*
|
||||
* persistent => true / false
|
||||
* Determines whether or not the database should use a persistent connection
|
||||
*
|
||||
* host =>
|
||||
* the host you connect to the database. To add a socket or port number, use 'port' => #
|
||||
*
|
||||
* prefix =>
|
||||
* Uses the given prefix for all the tables in this database. This setting can be overridden
|
||||
* on a per-table basis with the Model::$tablePrefix property.
|
||||
*
|
||||
* schema =>
|
||||
* For Postgres/Sqlserver specifies which schema you would like to use the tables in.
|
||||
* Postgres defaults to 'public'. For Sqlserver, it defaults to empty and use
|
||||
* the connected user's default schema (typically 'dbo').
|
||||
*
|
||||
* encoding =>
|
||||
* For MySQL, Postgres specifies the character encoding to use when connecting to the
|
||||
* database. Uses database default not specified.
|
||||
*
|
||||
* unix_socket =>
|
||||
* For MySQL to connect via socket specify the `unix_socket` parameter instead of `host` and `port`
|
||||
*
|
||||
* settings =>
|
||||
* Array of key/value pairs, on connection it executes SET statements for each pair
|
||||
* For MySQL : http://dev.mysql.com/doc/refman/5.6/en/set-statement.html
|
||||
* For Postgres : http://www.postgresql.org/docs/9.2/static/sql-set.html
|
||||
* For Sql Server : http://msdn.microsoft.com/en-us/library/ms190356.aspx
|
||||
*
|
||||
* flags =>
|
||||
* A key/value array of driver specific connection options.
|
||||
*/
|
||||
class DATABASE_CONFIG {
|
||||
|
||||
public $default = array(
|
||||
'datasource' => 'Database/Mysql',
|
||||
'persistent' => false,
|
||||
'host' => '@ZM_DB_HOST@',
|
||||
'login' => '@ZM_DB_USER@',
|
||||
'password' => '@ZM_DB_PASS@',
|
||||
'database' => '@ZM_DB_NAME@',
|
||||
'prefix' => '',
|
||||
//'encoding' => 'utf8',
|
||||
);
|
||||
|
||||
public $test = array(
|
||||
'datasource' => 'Database/Mysql',
|
||||
'persistent' => false,
|
||||
'host' => 'localhost',
|
||||
'login' => 'user',
|
||||
'password' => 'password',
|
||||
'database' => 'test_database_name',
|
||||
'prefix' => '',
|
||||
//'encoding' => 'utf8',
|
||||
);
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 2.0.0
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is email configuration file.
|
||||
*
|
||||
* Use it to configure email transports of CakePHP.
|
||||
*
|
||||
* Email configuration class.
|
||||
* You can specify multiple configurations for production, development and testing.
|
||||
*
|
||||
* transport => The name of a supported transport; valid options are as follows:
|
||||
* Mail - Send using PHP mail function
|
||||
* Smtp - Send using SMTP
|
||||
* Debug - Do not send the email, just return the result
|
||||
*
|
||||
* You can add custom transports (or override existing transports) by adding the
|
||||
* appropriate file to app/Network/Email. Transports should be named 'YourTransport.php',
|
||||
* where 'Your' is the name of the transport.
|
||||
*
|
||||
* from =>
|
||||
* The origin email. See CakeEmail::from() about the valid values
|
||||
*
|
||||
*/
|
||||
class EmailConfig {
|
||||
|
||||
public $default = array(
|
||||
'transport' => 'Mail',
|
||||
'from' => 'you@localhost',
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
);
|
||||
|
||||
public $smtp = array(
|
||||
'transport' => 'Smtp',
|
||||
'from' => array('site@localhost' => 'My Site'),
|
||||
'host' => 'localhost',
|
||||
'port' => 25,
|
||||
'timeout' => 30,
|
||||
'username' => 'user',
|
||||
'password' => 'secret',
|
||||
'client' => null,
|
||||
'log' => false,
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
);
|
||||
|
||||
public $fast = array(
|
||||
'from' => 'you@localhost',
|
||||
'sender' => null,
|
||||
'to' => null,
|
||||
'cc' => null,
|
||||
'bcc' => null,
|
||||
'replyTo' => null,
|
||||
'readReceipt' => null,
|
||||
'returnPath' => null,
|
||||
'messageId' => true,
|
||||
'subject' => null,
|
||||
'message' => null,
|
||||
'headers' => null,
|
||||
'viewRender' => null,
|
||||
'template' => false,
|
||||
'layout' => false,
|
||||
'viewVars' => null,
|
||||
'attachments' => null,
|
||||
'emailFormat' => null,
|
||||
'transport' => 'Smtp',
|
||||
'host' => 'localhost',
|
||||
'port' => 25,
|
||||
'timeout' => 30,
|
||||
'username' => 'user',
|
||||
'password' => 'secret',
|
||||
'client' => null,
|
||||
'log' => true,
|
||||
//'charset' => 'utf-8',
|
||||
//'headerCharset' => 'utf-8',
|
||||
);
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
/**
|
||||
* Routes configuration
|
||||
*
|
||||
* In this file, you set up routes to your controllers and their actions.
|
||||
* Routes are very important mechanism that allows you to freely connect
|
||||
* different URLs to chosen controllers and their actions (functions).
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Config
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load the API / REST routes
|
||||
*/
|
||||
Router::mapResources('monitors');
|
||||
Router::mapResources('zones');
|
||||
Router::mapResources('configs');
|
||||
Router::mapResources('events');
|
||||
Router::mapResources('frames');
|
||||
Router::parseExtensions();
|
||||
|
||||
/**
|
||||
* Here, we are connecting '/' (base path) to controller called 'Pages',
|
||||
* its action called 'display', and we pass a param to select the view file
|
||||
* to use (in this case, /app/View/Pages/home.ctp)...
|
||||
*/
|
||||
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
|
||||
/**
|
||||
* ...and connect the rest of 'Pages' controller's URLs.
|
||||
*/
|
||||
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
|
||||
|
||||
/**
|
||||
* Load all plugin routes. See the CakePlugin documentation on
|
||||
* how to customize the loading of plugin routes.
|
||||
*/
|
||||
CakePlugin::routes();
|
||||
|
||||
/**
|
||||
* Load the CakePHP default routes. Only remove this if you do not want to use
|
||||
* the built-in default routes.
|
||||
*/
|
||||
require CAKE . 'Config' . DS . 'routes.php';
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* AppShell file
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @since CakePHP(tm) v 2.0
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('Shell', 'Console');
|
||||
|
||||
/**
|
||||
* Application Shell
|
||||
*
|
||||
* Add your application-wide methods in the class below, your shells
|
||||
* will inherit them.
|
||||
*
|
||||
* @package app.Console.Command
|
||||
*/
|
||||
class AppShell extends Shell {
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
################################################################################
|
||||
#
|
||||
# Bake is a shell script for running CakePHP bake script
|
||||
#
|
||||
# CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
#
|
||||
# Licensed under The MIT License
|
||||
# For full copyright and license information, please see the LICENSE.txt
|
||||
# Redistributions of files must retain the above copyright notice.
|
||||
#
|
||||
# @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
# @link http://cakephp.org CakePHP(tm) Project
|
||||
# @package app.Console
|
||||
# @since CakePHP(tm) v 1.2.0.5012
|
||||
# @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Canonicalize by following every symlink of the given name recursively
|
||||
canonicalize() {
|
||||
NAME="$1"
|
||||
if [ -f "$NAME" ]
|
||||
then
|
||||
DIR=$(dirname -- "$NAME")
|
||||
NAME=$(cd -P "$DIR" && pwd -P)/$(basename -- "$NAME")
|
||||
fi
|
||||
while [ -h "$NAME" ]; do
|
||||
DIR=$(dirname -- "$NAME")
|
||||
SYM=$(readlink "$NAME")
|
||||
NAME=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
|
||||
done
|
||||
echo "$NAME"
|
||||
}
|
||||
|
||||
CONSOLE=$(dirname -- "$(canonicalize "$0")")
|
||||
APP=$(dirname "$CONSOLE")
|
||||
|
||||
exec php -q "$CONSOLE"/cake.php -working "$APP" "$@"
|
||||
exit
|
|
@ -0,0 +1,31 @@
|
|||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
::
|
||||
:: Bake is a shell script for running CakePHP bake script
|
||||
::
|
||||
:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
:: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
::
|
||||
:: Licensed under The MIT License
|
||||
:: Redistributions of files must retain the above copyright notice.
|
||||
::
|
||||
:: @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
:: @link http://cakephp.org CakePHP(tm) Project
|
||||
:: @package app.Console
|
||||
:: @since CakePHP(tm) v 2.0
|
||||
:: @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
|
||||
|
||||
@echo.
|
||||
@echo off
|
||||
|
||||
SET app=%0
|
||||
SET lib=%~dp0
|
||||
|
||||
php -q "%lib%cake.php" -working "%CD% " %*
|
||||
|
||||
echo.
|
||||
|
||||
exit /B %ERRORLEVEL%
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/php -q
|
||||
<?php
|
||||
/**
|
||||
* Command-line code generation utility to automate programmer chores.
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Console
|
||||
* @since CakePHP(tm) v 2.0
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
$ds = DIRECTORY_SEPARATOR;
|
||||
$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
|
||||
|
||||
if (function_exists('ini_set')) {
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
|
||||
// the following line differs from its sibling
|
||||
// /lib/Cake/Console/Templates/skel/Console/cake.php
|
||||
ini_set('include_path', $root . $ds . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
||||
}
|
||||
|
||||
if (!include $dispatcher) {
|
||||
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
|
||||
}
|
||||
unset($paths, $path, $dispatcher, $root, $ds);
|
||||
|
||||
return ShellDispatcher::run($argv);
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Application level Controller
|
||||
*
|
||||
* This file is application-wide controller file. You can put all
|
||||
* application-wide controller-related methods here.
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Controller
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('Controller', 'Controller');
|
||||
|
||||
/**
|
||||
* Application Controller
|
||||
*
|
||||
* Add your application-wide methods in the class below, your controllers
|
||||
* will inherit them.
|
||||
*
|
||||
* @package app.Controller
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html#the-app-controller
|
||||
*/
|
||||
class AppController extends Controller {
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
/**
|
||||
* Configs Controller
|
||||
*
|
||||
* @property Config $Config
|
||||
*/
|
||||
class ConfigsController extends AppController {
|
||||
|
||||
/**
|
||||
* Components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('RequestHandler');
|
||||
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function index() {
|
||||
$this->Config->recursive = 0;
|
||||
$configs = $this->Config->find('all');
|
||||
$this->set(array(
|
||||
'configs' => $configs,
|
||||
'_serialize' => array('configs')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* view method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function view($id = null) {
|
||||
if (!$this->Config->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid config'));
|
||||
}
|
||||
$options = array('conditions' => array('Config.' . $this->Config->primaryKey => $id));
|
||||
$config = $this->Config->find('first', $options);
|
||||
$this->set(array(
|
||||
'config' => $config,
|
||||
'_serialize' => array('config')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* edit method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function edit($id = null) {
|
||||
$this->Config->id = $id;
|
||||
|
||||
if (!$this->Config->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid config'));
|
||||
}
|
||||
if ($this->request->is(array('post', 'put'))) {
|
||||
if ($this->Config->save($this->request->data)) {
|
||||
return $this->flash(__('The config has been saved.'), array('action' => 'index'));
|
||||
}
|
||||
} else {
|
||||
$options = array('conditions' => array('Config.' . $this->Config->primaryKey => $id));
|
||||
$this->request->data = $this->Config->find('first', $options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* delete method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id = null) {
|
||||
$this->Config->id = $id;
|
||||
if (!$this->Config->exists()) {
|
||||
throw new NotFoundException(__('Invalid config'));
|
||||
}
|
||||
$this->request->allowMethod('post', 'delete');
|
||||
if ($this->Config->delete()) {
|
||||
return $this->flash(__('The config has been deleted.'), array('action' => 'index'));
|
||||
} else {
|
||||
return $this->flash(__('The config could not be deleted. Please, try again.'), array('action' => 'index'));
|
||||
}
|
||||
}}
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
/**
|
||||
* Events Controller
|
||||
*
|
||||
* @property Event $Event
|
||||
*/
|
||||
class EventsController extends AppController {
|
||||
|
||||
/**
|
||||
* Components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('RequestHandler');
|
||||
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function index() {
|
||||
$this->Event->recursive = -1;
|
||||
$events = $this->Event->find('all');
|
||||
$this->set(array(
|
||||
'events' => $events,
|
||||
'_serialize' => array('events')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* view method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function view($id = null) {
|
||||
$this->Event->recursive = -1;
|
||||
if (!$this->Event->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid event'));
|
||||
}
|
||||
$options = array('conditions' => array('Event.' . $this->Event->primaryKey => $id));
|
||||
$event = $this->Event->find('first', $options);
|
||||
$this->set(array(
|
||||
'event' => $event,
|
||||
'_serialize' => array('event')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* add method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add() {
|
||||
if ($this->request->is('post')) {
|
||||
$this->Event->create();
|
||||
if ($this->Event->save($this->request->data)) {
|
||||
return $this->flash(__('The event has been saved.'), array('action' => 'index'));
|
||||
}
|
||||
}
|
||||
$monitors = $this->Event->Monitor->find('list');
|
||||
$this->set(compact('monitors'));
|
||||
}
|
||||
|
||||
/**
|
||||
* edit method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function edit($id = null) {
|
||||
$this->Event->id = $id;
|
||||
|
||||
if (!$this->Event->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid event'));
|
||||
}
|
||||
|
||||
if ($this->Event->save($this->request->data)) {
|
||||
$message = 'Saved';
|
||||
} else {
|
||||
$message = 'Error';
|
||||
}
|
||||
|
||||
$this->set(array(
|
||||
'message' => $message,
|
||||
'_serialize' => array('message')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* delete method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id = null) {
|
||||
$this->Event->id = $id;
|
||||
if (!$this->Event->exists()) {
|
||||
throw new NotFoundException(__('Invalid event'));
|
||||
}
|
||||
$this->request->allowMethod('post', 'delete');
|
||||
if ($this->Event->delete()) {
|
||||
return $this->flash(__('The event has been deleted.'), array('action' => 'index'));
|
||||
} else {
|
||||
return $this->flash(__('The event could not be deleted. Please, try again.'), array('action' => 'index'));
|
||||
}
|
||||
}}
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
/**
|
||||
* Frames Controller
|
||||
*
|
||||
* @property Frame $Frame
|
||||
*/
|
||||
class FramesController extends AppController {
|
||||
|
||||
/**
|
||||
* Components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('RequestHandler');
|
||||
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function index() {
|
||||
$this->Frame->recursive = -1;
|
||||
$frames = $this->Frame->find('all');
|
||||
$this->set(array(
|
||||
'frames' => $frames,
|
||||
'_serialize' => array('frames')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* view method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function view($id = null) {
|
||||
$this->Frame->recursive = -1;
|
||||
if (!$this->Frame->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid frame'));
|
||||
}
|
||||
$options = array('conditions' => array('Frame.' . $this->Frame->primaryKey => $id));
|
||||
$frame = $this->Frame->find('first', $options);
|
||||
$this->set(array(
|
||||
'frame' => $frame,
|
||||
'_serialize' => array('frame')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* add method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add() {
|
||||
if ($this->request->is('post')) {
|
||||
$this->Frame->create();
|
||||
if ($this->Frame->save($this->request->data)) {
|
||||
return $this->flash(__('The frame has been saved.'), array('action' => 'index'));
|
||||
}
|
||||
}
|
||||
$events = $this->Frame->Event->find('list');
|
||||
$this->set(compact('events'));
|
||||
}
|
||||
|
||||
/**
|
||||
* edit method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function edit($id = null) {
|
||||
if (!$this->Frame->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid frame'));
|
||||
}
|
||||
if ($this->request->is(array('post', 'put'))) {
|
||||
if ($this->Frame->save($this->request->data)) {
|
||||
return $this->flash(__('The frame has been saved.'), array('action' => 'index'));
|
||||
}
|
||||
} else {
|
||||
$options = array('conditions' => array('Frame.' . $this->Frame->primaryKey => $id));
|
||||
$this->request->data = $this->Frame->find('first', $options);
|
||||
}
|
||||
$events = $this->Frame->Event->find('list');
|
||||
$this->set(compact('events'));
|
||||
}
|
||||
|
||||
/**
|
||||
* delete method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id = null) {
|
||||
$this->Frame->id = $id;
|
||||
if (!$this->Frame->exists()) {
|
||||
throw new NotFoundException(__('Invalid frame'));
|
||||
}
|
||||
$this->request->allowMethod('post', 'delete');
|
||||
if ($this->Frame->delete()) {
|
||||
return $this->flash(__('The frame has been deleted.'), array('action' => 'index'));
|
||||
} else {
|
||||
return $this->flash(__('The frame could not be deleted. Please, try again.'), array('action' => 'index'));
|
||||
}
|
||||
}}
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
/**
|
||||
* Monitors Controller
|
||||
*
|
||||
* @property Monitor $Monitor
|
||||
* @property PaginatorComponent $Paginator
|
||||
*/
|
||||
class MonitorsController extends AppController {
|
||||
|
||||
|
||||
/**
|
||||
* Components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('Paginator', 'RequestHandler');
|
||||
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function index() {
|
||||
$this->Monitor->recursive = 0;
|
||||
$monitors = $this->Monitor->find('all');
|
||||
$this->set(array(
|
||||
'monitors' => $monitors,
|
||||
'_serialize' => array('monitors')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* view method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function view($id = null) {
|
||||
$this->Monitor->recursive = 0;
|
||||
if (!$this->Monitor->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid monitor'));
|
||||
}
|
||||
$options = array('conditions' => array('Monitor.' . $this->Monitor->primaryKey => $id));
|
||||
$monitor = $this->Monitor->find('first', $options);
|
||||
$this->set(array(
|
||||
'monitor' => $monitor,
|
||||
'_serialize' => array('monitor')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* add method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add() {
|
||||
if ($this->request->is('post')) {
|
||||
$this->Monitor->create();
|
||||
if ($this->Monitor->save($this->request->data)) {
|
||||
return $this->flash(__('The monitor has been saved.'), array('action' => 'index'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* edit method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function edit($id = null) {
|
||||
$this->Monitor->id = $id;
|
||||
|
||||
if (!$this->Monitor->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid monitor'));
|
||||
}
|
||||
|
||||
if ($this->Monitor->save($this->request->data)) {
|
||||
$message = 'Saved';
|
||||
} else {
|
||||
$message = 'Error';
|
||||
}
|
||||
|
||||
$this->set(array(
|
||||
'message' => $message,
|
||||
'_serialize' => array('message')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* delete method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id = null) {
|
||||
$this->Monitor->id = $id;
|
||||
if (!$this->Monitor->exists()) {
|
||||
throw new NotFoundException(__('Invalid monitor'));
|
||||
}
|
||||
$this->request->allowMethod('post', 'delete');
|
||||
if ($this->Monitor->delete()) {
|
||||
return $this->flash(__('The monitor has been deleted.'), array('action' => 'index'));
|
||||
} else {
|
||||
return $this->flash(__('The monitor could not be deleted. Please, try again.'), array('action' => 'index'));
|
||||
}
|
||||
}}
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
/**
|
||||
* Static content controller.
|
||||
*
|
||||
* This file will render views from views/pages/
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Controller
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('AppController', 'Controller');
|
||||
|
||||
/**
|
||||
* Static content controller
|
||||
*
|
||||
* Override this controller by placing a copy in controllers directory of an application
|
||||
*
|
||||
* @package app.Controller
|
||||
* @link http://book.cakephp.org/2.0/en/controllers/pages-controller.html
|
||||
*/
|
||||
class PagesController extends AppController {
|
||||
|
||||
/**
|
||||
* This controller does not use a model
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $uses = array();
|
||||
|
||||
/**
|
||||
* Displays a view
|
||||
*
|
||||
* @param mixed What page to display
|
||||
* @return void
|
||||
* @throws NotFoundException When the view file could not be found
|
||||
* or MissingViewException in debug mode.
|
||||
*/
|
||||
public function display() {
|
||||
$path = func_get_args();
|
||||
|
||||
$count = count($path);
|
||||
if (!$count) {
|
||||
return $this->redirect('/');
|
||||
}
|
||||
$page = $subpage = $title_for_layout = null;
|
||||
|
||||
if (!empty($path[0])) {
|
||||
$page = $path[0];
|
||||
}
|
||||
if (!empty($path[1])) {
|
||||
$subpage = $path[1];
|
||||
}
|
||||
if (!empty($path[$count - 1])) {
|
||||
$title_for_layout = Inflector::humanize($path[$count - 1]);
|
||||
}
|
||||
$this->set(compact('page', 'subpage', 'title_for_layout'));
|
||||
|
||||
try {
|
||||
$this->render(implode('/', $path));
|
||||
} catch (MissingViewException $e) {
|
||||
if (Configure::read('debug')) {
|
||||
throw $e;
|
||||
}
|
||||
throw new NotFoundException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
/**
|
||||
* Zones Controller
|
||||
*
|
||||
* @property Zone $Zone
|
||||
* @property PaginatorComponent $Paginator
|
||||
*/
|
||||
class ZonesController extends AppController {
|
||||
|
||||
/**
|
||||
* Components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('Paginator', 'RequestHandler');
|
||||
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function index() {
|
||||
$this->Zone->recursive = -1;
|
||||
$zones = $this->Zone->find('all');
|
||||
$this->set(array(
|
||||
'zones' => $zones,
|
||||
'_serialize' => array('zones')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* view method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function view($id = null) {
|
||||
$this->Zone->recursive = -1;
|
||||
if (!$this->Zone->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid zone'));
|
||||
}
|
||||
$options = array('conditions' => array('Zone.' . $this->Zone->primaryKey => $id));
|
||||
$zone = $this->Zone->find('first', $options);
|
||||
$this->set(array(
|
||||
'zone' => $zone,
|
||||
'_serialize' => array('zone')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* add method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add() {
|
||||
if ($this->request->is('post')) {
|
||||
$this->Zone->create();
|
||||
if ($this->Zone->save($this->request->data)) {
|
||||
return $this->flash(__('The zone has been saved.'), array('action' => 'index'));
|
||||
}
|
||||
}
|
||||
$monitors = $this->Zone->Monitor->find('list');
|
||||
$this->set(compact('monitors'));
|
||||
}
|
||||
|
||||
/**
|
||||
* edit method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function edit($id = null) {
|
||||
$this->Zone->id = $id;
|
||||
|
||||
if (!$this->Zone->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid zone'));
|
||||
}
|
||||
if ($this->request->is(array('post', 'put'))) {
|
||||
if ($this->Zone->save($this->request->data)) {
|
||||
return $this->flash(__('The zone has been saved.'), array('action' => 'index'));
|
||||
}
|
||||
} else {
|
||||
$options = array('conditions' => array('Zone.' . $this->Zone->primaryKey => $id));
|
||||
$this->request->data = $this->Zone->find('first', $options);
|
||||
}
|
||||
$monitors = $this->Zone->Monitor->find('list');
|
||||
$this->set(compact('monitors'));
|
||||
}
|
||||
|
||||
/**
|
||||
* delete method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id = null) {
|
||||
$this->Zone->id = $id;
|
||||
if (!$this->Zone->exists()) {
|
||||
throw new NotFoundException(__('Invalid zone'));
|
||||
}
|
||||
$this->request->allowMethod('post', 'delete');
|
||||
if ($this->Zone->delete()) {
|
||||
return $this->flash(__('The zone has been deleted.'), array('action' => 'index'));
|
||||
} else {
|
||||
return $this->flash(__('The zone could not be deleted. Please, try again.'), array('action' => 'index'));
|
||||
}
|
||||
}}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* Application model for CakePHP.
|
||||
*
|
||||
* This file is application-wide model file. You can put all
|
||||
* application-wide model-related methods here.
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.Model
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('Model', 'Model');
|
||||
|
||||
/**
|
||||
* Application model for Cake.
|
||||
*
|
||||
* Add your application-wide methods in the class below, your models
|
||||
* will inherit them.
|
||||
*
|
||||
* @package app.Model
|
||||
*/
|
||||
class AppModel extends Model {
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
App::uses('AppModel', 'Model');
|
||||
/**
|
||||
* Config Model
|
||||
*
|
||||
*/
|
||||
class Config extends AppModel {
|
||||
|
||||
/**
|
||||
* Use table
|
||||
*
|
||||
* @var mixed False or table name
|
||||
*/
|
||||
public $useTable = 'Config';
|
||||
|
||||
/**
|
||||
* Primary key field
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $primaryKey = 'Id';
|
||||
|
||||
/**
|
||||
* Display field
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $displayField = 'Name';
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue