This commit is contained in:
Isaac Connor 2019-05-24 10:00:15 -04:00
parent 2fc7b3cf4d
commit 4e51379087
1 changed files with 5 additions and 5 deletions

View File

@ -193,7 +193,7 @@ function collectData() {
$entitySpec = &$statusData[strtolower(validJsStr($_REQUEST['entity']))]; $entitySpec = &$statusData[strtolower(validJsStr($_REQUEST['entity']))];
#print_r( $entitySpec ); #print_r( $entitySpec );
if ( !canView( $entitySpec['permission'] ) ) if ( !canView( $entitySpec['permission'] ) )
ajaxError( 'Unrecognised action or insufficient permissions' ); ajaxError('Unrecognised action or insufficient permissions');
if ( !empty($entitySpec['func']) ) { if ( !empty($entitySpec['func']) ) {
$data = eval( 'return( '.$entitySpec['func']." );" ); $data = eval( 'return( '.$entitySpec['func']." );" );
@ -398,9 +398,9 @@ function getNearEvents() {
global $user, $sortColumn, $sortOrder; global $user, $sortColumn, $sortOrder;
$eventId = $_REQUEST['id']; $eventId = $_REQUEST['id'];
$event = dbFetchOne( 'SELECT * FROM Events WHERE Id=?', NULL, array( $eventId ) ); $event = dbFetchOne('SELECT * FROM Events WHERE Id=?', NULL, array($eventId));
parseFilter( $_REQUEST['filter'] ); parseFilter($_REQUEST['filter']);
parseSort(); parseSort();
if ( $user['MonitorIds'] ) if ( $user['MonitorIds'] )
@ -419,8 +419,8 @@ function getNearEvents() {
$sql .= ', E.Id DESC'; $sql .= ', E.Id DESC';
} }
$sql .= ' LIMIT 1'; $sql .= ' LIMIT 1';
$result = dbQuery( $sql ); $result = dbQuery($sql);
$prevEvent = dbFetchNext( $result ); $prevEvent = dbFetchNext($result);
$sql = "SELECT E.Id AS Id, E.StartTime AS StartTime FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE $sortColumn ".($sortOrder=='asc'?'>=':'<=')." '".$event[$_REQUEST['sort_field']]."'".$_REQUEST['filter']['sql'].$midSql.' AND E.Id>'.$event['Id'] . " ORDER BY $sortColumn $sortOrder"; $sql = "SELECT E.Id AS Id, E.StartTime AS StartTime FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE $sortColumn ".($sortOrder=='asc'?'>=':'<=')." '".$event[$_REQUEST['sort_field']]."'".$_REQUEST['filter']['sql'].$midSql.' AND E.Id>'.$event['Id'] . " ORDER BY $sortColumn $sortOrder";
if ( $sortColumn != 'E.Id' ) { if ( $sortColumn != 'E.Id' ) {