Permalink
Browse files

improve coding style

  • Loading branch information...
1 parent 2c11a32 commit e482a943053c9307945c2a798707a6fa47267644 @ruleant ruleant committed Mar 14, 2012
@@ -22,7 +22,7 @@
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
- $cfg['Servers'][$i]['compress'] = FALSE;
+ $cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'pmapass';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
@@ -170,8 +170,10 @@ function PMA_auth()
?></a>
<h1>
<?php
- echo sprintf(__('Welcome to %s'),
- '<bdo dir="ltr" xml:lang="en">' . $page_title . '</bdo>');
+ echo sprintf(
+ __('Welcome to %s'),
+ '<bdo dir="ltr" xml:lang="en">' . $page_title . '</bdo>'
+ );
?>
</h1>
<?php
@@ -393,7 +395,8 @@ function PMA_auth_check()
$GLOBALS['PHP_AUTH_USER'] = PMA_blowfish_decrypt(
$_COOKIE['pmaUser-' . $GLOBALS['server']],
- PMA_get_blowfish_secret());
+ PMA_get_blowfish_secret()
+ );
// user was never logged in since session start
if (empty($_SESSION['last_access_time'])) {
@@ -419,7 +422,8 @@ function PMA_auth_check()
$GLOBALS['PHP_AUTH_PW'] = PMA_blowfish_decrypt(
$_COOKIE['pmaPass-' . $GLOBALS['server']],
- PMA_get_blowfish_secret());
+ PMA_get_blowfish_secret()
+ );
if ($GLOBALS['PHP_AUTH_PW'] == "\xff(blank)") {
$GLOBALS['PHP_AUTH_PW'] = '';
@@ -472,7 +476,7 @@ function PMA_auth_set_user()
}
if ($cfg['Server']['host'] != $GLOBALS['pma_auth_server']) {
$cfg['Server']['host'] = $tmp_host;
- if (!empty($tmp_port)) {
+ if (! empty($tmp_port)) {
$cfg['Server']['port'] = $tmp_port;
}
}
@@ -489,16 +493,22 @@ function PMA_auth_set_user()
// Name and password cookies need to be refreshed each time
// Duration = one month for username
- $GLOBALS['PMA_Config']->setCookie('pmaUser-' . $GLOBALS['server'],
+ $GLOBALS['PMA_Config']->setCookie(
+ 'pmaUser-' . $GLOBALS['server'],
PMA_blowfish_encrypt($cfg['Server']['user'],
- PMA_get_blowfish_secret()));
+ PMA_get_blowfish_secret())
+ );
// Duration = as configured
- $GLOBALS['PMA_Config']->setCookie('pmaPass-' . $GLOBALS['server'],
- PMA_blowfish_encrypt(!empty($cfg['Server']['password']) ? $cfg['Server']['password'] : "\xff(blank)",
- PMA_get_blowfish_secret()),
+ $GLOBALS['PMA_Config']->setCookie(
+ 'pmaPass-' . $GLOBALS['server'],
+ PMA_blowfish_encrypt(
+ ! empty($cfg['Server']['password']) ? $cfg['Server']['password'] : "\xff(blank)",
+ PMA_get_blowfish_secret()
+ ),
null,
- $GLOBALS['cfg']['LoginCookieStore']);
+ $GLOBALS['cfg']['LoginCookieStore']
+ );
// Set server cookies if required (once per session) and, in this case, force
// reload to ensure the client accepts cookies
@@ -1107,12 +1107,14 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql =
$message .= '<ul><li>' . __("View a structure's contents by clicking on its name") . '</li>';
$message .= '<li>' . __('Change any of its settings by clicking the corresponding "Options" link') . '</li>';
$message .= '<li>' . __('Edit structure by following the "Structure" link') . '</li>';
- $message .= sprintf('<br /><li><a href="%s" title="%s">%s</a> (<a href="%s" title="%s">' . __('Options') . '</a>)</li>',
- $db_url,
- sprintf(__('Go to database: %s'), htmlspecialchars(PMA_backquote($db_name))),
- htmlspecialchars($db_name),
- $db_ops_url,
- sprintf(__('Edit settings for %s'), htmlspecialchars(PMA_backquote($db_name))));
+ $message .= sprintf(
+ '<br /><li><a href="%s" title="%s">%s</a> (<a href="%s" title="%s">' . __('Options') . '</a>)</li>',
+ $db_url,
+ sprintf(__('Go to database: %s'), htmlspecialchars(PMA_backquote($db_name))),
+ htmlspecialchars($db_name),
+ $db_ops_url,
+ sprintf(__('Edit settings for %s'), htmlspecialchars(PMA_backquote($db_name)))
+ );
$message .= '<ul>';
@@ -1128,14 +1130,16 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null, &$additional_sql =
unset($params);
if (! PMA_Table::isView($db_name, $tables[$i][TBL_NAME])) {
- $message .= sprintf('<li><a href="%s" title="%s">%s</a> (<a href="%s" title="%s">' . __('Structure') . '</a>) (<a href="%s" title="%s">' . __('Options') . '</a>)</li>',
- $tbl_url,
- sprintf(__('Go to table: %s'), htmlspecialchars(PMA_backquote($tables[$i][TBL_NAME]))),
- htmlspecialchars($tables[$i][TBL_NAME]),
- $tbl_struct_url,
- sprintf(__('Structure of %s'), htmlspecialchars(PMA_backquote($tables[$i][TBL_NAME]))),
- $tbl_ops_url,
- sprintf(__('Edit settings for %s'), htmlspecialchars(PMA_backquote($db_name))));
+ $message .= sprintf(
+ '<li><a href="%s" title="%s">%s</a> (<a href="%s" title="%s">' . __('Structure') . '</a>) (<a href="%s" title="%s">' . __('Options') . '</a>)</li>',
+ $tbl_url,
+ sprintf(__('Go to table: %s'), htmlspecialchars(PMA_backquote($tables[$i][TBL_NAME]))),
+ htmlspecialchars($tables[$i][TBL_NAME]),
+ $tbl_struct_url,
+ sprintf(__('Structure of %s'), htmlspecialchars(PMA_backquote($tables[$i][TBL_NAME]))),
+ $tbl_ops_url,
+ sprintf(__('Edit settings for %s'), htmlspecialchars(PMA_backquote($db_name)))
+ );
} else {
$message .= sprintf('<li><a href="%s" title="%s">%s</a></li>',
$tbl_url,
@@ -1038,8 +1038,10 @@ function PMA_RTN_getQueryFromRequest()
);
}
if ($_REQUEST['item_param_length'][$i] != ''
- && !preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN)$@i',
- $_REQUEST['item_param_type'][$i])
+ && !preg_match(
+ '@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN)$@i',
+ $_REQUEST['item_param_type'][$i]
+ )
) {
$params .= "(" . $_REQUEST['item_param_length'][$i] . ")";
} else if ($_REQUEST['item_param_length'][$i] == '' && preg_match('@^(ENUM|SET|VARCHAR|VARBINARY)$@i', $_REQUEST['item_param_type'][$i])) {
@@ -1076,8 +1078,10 @@ function PMA_RTN_getQueryFromRequest()
$errors[] = __('You must provide a valid return type for the routine.');
}
if (! empty($_REQUEST['item_returnlength'])
- && !preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN)$@i',
- $_REQUEST['item_returntype'])
+ && !preg_match(
+ '@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN)$@i',
+ $_REQUEST['item_returntype']
+ )
) {
$query .= "(" . $_REQUEST['item_returnlength'] . ")";
} else if (empty($_REQUEST['item_returnlength']) && preg_match('@^(ENUM|SET|VARCHAR|VARBINARY)$@i', $_REQUEST['item_returntype'])) {
@@ -1251,8 +1255,10 @@ function PMA_RTN_handleExecute()
}
} else {
$output = '';
- $message = PMA_message::error(sprintf(__('The following query has failed: "%s"'), $query) . '<br /><br />'
- . __('MySQL said: ') . PMA_DBI_getError(null));
+ $message = PMA_message::error(
+ sprintf(__('The following query has failed: "%s"'), $query) . '<br /><br />'
+ . __('MySQL said: ') . PMA_DBI_getError(null)
+ );
}
// Print/send output
if ($GLOBALS['is_ajax_request']) {
@@ -169,7 +169,8 @@ function PMA_SQP_bug($message, $sql)
$encodedstr = preg_replace(
"/(\015\012)|(\015)|(\012)/",
'<br />' . "\n",
- chunk_split(base64_encode($encodedstr)));
+ chunk_split(base64_encode($encodedstr))
+ );
$SQP_errorString .= __('There is a chance that you may have found a bug in the SQL parser. Please examine your query closely, and check that the quotes are correct and not mis-matched. Other possible failure causes may be that you are uploading a file with binary outside of a quoted text area. You can also try your query on the MySQL command line interface. The MySQL server error output below, if there is any, may also help you in diagnosing the problem. If you still have problems or if the parser fails where the command line interface succeeds, please reduce your SQL query input to the single query that causes problems, and submit a bug report with the data chunk in the CUT section below:')
@@ -224,19 +225,19 @@ function PMA_SQP_parse($sql)
if (!isset($PMA_SQPdata_column_attrib)) {
$PMA_SQPdata_column_attrib = array_flip(
$GLOBALS['PMA_SQPdata_column_attrib']
- );
+ );
$PMA_SQPdata_function_name = array_flip(
$GLOBALS['PMA_SQPdata_function_name']
- );
+ );
$PMA_SQPdata_reserved_word = array_flip(
$GLOBALS['PMA_SQPdata_reserved_word']
- );
+ );
$PMA_SQPdata_forbidden_word = array_flip(
$GLOBALS['PMA_SQPdata_forbidden_word']
- );
+ );
$PMA_SQPdata_column_type = array_flip(
$GLOBALS['PMA_SQPdata_column_type']
- );
+ );
}
$sql_array = array();
@@ -2294,7 +2295,8 @@ function PMA_SQP_formatHtml($arr, $mode='color', $start_token=0,
$PMA_SQPdata_operators_docs[$arr[$i]['data']]['link'],
false,
$PMA_SQPdata_operators_docs[$arr[$i]['data']]['anchor'],
- true);
+ true
+ );
$after .= '</a>';
}
@@ -2409,7 +2411,8 @@ function PMA_SQP_formatHtml($arr, $mode='color', $start_token=0,
$PMA_SQPdata_functions_docs[$funcname]['link'],
false,
$PMA_SQPdata_functions_docs[$funcname]['anchor'],
- true);
+ true
+ );
$after .= '</a>';
}
break;
@@ -2727,7 +2730,8 @@ function PMA_SQP_buildCssData()
for ($i = 0; $i < 8; $i++) {
$css_string .= PMA_SQP_buildCssRule(
'syntax_indent' . $i, 'margin-left',
- ($i * $cfg['SQP']['fmtInd']) . $cfg['SQP']['fmtIndUnit']);
+ ($i * $cfg['SQP']['fmtInd']) . $cfg['SQP']['fmtIndUnit']
+ );
}
return $css_string;
@@ -2749,7 +2753,8 @@ function PMA_SQP_formatNone($arr)
$formatted_sql = preg_replace(
"@((\015\012)|(\015)|(\012)){3,}@",
"\n\n",
- $formatted_sql);
+ $formatted_sql
+ );
return $formatted_sql;
} // end of the "PMA_SQP_formatNone()" function
View
@@ -64,20 +64,20 @@
if (isset($_REQUEST['change_tbl_info']) && $_REQUEST['change_tbl_info'] == true) {
$extra_data = array();
$field = $_REQUEST['field'];
- if($field == 'pma_null') {
+ if ($field == 'pma_null') {
$extra_data['field_type'] = '';
$extra_data['field_collation'] = '';
$extra_data['field_operators'] = '';
- PMA_ajaxResponse(NULL, true, $extra_data);
+ PMA_ajaxResponse(null, true, $extra_data);
}
// Gets the list and number of fields
- list($fields_list, $fields_type, $fields_collation, $fields_null) = PMA_tbl_getFields($_REQUEST['db'],$_REQUEST['table']);
+ list($fields_list, $fields_type, $fields_collation, $fields_null) = 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);
+ $key = array_search($field, $fields_list);
$extra_data['field_type'] = $fields_type[$key];
$extra_data['field_collation'] = $fields_collation[$key];
@@ -86,29 +86,29 @@
if (strncasecmp($fields_type[$key], 'enum', 4) == 0) {
foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) {
$html .= "\n" . ' '
- . '<option value="' . htmlspecialchars($fc) . '">'
- . htmlspecialchars($fc) . '</option>';
+ . '<option value="' . htmlspecialchars($fc) . '">'
+ . htmlspecialchars($fc) . '</option>';
}
} elseif (preg_match('@char|blob|text|set@i', $fields_type[$key])) {
- foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
- $html .= "\n" . ' '
- . '<option value="' . htmlspecialchars($fc) . '">'
- . htmlspecialchars($fc) . '</option>';
+ foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
+ $html .= "\n" . ' '
+ . '<option value="' . htmlspecialchars($fc) . '">'
+ . htmlspecialchars($fc) . '</option>';
}
} else {
- foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {
- $html .= "\n" . ' '
- . '<option value="' . htmlspecialchars($fc) . '">'
- . htmlspecialchars($fc) . '</option>';
- }
+ foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {
+ $html .= "\n" . ' '
+ . '<option value="' . htmlspecialchars($fc) . '">'
+ . htmlspecialchars($fc) . '</option>';
+ }
} // end if... else...
if ($fields_null[$key]) {
foreach ($GLOBALS['cfg']['NullOperators'] as $fc) {
- $html .= "\n" . ' '
+ $html .= "\n" . ' '
. '<option value="' . htmlspecialchars($fc) . '">'
- . htmlspecialchars($fc) . '</option>';
- }
+ . htmlspecialchars($fc) . '</option>';
+ }
}
$html .= '</select>';
$extra_data['field_operators'] = $html;
@@ -119,9 +119,20 @@
$foreignData = PMA_getForeignData($foreigners, $field, false, '', '');
// HTML for field values
- $html = PMA_getForeignFields_Values($foreigners, $foreignData, $field, array($_REQUEST['it'] => $fields_type[$key]), $_REQUEST['it'] ,$_REQUEST['db'], $_REQUEST['table'], $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], '');
+ $html = PMA_getForeignFields_Values(
+ $foreigners,
+ $foreignData,
+ $field,
+ array($_REQUEST['it'] => $fields_type[$key]),
+ $_REQUEST['it'],
+ $_REQUEST['db'],
+ $_REQUEST['table'],
+ $titles,
+ $GLOBALS['cfg']['ForeignKeyMaxLimit'],
+ ''
+ );
$extra_data['field_value'] = $html;
- PMA_ajaxResponse(NULL, true, $extra_data);
+ PMA_ajaxResponse(null, true, $extra_data);
}
$titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));

0 comments on commit e482a94

Please sign in to comment.