Skip to content

Commit

Permalink
Fix server side validation [Ajax Availability]
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienheraud committed Jul 6, 2018
1 parent 07d6b65 commit e0edcbd
Showing 1 changed file with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,25 +154,19 @@ protected static function _where( $table, $fieldnames, $values, $method = 'array
$fields = JCckDatabase::loadObjectList( 'SELECT name, storage, storage_table, storage_field FROM #__cck_core_fields WHERE name IN ("'.str_replace( '||', '","', $fieldnames ).'")', 'name' );
$s_fields = array();
$where = explode( '||', $fieldnames );
if ( $method == 'object' ) {
foreach ( $where as $w ) {
if ( isset( $fields[$w] ) && $fields[$w]->storage == 'standard' && $fields[$w]->storage_table == $table ) {
$s_field = $fields[$w]->storage_field;

foreach ( $where as $w ) {
if ( isset( $fields[$w] ) && $fields[$w]->storage == 'standard' && $fields[$w]->storage_table == $table ) {
$s_field = $fields[$w]->storage_field;

if ( $method == 'object' ) {
$v = isset( $values->$s_field ) ? $values->$s_field : '';
if ( $v != '' && !isset( $s_fields[$s_field] ) ) {
$s_fields[$s_field] = '';
$and .= ' AND '.$s_field.'="'.JCckDatabase::escape( $v ).'"';
}
} else {
$v = $values[$w]->value;
}
}
} else {
foreach ( $where as $w ) {
if ( isset( $fields[$w] ) && $fields[$w]->storage == 'standard' && $fields[$w]->storage_table == $table ) {
$v = $values[$w]->value;
if ( $v != '' && !isset( $s_fields[$s_field] ) ) {
$s_fields[$s_field] = '';
$and .= ' AND '.$values[$w]->storage_field.'="'.JCckDatabase::escape( $v ).'"';
}
if ( $v != '' && !isset( $s_fields[$s_field] ) ) {
$s_fields[$s_field] = '';
$and .= ' AND '.$s_field.'="'.JCckDatabase::escape( $v ).'"';
}
}
}
Expand Down

0 comments on commit e0edcbd

Please sign in to comment.