Permalink
Browse files

Coding style improvements

  • Loading branch information...
1 parent ba16e22 commit 7e169fcaeffb6d0c9e6377b99133c94a8436180d @madhuracj madhuracj committed Aug 30, 2012
Showing with 220 additions and 110 deletions.
  1. +4 −2 import.php
  2. +7 −7 navigation.php
  3. +1 −1 pmd_pdf.php
  4. +3 −3 pmd_relation_upd.php
  5. +5 −5 pmd_save_pos.php
  6. +2 −1 server_binlog.php
  7. +41 −13 server_databases.php
  8. +3 −3 server_privileges.php
  9. +9 −4 server_variables.php
  10. +145 −71 sql.php
View
@@ -301,7 +301,7 @@
$import_file = $common_functions->userDir($cfg['UploadDir'])
. $local_import_file;
-
+
} elseif (empty($import_file) || ! is_uploaded_file($import_file)) {
$import_file = 'none';
}
@@ -530,7 +530,9 @@
// There was an error?
if (isset($my_die)) {
foreach ($my_die AS $key => $die) {
- $common_functions->mysqlDie($die['error'], $die['sql'], '', $err_url, $error);
+ $common_functions->mysqlDie(
+ $die['error'], $die['sql'], '', $err_url, $error
+ );
}
}
View
@@ -85,8 +85,8 @@ function PMA_exitNavigationFrame()
$header->setBodyId('body_leftFrame');
$scripts = $header->getScripts();
$scripts->addFile('navigation.js');
-$scripts->addCode('
- // INIT PMA_setFrameSize
+$scripts->addCode(
+ '// INIT PMA_setFrameSize
var onloadCnt = 0;
var onLoadHandler = window.onload;
var resizeHandler = window.onresize;
@@ -113,8 +113,8 @@ function PMA_exitNavigationFrame()
) {
PMA_saveFrameSize();
}
- };
-');
+ };'
+);
require 'libraries/navigation_header.inc.php';
@@ -339,7 +339,7 @@ function PMA_displayDbList($ext_dblist, $offset, $count)
{
global $element_counter, $img_minus, $img_plus, $href_left,
$db_start, $common_url_query;
-
+
$common_functions = PMA_CommonFunctions::getInstance();
// get table list, for all databases
@@ -530,9 +530,9 @@ function PMA_displayTableList(
$tables, $visible = false,
$tab_group_full = '', $table_db = ''
) {
-
+
$common_functions = PMA_CommonFunctions::getInstance();
-
+
if (! is_array($tables) || count($tables) === 0) {
return;
}
View
@@ -95,7 +95,7 @@
<br>
<div>
<?php
- if (!empty($message)) {
+ if (! empty($message)) {
$message->display();
}
?>
View
@@ -37,9 +37,9 @@
if (isset($existrel_foreign[$F2]['constraint'])) {
$upd_query = 'ALTER TABLE ' . $common_functions->backquote($DB2)
- . '.' . $common_functions->backquote($T2) . ' DROP FOREIGN KEY '
- . $common_functions->backquote($existrel_foreign[$F2]['constraint'])
- . ';';
+ . '.' . $common_functions->backquote($T2) . ' DROP FOREIGN KEY '
+ . $common_functions->backquote($existrel_foreign[$F2]['constraint'])
+ . ';';
$upd_rs = PMA_DBI_query($upd_query);
} else {
// there can be an internal relation even if InnoDB
View
@@ -76,10 +76,10 @@ function PMD_err_sav()
}
if (! empty($die_save_pos)) {
- header("Content-Type: text/xml; charset=utf-8");
- header("Cache-Control: no-cache");
-?>
-<root act='save_pos' return='<?php echo __('Modifications have been saved'); ?>'></root>
-<?php
+ header("Content-Type: text/xml; charset=utf-8");
+ header("Cache-Control: no-cache");
+ ?>
+ <root act='save_pos' return='<?php echo __('Modifications have been saved'); ?>'></root>
+ <?php
}
?>
View
@@ -137,7 +137,8 @@
$this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
}
- echo '<a href="server_binlog.php' . PMA_generate_common_url($this_url_params) . '"';
+ echo '<a href="server_binlog.php'
+ . PMA_generate_common_url($this_url_params) . '"';
if ($GLOBALS['cfg']['NavigationBarIconic']) {
echo ' title="' . _pgettext('Previous page', 'Previous') . '">';
} else {
View
@@ -113,7 +113,13 @@
} else {
$number_of_databases = 0;
}
- $message = PMA_Message::success(_ngettext('%1$d database has been dropped successfully.', '%1$d databases have been dropped successfully.', $number_of_databases));
+ $message = PMA_Message::success(
+ _ngettext(
+ '%1$d database has been dropped successfully.',
+ '%1$d databases have been dropped successfully.',
+ $number_of_databases
+ )
+ );
$message->addParam($number_of_databases);
}
}
@@ -207,10 +213,10 @@
$_url_params['sort_by'] = $stat_name;
$_url_params['sort_order'] = ($sort_by == $stat_name && $sort_order == 'desc') ? 'asc' : 'desc';
echo ' <th' . $colspan . '>'
- .'<a href="server_databases.php' . PMA_generate_common_url($_url_params) . '">' . "\n"
- .' ' . $stat['disp_name'] . "\n"
- .($sort_by == $stat_name ? ' ' . $common_functions->getImage('s_' . $sort_order . '.png', ($sort_order == 'asc' ? __('Ascending') : __('Descending'))) . "\n" : '')
- .' </a></th>' . "\n";
+ . '<a href="server_databases.php' . PMA_generate_common_url($_url_params) . '">' . "\n"
+ . ' ' . $stat['disp_name'] . "\n"
+ . ($sort_by == $stat_name ? ' ' . $common_functions->getImage('s_' . $sort_order . '.png', ($sort_order == 'asc' ? __('Ascending') : __('Descending'))) . "\n" : '')
+ . ' </a></th>' . "\n";
}
}
@@ -242,7 +248,15 @@
echo '<tr class="' . $tr_class . '">' . "\n";
$odd_row = ! $odd_row;
- 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
+ );
echo $generated_html;
@@ -294,21 +308,35 @@
unset($column_order, $stat_name, $stat, $databases, $table_columns);
if ($is_superuser || $cfg['AllowUserDropDatabase']) {
- $common_url_query = PMA_generate_common_url(array('sort_by' => $sort_by, 'sort_order' => $sort_order, 'dbstats' => $dbstats));
- echo '<img class="selectallarrow" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" width="38" height="22" alt="' . __('With selected:') . '" />' . "\n"
+ $common_url_query = PMA_generate_common_url(
+ array(
+ 'sort_by' => $sort_by,
+ 'sort_order' => $sort_order,
+ 'dbstats' => $dbstats
+ )
+ );
+ echo '<img class="selectallarrow" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"'
+ . ' width="38" height="22" alt="' . __('With selected:') . '" />' . "\n"
. '<input type="checkbox" id="checkall" title="' . __('Check All') . '" /> '
. '<label for="checkall">' . __('Check All') . '</label> '
. '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
- echo $common_functions->getButtonOrImage('drop_selected_dbs', 'mult_submit' . ($cfg['AjaxEnable'] ? ' ajax' : ''), 'drop_selected_dbs', __('Drop'), 'b_deltbl.png');
+ echo $common_functions->getButtonOrImage(
+ 'drop_selected_dbs',
+ 'mult_submit' . ($cfg['AjaxEnable'] ? ' ajax' : ''),
+ 'drop_selected_dbs',
+ __('Drop'), 'b_deltbl.png'
+ );
}
if (empty($dbstats)) {
echo '<ul><li id="li_switch_dbstats"><strong>' . "\n";
- echo ' <a href="server_databases.php?' . $url_query . '&amp;dbstats=1"'
- .' title="' . __('Enable Statistics') . '">' . "\n"
- .' ' . __('Enable Statistics');
+ echo '<a href="server_databases.php?' . $url_query . '&amp;dbstats=1"'
+ . ' title="' . __('Enable Statistics') . '">' . "\n"
+ . ' ' . __('Enable Statistics');
echo '</a></strong><br />' . "\n";
- PMA_Message::notice(__('Note: Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server.'))->display();
+ PMA_Message::notice(
+ __('Note: Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server.')
+ )->display();
echo '</li>' . "\n" . '</ul>' . "\n";
}
echo '</form>';
View
@@ -146,9 +146,9 @@
if (! $is_superuser) {
$response->addHTML(
'<h2>' . "\n"
- . $common_functions->getIcon('b_usrlist.png')
- . __('Privileges') . "\n"
- . '</h2>' . "\n"
+ . $common_functions->getIcon('b_usrlist.png')
+ . __('Privileges') . "\n"
+ . '</h2>' . "\n"
);
$response->addHTML(PMA_Message::error(__('No Privileges'))->getDisplay());
exit;
View
@@ -40,7 +40,8 @@
header('Content-Type: text/html; charset=UTF-8');
$varValue = PMA_DBI_fetch_single_row(
'SHOW GLOBAL VARIABLES WHERE Variable_name="'
- . $common_functions->sqlAddSlashes($_REQUEST['varName']) . '";', 'NUM'
+ . $common_functions->sqlAddSlashes($_REQUEST['varName']) . '";',
+ 'NUM'
);
if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
&& $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte'
@@ -167,12 +168,16 @@
function formatVariable($name, $value)
{
global $VARIABLE_DOC_LINKS;
-
+
$common_functions = PMA_CommonFunctions::getInstance();
if (is_numeric($value)) {
- if (isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte') {
- return '<abbr title="'.$common_functions->formatNumber($value, 0).'">'.implode(' ', $common_functions->formatByteDown($value, 3, 3)).'</abbr>';
+ if (isset($VARIABLE_DOC_LINKS[$name][3])
+ && $VARIABLE_DOC_LINKS[$name][3]=='byte'
+ ) {
+ return '<abbr title="' . $common_functions->formatNumber($value, 0) . '">'
+ . implode(' ', $common_functions->formatByteDown($value, 3, 3))
+ . '</abbr>';
} else {
return $common_functions->formatNumber($value, 0);
}
Oops, something went wrong.

0 comments on commit 7e169fc

Please sign in to comment.