Added new files to CVS.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@91 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2002-10-11 09:45:06 +00:00
parent 46d1680f2d
commit 65a1c4058c
5 changed files with 2949 additions and 0 deletions

91
web/zmconfig.php.z Normal file
View File

@ -0,0 +1,91 @@
<?php
//
// Zone Monitor web configuration file, $Date$, $Revision$
// Copyright (C) 2002 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.
//
define( "DB_SERVER", "localhost" ); // Database Server machine
define( "DB_NAME", "zm" ); // Database containing the tables
define( "DB_USER", "zmadmin" ); // Database login
define( "DB_PASS", "zmadminzm" ); // Database password
define( "MAX_EVENTS", 12 ); // The maximum number of events to show in the default event listing
define( "ALARM_POPUP", 1 ); // Whether the watch window jumps to front if an alarm occurs
define( "ALARM_SOUND", "Yeow.wav" ); // A sound to play on alarm
define( "ZM_PATH", "/usr/local/bin" ); // Path to the general ZoneMonitor executables
define( "ZMU_PATH", ZM_PATH."/zmu" ); // Path to the Zone Monitor Utility
define( "ZMS_PATH", "/cgi-bin/zms" ); // Path to the Zone Monitor Stream server
define( "EVENT_PATH", "events" ); // Local path to where events directory lives
define( "ZMS_EVENT_PATH", "/data/zm" ); // Full path (not web) to where events directory lives
define( "CAMBOZOLA_PATH", "cambozola.jar" ); // Path to (optional) cambozola java streaming client (recommended)
define( "MPEG_ENCODE_PATH", "./mpeg_encode" ); // Path to (optional) mpeg video encoder
define( "NETPBM_DIR", "/usr/bin" ); // Path to (optional) Netpbm utilities
if ( $bandwidth == "high" )
{
define( "REFRESH_MAIN", 300 ); // How often (in seconds) the main console window refreshes
define( "REFRESH_CYCLE", 5 ); // How often the cycle watch windows swaps to the next monitor
define( "REFRESH_IMAGE", 5 ); // How often the watched image is refreshed (if not streaming)
define( "REFRESH_STATUS", 3 ); // How often the little status frame refreshes itself in the watch window
define( "REFRESH_EVENTS", 30 ); // How often the event listing is refreshed in the watch window, only for recent events
define( "REFRESH_EVENTS_ALL", 120 ); // How often the event listing is refreshed when looking at longer listings
define( "STREAM_IDLE_DELAY", 1000 ); // How long (in milliseconds) between streamed frames in the watch window
define( "STREAM_FRAME_DELAY", 50 ); // How long (in milliseconds) to wait before looking for the next streamed frame
define( "STREAM_EVENT_DELAY", 200 ); // How long (in milliseconds) to wait between each frame when streaming events
define( "IMAGE_SCALING", 1 ); // Image scaling for thumbnails, bandwidth versus cpu in rescaling
}
elseif ( $bandwidth == "medium" )
{
define( "REFRESH_MAIN", 300 ); // How often (in seconds) the main console window refreshes
define( "REFRESH_CYCLE", 10 ); // How often the cycle watch windows swaps to the next monitor
define( "REFRESH_IMAGE", 15 ); // How often the watched image is refreshed (if not streaming)
define( "REFRESH_STATUS", 5 ); // How often the little status frame refreshes itself in the watch window
define( "REFRESH_EVENTS", 60 ); // How often the event listing is refreshed in the watch window, only for recent events
define( "REFRESH_EVENTS_ALL", 300 ); // How often the event listing is refreshed when looking at longer listings
define( "STREAM_IDLE_DELAY", 5000 ); // How long (in milliseconds) between streamed frames in the watch window
define( "STREAM_FRAME_DELAY", 100 ); // How long (in milliseconds) to wait before looking for the next streamed frame
define( "STREAM_EVENT_DELAY", 50 ); // How long (in milliseconds) to wait between each frame when streaming events
define( "IMAGE_SCALING", 4 ); // Image scaling for thumbnails, bandwidth versus cpu in rescaling
}
elseif ( $bandwidth == "medium" )
{
define( "REFRESH_MAIN", 300 ); // How often (in seconds) the main console window refreshes
define( "REFRESH_CYCLE", 30 ); // How often the cycle watch windows swaps to the next monitor
define( "REFRESH_IMAGE", 30 ); // How often the watched image is refreshed (if not streaming)
define( "REFRESH_STATUS", 10 ); // How often the little status frame refreshes itself in the watch window
define( "REFRESH_EVENTS", 180 ); // How often the event listing is refreshed in the watch window, only for recent events
define( "REFRESH_EVENTS_ALL", 600 ); // How often the event listing is refreshed when looking at longer listings
define( "STREAM_IDLE_DELAY", 10000 ); // How long (in milliseconds) between streamed frames in the watch window
define( "STREAM_FRAME_DELAY", 250 ); // How long (in milliseconds) to wait before looking for the next streamed frame
define( "STREAM_EVENT_DELAY", 10 ); // How long (in milliseconds) to wait between each frame when streaming events
define( "IMAGE_SCALING", 4 ); // Image scaling for thumbnails, bandwidth versus cpu in rescaling
}
elseif ( $bandwidth == "mobile" )
{
define( "REFRESH_MAIN", 300 ); // How often (in seconds) the main console window refreshes
define( "REFRESH_CYCLE", 30 ); // How often the cycle watch windows swaps to the next monitor
define( "REFRESH_IMAGE", 30 ); // How often the watched image is refreshed (if not streaming)
define( "REFRESH_STATUS", 10 ); // How often the little status frame refreshes itself in the watch window
define( "REFRESH_EVENTS", 180 ); // How often the event listing is refreshed in the watch window, only for recent events
define( "REFRESH_EVENTS_ALL", 600 ); // How often the event listing is refreshed when looking at longer listings
define( "STREAM_IDLE_DELAY", 10000 ); // How long (in milliseconds) between streamed frames in the watch window
define( "STREAM_FRAME_DELAY", 250 ); // How long (in milliseconds) to wait before looking for the next streamed frame
define( "STREAM_EVENT_DELAY", 10 ); // How long (in milliseconds) to wait between each frame when streaming events
define( "IMAGE_SCALING", 4 ); // Image scaling for thumbnails, bandwidth versus cpu in rescaling
}
?>

