From 7b4bb1c8657c1de0f9564fd0929ca0a0eaa515b3 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 17 Sep 2011 21:46:57 +0530 Subject: [PATCH] Coding style improvements --- tbl_zoom_select.php | 200 ++++++++++++++++++++++++++------------------ 1 file changed, 119 insertions(+), 81 deletions(-) diff --git a/tbl_zoom_select.php b/tbl_zoom_select.php index cf8a64f90c..a110ace4b7 100644 --- a/tbl_zoom_select.php +++ b/tbl_zoom_select.php @@ -37,13 +37,14 @@ $GLOBALS['js_include'][] = 'jquery/timepicker.js'; if (isset($_REQUEST['get_data_row']) && $_REQUEST['get_data_row'] == true) { $extra_data = array(); - $row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`' . $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause']; - $result = PMA_DBI_query( $row_info_query . ";" , null, PMA_DBI_QUERY_STORE); + $row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`' + . $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause']; + $result = PMA_DBI_query($row_info_query . ";", null, PMA_DBI_QUERY_STORE); $fields_meta = PMA_DBI_get_fields_meta($result); while ($row = PMA_DBI_fetch_assoc($result)) { $extra_data['row_info'] = $row; } - PMA_ajaxResponse(NULL, true, $extra_data); + PMA_ajaxResponse(null, true, $extra_data); } $titles['Browse'] = PMA_tbl_setTitle($GLOBALS['cfg']['PropertiesIconic'], $pmaThemeImage); @@ -83,7 +84,7 @@ $foreigners = PMA_getForeigners($db, $table); $flag = 1; $tbl_fields_type = $tbl_fields_collation = $tbl_fields_null = array(); if (! isset($zoom_submit) && ! isset($inputs)) { - $dataLabel = PMA_getDisplayField($db,$table); + $dataLabel = PMA_getDisplayField($db, $table); } ?>
@@ -114,7 +115,8 @@ if (isset($inputs) && ($inputs[0] != 'pma_null' || $inputs[1] != 'pma_null')) { */ ?> -
> +> @@ -135,28 +137,29 @@ for ($i = 0; $i < 4; $i++) { echo __("Additional search criteria"); echo ""; } -?> + ?> - - - - - + + + - - - - - + + + + - + - - + - + + - @@ -250,7 +260,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 ($dataLabel == '') { - $dataLabel = PMA_getDisplayField($db,$table); + $dataLabel = PMA_getDisplayField($db, $table); } } ?> @@ -261,13 +271,15 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null') - - + + - - + + @@ -321,8 +333,14 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' $cnt_func = count($zoomFunc[$i]); $func_type = $zoomFunc[$i]; list($charsets[$i]) = explode('_', $collations[$i]); - $unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) ? true : false; - $whereClause = PMA_tbl_search_getWhereClause($fields[$i],$inputs[$i], $types[$i], $collations[$i], $func_type, $unaryFlag); + $unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) + && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) + ? true + : false; + $whereClause = PMA_tbl_search_getWhereClause( + $fields[$i], $inputs[$i], $types[$i], + $collations[$i], $func_type, $unaryFlag + ); if ($whereClause) { $w[] = $whereClause; } @@ -335,7 +353,7 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' /* * Query execution part */ - $result = PMA_DBI_query($sql_query . ";" , null, PMA_DBI_QUERY_STORE); + $result = PMA_DBI_query($sql_query . ";", null, PMA_DBI_QUERY_STORE); $fields_meta = PMA_DBI_get_fields_meta($result); while ($row = PMA_DBI_fetch_assoc($result)) { //Need a row with indexes as 0,1,2 for the PMA_getUniqueCondition hence using a temporary array @@ -349,81 +367,101 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' //Append it to row array as where_clause $row['where_clause'] = $uniqueCondition[0]; if ($dataLabel == $inputs[0] || $dataLabel == $inputs[1]) { - $data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], 'where_clause' => $uniqueCondition[0]); + $data[] = array( + $inputs[0] => $row[$inputs[0]], + $inputs[1] => $row[$inputs[1]], + 'where_clause' => $uniqueCondition[0] + ); } elseif ($dataLabel) { - $data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], $dataLabel => $row[$dataLabel], 'where_clause' => $uniqueCondition[0]); + $data[] = array( + $inputs[0] => $row[$inputs[0]], + $inputs[1] => $row[$inputs[1]], + $dataLabel => $row[$dataLabel], + 'where_clause' => $uniqueCondition[0] + ); } else { - $data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], $dataLabel => '', 'where_clause' => $uniqueCondition[0]); + $data[] = array( + $inputs[0] => $row[$inputs[0]], + $inputs[1] => $row[$inputs[1]], + $dataLabel => '', + 'where_clause' => $uniqueCondition[0] + ); } } /* * Form for displaying point data and also the scatter plot */ -?> - > + ?> + >
- -
- +
+ -
-
- +
+
+ -
-
+ - +
- -