Browse files

Coding style improvements

  • Loading branch information...
1 parent 7c2b8ca commit ba16e22315f5ec8a35ddf2703b785087dd9f376a @madhuracj madhuracj committed Aug 30, 2012
Showing with 69 additions and 55 deletions.
  1. +0 −1 browse_foreigners.php
  2. +5 −3 db_datadict.php
  3. +12 −8 db_operations.php
  4. +8 −6 db_qbe.php
  5. +22 −18 db_structure.php
  6. +1 −2 db_tracking.php
  7. +21 −17 export.php
View
1 browse_foreigners.php
@@ -214,7 +214,6 @@ function formupdate(fieldmd5, key) {
$val_ordered_current_equals_data = false;
$key_ordered_current_equals_data = false;
foreach ($keys as $key_ordered_current_row => $value) {
- //for ($i = 0; $i < $count; $i++) {
$hcount++;
if ($cfg['RepeatCells'] > 0 && $hcount > $cfg['RepeatCells']) {
View
8 db_datadict.php
@@ -124,9 +124,11 @@
// and SHOW CREATE TABLE says NOT NULL
// http://bugs.mysql.com/20910.
+ $show_create_table_query = 'SHOW CREATE TABLE '
+ . PMA_CommonFunctions::getInstance()->backquote($db) . '.'
+ . PMA_CommonFunctions::getInstance()->backquote($table);
$show_create_table = PMA_DBI_fetch_value(
- 'SHOW CREATE TABLE ' . PMA_CommonFunctions::getInstance()->backquote($db) . '.' . PMA_CommonFunctions::getInstance()->backquote($table),
- 0, 1
+ $show_create_table_query, 0, 1
);
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
}
@@ -185,7 +187,7 @@
}
$extracted_columnspec
= PMA_CommonFunctions::getInstance()->extractColumnSpec($row['Type']);
-
+
// reformat mysql query output
// set or enum types: slashes single quotes inside options
if ('set' == $extracted_columnspec['type'] || 'enum' == $extracted_columnspec['type']) {
View
20 db_operations.php
@@ -33,8 +33,9 @@
/**
* Rename/move or copy database
*/
-if (strlen($db) && (! empty($_REQUEST['db_rename']) || ! empty($_REQUEST['db_copy']))) {
-
+if (strlen($db)
+ && (! empty($_REQUEST['db_rename']) || ! empty($_REQUEST['db_copy']))
+) {
if (! empty($_REQUEST['db_rename'])) {
$move = true;
} else {
@@ -70,7 +71,7 @@
// remove all foreign key constraints, otherwise we can get errors
$export_sql_plugin = PMA_getPlugin(
"export",
- "sql",
+ "sql",
'libraries/plugins/export/',
array(
'single_table' => isset($single_table),
@@ -82,7 +83,7 @@
$tables_full, $export_sql_plugin, $move, $db
);
- $views = PMA_getViewsAndCreateSqlViewStandIn(
+ $views = PMA_getViewsAndCreateSqlViewStandIn(
$tables_full, $export_sql_plugin, $db
);
@@ -113,7 +114,7 @@
// Duplicate the bookmarks for this db (done once for each db)
PMA_duplicateBookmarks($_error, $db);
-
+
if (! $_error && $move) {
/**
* cleanup pmadb stuff for this db
@@ -140,7 +141,9 @@
if (! $_error && $move) {
$db = $_REQUEST['newname'];
} elseif (! $_error) {
- if (isset($_REQUEST['switch_to_new']) && $_REQUEST['switch_to_new'] == 'true') {
+ if (isset($_REQUEST['switch_to_new'])
+ && $_REQUEST['switch_to_new'] == 'true'
+ ) {
$GLOBALS['PMA_Config']->setCookie('pma_switch_to_new', 'true');
$db = $_REQUEST['newname'];
} else {
@@ -213,7 +216,7 @@
*/
$response->addHTML(PMA_getHtmlForDatabaseComment($db));
}
-
+
$response->addHTML('<div class="operations_half_width">');
ob_start();
include 'libraries/display_create_table.lib.php';
@@ -230,7 +233,8 @@
}
// Drop link if allowed
- // Don't even try to drop information_schema. You won't be able to. Believe me. You won't.
+ // 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
View
14 db_qbe.php
@@ -54,13 +54,15 @@
array('query' => 1)
)
);
- $response->addHTML(PMA_Message::notice(
- sprintf(
- __('Switch to %svisual builder%s'),
- '<a href="' . $url . '">',
- '</a>'
+ $response->addHTML(
+ PMA_Message::notice(
+ sprintf(
+ __('Switch to %svisual builder%s'),
+ '<a href="' . $url . '">',
+ '</a>'
+ )
)
- ));//->display();
+ );
}
$response->addHTML($db_qbe->getSelectionForm($cfgRelation));
?>
View
40 db_structure.php
@@ -117,7 +117,8 @@
$_url_params['sort_order'] = $_REQUEST['sort_order'];
}
-$response->addHTML($common_functions->getListNavigator(
+$response->addHTML(
+ $common_functions->getListNavigator(
$total_num_tables, $pos, $_url_params, 'db_structure.php',
'frame_content', $GLOBALS['cfg']['MaxTableList']
)
@@ -126,7 +127,7 @@
// tables form
$response->addHTML(
'<form method="post" action="db_structure.php" '
- . 'name="tablesForm" id="tablesForm">'
+ . 'name="tablesForm" id="tablesForm">'
);
$response->addHTML(PMA_generate_common_hidden_inputs($db));
@@ -158,16 +159,17 @@
$drop_query = '';
$drop_message = '';
$overhead = '';
-
+
$table_is_view = false;
$table_encoded = urlencode($current_table['TABLE_NAME']);
// Sets parameters for links
$tbl_url_query = $url_query . '&amp;table=' . $table_encoded;
// do not list the previous table's size info for a view
-
+
list($current_table, $formatted_size, $unit, $formatted_overhead,
$overhead_unit, $overhead_size, $table_is_view, $sum_size)
- = PMA_getStuffForEngineTypeTable($current_table, $db_is_information_schema,
+ = PMA_getStuffForEngineTypeTable(
+ $current_table, $db_is_information_schema,
$is_show_stats, $table_is_view, $sum_size, $overhead_size
);
@@ -186,8 +188,10 @@
if ($is_show_stats) {
if ($formatted_overhead != '') {
$overhead = '<a href="tbl_structure.php?'
- . $tbl_url_query . '#showusage"><span>' . $formatted_overhead
- . '</span> <span class="unit">' . $overhead_unit . '</span></a>' . "\n";
+ . $tbl_url_query . '#showusage">'
+ . '<span>' . $formatted_overhead . '</span>'
+ . '<span class="unit">' . $overhead_unit . '</span>'
+ . '</a>' . "\n";
$overhead_check .=
"markAllRows('row_tbl_" . ($i + 1) . "');";
} else {
@@ -240,14 +244,13 @@
* the code easier to read without this operator.
*/
list($browse_table, $search_table, $browse_table_label, $empty_table,
- $tracking_icon
- ) = PMA_getHtmlForActionLinks(
+ $tracking_icon) = PMA_getHtmlForActionLinks(
$current_table, $table_is_view, $tbl_url_query,
$titles, $truename, $db_is_information_schema, $url_query
);
-
+
if (! $db_is_information_schema) {
- list($drop_query, $drop_message)
+ list($drop_query, $drop_message)
= PMA_getTableDropQueryAndMessage($table_is_view, $current_table);
}
@@ -258,17 +261,17 @@
$row_count = 1;
$odd_row = true;
- $response->addHTML('</tr>'
- . '</tbody>'
- . '</table>');
+ $response->addHTML(
+ '</tr></tbody></table>'
+ );
$response->addHTML(PMA_TableHeader(false, $server_slave_status));
}
list($do, $ignored) = PMA_getServerSlaveStatus(
$server_slave_status, $truename
);
-
+
list($html_output, $odd_row) = PMA_getHtmlForStructureTableRow(
$i, $odd_row, $table_is_view, $current_table, $checked,
$browse_table_label, $tracking_icon, $server_slave_status,
@@ -281,7 +284,7 @@
$is_show_stats, $ignored, $do, $colspan_for_structure
);
$response->addHTML($html_output);
-
+
} // end foreach
// Show Summary
@@ -296,8 +299,9 @@
$response->addHTML('</table>');
//check all
$response->addHTML(
- PMA_getHtmlForCheckAllTables($pmaThemeImage, $text_dir,
- $overhead_check, $db_is_information_schema, $hidden_fields
+ PMA_getHtmlForCheckAllTables(
+ $pmaThemeImage, $text_dir, $overhead_check,
+ $db_is_information_schema, $hidden_fields
)
);
$response->addHTML('</form>'); //end of form
View
3 db_tracking.php
@@ -171,8 +171,7 @@
}
}
}
- // If $value is a table.
- } else {
+ } else { // If $value is a table.
if (PMA_Tracker::getVersion($GLOBALS['db'], $value['Name']) == -1) {
$my_tables[] = $value['Name'];
}
View
38 export.php
@@ -324,7 +324,8 @@ function PMA_exportOutputHandler($line)
$filename = PMA_sanitizeFilename($filename);
// Grab basic dump extension and mime type
- // Check if the user already added extension; get the substring where the extension would be if it was included
+ // Check if the user already added extension;
+ // get the substring where the extension would be if it was included
$extension_start_pos = strlen($filename) - strlen(
$export_plugin->getProperties()->getExtension()
) - 1;
@@ -359,22 +360,21 @@ function PMA_exportOutputHandler($line)
|| ($quick_export
&& $_REQUEST['quick_export_onserverover'] != 'saveitover'))
) {
- $message = PMA_Message::error(__(
- 'File %s already exists on server, change filename or check'
- . ' overwrite option.'
- ));
+ $message = PMA_Message::error(
+ __('File %s already exists on server, change filename or check overwrite option.')
+ );
$message->addParam($save_filename);
} else {
if (is_file($save_filename) && ! is_writable($save_filename)) {
- $message = PMA_Message::error(__(
- 'The web server does not have permission to save the file %s.'
- ));
+ $message = PMA_Message::error(
+ __('The web server does not have permission to save the file %s.')
+ );
$message->addParam($save_filename);
} else {
if (! $file_handle = @fopen($save_filename, 'w')) {
- $message = PMA_Message::error(__(
- 'The web server does not have permission to save the file %s.'
- ));
+ $message = PMA_Message::error(
+ __('The web server does not have permission to save the file %s.')
+ );
$message->addParam($save_filename);
}
}
@@ -624,7 +624,9 @@ function PMA_exportOutputHandler($line)
}
// now export the triggers (needs to be done after the data because
// triggers can modify already imported tables)
- if ($GLOBALS[$what . '_structure_or_data'] == 'structure' || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data') {
+ if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
+ || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
+ ) {
if (! $export_plugin->exportStructure(
$db, $table, $crlf, $err_url,
'triggers', $export_type,
@@ -636,7 +638,9 @@ function PMA_exportOutputHandler($line)
}
foreach ($views as $view) {
// no data export for a view
- if ($GLOBALS[$what . '_structure_or_data'] == 'structure' || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data') {
+ if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
+ || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
+ ) {
if (! $export_plugin->exportStructure(
$db, $view, $crlf, $err_url,
'create_view', $export_type,
@@ -665,7 +669,9 @@ function PMA_exportOutputHandler($line)
}
$is_view = PMA_Table::isView($db, $table);
- if ($GLOBALS[$what . '_structure_or_data'] == 'structure' || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data') {
+ if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
+ || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
+ ) {
if (! $export_plugin->exportStructure(
$db, $table, $crlf, $err_url,
$is_view ? 'create_view' : 'create_table', $export_type,
@@ -693,9 +699,7 @@ function PMA_exportOutputHandler($line)
$local_query = 'SELECT * FROM ' . $common_functions->backquote($db)
. '.' . $common_functions->backquote($table) . $add_query;
}
- if (! $export_plugin->exportData($db, $table, $crlf, $err_url,
- $local_query
- )) {
+ if (! $export_plugin->exportData($db, $table, $crlf, $err_url, $local_query)) {
break;
}
}

0 comments on commit ba16e22

Please sign in to comment.