Make variable names uniform in search scripts

This commit is contained in:
Atul Pratap Singh 2012-06-01 20:57:20 +05:30
parent 230cae24d4
commit 2d9217f1da
2 changed files with 135 additions and 131 deletions

View File

@ -22,18 +22,18 @@ if (! defined('PHPMYADMIN')) {
function PMA_tbl_getFields($db, $table)
{
// Gets the list and number of fields
$fields = PMA_DBI_get_columns($db, $table, null, true);
$fields_list = $fields_null = $fields_type = $fields_collation = array();
$geom_column_present = false;
$columns = PMA_DBI_get_columns($db, $table, null, true);
$columnNames = $columnNullFlags = $columnTypes = $columnCollations = array();
$geomColumnFlag = false;
$geom_types = PMA_getGISDatatypes();
foreach ($fields as $key => $row) {
$fields_list[] = $row['Field'];
foreach ($columns as $key => $row) {
$columnNames[] = $row['Field'];
$type = $row['Type'];
// check whether table contains geometric columns
if (in_array($type, $geom_types)) {
$geom_column_present = true;
$geomColumnFlag = true;
}
// reformat mysql query output
@ -55,35 +55,35 @@ function PMA_tbl_getFields($db, $table)
if (empty($type)) {
$type = ' ';
}
$fields_null[] = $row['Null'];
$fields_type[] = $type;
$fields_collation[]
$columnNullFlags[] = $row['Null'];
$columnTypes[] = $type;
$columnCollations[]
= ! empty($row['Collation']) && $row['Collation'] != 'NULL'
? $row['Collation']
: '';
} // end while
return array(
$fields_list,
$fields_type,
$fields_collation,
$fields_null,
$geom_column_present
$columnNames,
$columnTypes,
$columnCollations,
$columnNullFlags,
$geomColumnFlag
);
}
/**
* Sets the table header for displaying a table in query-by-example format.
*
* @param bool $geom_column_present whether a geometry column is present
* @param bool $geomColumnFlag whether a geometry column is present
*
* @return HTML content, the tags and content for table header
*/
function PMA_tbl_setTableHeader($geom_column_present = false)
function PMA_tbl_setTableHeader($geomColumnFlag = false)
{
// Display the Function column only if there is alteast one geomety colum
$func = '';
if ($geom_column_present) {
if ($geomColumnFlag) {
$func = '<th>' . __('Function') . '</th>';
}
@ -135,7 +135,7 @@ function PMA_tbl_getSubTabs()
* @param string $table Selected table
* @param array $titles Selected title
* @param int $foreignMaxLimit Max limit of displaying foreign elements
* @param array $fields Array of search criteria inputs
* @param array $criteriaValues Array of search criteria inputs
* @param bool $in_fbs Whether we are in 'function based search'
* @param bool $in_zoom_search_edit Whether we are in zoom search edit
*
@ -143,8 +143,8 @@ function PMA_tbl_getSubTabs()
* for search criteria input.
*/
function PMA_getForeignFields_Values($foreigners, $foreignData, $field,
$tbl_fields_type, $column_index, $db, $table, $titles, $foreignMaxLimit, $fields,
$in_fbs = false, $in_zoom_search_edit = false
$tbl_fields_type, $column_index, $db, $table, $titles, $foreignMaxLimit,
$criteriaValues, $in_fbs = false, $in_zoom_search_edit = false
) {
$str = '';
if ($foreigners
@ -152,7 +152,7 @@ function PMA_getForeignFields_Values($foreigners, $foreignData, $field,
&& is_array($foreignData['disp_row'])
) {
// f o r e i g n k e y s
$str .= '<select name="fields[' . $column_index . ']" id="fieldID_'
$str .= '<select name="criteriaValues[' . $column_index . ']" id="fieldID_'
. $column_index .'">';
// go back to first row
// here, the 4th parameter is empty because there is no current
@ -165,14 +165,16 @@ function PMA_getForeignFields_Values($foreigners, $foreignData, $field,
$str .= '</select>';
} elseif ($foreignData['foreign_link'] == true) {
if (isset($fields[$column_index]) && is_string($fields[$column_index])) {
if (isset($criteriaValues[$column_index])
&& is_string($criteriaValues[$column_index])
) {
$str .= '<input type="text" id="fieldID_' . $column_index . '"'
. ' name="fields[' . $column_index . ']" value="'
. $fields[$column_index] . '" id="field_' . md5($field)
. ' name="criteriaValues[' . $column_index . ']" value="'
. $criteriaValues[$column_index] . '" id="field_' . md5($field)
. '[' . $column_index .']" class="textfield" />';
} else {
$str .= '<input type="text" id="fieldID_' . $column_index . '"'
. ' name="fields[' . $column_index . ']"'
. ' name="criteriaValues[' . $column_index . ']"'
. ' id="field_' . md5($field) . '[' . $column_index .']" class="textfield" />';
}
$str .= <<<EOT
@ -187,7 +189,7 @@ EOT;
} elseif (in_array($tbl_fields_type[$column_index], PMA_getGISDatatypes())) {
// g e o m e t r y
$str .= '<input type="text" name="fields[' . $column_index . ']"'
$str .= '<input type="text" name="criteriaValues[' . $column_index . ']"'
. ' size="40" class="textfield" id="field_' . $column_index . '" />';
if ($in_fbs) {
@ -220,18 +222,18 @@ EOT;
if ((strncasecmp($tbl_fields_type[$column_index], 'enum', 4) && ! $in_zoom_search_edit)
|| (strncasecmp($tbl_fields_type[$column_index], 'set', 3) && $in_zoom_search_edit)
) {
$str .= '<select name="fields[' . ($column_index) . '][]" id="fieldID_'
$str .= '<select name="criteriaValues[' . ($column_index) . '][]" id="fieldID_'
. $column_index .'">';
} else {
$str .= '<select name="fields[' . ($column_index) . '][]" id="fieldID_'
$str .= '<select name="criteriaValues[' . ($column_index) . '][]" id="fieldID_'
. $column_index .'" multiple="multiple" size="'
. min(3, $cnt_value) . '">';
}
for ($j = 0; $j < $cnt_value; $j++) {
if (isset($fields[$column_index])
&& is_array($fields[$column_index])
&& in_array($value[$j], $fields[$column_index])
if (isset($criteriaValues[$column_index])
&& is_array($criteriaValues[$column_index])
&& in_array($value[$j], $criteriaValues[$column_index])
) {
$str .= '<option value="' . $value[$j] . '" Selected>'
. $value[$j] . '</option>';
@ -255,12 +257,14 @@ EOT;
$the_class .= ' bit';
}
if (isset($fields[$column_index]) && is_string($fields[$column_index])) {
$str .= '<input type="text" name="fields[' . $column_index . ']"'
if (isset($criteriaValues[$column_index])
&& is_string($criteriaValues[$column_index])
) {
$str .= '<input type="text" name="criteriaValues[' . $column_index . ']"'
.' size="40" class="' . $the_class . '" id="fieldID_'
. $column_index .'" value = "' . $fields[$column_index] . '"/>';
. $column_index .'" value = "' . $criteriaValues[$column_index] . '"/>';
} else {
$str .= '<input type="text" name="fields[' . $column_index . ']"'
$str .= '<input type="text" name="criteriaValues[' . $column_index . ']"'
.' size="40" class="' . $the_class . '" id="fieldID_'
. $column_index .'" />';
}
@ -271,18 +275,18 @@ EOT;
/**
* Return the where clause for query generation based on the inputs provided.
*
* @param mixed $fields Search criteria input
* @param string $names Name of the column on which search is submitted
* @param string $types Type of the field
* @param string $collations Field collation
* @param string $func_type Search fucntion/operator
* @param bool $unaryFlag Whether operator unary or not
* @param bool $geom_func Whether geometry functions should be applied
* @param mixed $criteriaValues Search criteria input
* @param string $names Name of the column on which search is submitted
* @param string $types Type of the field
* @param string $collations Field collation
* @param string $func_type Search fucntion/operator
* @param bool $unaryFlag Whether operator unary or not
* @param bool $geom_func Whether geometry functions should be applied
*
* @return string HTML content for viewing foreing data and elements
* for search criteria input.
*/
function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
function PMA_tbl_search_getWhereClause($criteriaValues, $names, $types, $collations,
$func_type, $unaryFlag, $geom_func = null
) {
/**
@ -307,7 +311,7 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
} else {
// If the function takes two parameters
// create gis data from the string
$gis_data = PMA_createGISData($fields);
$gis_data = PMA_createGISData($criteriaValues);
$w = $geom_func . '(' . PMA_backquote($names) . ',' . $gis_data . ')';
return $w;
@ -317,7 +321,7 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
$types = $geom_funcs[$geom_func]['type'];
// If the where clause is something like 'IsEmpty(`spatial_col_name`)'
if (isset($geom_unary_functions[$geom_func]) && trim($fields) == '') {
if (isset($geom_unary_functions[$geom_func]) && trim($criteriaValues) == '') {
$w = $backquoted_name;
return $w;
}
@ -326,20 +330,20 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
}
if ($unaryFlag) {
$fields = '';
$criteriaValues = '';
$w = $backquoted_name . ' ' . $func_type;
} elseif (in_array($types, PMA_getGISDatatypes()) && ! empty($fields)) {
} elseif (in_array($types, PMA_getGISDatatypes()) && ! empty($criteriaValues)) {
// create gis data from the string
$gis_data = PMA_createGISData($fields);
$gis_data = PMA_createGISData($criteriaValues);
$w = $backquoted_name . ' ' . $func_type . ' ' . $gis_data;
} elseif (strncasecmp($types, 'enum', 4) == 0) {
if (! empty($fields)) {
if (! is_array($fields)) {
$fields = explode(',', $fields);
if (! empty($criteriaValues)) {
if (! is_array($criteriaValues)) {
$criteriaValues = explode(',', $criteriaValues);
}
$enum_selected_count = count($fields);
$enum_selected_count = count($criteriaValues);
if ($func_type == '=' && $enum_selected_count > 1) {
$func_type = 'IN';
$parens_open = '(';
@ -354,16 +358,16 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
$parens_open = '';
$parens_close = '';
}
$enum_where = '\'' . PMA_sqlAddslashes($fields[0]) . '\'';
$enum_where = '\'' . PMA_sqlAddslashes($criteriaValues[0]) . '\'';
for ($e = 1; $e < $enum_selected_count; $e++) {
$enum_where .= ', \'' . PMA_sqlAddslashes($fields[$e]) . '\'';
$enum_where .= ', \'' . PMA_sqlAddslashes($criteriaValues[$e]) . '\'';
}
$w = $backquoted_name . ' ' . $func_type . ' ' . $parens_open
. $enum_where . $parens_close;
}
} elseif ($fields != '') {
} elseif ($criteriaValues != '') {
// For these types we quote the value. Even if it's another type (like INT),
// for a LIKE we always quote the value. MySQL converts strings to numbers
// and numbers to strings as necessary during the comparison
@ -378,11 +382,11 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
// LIKE %...%
if ($func_type == 'LIKE %...%') {
$func_type = 'LIKE';
$fields = '%' . $fields . '%';
$criteriaValues = '%' . $criteriaValues . '%';
}
if ($func_type == 'REGEXP ^...$') {
$func_type = 'REGEXP';
$fields = '^' . $fields . '$';
$criteriaValues = '^' . $criteriaValues . '$';
}
if ($func_type == 'IN (...)'
@ -393,7 +397,7 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
$func_type = str_replace(' (...)', '', $func_type);
// quote values one by one
$values = explode(',', $fields);
$values = explode(',', $criteriaValues);
foreach ($values as &$value) {
$value = $quot . PMA_sqlAddslashes(trim($value)) . $quot;
}
@ -408,7 +412,7 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations,
}
} else {
$w = $backquoted_name . ' ' . $func_type . ' '
. $quot . PMA_sqlAddslashes($fields) . $quot;;
. $quot . PMA_sqlAddslashes($criteriaValues) . $quot;;
}
} // end if
@ -466,7 +470,7 @@ function PMA_tblSearchGenerateWhereClause()
}
// If there are no search criterias set, return
if (! array_filter($_POST['fields'])) {
if (! array_filter($_POST['criteriaValues'])) {
return $fullWhereClause;
}
@ -481,7 +485,7 @@ function PMA_tblSearchGenerateWhereClause()
$tmp_geom_func = isset($geom_func[$column_index]) ? $geom_func[$column_index] : null;
$whereClause = PMA_tbl_search_getWhereClause(
$_POST['fields'][$column_index],
$_POST['criteriaValues'][$column_index],
$_POST['criteriaColumnNames'][$column_index],
$_POST['criteriaColumnTypes'][$column_index],
$_POST['criteriaColumnCollations'][$column_index], $operator, $unaryFlag,

View File

@ -40,15 +40,15 @@ $GLOBALS['js_include'][] = 'tbl_zoom_plot_jqplot.js';
* Sets globals from $_POST
*/
$post_params = array(
'collations',
'criteriaColumnCollations',
'dataLabel',
'fields',
'fields_null',
'inputs',
'criteriaValues',
'criteriaColumnNullFlags',
'criteriaColumnNames',
'maxPlotLimit',
'types',
'criteriaColumnTypes',
'zoom_submit',
'zoomFunc'
'criteriaColumnOperators'
);
foreach ($post_params as $one_post_param) {
if (isset($_POST[$one_post_param])) {
@ -99,20 +99,20 @@ if (isset($_REQUEST['change_tbl_info']) && $_REQUEST['change_tbl_info'] == true)
// Gets the list and number of fields
list($fields_list, $fields_type, $fields_collation, $fields_null)
list($columnNames, $columnTypes, $columnCollations, $columnNullFlags)
= PMA_tbl_getFields($_REQUEST['db'], $_REQUEST['table']);
$foreigners = PMA_getForeigners($db, $table);
$titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
$key = array_search($field, $fields_list);
$extra_data['field_type'] = $fields_type[$key];
$extra_data['field_collation'] = $fields_collation[$key];
$key = array_search($field, $columnNames);
$extra_data['field_type'] = $columnTypes[$key];
$extra_data['field_collation'] = $columnCollations[$key];
// HTML for operators
$html = '<select name="zoomFunc[]">';
$html = '<select name="criteriaColumnOperators[]">';
$html .= $GLOBALS['PMA_Types']->getTypeOperatorsHtml(
preg_replace('@\(.*@s', '', $fields_type[$key]),
$fields_null[$key]
preg_replace('@\(.*@s', '', $columnTypes[$key]),
$columnNullFlags[$key]
);
$html .= '</select>';
$extra_data['field_operators'] = $html;
@ -127,7 +127,7 @@ if (isset($_REQUEST['change_tbl_info']) && $_REQUEST['change_tbl_info'] == true)
$foreigners,
$foreignData,
$field,
array($_REQUEST['it'] => $fields_type[$key]),
array($_REQUEST['it'] => $columnTypes[$key]),
$_REQUEST['it'],
$_REQUEST['db'],
$_REQUEST['table'],
@ -161,17 +161,17 @@ $err_url = $goto . '?' . PMA_generate_common_url($db, $table);
// Gets the list and number of fields
list($fields_list, $fields_type, $fields_collation, $fields_null)
list($columnNames, $columnTypes, $columnCollations, $columnNullFlags)
= PMA_tbl_getFields($db, $table);
$fields_cnt = count($fields_list);
$columnCount = count($columnNames);
// retrieve keys into foreign fields, if any
// check also foreigners even if relwork is FALSE (to get
// foreign keys from innodb)
$foreigners = PMA_getForeigners($db, $table);
$tbl_fields_type = $tbl_fields_collation = $tbl_fields_null = array();
$tbl_fields_type = $tbl_fields_collation = $tbl_criteriaColumnNullFlags = array();
if (! isset($zoom_submit) && ! isset($inputs)) {
if (! isset($zoom_submit) && ! isset($criteriaColumnNames)) {
$dataLabel = PMA_getDisplayField($db, $table);
}
?>
@ -186,30 +186,30 @@ echo PMA_generateHtmlTabs(PMA_tbl_getSubTabs(), $url_params, 'topmenu2');
/**
* Set the field name,type,collation and whether null on select of a coulmn
*/
if (isset($inputs) && ($inputs[0] != 'pma_null' || $inputs[1] != 'pma_null')) {
if (isset($criteriaColumnNames) && ($criteriaColumnNames[0] != 'pma_null' || $criteriaColumnNames[1] != 'pma_null')) {
for ($i = 0 ; $i < 4 ; $i++) {
if ($inputs[$i] != 'pma_null') {
$key = array_search($inputs[$i], $fields_list);
$tbl_fields_type[$i] = $fields_type[$key];
$tbl_fields_collation[$i] = $fields_collation[$key];
$tbl_fields_func[$i] = '<select name="zoomFunc[]">';
if ($criteriaColumnNames[$i] != 'pma_null') {
$key = array_search($criteriaColumnNames[$i], $columnNames);
$tbl_fields_type[$i] = $columnTypes[$key];
$tbl_fields_collation[$i] = $columnCollations[$key];
$tbl_fields_func[$i] = '<select name="criteriaColumnOperators[]">';
$tbl_fields_func[$i] .= $GLOBALS['PMA_Types']->getTypeOperatorsHtml(
preg_replace('@\(.*@s', '', $fields_type[$key]),
$fields_null[$key], $zoomFunc[$i]
preg_replace('@\(.*@s', '', $columnTypes[$key]),
$columnNullFlags[$key], $criteriaColumnOperators[$i]
);
$tbl_fields_func[$i] .= '</select>';
$foreignData = PMA_getForeignData($foreigners, $inputs[$i], false, '', '');
$foreignData = PMA_getForeignData($foreigners, $criteriaColumnNames[$i], false, '', '');
$tbl_fields_value[$i] = PMA_getForeignFields_Values(
$foreigners,
$foreignData,
$inputs[$i],
$criteriaColumnNames[$i],
$tbl_fields_type,
$i,
$db,
$table,
$titles,
$GLOBALS['cfg']['ForeignKeyMaxLimit'],
$fields
$criteriaValues
);
}
}
@ -243,17 +243,17 @@ for ($i = 0; $i < 4; $i++) {
}
?>
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
<th><select name="inputs[]" id="<?php echo 'tableid_' . $i; ?>" >
<th><select name="criteriaColumnNames[]" id="<?php echo 'tableid_' . $i; ?>" >
<option value="<?php echo 'pma_null'; ?>"><?php echo __('None'); ?></option>
<?php
for ($j = 0 ; $j < $fields_cnt ; $j++) {
if (isset($inputs[$i]) && $inputs[$i] == htmlspecialchars($fields_list[$j])) {?>
<option value="<?php echo htmlspecialchars($fields_list[$j]);?>" selected="selected">
<?php echo htmlspecialchars($fields_list[$j]);?></option>
for ($j = 0 ; $j < $columnCount ; $j++) {
if (isset($criteriaColumnNames[$i]) && $criteriaColumnNames[$i] == htmlspecialchars($columnNames[$j])) {?>
<option value="<?php echo htmlspecialchars($columnNames[$j]);?>" selected="selected">
<?php echo htmlspecialchars($columnNames[$j]);?></option>
<?php
} else { ?>
<option value="<?php echo htmlspecialchars($fields_list[$j]);?>">
<?php echo htmlspecialchars($fields_list[$j]);?></option>
<option value="<?php echo htmlspecialchars($columnNames[$j]);?>">
<?php echo htmlspecialchars($columnNames[$j]);?></option>
<?php
}
} ?>
@ -264,13 +264,13 @@ for ($i = 0; $i < 4; $i++) {
<td><?php if (isset($tbl_fields_value[$i])) echo $tbl_fields_value[$i]; ?></td>
</tr>
<tr><td>
<input type="hidden" name="types[<?php echo $i; ?>]" id="types_<?php echo $i; ?>"
<input type="hidden" name="criteriaColumnTypes[<?php echo $i; ?>]" id="types_<?php echo $i; ?>"
<?php
if (isset($_POST['types'][$i])) {
echo 'value="' . $_POST['types'][$i] . '"';
if (isset($_POST['criteriaColumnTypes'][$i])) {
echo 'value="' . $_POST['criteriaColumnTypes'][$i] . '"';
}
?> />
<input type="hidden" name="collations[<?php echo $i;?>]" id="collations_<?php echo $i; ?>" />
<input type="hidden" name="criteriaColumnCollations[<?php echo $i;?>]" id="collations_<?php echo $i; ?>" />
</td></tr>
<?php
}//end for
@ -284,7 +284,7 @@ for ($i = 0; $i < 4; $i++) {
*/
//Set default datalabel if not selected
if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null') {
if (isset($zoom_submit) && $criteriaColumnNames[0] != 'pma_null' && $criteriaColumnNames[1] != 'pma_null') {
if ($dataLabel == '') {
$dataLabel = PMA_getDisplayField($db, $table);
}
@ -295,16 +295,16 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null')
<td><select name="dataLabel" id='dataLabel' >
<option value = ''> <?php echo __('None'); ?> </option>
<?php
for ($j = 0; $j < $fields_cnt; $j++) {
if (isset($dataLabel) && $dataLabel == htmlspecialchars($fields_list[$j])) {
for ($j = 0; $j < $columnCount; $j++) {
if (isset($dataLabel) && $dataLabel == htmlspecialchars($columnNames[$j])) {
?>
<option value="<?php echo htmlspecialchars($fields_list[$j]);?>" selected="selected">
<?php echo htmlspecialchars($fields_list[$j]);?></option>
<option value="<?php echo htmlspecialchars($columnNames[$j]);?>" selected="selected">
<?php echo htmlspecialchars($columnNames[$j]);?></option>
<?php
} else {
?>
<option value="<?php echo htmlspecialchars($fields_list[$j]);?>" >
<?php echo htmlspecialchars($fields_list[$j]);?></option>
<option value="<?php echo htmlspecialchars($columnNames[$j]);?>" >
<?php echo htmlspecialchars($columnNames[$j]);?></option>
<?php
}
}
@ -338,9 +338,9 @@ echo '" /></td></tr>';
* Form for displaying query results
*/
if (isset($zoom_submit)
&& $inputs[0] != 'pma_null'
&& $inputs[1] != 'pma_null'
&& $inputs[0] != $inputs[1]
&& $criteriaColumnNames[0] != 'pma_null'
&& $criteriaColumnNames[1] != 'pma_null'
&& $criteriaColumnNames[0] != $criteriaColumnNames[1]
) {
/*
@ -352,19 +352,19 @@ if (isset($zoom_submit)
//Add the table
$sql_query .= ' FROM ' . PMA_backquote($table);
for ($i = 0; $i < 4; $i++) {
if ($inputs[$i] == 'pma_null') {
if ($criteriaColumnNames[$i] == 'pma_null') {
continue;
}
$tmp = array();
// The where clause
$charsets = array();
$cnt_func = count($zoomFunc[$i]);
$func_type = $zoomFunc[$i];
list($charsets[$i]) = explode('_', $collations[$i]);
$cnt_func = count($criteriaColumnOperators[$i]);
$func_type = $criteriaColumnOperators[$i];
list($charsets[$i]) = explode('_', $criteriaColumnCollations[$i]);
$unaryFlag = $GLOBALS['PMA_Types']->isUnaryOperator($func_type);
$whereClause = PMA_tbl_search_getWhereClause(
$fields[$i], $inputs[$i], $types[$i],
$collations[$i], $func_type, $unaryFlag
$criteriaValues[$i], $criteriaColumnNames[$i], $criteriaColumnTypes[$i],
$criteriaColumnCollations[$i], $func_type, $unaryFlag
);
if ($whereClause) {
$w[] = $whereClause;
@ -389,28 +389,28 @@ if (isset($zoom_submit)
}
//Get unique conditon on each row (will be needed for row update)
$uniqueCondition = PMA_getUniqueCondition(
$result, $fields_cnt, $fields_meta, $tmpRow, true
$result, $columnCount, $fields_meta, $tmpRow, true
);
//Append it to row array as where_clause
$row['where_clause'] = $uniqueCondition[0];
if ($dataLabel == $inputs[0] || $dataLabel == $inputs[1]) {
if ($dataLabel == $criteriaColumnNames[0] || $dataLabel == $criteriaColumnNames[1]) {
$data[] = array(
$inputs[0] => $row[$inputs[0]],
$inputs[1] => $row[$inputs[1]],
$criteriaColumnNames[0] => $row[$criteriaColumnNames[0]],
$criteriaColumnNames[1] => $row[$criteriaColumnNames[1]],
'where_clause' => $uniqueCondition[0]
);
} elseif ($dataLabel) {
$data[] = array(
$inputs[0] => $row[$inputs[0]],
$inputs[1] => $row[$inputs[1]],
$criteriaColumnNames[0] => $row[$criteriaColumnNames[0]],
$criteriaColumnNames[1] => $row[$criteriaColumnNames[1]],
$dataLabel => $row[$dataLabel],
'where_clause' => $uniqueCondition[0]
);
} else {
$data[] = array(
$inputs[0] => $row[$inputs[0]],
$inputs[1] => $row[$inputs[1]],
$criteriaColumnNames[0] => $row[$criteriaColumnNames[0]],
$criteriaColumnNames[1] => $row[$criteriaColumnNames[1]],
$dataLabel => '',
'where_clause' => $uniqueCondition[0]
);
@ -459,15 +459,15 @@ if (isset($zoom_submit)
<tbody>
<?php
$odd_row = true;
for ($i = 4; $i < $fields_cnt + 4; $i++) {
$tbl_fields_type[$i] = $fields_type[$i - 4];
$fieldpopup = $fields_list[$i - 4];
for ($i = 4; $i < $columnCount + 4; $i++) {
$tbl_fields_type[$i] = $columnTypes[$i - 4];
$fieldpopup = $columnNames[$i - 4];
$foreignData = PMA_getForeignData($foreigners, $fieldpopup, false, '', '');
?>
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
<th><?php echo htmlspecialchars($fields_list[$i - 4]); ?></th>
<th><?php echo ($fields_null[$i - 4] == 'YES')
? '<input type="checkbox" class="checkbox_null" name="fields_null[ '
<th><?php echo htmlspecialchars($columnNames[$i - 4]); ?></th>
<th><?php echo ($columnNullFlags[$i - 4] == 'YES')
? '<input type="checkbox" class="checkbox_null" name="criteriaColumnNullFlags[ '
. $i . ' ]" id="fields_null_id_' . $i . '" />'
: ''; ?>
</th>