Fixed id parsing.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3209 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2010-11-28 21:27:08 +00:00
parent c3918a7ac4
commit 00478b3ff2
1 changed files with 9 additions and 7 deletions

View File

@ -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 );