diff --git a/CMakeLists.txt b/CMakeLists.txt index edf9cc615..0c104998a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,11 +137,11 @@ set(ZM_WEB_USER "" CACHE STRING set(ZM_WEB_GROUP "" CACHE STRING "The group apache or the local web server runs on, Leave empty to be the same as the web user") -set(ZM_DIR_EVENTS "events" CACHE PATH - "Location where events are recorded to, default: events") -set(ZM_DIR_IMAGES "events" CACHE PATH +set(ZM_DIR_EVENTS "${ZM_CONTENTDIR}/events" CACHE PATH + "Location where events are recorded to, default: ZM_CONTENTDIR/events") +set(ZM_DIR_IMAGES "${ZM_CONTENTDIR}/images" CACHE PATH "Location where images, not directly associated with events, - are recorded to, default: images") + are recorded to, default: ZM_CONTENTDIR/images") set(ZM_DIR_SOUNDS "sounds" CACHE PATH "Location to look for optional sound files, default: sounds") set(ZM_PATH_ZMS "/cgi-bin/nph-zms" CACHE PATH @@ -154,7 +154,7 @@ set(ZM_PATH_ARP "" CACHE PATH "Full path to compatible arp binary. Leave empty for automatic detection.") set(ZM_CONFIG_DIR "/${CMAKE_INSTALL_SYSCONFDIR}" CACHE PATH "Location of ZoneMinder configuration, default system config directory") -set(ZM_CONFIG_SUBDIR "${ZM_CONFIG_DIR}/conf.d" CACHE PATH +set(ZM_CONFIG_SUBDIR "${ZM_CONFIG_DIR}/zm/conf.d" CACHE PATH "Location of ZoneMinder configuration subfolder, default: ZM_CONFIG_DIR/conf.d") set(ZM_EXTRA_LIBS "" CACHE STRING "A list of optional libraries, separated by semicolons, e.g. ssl;theora") @@ -801,11 +801,12 @@ endif(ZM_PERL_SEARCH_PATH) # If this is an out-of-source build, copy the files we need to the binary directory if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/conf.d" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/conf.d") + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/conf.d" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/conf.d" PATTERN "*.in" EXCLUDE) endif(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) # Generate files from the .in files configure_file(zm.conf.in "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" @ONLY) +configure_file(conf.d/01-system-paths.conf.in "${CMAKE_CURRENT_BINARY_DIR}/conf.d/01-system-paths.conf" @ONLY) configure_file(zoneminder-config.cmake "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) configure_file(zmconfgen.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmconfgen.pl" @ONLY) configure_file(zmlinkcontent.sh.in "${CMAKE_CURRENT_BINARY_DIR}/zmlinkcontent.sh" @ONLY) @@ -850,7 +851,7 @@ endif(zmconfgen_result EQUAL 0) # Install zm.conf and conf.d subfolder install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}") -install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/conf.d/" DESTINATION "${ZM_CONFIG_SUBDIR}") +install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/conf.d/" DESTINATION "${ZM_CONFIG_SUBDIR}" PATTERN "*.in" EXCLUDE) # Uninstall target configure_file( diff --git a/INSTALL b/INSTALL index bcb7f78df..3b50f5b62 100644 --- a/INSTALL +++ b/INSTALL @@ -47,7 +47,15 @@ Possible configuration options: ZM_DB_PASS Password of ZoneMinder database user, default: zmpass ZM_WEB_USER The user apache or the local web server runs on. Leave empty for automatic detection. If that fails, you can use this variable to force ZM_WEB_GROUP The group apache or the local web server runs on, Leave empty to be the same as the web user + ZM_DIR_EVENTS Location where events are recorded to, default: ZM_CONTENTDIR/events + ZM_DIR_IMAGES Location where images, not directly associated with events, are recorded to, default: ZM_CONTENTDIR/images + ZM_DIR_SOUNDS Location to look for optional sound files, default: sounds + ZM_PATH_ZMS Web url to zms streaming server, default: /cgi-bin/nph-zms Advanced: + ZM_PATH_MAP Location to save mapped memory files, default: /dev/shm + ZM_PATH_ARP Full path to compatible arp binary. Leave empty for automatic detection. + ZM_CONFIG_DIR Location of the main ZoneMinder config file, zm.conf. default: /etc/zm + ZM_CONFIG_SUBDIR Location of custom config files. default: ZM_CONFIG_DIR/conf.d ZM_EXTRA_LIBS A list of optional libraries, separated by semicolons, e.g. ssl;theora ZM_MYSQL_ENGINE MySQL engine to use with database, default: InnoDB ZM_NO_MMAP Set to ON to not use mmap shared memory. Shouldn't be enabled unless you experience problems with the shared memory. default: OFF diff --git a/conf.d/01-system-paths.conf.in b/conf.d/01-system-paths.conf.in new file mode 100644 index 000000000..9f45abdbd --- /dev/null +++ b/conf.d/01-system-paths.conf.in @@ -0,0 +1,53 @@ +# ========================================================================== +# +# ZoneMinder System Paths Configuration +# +# ========================================================================== +# +# This config file contains the variables previously found under Options -> Paths +# +# *** DO NOT EDIT THIS FILE *** +# +# To make custom changes to the variables below, create a new configuration +# file, with an extention of .conf, containing your desired modifications. +# + +# Full path to the folder events are recorded to. +# The web account user must have full read/write permission to this folder. +ZM_DIR_EVENTS=@ZM_DIR_EVENTS@ + +# Full path to the folder images, not directly associated with events, +# are recorded to. +# The web account user must have full read/write permission to this folder. +ZM_DIR_IMAGES=@ZM_DIR_IMAGES@ + +# Foldername under the webroot where ZoneMinder looks for optional sound files +# to play when an alarm is detected. +ZM_DIR_SOUNDS=@ZM_DIR_SOUNDS@ + +# Full path to the folder where exported archives are stored +# The web account user must have full read/write permission to this folder. +ZM_DIR_EXPORTS=@ZM_TMPDIR@ + +# ZoneMinder url path to the zms streaming server +ZM_PATH_ZMS=@ZM_PATH_ZMS@ + +# Full Path to ZoneMinder's mapped memory files +# The web account user must have full read/write permission to this folder. +ZM_PATH_MAP=@ZM_PATH_MAP@ + +# Full Path to ZoneMinder's socket folder +# The web account user must have full read/write permission to this folder. +ZM_PATH_SOCKS=@ZM_SOCKDIR@ + +# Full path to ZoneMinder's log folder +# The web account user must have full read/write permission to this folder. +ZM_PATH_LOGS=@ZM_LOGDIR@ + +# Full path to ZoneMinder's swap folder +# The web account user must have full read/write permission to this folder. +ZM_PATH_SWAP=@ZM_TMPDIR@ + +# Full path to optional arp binary +# ZoneMinder will find the arp binary automatically on most systems +ZM_PATH_ARP=@ZM_PATH_ARP@ diff --git a/conf.d/02-multiserver.conf b/conf.d/02-multiserver.conf new file mode 100644 index 000000000..d2fdfcca7 --- /dev/null +++ b/conf.d/02-multiserver.conf @@ -0,0 +1,12 @@ +# ========================================================================== +# +# ZoneMinder Multiserver Configuration +# +# ========================================================================== +# Do NOT set ZM_SERVER_HOST if you are not using Multi-Server +# You have been warned +# +# The name specified here must have a corresponding entry +# in the Servers tab under Options +#ZM_SERVER_HOST= + diff --git a/conf.d/zm-server-host.conf b/conf.d/zm-server-host.conf deleted file mode 100644 index 7c61c200d..000000000 --- a/conf.d/zm-server-host.conf +++ /dev/null @@ -1,7 +0,0 @@ -# Do NOT set ZM_SERVER_HOST if you are not using Multi-Server -# You have been warned -# -# The name specified here must have a corresponding entry -# in the Servers tab under Options -ZM_SERVER_HOST= - diff --git a/distros/debian/rules b/distros/debian/rules index 929f054df..fe725c2d0 100755 --- a/distros/debian/rules +++ b/distros/debian/rules @@ -18,7 +18,6 @@ override_dh_auto_configure: -DZM_TMPDIR=/var/tmp/zm \ -DZM_LOGDIR=/var/log/zm \ -DZM_WEBDIR=/usr/share/zoneminder/www \ - -DZM_CONTENTDIR=/var/cache/zoneminder \ -DZM_CGIDIR=/usr/lib/zoneminder/cgi-bin \ -DZM_WEB_USER=www-data \ -DZM_WEB_GROUP=www-data \ diff --git a/distros/redhat/CMakeLists.txt b/distros/redhat/CMakeLists.txt index 63159b1c7..73f88f968 100644 --- a/distros/redhat/CMakeLists.txt +++ b/distros/redhat/CMakeLists.txt @@ -9,15 +9,15 @@ else(ZM_TARGET_DISTRO MATCHES "^el") message([WARNING] "Unknown Build Option Detected" ...) endif(ZM_TARGET_DISTRO MATCHES "^el") -if((ZM_TARGET_DISTRO STREQUAL "el6") AND (ZM_WEB_USER STREQUAL "nginx")) - message([FATAL_ERROR] "Nginx is Not a Supported Build Option on EL6 Target Distro" ...) -endif((ZM_TARGET_DISTRO STREQUAL "el6") AND (ZM_WEB_USER STREQUAL "nginx")) +if((NOT ZM_TARGET_DISTRO MATCHES "^fc") AND (ZM_WEB_USER STREQUAL "nginx")) + message([FATAL_ERROR] "Experimental Nginx support is currently only supported on Fedora" ...) +endif((NOT ZM_TARGET_DISTRO MATCHES "^fc") AND (ZM_WEB_USER STREQUAL "nginx")) # Configure the zoneminder service files if(ZM_TARGET_DISTRO STREQUAL "el6") configure_file(sysvinit/zoneminder.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.sysvinit @ONLY) configure_file(sysvinit/zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY) - configure_file(sysvinit/zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.conf @ONLY) + configure_file(apache/zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.conf @ONLY) else(ZM_TARGET_DISTRO STREQUAL "el6") configure_file(systemd/zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY) if(ZM_WEB_USER STREQUAL "nginx") @@ -28,7 +28,7 @@ else(ZM_TARGET_DISTRO STREQUAL "el6") configure_file(nginx/README.Fedora ${CMAKE_CURRENT_SOURCE_DIR}/readme/README.Fedora COPYONLY) else(ZM_WEB_USER STREQUAL "nginx") configure_file(systemd/zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY) - configure_file(systemd/zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.conf @ONLY) + configure_file(apache/zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.conf @ONLY) configure_file(systemd/zoneminder.tmpfiles.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.tmpfiles @ONLY) endif(ZM_WEB_USER STREQUAL "nginx") endif(ZM_TARGET_DISTRO STREQUAL "el6") @@ -55,10 +55,7 @@ install(DIRECTORY zoneminder DESTINATION /var/run DIRECTORY_PERMISSIONS OWNER_WR 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\")") +# Symlink the cake php temp folder to the ZoneMinder temp folder install(CODE "execute_process(COMMAND ln -sf ../../../../../../var/lib/zoneminder/temp \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/api/app/tmp\")") # Link to Cambozola diff --git a/distros/redhat/systemd/zoneminder.conf.in b/distros/redhat/apache/zoneminder.conf.in similarity index 100% rename from distros/redhat/systemd/zoneminder.conf.in rename to distros/redhat/apache/zoneminder.conf.in diff --git a/distros/redhat/systemd/zoneminder.service.in b/distros/redhat/systemd/zoneminder.service.in index 2234af036..68918ab9e 100644 --- a/distros/redhat/systemd/zoneminder.service.in +++ b/distros/redhat/systemd/zoneminder.service.in @@ -1,4 +1,4 @@ -# ZoneMinder systemd unit file for CentOS 7 +# ZoneMinder systemd unit file for RedHat distros and clones [Unit] Description=ZoneMinder CCTV recording and security system diff --git a/distros/redhat/sysvinit/zoneminder.conf.in b/distros/redhat/sysvinit/zoneminder.conf.in deleted file mode 100644 index 0e546f9df..000000000 --- a/distros/redhat/sysvinit/zoneminder.conf.in +++ /dev/null @@ -1,71 +0,0 @@ -# -# ZoneMinder Apache configuration file -# With SSLRequire and HTTPS auto redirect -# Modify this configuration to suit your requirements -# - -# Auto Redirect HTTP requests to HTTPS -RewriteEngine On -RewriteCond %{HTTPS} !=on -RewriteRule ^/?(zm)(.*) https://%{SERVER_NAME}/$1$2 [R,L] - -Alias /zm "@ZM_WEBDIR@" - - # explicitly set index.php as the only directoryindex - DirectoryIndex disabled - DirectoryIndex index.php - SSLRequireSSL - Options -Indexes +MultiViews +FollowSymLinks - AllowOverride None - - # Apache 2.4 - Require all granted - - - # Apache 2.2 - Order deny,allow - Allow from all - - - -ScriptAlias /cgi-bin-zm "@ZM_CGIDIR@" - - SSLRequireSSL - AllowOverride None - Options +ExecCGI +FollowSymLinks - - # Apache 2.4 - Require all granted - - - # Apache 2.2 - Order deny,allow - Allow from all - - - -# For better visibility, the following directives have been migrated from the -# default .htaccess files included with the CakePHP project. -# Parameters not set here are inherited from the parent directive above. - - RewriteEngine on - RewriteRule ^$ app/webroot/ [L] - RewriteRule (.*) app/webroot/$1 [L] - RewriteBase /zm/api - - - - RewriteEngine on - RewriteRule ^$ webroot/ [L] - RewriteRule (.*) webroot/$1 [L] - RewriteBase /zm/api - - - - RewriteEngine On - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^ index.php [L] - RewriteBase /zm/api - - diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index f60ae222a..d56c0cc21 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -286,12 +286,18 @@ rm -rf %{_docdir}/%{name}-%{version} %files %license COPYING %doc AUTHORS README.md distros/redhat/readme/README.%{readme_suffix} distros/redhat/readme/README.https distros/redhat/jscalendar-doc + +# We want these two folders to have "normal" read permission +# compared to the folder contents %dir %{_sysconfdir}/zm %dir %{_sysconfdir}/zm/conf.d + +# Config folder contents contain sensitive info +# and should not be readable by normal users %{_sysconfdir}/zm/conf.d/README -# Always overwrite zm.conf now that ZoneMinder supports conf.d folder -%attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/zm.conf +%config(noreplace) %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/zm.conf %config(noreplace) %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/conf.d/*.conf +%ghost %attr(640,root,%{zmgid_final}) %{_sysconfdir}/zm/conf.d/zmcustom.conf %config(noreplace) %attr(644,root,root) %{wwwconfdir}/zoneminder.conf %config(noreplace) %{_sysconfdir}/logrotate.d/zoneminder diff --git a/distros/ubuntu1204/rules b/distros/ubuntu1204/rules index dcf11864b..0103d1c27 100755 --- a/distros/ubuntu1204/rules +++ b/distros/ubuntu1204/rules @@ -25,7 +25,6 @@ override_dh_auto_configure: -DZM_SOCKDIR="/var/run/zm" \ -DZM_TMPDIR="/tmp/zm" \ -DZM_CGIDIR="/usr/lib/zoneminder/cgi-bin" \ - -DZM_CONTENTDIR="/var/cache/zoneminder" \ -DZM_DIR_EVENTS="/var/cache/zoneminder/events" \ -DZM_DIR_IMAGES="/var/cache/zoneminder/images" \ -DZM_PATH_ZMS="/zm/cgi-bin/nph-zms" \ diff --git a/distros/ubuntu1204/zoneminder.links b/distros/ubuntu1204/zoneminder.links index 4c44d3238..373548919 100644 --- a/distros/ubuntu1204/zoneminder.links +++ b/distros/ubuntu1204/zoneminder.links @@ -1,4 +1 @@ -/var/cache/zoneminder/events /usr/share/zoneminder/www/events -/var/cache/zoneminder/images /usr/share/zoneminder/www/images -/var/cache/zoneminder/temp /usr/share/zoneminder/www/temp /tmp/zm /usr/share/zoneminder/www/api/app/tmp diff --git a/distros/ubuntu1504_cmake_split_packages/rules b/distros/ubuntu1504_cmake_split_packages/rules index 7c8fc232d..0eca4b511 100755 --- a/distros/ubuntu1504_cmake_split_packages/rules +++ b/distros/ubuntu1504_cmake_split_packages/rules @@ -58,7 +58,6 @@ override_dh_auto_configure: -DZM_TMPDIR=/var/tmp/zm \ -DZM_LOGDIR=/var/log/zm \ -DZM_WEBDIR=/usr/share/zoneminder \ - -DZM_CONTENTDIR=/var/cache/zoneminder \ -DZM_CGIDIR=/usr/lib/cgi-bin \ -DZM_WEB_USER=www-data \ -DZM_WEB_GROUP=www-data \ diff --git a/distros/ubuntu1504_cmake_split_packages/zoneminder-core.links b/distros/ubuntu1504_cmake_split_packages/zoneminder-core.links deleted file mode 100644 index e7d90d176..000000000 --- a/distros/ubuntu1504_cmake_split_packages/zoneminder-core.links +++ /dev/null @@ -1,3 +0,0 @@ -var/cache/zoneminder/events usr/share/zoneminder/www/events -var/cache/zoneminder/images usr/share/zoneminder/www/images -var/cache/zoneminder/temp usr/share/zoneminder/www/temp diff --git a/distros/ubuntu1504_cmake_split_packages/zoneminder-ui-base.links b/distros/ubuntu1504_cmake_split_packages/zoneminder-ui-base.links deleted file mode 100644 index b00a147d6..000000000 --- a/distros/ubuntu1504_cmake_split_packages/zoneminder-ui-base.links +++ /dev/null @@ -1 +0,0 @@ -usr/lib/cgi-bin usr/share/zoneminder/cgi-bin diff --git a/distros/ubuntu1604/patches/default_cgi-path.patch b/distros/ubuntu1604/patches/default_cgi-path.patch deleted file mode 100644 index 8bfc2ba06..000000000 --- a/distros/ubuntu1604/patches/default_cgi-path.patch +++ /dev/null @@ -1,16 +0,0 @@ -Last-Update: 2015-08-16 -Forwarded: no -Author: Dmitry Smirnov -Description: correct path to CGI app according to default web server configuration. - ---- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in -+++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in -@@ -428,7 +428,7 @@ our @options = - }, - { - name => "ZM_PATH_ZMS", -- default => "/cgi-bin/nph-zms", -+ default => "/zm/cgi-bin/nph-zms", - description => "Web path to zms streaming server", - help => qqq(" - The ZoneMinder streaming server is required to send streamed diff --git a/distros/ubuntu1604/rules b/distros/ubuntu1604/rules index b78361212..6bc3dffb5 100755 --- a/distros/ubuntu1604/rules +++ b/distros/ubuntu1604/rules @@ -25,7 +25,6 @@ override_dh_auto_configure: -DZM_SOCKDIR="/var/run/zm" \ -DZM_TMPDIR="/tmp/zm" \ -DZM_CGIDIR="/usr/lib/zoneminder/cgi-bin" \ - -DZM_CONTENTDIR="/var/cache/zoneminder" \ -DZM_DIR_EVENTS="/var/cache/zoneminder/events" \ -DZM_DIR_IMAGES="/var/cache/zoneminder/images" \ -DZM_PATH_ZMS="/zm/cgi-bin/nph-zms" diff --git a/distros/ubuntu1604/zoneminder.links b/distros/ubuntu1604/zoneminder.links index 14a8aee91..b7258c3c4 100644 --- a/distros/ubuntu1604/zoneminder.links +++ b/distros/ubuntu1604/zoneminder.links @@ -1,4 +1 @@ -/var/cache/zoneminder/events /usr/share/zoneminder/www/events -/var/cache/zoneminder/images /usr/share/zoneminder/www/images -/var/cache/zoneminder/temp /usr/share/zoneminder/www/temp /var/tmp /usr/share/zoneminder/www/api/app/tmp diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/MaginonIPC.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/MaginonIPC.pm index 35159fc4e..38ae81aa3 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/MaginonIPC.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/MaginonIPC.pm @@ -15,7 +15,7 @@ # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # ========================================================================== # diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Monitor.pm b/scripts/ZoneMinder/lib/ZoneMinder/Monitor.pm index d5b7d7f53..ebdb073b2 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Monitor.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Monitor.pm @@ -15,7 +15,7 @@ # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # ========================================================================== # diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Object.pm b/scripts/ZoneMinder/lib/ZoneMinder/Object.pm index b87e111a6..63193bccf 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Object.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Object.pm @@ -15,7 +15,7 @@ # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # ========================================================================== # diff --git a/web/api/app/Config/bootstrap.php.in b/web/api/app/Config/bootstrap.php.in index ac3bcb62c..cf63e40c1 100644 --- a/web/api/app/Config/bootstrap.php.in +++ b/web/api/app/Config/bootstrap.php.in @@ -101,49 +101,66 @@ CakeLog::config('debug', array( 'engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'cake_debug', + 'path' => '@ZM_LOGDIR@/' )); CakeLog::config('error', array( 'engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'cake_error', + 'path' => '@ZM_LOGDIR@/' )); CakeLog::config('custom_path', array( 'engine' => 'File', - 'path' => '@ZM_LOGDIR@' + 'path' => '@ZM_LOGDIR@/' )); Configure::write('ZM_CONFIG', '@ZM_CONFIG@'); +Configure::write('ZM_CONFIG_SUBDIR', '@ZM_CONFIG_SUBDIR@'); Configure::write('ZM_VERSION', '@VERSION@'); Configure::write('ZM_API_VERSION', '@API_VERSION@'); -loadConfigFile(); +# Process name, value pairs from the main config file first +$configvals = process_configfile(Configure::read('ZM_CONFIG')); -function loadConfigFile() { - $configFile = Configure::read('ZM_CONFIG'); - $localConfigFile = basename($configFile); - if ( file_exists( $localConfigFile ) && filesize( $localConfigFile ) > 0 ) - { - if ( php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR']) ) - print( "Warning, overriding installed $localConfigFile file with local copy\n" ); - else - error_log( "Warning, overriding installed $localConfigFile file with local copy" ); - $configFile = $localConfigFile; - } - - $cfg = fopen( $configFile, "r") or die("Could not open config file."); - while ( !feof($cfg) ) - { - $str = fgets( $cfg, 256 ); - if ( preg_match( '/^\s*$/', $str )) - continue; - elseif ( preg_match( '/^\s*#/', $str )) - continue; - elseif ( preg_match( '/^\s*([^=\s]+)\s*=\s*(.*?)\s*$/', $str, $matches )) { - Configure::write( $matches[1], $matches[2] ); - define( $matches[1], $matches[2] ); - } - } - fclose( $cfg ); +# Search for user created config files. If one or more are found then +# update our config value array with those values +$configSubFolder = Configure::read('ZM_CONFIG_SUBDIR'); +if ( is_dir($configSubFolder) ) { + if ( is_readable($configSubFolder) ) { + foreach ( glob("$configSubFolder/*.conf") as $filename ) { + $configvals = array_replace($configvals, process_configfile($filename) ); + } + } else { + error_log( "WARNING: ZoneMinder configuration subfolder found but is not readable. Check folder permissions on $configSubFolder." ); + } } +# Now that our array our finalized, define each key => value +# pair in the array as a constant +foreach( $configvals as $key => $value) { + define( $key, $value ); + Configure::write( $key, $value ); +} + +function process_configfile($configFile) { + if ( is_readable( $configFile ) ) { + $configvals = array(); + + $cfg = fopen( $configFile, "r") or die("Could not open config file."); + while ( !feof($cfg) ) { + $str = fgets( $cfg, 256 ); + if ( preg_match( '/^\s*$/', $str )) + continue; + elseif ( preg_match( '/^\s*#/', $str )) + continue; + elseif ( preg_match( '/^\s*([^=\s]+)\s*=\s*(.*?)\s*$/', $str, $matches )) + $configvals[$matches[1]] = $matches[2]; + } + fclose( $cfg ); + return( $configvals ); + } else { + error_log( "WARNING: ZoneMinder configuration file found but is not readable. Check file permissions on $configFile." ); + return( false ); + } +} diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index ad2382ff4..ad6891161 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -252,27 +252,26 @@ foreach( $displayMonitors as $monitor ) { $Server = new Server( $monitor['ServerId'] ); echo $Server->Name(); ?> - - - '.$monitor['Device'].' ('.$monitor['Channel'].')', canEdit( 'Monitors' ) ) ?> - - '.preg_replace( '/^.*@/', '', $monitor['Host'] ).'', canEdit( 'Monitors' ) ) ?> - - '.preg_replace( '/^.*\//', '', $monitor['Path'] ).'', canEdit( 'Monitors' ) ) ?> - - '.$shortpath.'', canEdit( 'Monitors' ) ) ?> - - '.preg_replace( '/^.*\//', '', $monitor['Path'] ).'', canEdit( 'Monitors' ) ) ?> - -   - '. makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', ''.$source.'', canEdit( 'Monitors' ) ).''; + for ( $i = 0; $i < count($eventCounts); $i++ ) { ?> diff --git a/web/skins/classic/views/image-ffmpeg.php b/web/skins/classic/views/image-ffmpeg.php index 082c75099..37e2cd691 100644 --- a/web/skins/classic/views/image-ffmpeg.php +++ b/web/skins/classic/views/image-ffmpeg.php @@ -15,7 +15,7 @@ // // 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. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // if ( !canView( 'Events' ) ) diff --git a/web/views/view_video.php b/web/views/view_video.php index 8cf590e9d..a4bfa3892 100644 --- a/web/views/view_video.php +++ b/web/views/view_video.php @@ -15,7 +15,7 @@ // // 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. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // // Calling sequence: ... /zm/index.php?view=video&event_id=123 diff --git a/zm.conf.in b/zm.conf.in index c417aacd2..bde068104 100644 --- a/zm.conf.in +++ b/zm.conf.in @@ -1,16 +1,15 @@ # ========================================================================== # -# ZoneMinder Base Configuration File +# ZoneMinder Base Configuration # # ========================================================================== # # *** DO NOT EDIT THIS FILE *** -# Changes made directly to this configuration file are no longer supported. -# They will be overwritten during an upgrade. # -# Instead, create a custom configuration file, with an extention of ".conf" -# under the @ZM_CONFIG_SUBDIR@ subfolder containing your desired modifications. -# +# To make custom changes to the variables below, create a new configuration +# file, with an extention of .conf, under the @ZM_CONFIG_SUBDIR@ +# folder, containing your desired modifications. +# # Path to installed data directory, used mostly for finding DB upgrade scripts ZM_PATH_DATA=@PKGDATADIR@ @@ -50,43 +49,10 @@ ZM_DB_USER=@ZM_DB_USER@ # ZoneMinder database password ZM_DB_PASS=@ZM_DB_PASS@ -# Full path to the folder events are recorded to. -# The web account user must have full read/write permission to this folder. -ZM_DIR_EVENTS=@ZM_DIR_EVENTS@ - -# Full path to the folder images, not directly associated with events, -# are recorded to. -# The web account user must have full read/write permission to this folder. -ZM_DIR_IMAGES=@ZM_DIR_IMAGES@ - -# Foldername under the webroot where ZoneMinder looks for optional sound files -# to play when an alarm is detected. -ZM_DIR_SOUNDS=@ZM_DIR_SOUNDS@ - -# Full path to the folder where exported archives are stored -# The web account user must have full read/write permission to this folder. -ZM_DIR_EXPORTS=@ZM_TMPDIR@ - -# ZoneMinder url path to the zms streaming server -ZM_PATH_ZMS=@ZM_PATH_ZMS@ - -# Full Path to ZoneMinder's mapped memory files -# The web account user must have full read/write permission to this folder. -ZM_PATH_MAP=@ZM_PATH_MAP@ - -# Full Path to ZoneMinder's socket folder -# The web account user must have full read/write permission to this folder. -ZM_PATH_SOCKS=@ZM_SOCKDIR@ - -# Full path to ZoneMinder's log folder -# The web account user must have full read/write permission to this folder. -ZM_PATH_LOGS=@ZM_LOGDIR@ - -# Full path to ZoneMinder's swap folder -# The web account user must have full read/write permission to this folder. -ZM_PATH_SWAP=@ZM_TMPDIR@ - -# Full path to optional arp binary -# ZoneMinder will find the arp binary automatically on most systems -ZM_PATH_ARP=@ZM_PATH_ARP@ +# Do NOT set ZM_SERVER_HOST if you are not using Multi-Server +# You have been warned +# +# The name specified here must have a corresponding entry +# in the Servers tab under Options +ZM_SERVER_HOST=