The branch, master has been updated via d6ba069b01d4a9d89ed3d5eb7b76bc388c04938c (commit) via 35b3595ec0e6833b9199da0cb238243b4c7457fe (commit) from 8c4530e338ba81851cc5f0e2c9b3708293efa4ec (commit)
- Log ----------------------------------------------------------------- commit d6ba069b01d4a9d89ed3d5eb7b76bc388c04938c Merge: 35b3595 8c4530e Author: Dieter Adriaenssens ruleant@users.sourceforge.net Date: Tue Aug 16 22:40:30 2011 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit 35b3595ec0e6833b9199da0cb238243b4c7457fe Author: Dieter Adriaenssens ruleant@users.sourceforge.net Date: Tue Aug 16 22:39:46 2011 +0200
coding style and wrapping long lines
-----------------------------------------------------------------------
Summary of changes: libraries/common.lib.php | 72 ++++++++++++++++++++++++++++++---------------- tbl_change.php | 55 ++++++++++++++++++++-------------- 2 files changed, 79 insertions(+), 48 deletions(-)
diff --git a/libraries/common.lib.php b/libraries/common.lib.php index eee6035..0b89345 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -94,7 +94,7 @@ function PMA_getIcon($icon, $alternate = '', $force_text = false, $noSprite = fa $button .= '<span class="nowrap">';
if ($include_icon) { - if($noSprite) { + if ($noSprite) { $button .= '<img src="' . $GLOBALS['pmaThemeImage'] . $icon . '"' . ' class="icon" width="16" height="16" />'; } else { @@ -713,8 +713,8 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count = // in $group we save the reference to the place in $table_groups // where to store the table info if ($GLOBALS['cfg']['LeftFrameDBTree'] - && $sep && strstr($table_name, $sep)) - { + && $sep && strstr($table_name, $sep) + ) { $parts = explode($sep, $table_name);
$group =& $table_groups; @@ -754,7 +754,8 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count =
if ($GLOBALS['cfg']['ShowTooltipAliasTB'] - && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') { + && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested' + ) { // switch tooltip and name $table['Comment'] = $table['Name']; $table['disp_name'] = $table['Comment']; @@ -935,7 +936,8 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view // @todo what about $GLOBALS['display_query']??? // @todo this is REALLY the wrong place to do this - very unexpected here if (strlen($GLOBALS['table']) - && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) { + && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table']) + ) { if (PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Index_length') > 1024) { PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table'])); } @@ -1029,7 +1031,8 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view */
if (isset($analyzed_display_query[0]['queryflags']['select_from']) - && isset($GLOBALS['sql_limit_to_append'])) { + && isset($GLOBALS['sql_limit_to_append']) + ) { $query_base = $analyzed_display_query[0]['section_before_limit'] . "\n" . $GLOBALS['sql_limit_to_append'] . $analyzed_display_query[0]['section_after_limit']; @@ -1142,7 +1145,8 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
// Refresh query if (! empty($cfg['SQLQuery']['Refresh']) - && preg_match('@^(SELECT|SHOW)[[:space:]]+@i', $sql_query)) { + && preg_match('@^(SELECT|SHOW)[[:space:]]+@i', $sql_query) + ) { $refresh_link = 'import.php' . PMA_generate_common_url($url_params); $refresh_link = ' [' . PMA_linkOrButton($refresh_link, __('Refresh')) . ']'; } else { @@ -1150,7 +1154,8 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view } //show as php
if (! empty($cfg['SQLValidator']['use']) - && ! empty($cfg['SQLQuery']['Validate'])) { + && ! empty($cfg['SQLQuery']['Validate']) + ) { $validate_params = $url_params; if (!empty($GLOBALS['validatequery'])) { $validate_message = __('Skip Validate SQL') ; @@ -1251,8 +1256,9 @@ function PMA_profilingSupported() // (avoid a trip to the server for MySQL before 5.0.37) // and do not set a constant as we might be switching servers if (defined('PMA_MYSQL_INT_VERSION') - && PMA_MYSQL_INT_VERSION >= 50037 - && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'")) { + && PMA_MYSQL_INT_VERSION >= 50037 + && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'") + ) { PMA_cacheSet('profiling_supported', true, true); } else { PMA_cacheSet('profiling_supported', false, true); @@ -1734,7 +1740,10 @@ function PMA_linkOrButton($url, $message, $tag_params = array(),
$displayed_message = ''; // Add text if not already added - if (stristr($message, '<img') && (!$strip_img || $GLOBALS['cfg']['PropertiesIconic'] === true) && strip_tags($message)==$message) { + if (stristr($message, '<img') + && (!$strip_img || $GLOBALS['cfg']['PropertiesIconic'] === true) + && strip_tags($message)==$message + ) { $displayed_message = '<span>' . htmlspecialchars(preg_replace('/^.*\salt="([^"]*)".*$/si', '\1', $message)) . '</span>'; }
@@ -1996,7 +2005,8 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force $meta->orgname = $meta->name;
if (isset($GLOBALS['analyzed_sql'][0]['select_expr']) - && is_array($GLOBALS['analyzed_sql'][0]['select_expr'])) { + && is_array($GLOBALS['analyzed_sql'][0]['select_expr']) + ) { foreach ($GLOBALS['analyzed_sql'][0]['select_expr'] as $select_expr) { // need (string) === (string) // '' !== 0 but '' == 0 @@ -2019,7 +2029,10 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force // a view because this view might be updatable. // (The isView() verification should not be costly in most cases // because there is some caching in the function). - if (isset($meta->orgtable) && $meta->table != $meta->orgtable && ! PMA_Table::isView($GLOBALS['db'], $meta->table)) { + if (isset($meta->orgtable) + && $meta->table != $meta->orgtable + && ! PMA_Table::isView($GLOBALS['db'], $meta->table) + ) { $meta->table = $meta->orgtable; }
@@ -2042,7 +2055,10 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force } else { // timestamp is numeric on some MySQL 4.1 // for real we use CONCAT above and it should compare to string - if ($meta->numeric && $meta->type != 'timestamp' && $meta->type != 'real') { + if ($meta->numeric + && $meta->type != 'timestamp' + && $meta->type != 'real' + ) { $con_val = '= ' . $row[$i]; } elseif (($meta->type == 'blob' || $meta->type == 'string') // hexify only if this is a true not empty BLOB or a BINARY @@ -2131,10 +2147,13 @@ function PMA_buttonOrImage($button_name, $button_class, $image_name, $text, . PMA_getIcon($image, $text) .'</button>' . "\n"; } else { - echo '<input type="image" name="' . $image_name . '" value="' - . htmlspecialchars($value) . '" title="' . htmlspecialchars($text) . '" src="' . $GLOBALS['pmaThemeImage'] - . $image . '" />' - . ($GLOBALS['cfg']['PropertiesIconic'] === 'both' ? ' ' . htmlspecialchars($text) : '') . "\n"; + echo '<input type="image" name="' . $image_name + . '" value="' . htmlspecialchars($value) + . '" title="' . htmlspecialchars($text) + . '" src="' . $GLOBALS['pmaThemeImage']. $image . '" />' + . ($GLOBALS['cfg']['PropertiesIconic'] === 'both' + ? ' ' . htmlspecialchars($text) + : '') . "\n"; } } // end function
@@ -2228,7 +2247,8 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1, } else { $selected = ''; } - $gotopage .= ' <option ' . $selected . ' value="' . (($i - 1) * $rows) . '">' . $i . '</option>' . "\n"; + $gotopage .= ' <option ' . $selected + . ' value="' . (($i - 1) * $rows) . '">' . $i . '</option>' . "\n"; }
$gotopage .= ' </select><noscript><input type="submit" value="' . __('Go') . '" /></noscript>'; @@ -2363,8 +2383,8 @@ function PMA_getDbLink($database = null) }
return '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($database) . '"' - .' title="' . sprintf(__('Jump to database "%s".'), htmlspecialchars($database)) . '">' - .htmlspecialchars($database) . '</a>'; + . ' title="' . sprintf(__('Jump to database "%s".'), htmlspecialchars($database)) . '">' + . htmlspecialchars($database) . '</a>'; }
/** @@ -3185,7 +3205,8 @@ function PMA_getFunctionsForField($field, $insert_mode) // or something similar. Then directly look up the entry in the RestrictFunctions array, // which will then reveal the available dropdown options if (isset($cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]) - && isset($cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]])) { + && isset($cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]]) + ) { $current_func_type = $cfg['RestrictColumnTypes'][strtoupper($field['True_Type'])]; $dropdown = $cfg['RestrictFunctions'][$current_func_type]; $default_function = $cfg['DefaultFunctions'][$current_func_type]; @@ -3202,9 +3223,10 @@ function PMA_getFunctionsForField($field, $insert_mode) // and the column does not have the // ON UPDATE DEFAULT TIMESTAMP attribute. if ($field['True_Type'] == 'timestamp' - && empty($field['Default']) - && empty($data) - && ! isset($analyzed_sql[0]['create_table_fields'][$field['Field']]['on_update_current_timestamp'])) { + && empty($field['Default']) + && empty($data) + && ! isset($analyzed_sql[0]['create_table_fields'][$field['Field']]['on_update_current_timestamp']) + ) { $default_function = $cfg['DefaultFunctions']['first_timestamp']; } // For primary keys of type char(36) or varchar(36) UUID if the default function diff --git a/tbl_change.php b/tbl_change.php index 8befabb..9148ef3 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -791,26 +791,26 @@ foreach ($rows as $row_id => $vrow) { // We don't want binary data destroyed elseif ($field['is_binary'] || $field['is_blob']) { if (($cfg['ProtectBinary'] && $field['is_blob']) - || ($cfg['ProtectBinary'] == 'all' && $field['is_binary'])) { + || ($cfg['ProtectBinary'] == 'all' && $field['is_binary']) + ) { echo "\n"; // for blobstreaming - if (PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type) && PMA_BS_IsPBMSReference($data, $db)) - { - echo '<input type="hidden" name="remove_blob_ref_' . $field['Field_md5'] . $vkey . '" value="' . $data . '" />'; - echo '<input type="checkbox" name="remove_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Remove BLOB Repository Reference') . "<br />"; - echo PMA_BS_CreateReferenceLink($data, $db); - echo "<br />"; + if (PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type) + && PMA_BS_IsPBMSReference($data, $db) + ) { + echo '<input type="hidden" name="remove_blob_ref_' . $field['Field_md5'] . $vkey . '" value="' . $data . '" />'; + echo '<input type="checkbox" name="remove_blob_repo_' . $field['Field_md5'] . $vkey . '" /> ' . __('Remove BLOB Repository Reference') . "<br />"; + echo PMA_BS_CreateReferenceLink($data, $db); + echo "<br />"; + } else { + echo __('Binary - do not edit'); + if (isset($data)) { + $data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1); + echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')'; + unset($data_size); } - else - { - echo __('Binary - do not edit'); - if (isset($data)) { - $data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1); - echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')'; - unset($data_size); - } - echo "\n"; - } // end if (PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type) && PMA_BS_IsPBMSReference($data, $db)) + echo "\n"; + } // end if (PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type) && PMA_BS_IsPBMSReference($data, $db)) ?> <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="protected" /> <input type="hidden" name="fields<?php echo $field_name_appendix; ?>" value="" /> @@ -849,7 +849,9 @@ foreach ($rows as $row_id => $vrow) {
if ($is_upload && $field['is_blob']) { // check if field type is of longblob and if the table is PBMS enabled. - if (($field['pma_type'] == "longblob") && PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type)) { + if (($field['pma_type'] == "longblob") + && PMA_BS_IsTablePBMSEnabled($db, $table, $tbl_type) + ) { echo '<br />'; echo '<input type="checkbox" name="upload_blob_repo' . $vkey . '[' . $field['Field_md5'] . ']" /> ' . __('Upload to BLOB repository'); } @@ -898,12 +900,14 @@ foreach ($rows as $row_id => $vrow) {
elseif (in_array($field['pma_type'], $no_support_types)) { // ignore this column to avoid changing it - } - else { + } else { // field size should be at least 4 and max 40 $fieldsize = min(max($field['len'], 4), 40); echo $backup_field . "\n"; - if ($field['is_char'] && ($cfg['CharEditing'] == 'textarea' || strpos($data, "\n") !== false)) { + if ($field['is_char'] + && ($cfg['CharEditing'] == 'textarea' + || strpos($data, "\n") !== false) + ) { echo "\n"; ?> <textarea name="fields<?php echo $field_name_appendix; ?>" @@ -919,7 +923,9 @@ foreach ($rows as $row_id => $vrow) { $the_class = 'textfield'; if ($field['pma_type'] == 'date') { $the_class .= ' datefield'; - } elseif ($field['pma_type'] == 'datetime' || substr($field['pma_type'], 0, 9) == 'timestamp') { + } elseif ($field['pma_type'] == 'datetime' + || substr($field['pma_type'], 0, 9) == 'timestamp' + ) { $the_class .= ' datetimefield'; } ?> @@ -949,7 +955,10 @@ foreach ($rows as $row_id => $vrow) { <input type="hidden" name="fields_type<?php echo $field_name_appendix; ?>" value="bit" /> <?php } - if ($field['pma_type'] == 'date' || $field['pma_type'] == 'datetime' || substr($field['pma_type'], 0, 9) == 'timestamp') { + if ($field['pma_type'] == 'date' + || $field['pma_type'] == 'datetime' + || substr($field['pma_type'], 0, 9) == 'timestamp' + ) { // the _3 suffix points to the date field // the _2 suffix points to the corresponding NULL checkbox // in dateFormat, 'yy' means the year with 4 digits
hooks/post-receive