From 003b8c98680b77c98d904eaa989cfd395b93f5ce Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 17 Dec 2013 14:38:08 -0500 Subject: [PATCH] more removal of escaping --- web/ajax/status.php | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/web/ajax/status.php b/web/ajax/status.php index 29823acf0..3f4770987 100644 --- a/web/ajax/status.php +++ b/web/ajax/status.php @@ -246,12 +246,16 @@ function collectData() { $index = 0; $where = array(); + $values = array(); foreach( $entitySpec['selector'] as $selector ) { - if ( is_array( $selector ) ) - $where[] = $selector['selector']." = ".dbEscape($id[$index]); - else - $where[] = $selector." = ".dbEscape($id[$index]); + if ( is_array( $selector ) ) { + $where[] = $selector['selector'].' = ?'; + $values[] = $id[$index]; + } else { + $where[] = $selector.' = ?'; + $values[] = $id[$index]; + } $index++; } $sql .= " where ".join( " and ", $where ); @@ -259,27 +263,22 @@ function collectData() if ( $groupSql ) $sql .= " group by ".join( ",", array_unique( $groupSql ) ); if ( !empty($_REQUEST['sort']) ) - $sql .= " order by ".dbEscape($_REQUEST['sort']); + $sql .= " order by ".$_REQUEST['sort']; if ( !empty($entitySpec['limit']) ) $limit = $entitySpec['limit']; elseif ( !empty($_REQUEST['count']) ) - $limit = dbEscape($_REQUEST['count']); + $limit = $_REQUEST['count']; if ( !empty( $limit ) ) $sql .= " limit ".$limit; - if ( isset($limit) && $limit == 1 ) - { - if ( $sqlData = dbFetchOne( $sql ) ) - { + if ( isset($limit) && $limit == 1 ) { + if ( $sqlData = dbFetchOne( $sql, NULL, $values ) ) { foreach ( $postFuncs as $element=>$func ) $sqlData[$element] = eval( 'return( '.$func.'( $sqlData ) );' ); $data = array_merge( $data, $sqlData ); } - } - else - { + } else { $count = 0; - foreach( dbFetchAll( $sql ) as $sqlData ) - { + foreach( dbFetchAll( $sql, NULL, $values ) as $sqlData ) { foreach ( $postFuncs as $element=>$func ) $sqlData[$element] = eval( 'return( '.$func.'( $sqlData ) );' ); $data[] = $sqlData;