Ensured that events cannot be scrolled into forbidden monitors.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@937 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2004-03-09 17:07:09 +00:00
parent ba2820ef37
commit 54a57d9505
1 changed files with 12 additions and 3 deletions

View File

@ -31,7 +31,16 @@ if ( !isset($mode) )
$mode = "still"; $mode = "still";
} }
$result = mysql_query( "select E.*,M.Name as MonitorName,M.Width,M.Height from Events as E, Monitors as M where E.Id = '$eid' and E.MonitorId = M.Id" ); if ( $user['MonitorIds'] )
{
$mid_sql = " and MonitorId in (".join( ",", preg_split( '/["\'\s]*,["\'\s]*/', $user['MonitorIds'] ) ).")";
}
else
{
$mid_sql = '';
}
$result = mysql_query( "select E.*,M.Name as MonitorName,M.Width,M.Height from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.Id = '$eid'$mid_sql" );
if ( !$result ) if ( !$result )
die( mysql_error() ); die( mysql_error() );
$event = mysql_fetch_assoc( $result ); $event = mysql_fetch_assoc( $result );
@ -39,12 +48,12 @@ $event = mysql_fetch_assoc( $result );
if ( empty($mid) ) if ( empty($mid) )
{ {
$mid = 0; $mid = 0;
$mid_sql = '';
} }
else else
{ {
$mid_sql = " and MonitorId = '$mid'"; $mid_sql .= " and MonitorId = '$mid'";
} }
$result = mysql_query( "select * from Events where Id < '$eid'$mid_sql order by Id desc limit 0,1" ); $result = mysql_query( "select * from Events where Id < '$eid'$mid_sql order by Id desc limit 0,1" );
if ( !$result ) if ( !$result )
die( mysql_error() ); die( mysql_error() );