Merge branch 'zma_to_thread' of github.com:/ConnorTechnology/ZoneMinder into zma_to_thread

This commit is contained in:
Isaac Connor 2017-12-07 10:52:16 -05:00
commit 4ab395b83a
18 changed files with 112 additions and 104 deletions

View File

@ -6,7 +6,6 @@ Uploaders: Vagrant Cascadian <vagrant@debian.org>
Build-Depends: debhelper (>= 9), dh-systemd, python-sphinx | python3-sphinx, apache2-dev, dh-linktree
,cmake
,libx264-dev, libmp4v2-dev
,libboost-dev
,libavdevice-dev (>= 6:10~)
,libavcodec-dev (>= 6:10~)
,libavformat-dev (>= 6:10~)

View File

@ -414,11 +414,11 @@ sub MoveTo {
$$self{Storage} = $NewStorage;
my ( $NewPath ) = ( $NewStorage->Path(undef) =~ /^(.*)$/ ); # De-taint
my ( $NewPath ) = ( $NewStorage->Path() =~ /^(.*)$/ ); # De-taint
if ( ! $$NewStorage{Id} ) {
return "New storage does not have an id. Moving will not happen.";
} elsif ( !$NewPath ) {
return "$NewPath is empty.";
return "New path ($NewPath) is empty.";
} elsif ( ! -e $NewPath ) {
return "New path $NewPath does not exist.";
} elsif ( ! -e $OldPath ) {

View File

@ -101,6 +101,9 @@ while( 1 ) {
my $res = $sth->execute( $Config{ZM_SERVER_ID} ? $Config{ZM_SERVER_ID} : () )
or Fatal( "Can't execute: ".$sth->errstr() );
while( my $monitor = $sth->fetchrow_hashref() ) {
$eventcounts_sth->execute( $$monitor{Id} ) or Error( "Can't execute: ".$eventcounts_sth->errstr() );
my $now = time();
next if $monitor->{Function} eq 'None';
my $restart = 0;
@ -200,8 +203,6 @@ while( 1 ) {
zmMemInvalidate( $monitor ); # Close our file handle to the zmc process we are about to end
$eventcounts_sth->execute( $$monitor{Id} ) or Error( "Can't execute: ".$eventcounts_sth->errstr() );
} # end foreach monitor
$eventcounts_sth->finish();

View File

@ -10,7 +10,7 @@ configure_file(includes/config.php.in "${CMAKE_CURRENT_BINARY_DIR}/includes/conf
# Install the web files
install(DIRECTORY api ajax css fonts graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE PATTERN "*cmake*" EXCLUDE)
install(FILES index.php DESTINATION "${ZM_WEBDIR}")
install(FILES index.php robots.txt DESTINATION "${ZM_WEBDIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" DESTINATION "${ZM_WEBDIR}/includes")
# Install the api config files (if its not in the source directory)

View File

@ -1,5 +1,5 @@
<?php
if ($_REQUEST['entity'] == "navBar") {
if ($_REQUEST['entity'] == 'navBar') {
ajaxResponse(getNavBarHtml('reload'));
return;
}
@ -10,21 +10,21 @@ $statusData = array(
'table' => 'Monitors',
'limit' => 1,
'elements' => array(
'MonitorCount' => array( 'sql' => "count(*)" ),
'MonitorCount' => array( 'sql' => 'count(*)' ),
'ActiveMonitorCount' => array( 'sql' => "count(if(Function != 'None',1,NULL))" ),
'State' => array( 'func' => "daemonCheck()?".translate('Running').":".translate('Stopped') ),
'Load' => array( 'func' => "getLoad()" ),
'Disk' => array( 'func' => "getDiskPercent()" ),
'State' => array( 'func' => 'daemonCheck()?'.translate('Running').':'.translate('Stopped') ),
'Load' => array( 'func' => 'getLoad()' ),
'Disk' => array( 'func' => 'getDiskPercent()' ),
),
),
'monitor' => array(
'permission' => 'Monitors',
'table' => 'Monitors',
'limit' => 1,
'selector' => "Monitors.Id",
'selector' => 'Monitors.Id',
'elements' => array(
'Id' => array( 'sql' => "Monitors.Id" ),
'Name' => array( 'sql' => "Monitors.Name" ),
'Id' => array( 'sql' => 'Monitors.Id' ),
'Name' => array( 'sql' => 'Monitors.Name' ),
'Type' => true,
'Function' => true,
'Enabled' => true,
@ -36,8 +36,8 @@ $statusData = array(
'Host' => true,
'Port' => true,
'Path' => true,
'Width' => array( 'sql' => "Monitors.Width" ),
'Height' => array( 'sql' => "Monitors.Height" ),
'Width' => array( 'sql' => 'Monitors.Width' ),
'Height' => array( 'sql' => 'Monitors.Height' ),
'Palette' => true,
'Orientation' => true,
'Brightness' => true,
@ -75,17 +75,17 @@ $statusData = array(
'DefaultScale' => true,
'WebColour' => true,
'Sequence' => true,
'MinEventId' => array( 'sql' => "(SELECT min(Events.Id) FROM Events WHERE Events.MonitorId = Monitors.Id" ),
'MaxEventId' => array( 'sql' => "(SELECT max(Events.Id) FROM Events WHERE Events.MonitorId = Monitors.Id" ),
'TotalEvents' => array( 'sql' => "(SELECT count(Events.Id) FROM Events WHERE Events.MonitorId = Monitors.Id" ),
'Status' => array( 'zmu' => "-m ".escapeshellarg($_REQUEST['id'][0])." -s" ),
'FrameRate' => array( 'zmu' => "-m ".escapeshellarg($_REQUEST['id'][0])." -f" ),
'MinEventId' => array( 'sql' => '(SELECT min(Events.Id) FROM Events WHERE Events.MonitorId = Monitors.Id' ),
'MaxEventId' => array( 'sql' => '(SELECT max(Events.Id) FROM Events WHERE Events.MonitorId = Monitors.Id' ),
'TotalEvents' => array( 'sql' => '(SELECT count(Events.Id) FROM Events WHERE Events.MonitorId = Monitors.Id' ),
'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",
'selector' => 'Events.MonitorId',
'elements' => array(
'Id' => true,
'Name' => true,
@ -108,11 +108,11 @@ $statusData = array(
'permission' => 'Events',
'table' => 'Events',
'limit' => 1,
'selector' => "Events.Id",
'selector' => 'Events.Id',
'elements' => array(
'Id' => array( 'sql' => "Events.Id" ),
'Id' => array( 'sql' => 'Events.Id' ),
'MonitorId' => true,
'MonitorName' => array('sql' => "(SELECT Monitors.Name FROM Monitors WHERE Monitors.Id = Events.MonitorId)"),
'MonitorName' => array('sql' => '(SELECT Monitors.Name FROM Monitors WHERE Monitors.Id = Events.MonitorId)'),
'Name' => true,
'Cause' => true,
'StartTime' => true,
@ -134,10 +134,10 @@ $statusData = array(
'Messaged' => true,
'Executed' => true,
'Notes' => true,
'MinFrameId' => array( 'sql' => "(SELECT min(Frames.FrameId) FROM Frames WHERE EventId=Events.Id)" ),
'MaxFrameId' => array( 'sql' => "(SELECT max(Frames.FrameId) FROM Frames WHERE Events.Id = Frames.EventId)" ),
'MinFrameDelta' => array( 'sql' => "(SELECT min(Frames.Delta) FROM Frames WHERE Events.Id = Frames.EventId)" ),
'MaxFrameDelta' => array( 'sql' => "(SELECT max(Frames.Delta) FROM Frames WHERE Events.Id = Frames.EventId)" ),
'MinFrameId' => array( 'sql' => '(SELECT min(Frames.FrameId) FROM Frames WHERE EventId=Events.Id)' ),
'MaxFrameId' => array( 'sql' => '(SELECT max(Frames.FrameId) FROM Frames WHERE Events.Id = Frames.EventId)' ),
'MinFrameDelta' => array( 'sql' => '(SELECT min(Frames.Delta) FROM Frames WHERE Events.Id = Frames.EventId)' ),
'MaxFrameDelta' => array( 'sql' => '(SELECT max(Frames.Delta) FROM Frames WHERE Events.Id = Frames.EventId)' ),
//'Path' => array( 'postFunc' => 'getEventPath' ),
),
),
@ -156,9 +156,9 @@ $statusData = array(
'permission' => 'Events',
'table' => 'Frames',
'limit' => 1,
'selector' => array( array( 'table' => 'Events', 'join' => "Events.Id = Frames.EventId", 'selector'=>"Events.Id" ), "Frames.FrameId" ),
'selector' => array( array( 'table' => 'Events', 'join' => 'Events.Id = Frames.EventId', 'selector'=>"Events.Id' ), 'Frames.FrameId" ),
'elements' => array(
//'Id' => array( 'sql' => "Frames.FrameId" ),
//'Id' => array( 'sql' => 'Frames.FrameId' ),
'FrameId' => true,
'EventId' => true,
'Type' => true,
@ -171,15 +171,15 @@ $statusData = array(
),
'frameimage' => array(
'permission' => 'Events',
'func' => "getFrameImage()"
'func' => 'getFrameImage()'
),
'nearframe' => array(
'permission' => 'Events',
'func' => "getNearFrame()"
'func' => 'getNearFrame()'
),
'nearevents' => array(
'permission' => 'Events',
'func' => "getNearEvents()"
'func' => 'getNearEvents()'
)
);
@ -192,7 +192,7 @@ function collectData() {
ajaxError( 'Unrecognised action or insufficient permissions' );
if ( !empty($entitySpec['func']) ) {
$data = eval( "return( ".$entitySpec['func']." );" );
$data = eval( 'return( '.$entitySpec['func']." );" );
} else {
$data = array();
$postFuncs = array();
@ -221,25 +221,25 @@ function collectData() {
$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'];
$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 );
ajaxError( 'Bad '.validJsStr($_REQUEST['entity']).' element '.$element );
if ( isset($elementData['func']) )
$data[$element] = eval( "return( ".$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'] ) ) );
$data[$element] = exec( escapeshellcmd( getZmuCommand( ' '.$elementData['zmu'] ) ) );
else {
if ( isset($elementData['sql']) )
$fieldSql[] = $elementData['sql']." as ".$element;
$fieldSql[] = $elementData['sql'].' as '.$element;
else
$fieldSql[] = $element;
if ( isset($elementData['table']) && isset($elementData['join']) ) {
$joinSql[] = "left join ".$elementData['table']." on ".$elementData['join'];
$joinSql[] = 'left join '.$elementData['table'].' on '.$elementData['join'];
}
if ( isset($elementData['group']) ) {
$groupSql[] = $elementData['group'];
@ -248,9 +248,9 @@ function collectData() {
}
if ( count($fieldSql) ) {
$sql = "select ".join( ", ", $fieldSql )." from ".$entitySpec['table'];
$sql = 'select '.join( ', ', $fieldSql ).' from '.$entitySpec['table'];
if ( $joinSql )
$sql .= " ".join( " ", array_unique( $joinSql ) );
$sql .= ' '.join( ' ', array_unique( $joinSql ) );
if ( $id && !empty($entitySpec['selector']) ) {
$index = 0;
$where = array();
@ -265,21 +265,21 @@ function collectData() {
}
$index++;
}
$sql .= " where ".join( " and ", $where );
$sql .= ' where '.join( ' and ', $where );
}
if ( $groupSql )
$sql .= " GROUP BY ".join( ",", array_unique( $groupSql ) );
$sql .= ' GROUP BY '.join( ',', array_unique( $groupSql ) );
if ( !empty($_REQUEST['sort']) )
$sql .= " order by ".$_REQUEST['sort'];
$sql .= ' order by '.$_REQUEST['sort'];
if ( !empty($entitySpec['limit']) )
$limit = $entitySpec['limit'];
elseif ( !empty($_REQUEST['count']) )
$limit = validInt($_REQUEST['count']);
$limit_offset="";
$limit_offset='';
if ( !empty($_REQUEST['offset']) )
$limit_offset = validInt($_REQUEST['offset']) . ", ";
$limit_offset = validInt($_REQUEST['offset']) . ', ';
if ( !empty( $limit ) )
$sql .= " limit ".$limit_offset.$limit;
$sql .= ' limit '.$limit_offset.$limit;
if ( isset($limit) && $limit == 1 ) {
if ( $sqlData = dbFetchOne( $sql, NULL, $values ) ) {
foreach ( $postFuncs as $element=>$func )
@ -312,7 +312,7 @@ switch( $_REQUEST['layout'] ) {
case 'xml NOT CURRENTLY SUPPORTED' :
{
header("Content-type: application/xml" );
echo( '<?xml version="1.0" encoding="iso-8859-1"?>'."\n" );
echo( '<?xml version="1.0' encoding='iso-8859-1"?>'.'\n' );
echo "<".strtolower($_REQUEST['entity']).">\n";
foreach ( $data as $key=>$value ) {
$key = strtolower( $key );
@ -332,7 +332,7 @@ switch( $_REQUEST['layout'] ) {
case 'text' :
{
header("Content-type: text/plain" );
echo join( " ", array_values( $data ) );
echo join( ' ', array_values( $data ) );
break;
}
}
@ -380,7 +380,7 @@ function getNearEvents() {
parseSort();
if ( $user['MonitorIds'] )
$midSql = " and MonitorId in (".join( ",", preg_split( '/["\'\s]*,["\'\s]*/', $user['MonitorIds'] ) ).")";
$midSql = ' and MonitorId in ('.join( ',', preg_split( '/["\'\s]*,["\'\s]*/', $user['MonitorIds'] ) ).')';
else
$midSql = '';

View File

@ -114,7 +114,7 @@ if ( $action == 'login' && isset($_REQUEST['username']) && ( ZM_AUTH_TYPE == 're
} else {
//Let them login but show an error
echo '<script type="text/javascript">alert("'.translate('RecaptchaWarning').'"); </script>';
Error ("Invalid recaptcha secret detected");
Error ('Invalid recaptcha secret detected');
}
}
} // end if success==false
@ -242,11 +242,11 @@ if ( !empty($_REQUEST['mid']) && canView( 'Control', $_REQUEST['mid'] ) ) {
$ctrlCommand = buildControlCommand( $monitor );
sendControlCommand( $monitor->Id(), $ctrlCommand );
} elseif ( $action == 'settings' ) {
$args = " -m " . escapeshellarg($mid);
$args .= " -B" . escapeshellarg($_REQUEST['newBrightness']);
$args .= " -C" . escapeshellarg($_REQUEST['newContrast']);
$args .= " -H" . escapeshellarg($_REQUEST['newHue']);
$args .= " -O" . escapeshellarg($_REQUEST['newColour']);
$args = ' -m ' . escapeshellarg($mid);
$args .= ' -B' . escapeshellarg($_REQUEST['newBrightness']);
$args .= ' -C' . escapeshellarg($_REQUEST['newContrast']);
$args .= ' -H' . escapeshellarg($_REQUEST['newHue']);
$args .= ' -O' . escapeshellarg($_REQUEST['newColour']);
$zmuCommand = getZmuCommand( $args );
@ -280,9 +280,9 @@ if ( canEdit( 'Control' ) ) {
if ( count( $changes ) ) {
if ( !empty($_REQUEST['cid']) ) {
dbQuery( "update Controls set ".implode( ", ", $changes )." where Id = ?", array($_REQUEST['cid']) );
dbQuery( 'update Controls set '.implode( ', ', $changes ).' where Id = ?', array($_REQUEST['cid']) );
} else {
dbQuery( "insert into Controls set ".implode( ", ", $changes ) );
dbQuery( 'insert into Controls set '.implode( ', ', $changes ) );
//$_REQUEST['cid'] = dbInsertId();
}
$refreshParent = true;
@ -291,8 +291,8 @@ if ( canEdit( 'Control' ) ) {
} elseif ( $action == 'delete' ) {
if ( isset($_REQUEST['markCids']) ) {
foreach( $_REQUEST['markCids'] as $markCid ) {
dbQuery( "delete from Controls where Id = ?", array($markCid) );
dbQuery( "update Monitors set Controllable = 0, ControlId = 0 where ControlId = ?", array($markCid) );
dbQuery( 'delete from Controls where Id = ?', array($markCid) );
dbQuery( 'update Monitors set Controllable = 0, ControlId = 0 where ControlId = ?', array($markCid) );
$refreshParent = true;
}
}
@ -376,9 +376,9 @@ if ( !empty($_REQUEST['mid']) && canEdit( 'Monitors', $_REQUEST['mid'] ) ) {
if ( count( $changes ) ) {
if ( $zid > 0 ) {
dbQuery( "UPDATE Zones SET ".implode( ", ", $changes )." WHERE MonitorId=? AND Id=?", array( $mid, $zid) );
dbQuery( 'UPDATE Zones SET '.implode( ', ', $changes ).' WHERE MonitorId=? AND Id=?', array( $mid, $zid) );
} else {
dbQuery( "INSERT INTO Zones SET MonitorId=?, ".implode( ", ", $changes ), array( $mid ) );
dbQuery( 'INSERT INTO Zones SET MonitorId=?, '.implode( ', ', $changes ), array( $mid ) );
dbQuery( 'UPDATE Monitors SET ZoneCount=(SELECT COUNT(Id) FROM Zones WHERE MonitorId=Monitors.Id) WHERE Id=?', array($mid));
}
//if ( $cookies ) session_write_close();
@ -405,7 +405,7 @@ if ( !empty($_REQUEST['mid']) && canEdit( 'Monitors', $_REQUEST['mid'] ) ) {
foreach( $pconfs as $pconf ) {
$value=$_REQUEST['pluginOpt'][$pconf['Name']];
if(array_key_exists($pconf['Name'], $_REQUEST['pluginOpt']) && ($pconf['Value']!=$value)) {
dbQuery("UPDATE PluginsConfig SET Value=? WHERE id=?", array( $value, $pconf['Id'] ) );
dbQuery('UPDATE PluginsConfig SET Value=? WHERE id=?', array( $value, $pconf['Id'] ) );
$changes++;
}
}
@ -528,7 +528,7 @@ if ( canEdit( 'Monitors' ) ) {
$changes = getFormChanges( $zone, $newZone, $types );
if ( count( $changes ) ) {
dbQuery( "update Zones set ".implode( ", ", $changes )." WHERE MonitorId=? AND Id=?", array( $mid, $zone['Id'] ) );
dbQuery( 'update Zones set '.implode( ', ', $changes ).' WHERE MonitorId=? AND Id=?', array( $mid, $zone['Id'] ) );
}
}
}
@ -559,12 +559,12 @@ if ( canEdit( 'Monitors' ) ) {
if ( count( $x10Changes ) ) {
if ( $x10Monitor && isset($_REQUEST['newX10Monitor']) ) {
dbQuery( "update TriggersX10 set ".implode( ", ", $x10Changes )." where MonitorId=?", array($mid) );
dbQuery( 'update TriggersX10 set '.implode( ', ', $x10Changes ).' where MonitorId=?', array($mid) );
} elseif ( !$user['MonitorIds'] ) {
if ( !$x10Monitor ) {
dbQuery( "insert into TriggersX10 set MonitorId = ?, ".implode( ", ", $x10Changes ), array( $mid ) );
dbQuery( 'insert into TriggersX10 set MonitorId = ?, '.implode( ', ', $x10Changes ), array( $mid ) );
} else {
dbQuery( "delete from TriggersX10 where MonitorId = ?", array($mid) );
dbQuery( 'delete from TriggersX10 where MonitorId = ?', array($mid) );
}
}
$restart = true;
@ -633,9 +633,9 @@ if ( canEdit( 'Devices' ) ) {
setDeviceStatusX10( $_REQUEST['key'], $_REQUEST['command'] );
} elseif ( isset( $_REQUEST['newDevice'] ) ) {
if ( isset($_REQUEST['did']) ) {
dbQuery( "update Devices set Name=?, KeyString=? where Id=?", array($_REQUEST['newDevice']['Name'], $_REQUEST['newDevice']['KeyString'], $_REQUEST['did']) );
dbQuery( 'update Devices set Name=?, KeyString=? where Id=?', array($_REQUEST['newDevice']['Name'], $_REQUEST['newDevice']['KeyString'], $_REQUEST['did']) );
} else {
dbQuery( "insert into Devices set Name=?, KeyString=?", array( $_REQUEST['newDevice']['Name'], $_REQUEST['newDevice']['KeyString'] ) );
dbQuery( 'insert into Devices set Name=?, KeyString=?', array( $_REQUEST['newDevice']['Name'], $_REQUEST['newDevice']['KeyString'] ) );
}
$refreshParent = true;
$view = 'none';
@ -643,7 +643,7 @@ if ( canEdit( 'Devices' ) ) {
} elseif ( $action == 'delete' ) {
if ( isset($_REQUEST['markDids']) ) {
foreach( $_REQUEST['markDids'] as $markDid ) {
dbQuery( "delete from Devices where Id=?", array($markDid) );
dbQuery( 'delete from Devices where Id=?', array($markDid) );
$refreshParent = true;
}
}
@ -734,9 +734,9 @@ if ( canEdit( 'System' ) ) {
if ( count( $changes ) ) {
if ( !empty($_REQUEST['id']) ) {
dbQuery( "UPDATE Servers SET ".implode( ", ", $changes )." WHERE Id = ?", array($_REQUEST['id']) );
dbQuery( 'UPDATE Servers SET '.implode( ', ', $changes ).' WHERE Id = ?', array($_REQUEST['id']) );
} else {
dbQuery( "INSERT INTO Servers set ".implode( ", ", $changes ) );
dbQuery( 'INSERT INTO Servers set '.implode( ', ', $changes ) );
}
$refreshParent = true;
}
@ -744,7 +744,7 @@ if ( canEdit( 'System' ) ) {
} else if ( $action == 'delete' ) {
if ( !empty($_REQUEST['markIds']) ) {
foreach( $_REQUEST['markIds'] as $Id )
dbQuery( "DELETE FROM Servers WHERE Id=?", array($Id) );
dbQuery( 'DELETE FROM Servers WHERE Id=?', array($Id) );
}
$refreshParent = true;
} else {
@ -762,9 +762,9 @@ if ( canEdit( 'System' ) ) {
if ( count( $changes ) ) {
if ( !empty($_REQUEST['id']) ) {
dbQuery( "UPDATE Storage SET ".implode( ", ", $changes )." WHERE Id = ?", array($_REQUEST['id']) );
dbQuery( 'UPDATE Storage SET '.implode( ', ', $changes ).' WHERE Id = ?', array($_REQUEST['id']) );
} else {
dbQuery( "INSERT INTO Storage set ".implode( ", ", $changes ) );
dbQuery( 'INSERT INTO Storage set '.implode( ', ', $changes ) );
}
$refreshParent = true;
}
@ -857,7 +857,7 @@ if ( canEdit( 'System' ) ) {
if ( $value['Type'] == 'boolean' && empty($_REQUEST['newConfig'][$name]) )
$newValue = 0;
elseif ( isset($_REQUEST['newConfig'][$name]) )
$newValue = preg_replace( "/\r\n/", "\n", stripslashes( $_REQUEST['newConfig'][$name] ) );
$newValue = preg_replace( "/\r\n/', '\n", stripslashes( $_REQUEST['newConfig'][$name] ) );
if ( isset($newValue) && ($newValue != $value['Value']) ) {
dbQuery( 'UPDATE Config SET Value=? WHERE Name=?', array( $newValue, $name ) );
@ -896,18 +896,18 @@ if ( canEdit( 'System' ) ) {
$changes = getFormChanges( $dbUser, $_REQUEST['newUser'], $types );
if ( $_REQUEST['newUser']['Password'] )
$changes['Password'] = "Password = password(".dbEscape($_REQUEST['newUser']['Password']).")";
$changes['Password'] = 'Password = password('.dbEscape($_REQUEST['newUser']['Password']).')';
else
unset( $changes['Password'] );
if ( count( $changes ) ) {
if ( !empty($_REQUEST['uid']) ) {
dbQuery( "update Users set ".implode( ", ", $changes )." where Id = ?", array($_REQUEST['uid']) );
dbQuery( 'update Users set '.implode( ', ', $changes ).' where Id = ?', array($_REQUEST['uid']) );
# If we are updating the logged in user, then update our session user data.
if ( $user and ( $dbUser['Username'] == $user['Username'] ) )
userLogin( $dbUser['Username'], $dbUser['Password'] );
} else {
dbQuery( "insert into Users set ".implode( ", ", $changes ) );
dbQuery( 'insert into Users set '.implode( ', ', $changes ) );
}
$refreshParent = true;
}
@ -924,20 +924,20 @@ if ( canEdit( 'System' ) ) {
$definitions = array();
foreach( dbFetchAll( $sql ) as $monitor )
{
$definitions[] = $monitor['Id'].":".$monitor['Function'].":".$monitor['Enabled'];
$definitions[] = $monitor['Id'].':'.$monitor['Function'].':'.$monitor['Enabled'];
}
$definition = join( ',', $definitions );
if ( $_REQUEST['newState'] )
$_REQUEST['runState'] = $_REQUEST['newState'];
dbQuery( "replace into States set Name=?, Definition=?", array( $_REQUEST['runState'],$definition) );
dbQuery( 'replace into States set Name=?, Definition=?', array( $_REQUEST['runState'],$definition) );
}
} elseif ( $action == 'delete' ) {
if ( isset($_REQUEST['runState']) )
dbQuery( "delete from States where Name=?", array($_REQUEST['runState']) );
dbQuery( 'delete from States where Name=?', array($_REQUEST['runState']) );
if ( isset($_REQUEST['markUids']) ) {
foreach( $_REQUEST['markUids'] as $markUid )
dbQuery( "delete from Users where Id = ?", array($markUid) );
dbQuery( 'delete from Users where Id = ?', array($markUid) );
if ( $markUid == $user['Id'] )
userLogout();
}
@ -952,11 +952,11 @@ if ( canEdit( 'System' ) ) {
$changes = getFormChanges( $dbUser, $_REQUEST['newUser'], $types );
if ( !empty($_REQUEST['newUser']['Password']) )
$changes['Password'] = "Password = password(".dbEscape($_REQUEST['newUser']['Password']).")";
$changes['Password'] = 'Password = password('.dbEscape($_REQUEST['newUser']['Password']).')';
else
unset( $changes['Password'] );
if ( count( $changes ) ) {
dbQuery( "update Users set ".implode( ", ", $changes )." where Id=?", array($uid) );
dbQuery( 'update Users set '.implode( ', ', $changes ).' where Id=?', array($uid) );
$refreshParent = true;
}
$view = 'none';

View File

@ -475,8 +475,7 @@ function getEventPath( $event ) {
function getEventDefaultVideoPath( $event ) {
$Event = new Event( $event );
return $Event->getStreamSrc( array( "mode"=>"mpeg", "format"=>"h264" ) );
//$Event->Path().'/'.$event['DefaultVideo'];
return $Event->getStreamSrc( array( 'mode'=>'mpeg', 'format'=>'h264' ) );
}
function deletePath( $path ) {

View File

@ -344,6 +344,7 @@ $SLANG = array(
'FilterArchiveEvents' => 'Archive all matches',
'FilterUpdateDiskSpace' => 'Update used disk space',
'FilterDeleteEvents' => 'Delete all matches',
'FilterMoveEvents' => 'Move all matches',
'FilterEmailEvents' => 'Email details of all matches',
'FilterExecuteEvents' => 'Execute command on all matches',
'FilterLog' => 'Filter log',

2
web/robots.txt Normal file
View File

@ -0,0 +1,2 @@
User-agent: *
Disallow: /

View File

@ -29,10 +29,10 @@
#monitors .alert {
color: #ffa500;
border: none;
margin: 0;
padding: 0;
border-radius: 0;
border: none;
}
#monitors .imageFeed {

View File

@ -45,7 +45,8 @@ $scales = array(
'12.5' => '1/8x',
);
if (isset($_REQUEST['view'])) unset($scales[$_REQUEST['view'] == 'montage' ? 'auto' : '']); //Only use fixed width/Height on montage
if (isset($_REQUEST['view']) && ($_REQUEST['view'] == 'montage'))
unset($scales['auto']); //Remove auto if we aren't using event view
$bandwidth_options = array(
'high' => translate('High'),

View File

@ -44,9 +44,9 @@ if (isset($_REQUEST['rate'])) {
if (isset($_REQUEST['scale'])) {
$scale = validInt($_REQUEST['scale']);
} else if (isset($_COOKIE['zmEventScaleAuto'])) { //If we're using scale to fit use it on all monitors
} else if ( isset( $_COOKIE['zmEventScaleAuto'] ) ) { //If we're using scale to fit use it on all monitors
$scale = 'auto';
} else if (isset($_COOKIE['zmEventScale'.$Event->MonitorId()])) {
} else if ( isset( $_COOKIE['zmEventScale'.$Event->MonitorId()] ) ) {
$scale = $_COOKIE['zmEventScale'.$Event->MonitorId()];
} else {
$scale = reScale( SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE );

View File

@ -57,8 +57,10 @@ else
$limit = 0;
$nEvents = dbFetchOne( $countSql, 'EventCount' );
Warning("Number of events: $nEvents");
if ( !empty($limit) && $nEvents > $limit ) {
$nEvents = $limit;
Logger::Debug("Number of events: $nEvents");
}
$pages = (int)ceil($nEvents/ZM_WEB_EVENTS_PER_PAGE);
if ( !empty($page) ) {

View File

@ -154,6 +154,9 @@ if ( (null !== $filter->Concurrent()) and $filter->Concurrent() )
<input type="hidden" name="object" value="filter"/>
<hr/>
<?php if ( $filter->Id() ) { ?>
<p class="Id"><label><?php echo translate('Id') ?></label><?php echo $filter->Id() ?></p>
<?php } ?>
<p class="Name">
<label for="filter[Name]"><?php echo translate('Name') ?></label>
<input type="text" id="filter[Name]" name="filter[Name]" value="<?php echo $filter->Name() ?>"/>
@ -161,7 +164,7 @@ if ( (null !== $filter->Concurrent()) and $filter->Concurrent() )
<table id="fieldsTable" class="filterTable">
<tbody>
<?php
for ( $i = 0; $i < count($terms); $i++ ) {
for ( $i=0; $i < count($terms); $i++ ) {
$term = $terms[$i];
if ( ! isset( $term['op'] ) )
$term['op'] = '=';
@ -249,7 +252,7 @@ for ( $i = 0; $i < count($terms); $i++ ) {
} elseif ( $term['attr'] == 'ServerId' ) {
$servers = array();
$servers['ZM_SERVER_ID'] = 'Current Server';
foreach ( dbFetchAll( "SELECT Id,Name FROM Servers ORDER BY lower(Name) ASC" ) as $server ) {
foreach ( dbFetchAll( 'SELECT Id,Name FROM Servers ORDER BY lower(Name) ASC' ) as $server ) {
$servers[$server['Id']] = $server['Name'];
}
?>
@ -336,7 +339,6 @@ echo htmlSelect( 'filter[Query][sort_asc]', $sort_dirns, $filter->sort_asc() );
</table>
<hr/>
<div id="actionsTable" class="filterTable">
<p>
<label><?php echo translate('FilterArchiveEvents') ?></label>
<input type="checkbox" name="filter[AutoArchive]" value="1"<?php if ( !empty($filter->AutoArchive()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>

View File

@ -97,7 +97,7 @@ $j( function() {
function applySort(event, ui) {
var monitor_ids = $j(this).sortable('toArray');
var ajax = new Request.JSON( {
url: '?request=console',
url: 'index.php?request=console',
data: { monitor_ids: monitor_ids, action: 'sort' },
method: 'post',
timeout: AJAX_TIMEOUT

View File

@ -40,6 +40,8 @@ function vjsReplay() {
}
}
$j.ajaxSetup ({timeout: AJAX_TIMEOUT }); //sets timeout for all getJSON.
var cueFrames = null; //make cueFrames availaible even if we don't send another ajax query
function initialAlarmCues (eventId) {

View File

@ -8,10 +8,10 @@ function changeScale() {
last: $j('#lastLink')
}
if (img) {
if ( img ) {
let baseWidth = $j('#base_width').val();
let baseHeight = $j('#base_height').val();
if (scale == "auto") {
if ( scale == 'auto' ) {
let newSize = scaleToFit(baseWidth, baseHeight, img, $j('#controls'));
newWidth = newSize.width;
newHeight = newSize.height;
@ -21,8 +21,8 @@ function changeScale() {
newWidth = baseWidth * scale / SCALE_BASE;
newHeight = baseHeight * scale / SCALE_BASE;
}
img.css('width', newWidth + "px");
img.css('height', newHeight + "px");
img.css('width', newWidth + 'px');
img.css('height', newHeight + 'px');
}
Cookie.write( 'zmWatchScale', scale, { duration: 10*365 } );
$j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices
@ -31,5 +31,4 @@ function changeScale() {
});
}
if (scale == "auto") $j(document).ready(changeScale);
if (scale == 'auto') $j(document).ready(changeScale);

View File

@ -1,3 +1,3 @@
var scale = "<?php echo $scale ?>";
var scale = '<?php echo $scale ?>';
var SCALE_BASE = <?php echo SCALE_BASE ?>;