Merge branch 'robots' into storageareas

This commit is contained in:
Isaac Connor 2017-12-07 10:31:25 -05:00
commit bd73e7c2e2
14 changed files with 104 additions and 98 deletions

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;
@ -195,8 +198,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;
}
}
@ -379,7 +379,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 ) {

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

@ -93,7 +93,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 ?>;