diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2012-04-14 16:14:39 +0400 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2012-04-14 16:14:39 +0400 |
commit | 8e62b92d70f15894eccb0d9ec6eb386f047572f4 (patch) | |
tree | 041d017de292b4e15b00025a61b0f45091f6cb09 | |
parent | ef68eaa25487addf2015a60ef399ca96919bd9a4 (diff) |
Coding style improvements
-rw-r--r-- | db_create.php | 20 | ||||
-rw-r--r-- | db_datadict.php | 7 | ||||
-rw-r--r-- | db_export.php | 6 | ||||
-rw-r--r-- | db_operations.php | 36 | ||||
-rw-r--r-- | db_printview.php | 8 | ||||
-rw-r--r-- | db_qbe.php | 68 | ||||
-rw-r--r-- | db_search.php | 47 | ||||
-rw-r--r-- | db_sql.php | 5 | ||||
-rw-r--r-- | db_structure.php | 42 | ||||
-rw-r--r-- | db_tracking.php | 17 |
10 files changed, 153 insertions, 103 deletions
diff --git a/db_create.php b/db_create.php index dd299a128c..d3e5062414 100644 --- a/db_create.php +++ b/db_create.php @@ -12,7 +12,7 @@ require_once 'libraries/common.inc.php'; $GLOBALS['js_include'][] = 'functions.js'; require_once 'libraries/mysql_charsets.lib.php'; -if (!PMA_DRIZZLE) { +if (! PMA_DRIZZLE) { include_once 'libraries/replication.inc.php'; } require 'libraries/build_html_for_db.lib.php'; @@ -41,9 +41,11 @@ $err_url = 'main.php?' . PMA_generate_common_url(); * Builds and executes the db creation sql query */ $sql_query = 'CREATE DATABASE ' . PMA_backquote($new_db); -if (!empty($db_collation)) { +if (! empty($db_collation)) { list($db_charset) = explode('_', $db_collation); - if (in_array($db_charset, $mysql_charsets) && in_array($db_collation, $mysql_collations[$db_charset])) { + if (in_array($db_charset, $mysql_charsets) + && in_array($db_collation, $mysql_collations[$db_charset]) + ) { $sql_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation); } $db_collation_for_ajax = $db_collation; @@ -85,10 +87,13 @@ if (! $result) { */ $extra_data['sql_query'] = PMA_showMessage(null, $sql_query, 'success'); - //Construct the html for the new database, so that it can be appended to the list of databases on server_databases.php + //Construct the html for the new database, so that it can be appended to + // the list of databases on server_databases.php /** - * Build the array to be passed to {@link PMA_generate_common_url} to generate the links + * Build the array to be passed to {@link PMA_generate_common_url} + * to generate the links + * * @global array $GLOBALS['db_url_params'] * @name $db_url_params */ @@ -127,7 +132,10 @@ if (! $result) { ); } - list($column_order, $generated_html) = PMA_buildHtmlForDb($current, $is_superuser, (isset($checkall) ? $checkall : ''), $url_query, $column_order, $replication_types, $replication_info); + list($column_order, $generated_html) = PMA_buildHtmlForDb( + $current, $is_superuser, (isset($checkall) ? $checkall : ''), + $url_query, $column_order, $replication_types, $replication_info + ); $new_db_string .= $generated_html; $new_db_string .= '</tr>'; diff --git a/db_datadict.php b/db_datadict.php index b7a253255f..c4ff0eabd2 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -204,9 +204,10 @@ foreach ($tables as $table) { $field_name = $row['Field']; if (PMA_MYSQL_INT_VERSION < 50025 - && ! empty($analyzed_sql[0]['create_table_fields'][$field_name]['type']) - && $analyzed_sql[0]['create_table_fields'][$field_name]['type'] == 'TIMESTAMP' - && $analyzed_sql[0]['create_table_fields'][$field_name]['timestamp_not_null']) { + && ! empty($analyzed_sql[0]['create_table_fields'][$field_name]['type']) + && $analyzed_sql[0]['create_table_fields'][$field_name]['type'] == 'TIMESTAMP' + && $analyzed_sql[0]['create_table_fields'][$field_name]['timestamp_not_null'] + ) { // here, we have a TIMESTAMP that SHOW FULL COLUMNS reports as having the // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe // the latter. diff --git a/db_export.php b/db_export.php index a006e4b134..732b88b217 100644 --- a/db_export.php +++ b/db_export.php @@ -48,7 +48,8 @@ if (!empty($selected_tbl) && empty($table_select)) { $table_select = $selected_tbl; } -// Check if the selected tables are defined in $_GET (from clicking Back button on export.php) +// Check if the selected tables are defined in $_GET +// (from clicking Back button on export.php) if (isset($_GET['table_select'])) { $_GET['table_select'] = urldecode($_GET['table_select']); $_GET['table_select'] = explode(",", $_GET['table_select']); @@ -62,7 +63,8 @@ foreach ($tables as $each_table) { $is_selected = ''; } } elseif (! empty($unselectall) - || (! empty($table_select) && !in_array($each_table['Name'], $table_select))) { + || (! empty($table_select) && !in_array($each_table['Name'], $table_select)) + ) { $is_selected = ''; } else { $is_selected = ' selected="selected"'; diff --git a/db_operations.php b/db_operations.php index a98107dae4..f7afc484de 100644 --- a/db_operations.php +++ b/db_operations.php @@ -60,10 +60,15 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { } else { $sql_query = ''; // in case target db exists $_error = false; - if ($move || (isset($create_database_before_copying) && $create_database_before_copying)) { + if ($move + || (isset($create_database_before_copying) + && $create_database_before_copying) + ) { // lower_case_table_names=1 `DB` becomes `db` - if (!PMA_DRIZZLE) { - $lower_case_table_names = PMA_DBI_fetch_value('SHOW VARIABLES LIKE "lower_case_table_names"', 0, 1); + if (! PMA_DRIZZLE) { + $lower_case_table_names = PMA_DBI_fetch_value( + 'SHOW VARIABLES LIKE "lower_case_table_names"', 0, 1 + ); if ($lower_case_table_names === '1') { $newname = PMA_strtolower($newname); } @@ -206,7 +211,9 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { unset($triggers); // this does not apply to a rename operation - if (isset($GLOBALS['add_constraints']) && !empty($GLOBALS['sql_constraints_query'])) { + if (isset($GLOBALS['add_constraints']) + && ! empty($GLOBALS['sql_constraints_query']) + ) { $GLOBALS['sql_constraints_query_full_db'][] = $GLOBALS['sql_constraints_query']; unset($GLOBALS['sql_constraints_query']); } @@ -245,21 +252,24 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) { PMA_DBI_select_db($newname); foreach ($GLOBALS['sql_constraints_query_full_db'] as $one_query) { PMA_DBI_query($one_query); - // and prepare to display them + // and prepare to display them $GLOBALS['sql_query'] .= "\n" . $one_query; } unset($GLOBALS['sql_constraints_query_full_db'], $one_query); } - if (!PMA_DRIZZLE && PMA_MYSQL_INT_VERSION >= 50100) { + if (! PMA_DRIZZLE && PMA_MYSQL_INT_VERSION >= 50100) { // here DELIMITER is not used because it's not part of the // language; each statement is sent one by one // to avoid selecting alternatively the current and new db // we would need to modify the CREATE definitions to qualify // the db name - $event_names = PMA_DBI_fetch_result('SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' . PMA_sqlAddSlashes($db, true) . '\';'); + $event_names = PMA_DBI_fetch_result( + 'SELECT EVENT_NAME FROM information_schema.EVENTS WHERE EVENT_SCHEMA= \'' + . PMA_sqlAddSlashes($db, true) . '\';' + ); if ($event_names) { foreach ($event_names as $event_name) { PMA_DBI_select_db($db); @@ -447,7 +457,7 @@ if ($db != 'mysql') { // Don't even try to drop information_schema. You won't be able to. Believe me. You won't. // Don't allow to easily drop mysql database, RFE #1327514. if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) - && !$db_is_information_schema + && ! $db_is_information_schema && (PMA_DRIZZLE || $db != 'mysql')) { ?> <div class="operations_half_width"> @@ -534,8 +544,10 @@ echo __('Remove database'); <?php unset($drop_clause); - if (isset($_COOKIE) && isset($_COOKIE['pma_switch_to_new']) - && $_COOKIE['pma_switch_to_new'] == 'true') { + if (isset($_COOKIE) + && isset($_COOKIE['pma_switch_to_new']) + && $_COOKIE['pma_switch_to_new'] == 'true' + ) { $pma_switch_to_new = 'true'; } ?> @@ -580,7 +592,9 @@ echo __('Remove database'); . '</form></div>' . "\n"; if ($num_tables > 0 - && ! $cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) { + && ! $cfgRelation['allworks'] + && $cfg['PmaNoRelation_DisableWarning'] == false + ) { $message = PMA_Message::notice(__('The phpMyAdmin configuration storage has been deactivated. To find out why click %shere%s.')); $message->addParam('<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $url_query . '">', false); $message->addParam('</a>', false); diff --git a/db_printview.php b/db_printview.php index a76ee380e2..22bf7c871f 100644 --- a/db_printview.php +++ b/db_printview.php @@ -115,7 +115,8 @@ if ($num_tables == 0) { $odd_row = true; foreach ($tables as $sts_data) { if (PMA_Table::isMerge($db, $sts_data['TABLE_NAME']) - || strtoupper($sts_data['ENGINE']) == 'FEDERATED') { + || strtoupper($sts_data['ENGINE']) == 'FEDERATED' + ) { $merged_size = true; } else { $merged_size = false; @@ -171,8 +172,9 @@ if ($num_tables == 0) { } if (! empty($sts_data['Create_time']) - || ! empty($sts_data['Update_time']) - || ! empty($sts_data['Check_time'])) { + || ! empty($sts_data['Update_time']) + || ! empty($sts_data['Check_time']) + ) { echo $needs_break; ?> <table width="100%"> diff --git a/db_qbe.php b/db_qbe.php index 767933fd9f..3ae8b071db 100644 --- a/db_qbe.php +++ b/db_qbe.php @@ -95,7 +95,10 @@ if (PMA_isValid($_REQUEST['TableList'], 'array')) { /** * Prepares the form */ -$tbl_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE); +$tbl_result = PMA_DBI_query( + 'SHOW TABLES FROM ' . PMA_backquote($db) . ';', + null, PMA_DBI_QUERY_STORE +); $tbl_result_cnt = PMA_DBI_num_rows($tbl_result); if (0 == $tbl_result_cnt) { PMA_Message::error(__('No tables found in database.'))->display(); @@ -107,7 +110,7 @@ if (0 == $tbl_result_cnt) { while (list($tbl) = PMA_DBI_fetch_row($tbl_result)) { $fld_results = PMA_DBI_get_columns($db, $tbl); - if (empty($tbl_names[$tbl]) && !empty($_REQUEST['TableList'])) { + if (empty($tbl_names[$tbl]) && ! empty($_REQUEST['TableList'])) { $tbl_names[$tbl] = ''; } else { $tbl_names[$tbl] = ' selected="selected"'; @@ -166,7 +169,7 @@ function showColumnSelectCell($columns, $column_number, $selected = '') } ?> -<?php if (!empty($tab_designer['link'])) { +<?php if (! empty($tab_designer['link'])) { $tab_designer['link'] = htmlentities($tab_designer['link']); $tab_designer['link'] = $tab_designer['link'] . PMA_generate_common_url($url_params); if (! empty($tab_designer['args'])) { @@ -223,7 +226,7 @@ for ($x = 0; $x < $col; $x++) { <?php $z = 0; for ($x = 0; $x < $col; $x++) { - if (!empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') { + if (! empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') { ?> <td class="center"> <select style="width: <?php echo $realwidth; ?>" name="Sort[<?php echo $z; ?>]" size="1"> @@ -237,7 +240,7 @@ for ($x = 0; $x < $col; $x++) { } // end if echo "\n"; - if (!empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') { + if (! empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') { continue; } ?> @@ -287,7 +290,7 @@ for ($x = 0; $x < $col; $x++) { <?php $z = 0; for ($x = 0; $x < $col; $x++) { - if (!empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') { + if (! empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') { ?> <td class="center"> <input type="checkbox" name="Show[<?php echo $z; ?>]" /> @@ -297,7 +300,7 @@ for ($x = 0; $x < $col; $x++) { } // end if echo "\n"; - if (!empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') { + if (! empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') { continue; } if (isset($Show[$x])) { @@ -323,7 +326,7 @@ for ($x = 0; $x < $col; $x++) { <?php $z = 0; for ($x = 0; $x < $col; $x++) { - if (!empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') { + if (! empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') { ?> <td class="center"> <input type="text" name="criteria[<?php echo $z; ?>]" value="" class="textfield" style="width: <?php echo $realwidth; ?>" size="20" /> @@ -333,14 +336,15 @@ for ($x = 0; $x < $col; $x++) { } // end if echo "\n"; - if (!empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') { + if (! empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') { continue; } if (isset($criteria[$x])) { $tmp_criteria = $criteria[$x]; } if ((empty($prev_criteria) || ! isset($prev_criteria[$x])) - || $prev_criteria[$x] != htmlspecialchars($tmp_criteria)) { + || $prev_criteria[$x] != htmlspecialchars($tmp_criteria) + ) { $curCriteria[$z] = $tmp_criteria; } else { $curCriteria[$z] = $prev_criteria[$x]; @@ -481,7 +485,7 @@ for ($y = 0; $y <= $row; $y++) { <?php $z = 0; for ($x = 0; $x < $col; $x++) { - if (!empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') { + if (! empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') { echo "\n"; $or = 'Or' . $w . '[' . $z . ']'; ?> @@ -491,7 +495,7 @@ for ($y = 0; $y <= $row; $y++) { <?php $z++; } // end if - if (!empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') { + if (! empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') { continue; } @@ -500,7 +504,7 @@ for ($y = 0; $y <= $row; $y++) { if (! isset(${$or})) { ${$or} = ''; } - if (!empty(${$or}) && isset(${$or}[$x])) { + if (! empty(${$or}) && isset(${$or}[$x])) { $tmp_or = ${$or}[$x]; } else { $tmp_or = ''; @@ -510,7 +514,7 @@ for ($y = 0; $y <= $row; $y++) { <input type="text" name="Or<?php echo $w . '[' . $z . ']'; ?>" value="<?php echo htmlspecialchars($tmp_or); ?>" class="textfield" style="width: <?php echo $realwidth; ?>" size="20" /> </td> <?php - if (!empty(${$or}) && isset(${$or}[$x])) { + if (! empty(${$or}) && isset(${$or}[$x])) { ${'cur' . $or}[$z] = ${$or}[$x]; } $z++; @@ -530,7 +534,7 @@ for ($y = 0; $y <= $row; $y++) { <?php $z = 0; for ($x = 0; $x < $col; $x++) { - if (!empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') { + if (! empty($ins_col) && isset($ins_col[$x]) && $ins_col[$x] == 'on') { $curAndOrCol[$z] = $and_or_col[$y]; if ($and_or_col[$z] == 'or') { $chk['or'] = ' checked="checked"'; @@ -556,7 +560,7 @@ for ($x = 0; $x < $col; $x++) { } // end if echo "\n"; - if (!empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') { + if (! empty($del_col) && isset($del_col[$x]) && $del_col[$x] == 'on') { continue; } @@ -667,7 +671,7 @@ if (! isset($qry_select)) { $qry_select = ''; } for ($x = 0; $x < $col; $x++) { - if (!empty($curField[$x]) && isset($curShow[$x]) && $curShow[$x] == 'on') { + if (! empty($curField[$x]) && isset($curShow[$x]) && $curShow[$x] == 'on') { if ($last_select) { $qry_select .= ', '; } @@ -675,7 +679,7 @@ for ($x = 0; $x < $col; $x++) { $last_select = 1; } } // end for -if (!empty($qry_select)) { +if (! empty($qry_select)) { echo 'SELECT ' . htmlspecialchars($qry_select) . "\n"; } @@ -700,14 +704,14 @@ if (isset($Field) && count($Field) > 0) { // We only start this if we have fields, otherwise it would be dumb foreach ($Field as $value) { $parts = explode('.', $value); - if (!empty($parts[0]) && !empty($parts[1])) { + if (! empty($parts[0]) && ! empty($parts[1])) { $tab_raw = $parts[0]; $tab = str_replace('`', '', $tab_raw); $tab_all[$tab] = $tab; $col_raw = $parts[1]; $col_all[] = $tab . '.' . str_replace('`', '', $col_raw); - } + } } // end while // Check 'where' clauses @@ -716,7 +720,7 @@ if (isset($Field) && count($Field) > 0) { $crit_cnt = count($criteria); for ($x = 0; $x < $crit_cnt; $x++) { $curr_tab = explode('.', $Field[$x]); - if (!empty($curr_tab[0]) && !empty($curr_tab[1])) { + if (! empty($curr_tab[0]) && ! empty($curr_tab[1])) { $tab_raw = $curr_tab[0]; $tab = str_replace('`', '', $tab_raw); @@ -725,7 +729,7 @@ if (isset($Field) && count($Field) > 0) { $col1 = $tab . '.' . $col1; // Now we know that our array has the same numbers as $criteria // we can check which of our columns has a where clause - if (!empty($criteria[$x])) { + if (! empty($criteria[$x])) { if (substr($criteria[$x], 0, 1) == '=' || stristr($criteria[$x], 'is')) { $col_where[$col] = $col1; $tab_wher[$tab] = $tab; @@ -866,7 +870,7 @@ if (empty($qry_from) && isset($tab_all)) { $qry_from = implode(', ', $tab_all); } // Now let's see what we got -if (!empty($qry_from)) { +if (! empty($qry_from)) { echo 'FROM ' . htmlspecialchars($qry_from) . "\n"; } @@ -874,10 +878,10 @@ if (!empty($qry_from)) { $qry_where = ''; $criteria_cnt = 0; for ($x = 0; $x < $col; $x++) { - if (!empty($curField[$x]) && !empty($curCriteria[$x]) && $x && isset($last_where) && isset($curAndOrCol)) { + if (! empty($curField[$x]) && ! empty($curCriteria[$x]) && $x && isset($last_where) && isset($curAndOrCol)) { $qry_where .= ' ' . strtoupper($curAndOrCol[$last_where]) . ' '; } - if (!empty($curField[$x]) && !empty($curCriteria[$x])) { + if (! empty($curField[$x]) && ! empty($curCriteria[$x])) { $qry_where .= '(' . $curField[$x] . ' ' . $curCriteria[$x] . ')'; $last_where = $x; $criteria_cnt++; @@ -895,10 +899,10 @@ for ($y = 0; $y <= $row; $y++) { $qry_orwhere = ''; $last_orwhere = ''; for ($x = 0; $x < $col; $x++) { - if (!empty($curField[$x]) && !empty(${'curOr' . $y}[$x]) && $x) { + if (! empty($curField[$x]) && ! empty(${'curOr' . $y}[$x]) && $x) { $qry_orwhere .= ' ' . strtoupper($curAndOrCol[$last_orwhere]) . ' '; } - if (!empty($curField[$x]) && !empty(${'curOr' . $y}[$x])) { + if (! empty($curField[$x]) && ! empty(${'curOr' . $y}[$x])) { $qry_orwhere .= '(' . $curField[$x] . ' ' . ${'curOr' . $y}[$x] @@ -910,14 +914,14 @@ for ($y = 0; $y <= $row; $y++) { if ($criteria_cnt > 1) { $qry_orwhere = '(' . $qry_orwhere . ')'; } - if (!empty($qry_orwhere)) { + if (! empty($qry_orwhere)) { $qry_where .= "\n" . strtoupper(isset($curAndOrRow[$y]) ? $curAndOrRow[$y] . ' ' : '') . $qry_orwhere; } // end if } // end for -if (!empty($qry_where) && $qry_where != '()') { +if (! empty($qry_where) && $qry_where != '()') { echo 'WHERE ' . htmlspecialchars($qry_where) . "\n"; } // end if @@ -928,10 +932,10 @@ if (! isset($qry_orderby)) { $qry_orderby = ''; } for ($x = 0; $x < $col; $x++) { - if ($last_orderby && $x && !empty($curField[$x]) && !empty($curSort[$x])) { + if ($last_orderby && $x && ! empty($curField[$x]) && ! empty($curSort[$x])) { $qry_orderby .= ', '; } - if (!empty($curField[$x]) && !empty($curSort[$x])) { + if (! empty($curField[$x]) && ! empty($curSort[$x])) { // if they have chosen all fields using the * selector, // then sorting is not available // Fix for Bug #570698 @@ -941,7 +945,7 @@ for ($x = 0; $x < $col; $x++) { } } } // end for -if (!empty($qry_orderby)) { +if (! empty($qry_orderby)) { echo 'ORDER BY ' . htmlspecialchars($qry_orderby) . "\n"; } ?> diff --git a/db_search.php b/db_search.php index b262d24b09..1eb59ac19e 100644 --- a/db_search.php +++ b/db_search.php @@ -46,8 +46,10 @@ $search_options = array( '4' => __('as regular expression'), ); -if (empty($_REQUEST['search_option']) || ! is_string($_REQUEST['search_option']) - || ! array_key_exists($_REQUEST['search_option'], $search_options)) { +if (empty($_REQUEST['search_option']) + || ! is_string($_REQUEST['search_option']) + || ! array_key_exists($_REQUEST['search_option'], $search_options) +) { $search_option = 1; unset($_REQUEST['submit_search']); } else { @@ -66,7 +68,9 @@ if (empty($_REQUEST['search_str']) || ! is_string($_REQUEST['search_str'])) { // // Usage example: If user is seaching for a literal $ in a regexp search, // he should enter \$ as the value. - $search_str = PMA_sqlAddSlashes($_REQUEST['search_str'], ($search_option == 4 ? false : true)); + $search_str = PMA_sqlAddSlashes( + $_REQUEST['search_str'], ($search_option == 4 ? false : true) + ); } $tables_selected = array(); @@ -106,6 +110,15 @@ if (isset($_REQUEST['submit_search'])) { /** * Builds the SQL search query * + * @param string $table the table name + * @param string $field restrict the search to this field + * @param string $search_str the string to search + * @param integer $search_option type of search + * (1 -> 1 word at least, 2 -> all words, + * 3 -> exact string, 4 -> regexp) + * + * @return array 3 SQL querys (for count, display and delete results) + * * @todo can we make use of fulltextsearch IN BOOLEAN MODE for this? * PMA_backquote * PMA_DBI_free_result @@ -114,13 +127,6 @@ if (isset($_REQUEST['submit_search'])) { * explode * count * strlen - * @param string the table name - * @param string restrict the search to this field - * @param string the string to search - * @param integer type of search (1 -> 1 word at least, 2 -> all words, - * 3 -> exact string, 4 -> regexp) - * - * @return array 3 SQL querys (for count, display and delete results) */ function PMA_getSearchSqls($table, $field, $search_str, $search_option) { @@ -152,16 +158,16 @@ if (isset($_REQUEST['submit_search'])) { // Drizzle has no CONVERT and all text columns are UTF-8 if (PMA_DRIZZLE) { $thefieldlikevalue[] = PMA_backquote($tblfield['Field']) - . ' ' . $like_or_regex . ' ' - . "'" . $automatic_wildcard - . $search_word - . $automatic_wildcard . "'"; + . ' ' . $like_or_regex . ' ' + . "'" . $automatic_wildcard + . $search_word + . $automatic_wildcard . "'"; } else { $thefieldlikevalue[] = 'CONVERT(' . PMA_backquote($tblfield['Field']) . ' USING utf8)' - . ' ' . $like_or_regex . ' ' - . "'" . $automatic_wildcard - . $search_word - . $automatic_wildcard . "'"; + . ' ' . $like_or_regex . ' ' + . "'" . $automatic_wildcard + . $search_word + . $automatic_wildcard . "'"; } } } // end for @@ -217,7 +223,10 @@ if (isset($_REQUEST['submit_search'])) { foreach ($tables_selected as $each_table) { // Gets the SQL statements - $newsearchsqls = PMA_getSearchSqls($each_table, (! empty($field_str) ? $field_str : ''), $search_str, $search_option); + $newsearchsqls = PMA_getSearchSqls( + $each_table, (! empty($field_str) ? $field_str : ''), + $search_str, $search_option + ); // Executes the "COUNT" statement $res_cnt = PMA_DBI_fetch_value($newsearchsqls['select_count']); diff --git a/db_sql.php b/db_sql.php index ed4c47b19b..a0526dff58 100644 --- a/db_sql.php +++ b/db_sql.php @@ -59,7 +59,10 @@ if ($num_tables == 0 && empty($db_query_force)) { /** * Query box, bookmark, insert data from textfile */ -PMA_sqlQueryForm(true, false, isset($_REQUEST['delimiter']) ? htmlspecialchars($_REQUEST['delimiter']) : ';'); +PMA_sqlQueryForm( + true, false, + isset($_REQUEST['delimiter']) ? htmlspecialchars($_REQUEST['delimiter']) : ';' +); /** * Displays the footer diff --git a/db_structure.php b/db_structure.php index f546445c8f..a80283094e 100644 --- a/db_structure.php +++ b/db_structure.php @@ -172,12 +172,14 @@ foreach ($tables as $keyname => $each_table) { } if ($is_show_stats) { - $tblsize = doubleval($each_table['Data_length']) + doubleval($each_table['Index_length']); - $sum_size += $tblsize; - list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0); + $tblsize = doubleval($each_table['Data_length']) + doubleval($each_table['Index_length']); + $sum_size += $tblsize; + list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0); if (isset($each_table['Data_free']) && $each_table['Data_free'] > 0) { - list($formatted_overhead, $overhead_unit) = PMA_formatByteDown($each_table['Data_free'], 3, ($each_table['Data_free'] > 0) ? 1 : 0); - $overhead_size += $each_table['Data_free']; + list($formatted_overhead, $overhead_unit) = PMA_formatByteDown( + $each_table['Data_free'], 3, ($each_table['Data_free'] > 0) ? 1 : 0 + ); + $overhead_size += $each_table['Data_free']; } } break; @@ -201,9 +203,9 @@ foreach ($tables as $keyname => $each_table) { // Drizzle doesn't provide data and index length, check for null if ($is_show_stats && $each_table['Data_length'] !== null) { - $tblsize = $each_table['Data_length'] + $each_table['Index_length']; - $sum_size += $tblsize; - list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0); + $tblsize = $each_table['Data_length'] + $each_table['Index_length']; + $sum_size += $tblsize; + list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0); } //$display_rows = ' - '; break; @@ -281,7 +283,7 @@ foreach ($tables as $keyname => $each_table) { if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { // $showtable might already be set from ShowDbStructureCreation, see above - if (!isset($showtable)) { + if (! isset($showtable)) { $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME'], null, true); } $update_time = isset($showtable['Update_time']) ? $showtable['Update_time'] : false; @@ -294,7 +296,7 @@ foreach ($tables as $keyname => $each_table) { if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) { // $showtable might already be set from ShowDbStructureCreation, see above - if (!isset($showtable)) { + if (! isset($showtable)) { $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME'], null, true); } $check_time = isset($showtable['Check_time']) ? $showtable['Check_time'] : false; @@ -305,10 +307,10 @@ foreach ($tables as $keyname => $each_table) { } } - $alias = (!empty($tooltip_aliasname) && isset($tooltip_aliasname[$each_table['TABLE_NAME']])) + $alias = (! empty($tooltip_aliasname) && isset($tooltip_aliasname[$each_table['TABLE_NAME']])) ? str_replace(' ', ' ', htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']])) : str_replace(' ', ' ', htmlspecialchars($each_table['TABLE_NAME'])); - $truename = (!empty($tooltip_truename) && isset($tooltip_truename[$each_table['TABLE_NAME']])) + $truename = (! empty($tooltip_truename) && isset($tooltip_truename[$each_table['TABLE_NAME']])) ? str_replace(' ', ' ', htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']])) : str_replace(' ', ' ', htmlspecialchars($each_table['TABLE_NAME'])); @@ -359,11 +361,11 @@ foreach ($tables as $keyname => $each_table) { $empty_table .= 'class="truncate_table_anchor"'; } $empty_table .= ' href="sql.php?' . $tbl_url_query - . '&sql_query='; + . '&sql_query='; $empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME'])) - . '&message_to_show=' - . urlencode(sprintf(__('Table %s has been emptied'), htmlspecialchars($each_table['TABLE_NAME']))) - .'">'; + . '&message_to_show=' + . urlencode(sprintf(__('Table %s has been emptied'), htmlspecialchars($each_table['TABLE_NAME']))) + .'">'; if ($may_have_rows) { $empty_table .= $titles['Empty']; } else { @@ -413,8 +415,6 @@ foreach ($tables as $keyname => $each_table) { $do = false; if ($server_slave_status) { - //////////////////////////////////////////////////////////////// - if ((strlen(array_search($truename, $server_slave_Do_Table)) > 0) || (strlen(array_search($db, $server_slave_Do_DB)) > 0) || (count($server_slave_Do_DB) == 1 && count($server_slave_Ignore_DB) == 1) @@ -429,7 +429,7 @@ foreach ($tables as $keyname => $each_table) { $do = true; } } - //////////////////////////////////////////////////////////////////// + if ((strlen(array_search($truename, $server_slave_Ignore_Table)) > 0) || (strlen(array_search($db, $server_slave_Ignore_DB)) > 0) ) { @@ -489,8 +489,8 @@ foreach ($tables as $keyname => $each_table) { $row_count_pre = ''; $show_superscript = ''; if ($table_is_view) { - // Drizzle views use FunctionEngine, and the only place where they are available are I_S and D_D - // schemas, where we do exact counting + // Drizzle views use FunctionEngine, and the only place where they are + // available are I_S and D_D schemas, where we do exact counting if ($each_table['TABLE_ROWS'] >= $GLOBALS['cfg']['MaxExactCountViews'] && $each_table['ENGINE'] != 'FunctionEngine' ) { diff --git a/db_tracking.php b/db_tracking.php index 7782321dc7..f69ea41aed 100644 --- a/db_tracking.php +++ b/db_tracking.php @@ -100,7 +100,9 @@ if (PMA_DBI_num_rows($all_tables_result) > 0) { if (true == $GLOBALS['cfg']['PropertiesIconic']) { $drop_image_or_text .= PMA_getImage('b_drop.png', __('Delete tracking data for this table')); } - if ('both' === $GLOBALS['cfg']['PropertiesIconic'] || false === $GLOBALS['cfg']['PropertiesIconic']) { + if ('both' === $GLOBALS['cfg']['PropertiesIconic'] + || false === $GLOBALS['cfg']['PropertiesIconic'] + ) { $drop_image_or_text .= __('Drop'); } @@ -110,7 +112,9 @@ if (PMA_DBI_num_rows($all_tables_result) > 0) { $table_query = ' SELECT * FROM ' . PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . PMA_backquote($GLOBALS['cfg']['Server']['tracking']) . - ' WHERE `db_name` = \'' . PMA_sqlAddSlashes($_REQUEST['db']) . '\' AND `table_name` = \'' . PMA_sqlAddSlashes($table_name) . '\' AND `version` = \'' . $version_number . '\''; + ' WHERE `db_name` = \'' . PMA_sqlAddSlashes($_REQUEST['db']) + . '\' AND `table_name` = \'' . PMA_sqlAddSlashes($table_name) + . '\' AND `version` = \'' . $version_number . '\''; $table_result = PMA_query_as_controluser($table_query); $version_data = PMA_DBI_fetch_array($table_result); @@ -120,8 +124,10 @@ if (PMA_DBI_num_rows($all_tables_result) > 0) { } else { $version_status = __('not active'); } - $tmp_link = 'tbl_tracking.php?' . $url_query . '&table=' . htmlspecialchars($version_data['table_name']); - $delete_link = 'db_tracking.php?' . $url_query . '&table=' . htmlspecialchars($version_data['table_name']) . '&delete_tracking=true&'; + $tmp_link = 'tbl_tracking.php?' . $url_query . '&table=' + . htmlspecialchars($version_data['table_name']); + $delete_link = 'db_tracking.php?' . $url_query . '&table=' + . htmlspecialchars($version_data['table_name']) . '&delete_tracking=true&'; ?> <tr class="noclick <?php echo $style;?>"> <td><?php echo htmlspecialchars($version_data['db_name']);?></td> @@ -196,7 +202,8 @@ if (isset($my_tables)) { foreach ($my_tables as $key => $tablename) { if (PMA_Tracker::getVersion($GLOBALS['db'], $tablename) == -1) { - $my_link = '<a href="tbl_tracking.php?' . $url_query . '&table=' . htmlspecialchars($tablename) .'">'; + $my_link = '<a href="tbl_tracking.php?' . $url_query + . '&table=' . htmlspecialchars($tablename) .'">'; $my_link .= PMA_getIcon('eye.png', __('Track table')) . '</a>'; ?> <tr class="noclick <?php echo $style;?>"> |