2002-10-11 17:45:06 +08:00
|
|
|
<?php
|
|
|
|
//
|
2002-12-10 21:23:22 +08:00
|
|
|
// ZoneMinder web configuration file, $Date$, $Revision$
|
2003-01-12 02:22:27 +08:00
|
|
|
// Copyright (C) 2003 Philip Coombes
|
2002-10-11 17:45:06 +08:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
|
2003-01-11 00:43:47 +08:00
|
|
|
// This section contains options substituted by the zmconfig.pl utility, do not edit these directly
|
|
|
|
//
|
2003-01-31 23:45:27 +08:00
|
|
|
define( "ZM_VERSION", "<from zmconfig>" ); // Version Number
|
2004-12-29 00:46:48 +08:00
|
|
|
define( "ZM_CONFIG", "<from zmconfig>" ); // Path to config file
|
2003-01-15 23:06:15 +08:00
|
|
|
define( "ZM_PATH_BIN", "<from zmconfig>" ); // Path to binaries
|
|
|
|
define( "ZM_PATH_WEB", "<from zmconfig>" ); // Path to web files
|
|
|
|
define( "ZM_PATH_CGI", "<from zmconfig>" ); // Path to cgi files
|
2004-12-29 00:46:48 +08:00
|
|
|
|
|
|
|
$cfg = fopen( ZM_CONFIG, "r") or die("Could not open config file.");
|
|
|
|
while ( !feof($cfg) ) {
|
|
|
|
$str = fgets( $cfg );
|
|
|
|
if ( preg_match( '/^\s*$/', $str )) { continue; }
|
|
|
|
elseif ( preg_match( '/^\s*#/', $str )) { continue; }
|
|
|
|
elseif ( preg_match( '/^\s*([^=\s+)\s*=\s*([^=\s+)\s*$/', $str, $matches ))
|
|
|
|
{
|
|
|
|
if (( $matches[1] == "ZM_DB_SERVER") ||
|
|
|
|
( $matches[1] == "ZM_DB_NAME") ||
|
|
|
|
( $matches[1] == "ZM_DB_USERA") ||
|
|
|
|
( $matches[1] == "ZM_DB_PASSA") ||
|
|
|
|
( $matches[1] == "ZM_DB_USERB") ||
|
|
|
|
( $matches[1] == "ZM_DB_PASSB"))
|
|
|
|
{
|
|
|
|
define( $matches[1], $matches[2] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose( $cfg );
|
2002-10-11 17:45:06 +08:00
|
|
|
|
2003-01-11 00:43:47 +08:00
|
|
|
// This section is options normally derived from other options or configuration
|
|
|
|
//
|
2003-01-11 01:12:23 +08:00
|
|
|
define( "ZM_DB_USER", ZM_DB_USERA ); // Database login
|
|
|
|
define( "ZM_DB_PASS", ZM_DB_PASSA ); // Database password
|
2003-01-15 23:06:15 +08:00
|
|
|
define( "ZMU_PATH", ZM_PATH_BIN."/zmu" ); // Local path to the ZoneMinder Utility
|
2002-12-10 18:54:06 +08:00
|
|
|
|
2003-01-11 18:15:12 +08:00
|
|
|
// These are miscellaneous options you won't normally need to change
|
2003-01-11 00:43:47 +08:00
|
|
|
//
|
2003-01-17 18:34:35 +08:00
|
|
|
define( "MAX_EVENTS", 10 ); // The maximum number of events to show in the monitor event listing
|
2004-02-16 03:47:23 +08:00
|
|
|
define( "RATE_SCALE", 100 ); // The additional scaling factor used to help get fractional rates in integer format
|
|
|
|
define( "SCALE_SCALE", 100 ); // The additional scaling factor used to help get fractional scales in integer format
|
2003-01-11 00:43:47 +08:00
|
|
|
define( "LEARN_MODE", false ); // Currently unimplemented, do not change
|
2003-01-04 20:38:26 +08:00
|
|
|
|
2003-07-04 20:31:36 +08:00
|
|
|
require_once( 'zm_db.php' );
|
|
|
|
loadConfig();
|
|
|
|
|
2002-10-28 02:20:01 +08:00
|
|
|
switch ( $bandwidth )
|
2002-10-11 17:45:06 +08:00
|
|
|
{
|
2002-10-28 02:20:01 +08:00
|
|
|
case "high" :
|
|
|
|
{
|
2004-04-19 19:23:40 +08:00
|
|
|
define( "ZM_WEB_REFRESH_MAIN", ZM_WEB_H_REFRESH_MAIN ); // How often (in seconds) the main console window refreshes
|
|
|
|
define( "ZM_WEB_REFRESH_CYCLE", ZM_WEB_H_REFRESH_CYCLE ); // How often the cycle watch windows swaps to the next monitor
|
|
|
|
define( "ZM_WEB_REFRESH_IMAGE", ZM_WEB_H_REFRESH_IMAGE ); // How often the watched image is refreshed (if not streaming)
|
|
|
|
define( "ZM_WEB_REFRESH_STATUS", ZM_WEB_H_REFRESH_STATUS ); // How often the little status frame refreshes itself in the watch window
|
|
|
|
define( "ZM_WEB_REFRESH_EVENTS", ZM_WEB_H_REFRESH_EVENTS ); // How often the event listing is refreshed in the watch window, only for recent events
|
|
|
|
define( "ZM_WEB_DEFAULT_SCALE", ZM_WEB_H_DEFAULT_SCALE ); // What the default scaling factor applied to 'live' or 'event' views is (%)
|
|
|
|
define( "ZM_WEB_DEFAULT_RATE", ZM_WEB_H_DEFAULT_RATE ); // What the default replay rate factor applied to 'event' views is (%)
|
|
|
|
define( "ZM_WEB_VIDEO_BITRATE", ZM_WEB_H_VIDEO_BITRATE ); // What the bitrate of any streamed video should be
|
|
|
|
define( "ZM_WEB_VIDEO_MAXFPS", ZM_WEB_H_VIDEO_MAXFPS ); // What the maximum frame rate of any streamed video should be
|
|
|
|
define( "ZM_WEB_IMAGE_SCALING", ZM_WEB_H_IMAGE_SCALING ); // Image scaling for thumbnails, bandwidth versus cpu in rescaling
|
2002-10-28 02:20:01 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "medium" :
|
|
|
|
{
|
2004-04-19 19:23:40 +08:00
|
|
|
define( "ZM_WEB_REFRESH_MAIN", ZM_WEB_M_REFRESH_MAIN ); // How often (in seconds) the main console window refreshes
|
|
|
|
define( "ZM_WEB_REFRESH_CYCLE", ZM_WEB_M_REFRESH_CYCLE ); // How often the cycle watch windows swaps to the next monitor
|
|
|
|
define( "ZM_WEB_REFRESH_IMAGE", ZM_WEB_M_REFRESH_IMAGE ); // How often the watched image is refreshed (if not streaming)
|
|
|
|
define( "ZM_WEB_REFRESH_STATUS", ZM_WEB_M_REFRESH_STATUS ); // How often the little status frame refreshes itself in the watch window
|
|
|
|
define( "ZM_WEB_REFRESH_EVENTS", ZM_WEB_M_REFRESH_EVENTS ); // How often the event listing is refreshed in the watch window, only for recent events
|
|
|
|
define( "ZM_WEB_DEFAULT_SCALE", ZM_WEB_M_DEFAULT_SCALE ); // What the default scaling factor applied to 'live' or 'event' views is (%)
|
|
|
|
define( "ZM_WEB_DEFAULT_RATE", ZM_WEB_M_DEFAULT_RATE ); // What the default replay rate factor applied to 'event' views is (%)
|
|
|
|
define( "ZM_WEB_VIDEO_BITRATE", ZM_WEB_M_VIDEO_BITRATE ); // What the bitrate of any streamed video should be
|
|
|
|
define( "ZM_WEB_VIDEO_MAXFPS", ZM_WEB_M_VIDEO_MAXFPS ); // What the maximum frame rate of any streamed video should be
|
|
|
|
define( "ZM_WEB_IMAGE_SCALING", ZM_WEB_M_IMAGE_SCALING ); // Image scaling for thumbnails, bandwidth versus cpu in rescaling
|
2002-10-28 02:20:01 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "low" :
|
|
|
|
{
|
2004-04-19 19:23:40 +08:00
|
|
|
define( "ZM_WEB_REFRESH_MAIN", ZM_WEB_L_REFRESH_MAIN ); // How often (in seconds) the main console window refreshes
|
|
|
|
define( "ZM_WEB_REFRESH_CYCLE", ZM_WEB_L_REFRESH_CYCLE ); // How often the cycle watch windows swaps to the next monitor
|
|
|
|
define( "ZM_WEB_REFRESH_IMAGE", ZM_WEB_L_REFRESH_IMAGE ); // How often the watched image is refreshed (if not streaming)
|
|
|
|
define( "ZM_WEB_REFRESH_STATUS", ZM_WEB_L_REFRESH_STATUS ); // How often the little status frame refreshes itself in the watch window
|
|
|
|
define( "ZM_WEB_REFRESH_EVENTS", ZM_WEB_L_REFRESH_EVENTS ); // How often the event listing is refreshed in the watch window, only for recent events
|
|
|
|
define( "ZM_WEB_DEFAULT_SCALE", ZM_WEB_L_DEFAULT_SCALE ); // What the default scaling factor applied to 'live' or 'event' views is (%)
|
|
|
|
define( "ZM_WEB_DEFAULT_RATE", ZM_WEB_L_DEFAULT_RATE ); // What the default replay rate factor applied to 'event' views is (%)
|
|
|
|
define( "ZM_WEB_VIDEO_BITRATE", ZM_WEB_L_VIDEO_BITRATE ); // What the bitrate of any streamed video should be
|
|
|
|
define( "ZM_WEB_VIDEO_MAXFPS", ZM_WEB_L_VIDEO_MAXFPS ); // What the maximum frame rate of any streamed video should be
|
|
|
|
define( "ZM_WEB_IMAGE_SCALING", ZM_WEB_L_IMAGE_SCALING ); // Image scaling for thumbnails, bandwidth versus cpu in rescaling
|
2002-10-28 02:20:01 +08:00
|
|
|
break;
|
|
|
|
}
|
2003-01-11 00:43:47 +08:00
|
|
|
case "mobile" : // Very incomplete at present
|
2002-10-28 02:20:01 +08:00
|
|
|
{
|
2004-04-19 19:23:40 +08:00
|
|
|
define( "ZM_WEB_REFRESH_MAIN", ZM_WEB_P_REFRESH_MAIN ); // How often (in seconds) the main console window refreshes
|
|
|
|
define( "ZM_WEB_REFRESH_IMAGE", ZM_WEB_P_REFRESH_IMAGE ); // How often the watched image is refreshed (if not streaming)
|
2002-10-28 02:20:01 +08:00
|
|
|
break;
|
|
|
|
}
|
2002-10-11 17:45:06 +08:00
|
|
|
}
|
2002-10-17 06:11:35 +08:00
|
|
|
|
2003-07-04 04:39:02 +08:00
|
|
|
function loadConfig()
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
global $config_cats;
|
|
|
|
|
2003-07-07 21:26:50 +08:00
|
|
|
$config = array();
|
|
|
|
$config_cat = array();
|
|
|
|
|
2003-07-04 04:39:02 +08:00
|
|
|
$sql = "select * from Config";
|
|
|
|
$result = mysql_query( $sql );
|
|
|
|
if ( !$result )
|
|
|
|
echo mysql_error();
|
|
|
|
$monitors = array();
|
|
|
|
while( $row = mysql_fetch_assoc( $result ) )
|
|
|
|
{
|
2004-01-08 18:09:35 +08:00
|
|
|
define( $row['Name'], $row['Value'] );
|
|
|
|
$config[$row['Name']] = $row;
|
|
|
|
if ( !($config_cat = &$config_cats[$row['Category']]) )
|
2003-07-04 04:39:02 +08:00
|
|
|
{
|
2004-01-08 18:09:35 +08:00
|
|
|
$config_cats[$row['Category']] = array();
|
|
|
|
$config_cat = &$config_cats[$row['Category']];
|
2003-07-04 04:39:02 +08:00
|
|
|
}
|
2004-01-08 18:09:35 +08:00
|
|
|
$config_cat[$row['Name']] = $row;
|
2003-07-04 04:39:02 +08:00
|
|
|
}
|
|
|
|
//print_r( $config );
|
|
|
|
//print_r( $config_cats );
|
|
|
|
}
|
|
|
|
|
2002-10-17 06:11:35 +08:00
|
|
|
// Javascript window sizes
|
|
|
|
$jws = array(
|
2003-12-16 22:56:36 +08:00
|
|
|
'console' => array( 'w'=>720, 'h'=>540 ),
|
2003-12-08 01:13:19 +08:00
|
|
|
'state' => array( 'w'=>300, 'h'=>120 ),
|
2004-02-01 21:05:26 +08:00
|
|
|
'version' => array( 'w'=>320, 'h'=>140 ),
|
2004-02-19 23:05:21 +08:00
|
|
|
'cycle' => array( 'w'=>16, 'h'=>32 ),
|
2003-03-21 20:22:56 +08:00
|
|
|
'montage' => array( 'w'=>20, 'h'=>20 ),
|
2003-09-23 17:52:45 +08:00
|
|
|
'monitor' => array( 'w'=>360, 'h'=>300 ),
|
2004-01-08 20:26:31 +08:00
|
|
|
'watch' => array( 'w'=>72, 'h'=>342 ),
|
2002-10-17 06:11:35 +08:00
|
|
|
'device' => array( 'w'=>196, 'h'=>164 ),
|
2003-03-26 19:41:22 +08:00
|
|
|
'function' => array( 'w'=>248, 'h'=>92 ),
|
2002-10-17 06:11:35 +08:00
|
|
|
'events' => array( 'w'=>720, 'h'=>480 ),
|
2003-12-16 22:56:36 +08:00
|
|
|
'event' => array( 'w'=>72, 'h'=>168 ),
|
2002-11-29 19:20:58 +08:00
|
|
|
'filter' => array( 'w'=>560, 'h'=>250 ),
|
2004-02-16 03:42:00 +08:00
|
|
|
'filtersave' => array( 'w'=>560, 'h'=>220 ),
|
2002-10-17 06:11:35 +08:00
|
|
|
'zones' => array( 'w'=>72, 'h'=>232 ),
|
2004-02-20 22:59:54 +08:00
|
|
|
'zone' => array( 'w'=>360, 'h'=>500 ),
|
2002-10-17 06:11:35 +08:00
|
|
|
'video' => array( 'w'=>100, 'h'=>80 ),
|
2004-10-13 17:49:11 +08:00
|
|
|
'groups' => array( 'w'=>360, 'h'=>220 ),
|
2003-04-11 23:42:54 +08:00
|
|
|
'image' => array( 'w'=>48, 'h'=>80 ),
|
2003-11-05 23:52:22 +08:00
|
|
|
'frames' => array( 'w'=>500, 'h'=>300 ),
|
2004-05-06 00:22:04 +08:00
|
|
|
'stats' => array( 'w'=>680, 'h'=>200 ),
|
2004-03-15 06:24:09 +08:00
|
|
|
'options' => array( 'w'=>760, 'h'=>480 ),
|
2003-07-04 04:39:02 +08:00
|
|
|
'optionhelp' => array( 'w'=>320, 'h'=>240 ),
|
|
|
|
'restarting' => array( 'w'=>250, 'h'=>150 ),
|
2004-01-07 21:24:44 +08:00
|
|
|
'user' => array( 'w'=>230, 'h'=>340 ),
|
2003-06-25 17:47:09 +08:00
|
|
|
'settings' => array( 'w'=>200, 'h'=>225 ),
|
2003-06-30 04:53:55 +08:00
|
|
|
'logout' => array( 'w'=>200, 'h'=>100 ),
|
|
|
|
'bandwidth' => array( 'w'=>200, 'h'=>90 ),
|
2002-10-17 06:11:35 +08:00
|
|
|
);
|
2002-10-11 17:45:06 +08:00
|
|
|
?>
|