41
web/zmdb.php Normal file
View File

@ -0,0 +1,41 @@
<?php
//
// Zone Monitor database interface file, $Date$, $Revision$
// Copyright (C) 2002 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.
//
$conn = mysql_pconnect( DB_SERVER, DB_USER, DB_PASS ) or die("Could not connect to database: ".mysql_error());
mysql_select_db( DB_NAME, $conn) or die("Could not select database: ".mysql_error());
function getEnumValues( $table, $column )
{
$enum_values = array();
$result = mysql_query( "DESCRIBE $table $column" );
if ( $result )
{
$row = mysql_fetch_assoc($result);
preg_match_all( "/'([^']+)'/", $row[Type], $enum_matches );
$enum_values = $enum_matches[1];
}
else
{
echo mysql_error();
}
return $enum_values;
}
?>

129
web/zmfuncs.php Normal file
View File

@ -0,0 +1,129 @@
<?php
//
// Zone Monitor function library file, $Date$, $Revision$
// Copyright (C) 2002 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.
//
function getBrowser( &$browser, &$version )
{
global $HTTP_SERVER_VARS;
if (ereg( 'MSIE ([0-9].[0-9]{1,2})',$HTTP_SERVER_VARS[HTTP_USER_AGENT],$log_version))
{
$version = $log_version[1];
$browser = 'ie';
}
elseif (ereg( 'Opera ([0-9].[0-9]{1,2})',$HTTP_SERVER_VARS[HTTP_USER_AGENT],$log_version))
{
$version = $log_version[1];
$browser = 'opera';
}
elseif (ereg( 'Mozilla/([0-9].[0-9]{1,2})',$HTTP_SERVER_VARS[HTTP_USER_AGENT],$log_version))
{
$version = $log_version[1];
$browser = 'mozilla';
}
else
{
$version = 0;
$browser = 'unknown';
}
}
function isNetscape()
{
getBrowser( $browser, $version );
return( $browser == "mozilla" );
}
function canStream()
{
return( isNetscape() || (CAMBOZOLA_PATH && file_exists( CAMBOZOLA_PATH )) );
}
function startDaemon( $daemon, $did )
{
$ps_command = "ps -edalf | grep '$daemon $did' | grep -v grep";
$ps_array = preg_split( "/\s+/", exec( $ps_command ) );
$pid = $ps_array[3];
if ( $pid )
{
exec( "kill -HUP $pid" );
return;
}
$command = ZM_PATH."/$daemon $did".' 2>/dev/null >&- <&- >/dev/null &';
exec( $command );
$ps_array = preg_split( "/\s+/", exec( $ps_command ) );
while ( !$pid )
{
sleep( 1 );
$ps_array = preg_split( "/\s+/", exec( $ps_command ) );
$pid = $ps_array[3];
}
}
function stopDaemon( $daemon, $did )
{
$ps_command = "ps -edalf | grep '$daemon $did' | grep -v grep";
$ps_array = preg_split( "/\s+/", exec( $ps_command ) );
if ( $ps_array[3] )
{
$pid = $ps_array[3];
exec( "kill -TERM $pid" );
}
else
{
return;
}
while( $pid )
{
sleep( 1 );
$ps_array = preg_split( "/\s+/", exec( $ps_command ) );
$pid = $ps_array[3];
}
}
function controlDaemons( $device )
{
$sql = "select count(if(Function='Passive',1,NULL)) as PassiveCount, count(if(Function='Active',1,NULL)) as ActiveCount from Monitors where Device = '$device'";
$result = mysql_query( $sql );
if ( !$result )
echo mysql_error();
$row = mysql_fetch_assoc( $result );
$passive_count = $row[PassiveCount];
$active_count = $row[ActiveCount];
if ( !$passive_count && !$active_count )
{
stopDaemon( "zmc", $device );
}
else
{
startDaemon( "zmc", $device );
}
if ( !$active_count )
{
stopDaemon( "zma", $device );
}
else
{
startDaemon( "zma", $device );
}
}
?>

1398
web/zmhtml.php Normal file

File diff suppressed because it is too large Load Diff

1290
web/zmwml.php Normal file

File diff suppressed because it is too large Load Diff