From 00478b3ff2e33e22492c9ca7f6850a7128d0c030 Mon Sep 17 00:00:00 2001 From: stan Date: Sun, 28 Nov 2010 21:27:08 +0000 Subject: [PATCH] Fixed id parsing. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3209 e3e1d417-86f3-4887-817a-d78f3d33393f --- web/ajax/status.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/web/ajax/status.php b/web/ajax/status.php index d112b02f0..fe82fe5cc 100644 --- a/web/ajax/status.php +++ b/web/ajax/status.php @@ -189,10 +189,12 @@ function collectData() $elements = &$entitySpec['elements']; $lc_elements = array_change_key_case( $elements ); - if ( !isset($_REQUEST['id']) ) - $_REQUEST['id'] = array_keys( $id ); - else if ( !is_array($_REQUEST['id']) ) - $_REQUEST['id'] = array( validJsStr($_REQUEST['id']) ); + $id = false; + if ( isset($_REQUEST['id']) ) + if ( !is_array($_REQUEST['id']) ) + $id = array( validJsStr($_REQUEST['id']) ); + else + $id = array_values( $_REQUEST['id'] ); if ( !isset($_REQUEST['element']) ) $_REQUEST['element'] = array_keys( $elements ); @@ -240,16 +242,16 @@ function collectData() $sql = "select ".join( ", ", $fieldSql )." from ".$entitySpec['table']; if ( $joinSql ) $sql .= " ".join( " ", array_unique( $joinSql ) ); - if ( $entitySpec['selector'] ) + if ( $id && !empty($entitySpec['selector']) ) { $index = 0; $where = array(); foreach( $entitySpec['selector'] as $selector ) { if ( is_array( $selector ) ) - $where[] = $selector['selector']." = ".dbEscape($_REQUEST['id'][$index]); + $where[] = $selector['selector']." = ".dbEscape($id[$index]); else - $where[] = $selector." = ".dbEscape($_REQUEST['id'][$index]); + $where[] = $selector." = ".dbEscape($id[$index]); $index++; } $sql .= " where ".join( " and ", $where );