Revert "Fix sql query when user is limited to specific monitors"
This reverts commit 41b581552e
.
This commit is contained in:
parent
41b581552e
commit
851a246cf2
|
@ -27,15 +27,13 @@ if ( !canView( 'Events' ) )
|
||||||
$eid = validInt( $_REQUEST['eid'] );
|
$eid = validInt( $_REQUEST['eid'] );
|
||||||
$fid = !empty($_REQUEST['fid'])?validInt($_REQUEST['fid']):1;
|
$fid = !empty($_REQUEST['fid'])?validInt($_REQUEST['fid']):1;
|
||||||
|
|
||||||
$sql = 'SELECT E.*,M.Name AS MonitorName,M.Width,M.Height,M.DefaultRate,M.DefaultScale FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?';
|
if ( $user['MonitorIds'] )
|
||||||
$sql_values = array( $eid );
|
$midSql = " and MonitorId in (".join( ",", preg_split( '/["\'\s]*,["\'\s]*/', dbEscape($user['MonitorIds']) ) ).")";
|
||||||
|
else
|
||||||
|
$midSql = '';
|
||||||
|
|
||||||
if ( $user['MonitorIds'] ) {
|
$sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultRate,M.DefaultScale FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?'.$midSql;
|
||||||
$monitor_ids = preg_split( '/,/', $user['MonitorIds'] );
|
$event = dbFetchOne( $sql, NULL, array($eid) );
|
||||||
$sql .= ' AND MonitorId IN (' .implode( ',', array_fill(0,count($monitor_ids),'?') ) . ')';
|
|
||||||
$sql_values = array_merge( $sql_values, $monitor_ids );
|
|
||||||
}
|
|
||||||
$event = dbFetchOne( $sql, NULL, $sql_values );
|
|
||||||
|
|
||||||
if ( isset( $_REQUEST['rate'] ) )
|
if ( isset( $_REQUEST['rate'] ) )
|
||||||
$rate = validInt($_REQUEST['rate']);
|
$rate = validInt($_REQUEST['rate']);
|
||||||
|
|
Loading…
Reference in New Issue