diff options
author | Sebastian Mendel <cybot_tm@users.sourceforge.net> | 2007-04-01 15:02:46 +0400 |
---|---|---|
committer | Sebastian Mendel <cybot_tm@users.sourceforge.net> | 2007-04-01 15:02:46 +0400 |
commit | cfeb30652642d995bb0c8d17988d33d11b02318f (patch) | |
tree | 33fec5cdc925d60888ee67c32dbfc0422c6bc29a | |
parent | adb39168cc384d7a808f836cf2e9f9585b82f864 (diff) |
coding standard: no spaces inside braces
84 files changed, 746 insertions, 748 deletions
diff --git a/browse_foreigners.php b/browse_foreigners.php index 13daf3454a..823fc1066b 100644 --- a/browse_foreigners.php +++ b/browse_foreigners.php @@ -56,7 +56,7 @@ $showall = ''; if (isset($disp_row) && is_array($disp_row)) { - if ( $cfg['ShowAll'] && ($the_total > $per_page) ) { + if ($cfg['ShowAll'] && ($the_total > $per_page)) { $showall = '<input type="submit" name="foreign_navig" value="' . $strShowAll . '" />'; } @@ -64,7 +64,7 @@ if (isset($disp_row) && is_array($disp_row)) { $pageNow = @floor($pos / $session_max_rows) + 1; $nbTotalPage = @ceil($the_total / $session_max_rows); - if ( $the_total > $per_page ) { + if ($the_total > $per_page) { $gotopage = PMA_pageselector( 'browse_foreigners.php?field=' . urlencode($field) . '&' . PMA_generate_common_url($db, $table) @@ -90,22 +90,22 @@ if (isset($disp_row) && is_array($disp_row)) { <title>phpMyAdmin</title> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" /> <link rel="stylesheet" type="text/css" - href="phpmyadmin.css.php?<?php echo PMA_generate_common_url( '', '' ); ?>&js_frame=right&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" /> + href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&js_frame=right&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" /> <script src="./js/functions.js" type="text/javascript" language="javascript"></script> <script type="text/javascript" language="javascript"> //<![CDATA[ self.focus(); - function formupdate( field, key ) { + function formupdate(field, key) { if (opener && opener.document && opener.document.insertForm) { var field = 'field_' + field; - <?php if ( isset( $pk ) ) { ?> - var element_name = field + '[multi_edit][<?php echo urlencode( $pk ); ?>][]'; + <?php if (isset($pk)) { ?> + var element_name = field + '[multi_edit][<?php echo urlencode($pk); ?>][]'; <?php } else { ?> var element_name = field + '[]'; <?php } ?> - <?php if ( isset( $fieldkey ) ) { ?> + <?php if (isset($fieldkey)) { ?> var element_name_alt = field + '[<?php echo $fieldkey; ?>]'; <?php } else { ?> var element_name_alt = field + '[0]'; @@ -134,11 +134,11 @@ if (isset($disp_row) && is_array($disp_row)) { <form action="browse_foreigners.php" method="post"> <fieldset> -<?php echo PMA_generate_common_hidden_inputs( $db, $table ); ?> +<?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="field" value="<?php echo urlencode($field); ?>" /> <input type="hidden" name="fieldkey" value="<?php echo isset($fieldkey) ? $fieldkey : ''; ?>" /> -<?php if ( isset( $pk ) ) { ?> +<?php if (isset($pk)) { ?> <input type="hidden" name="pk" value="<?php echo urlencode($pk); ?>" /> <?php } ?> <span class="formelement"> @@ -173,7 +173,7 @@ if (isset($disp_row) && is_array($disp_row)) { $values = array(); $keys = array(); - foreach ( $disp_row as $relrow ) { + foreach ($disp_row as $relrow) { if ($foreign_display != FALSE) { $values[] = $relrow[$foreign_display]; } else { @@ -183,15 +183,15 @@ if (isset($disp_row) && is_array($disp_row)) { $keys[] = $relrow[$foreign_field]; } - asort( $keys ); + asort($keys); $hcount = 0; $odd_row = true; $val_ordered_current_row = 0; $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++ ) { + foreach ($keys as $key_ordered_current_row => $value) { + //for ($i = 0; $i < $count; $i++) { $hcount++; if ($cfg['RepeatCells'] > 0 && $hcount > $cfg['RepeatCells']) { @@ -208,28 +208,28 @@ if (isset($disp_row) && is_array($disp_row)) { $val_ordered_current_row++; - if (PMA_strlen( $val_ordered_current_val ) <= $cfg['LimitChars']) { + if (PMA_strlen($val_ordered_current_val) <= $cfg['LimitChars']) { $val_ordered_current_val = htmlspecialchars($val_ordered_current_val); $val_ordered_current_val_title = ''; } else { $val_ordered_current_val_title = - htmlspecialchars( $val_ordered_current_val ); + htmlspecialchars($val_ordered_current_val); $val_ordered_current_val = - htmlspecialchars( PMA_substr( $val_ordered_current_val, 0, - $cfg['LimitChars'] ) . '...' ); + htmlspecialchars(PMA_substr($val_ordered_current_val, 0, + $cfg['LimitChars']) . '...'); } - if (PMA_strlen( $key_ordered_current_val ) <= $cfg['LimitChars']) { + if (PMA_strlen($key_ordered_current_val) <= $cfg['LimitChars']) { $key_ordered_current_val = htmlspecialchars($key_ordered_current_val); $key_ordered_current_val_title = ''; } else { $key_ordered_current_val_title = - htmlspecialchars( $key_ordered_current_val ); + htmlspecialchars($key_ordered_current_val); $key_ordered_current_val = - htmlspecialchars( PMA_substr( $key_ordered_current_val, 0, - $cfg['LimitChars'] ) . '...' ); + htmlspecialchars(PMA_substr($key_ordered_current_val, 0, + $cfg['LimitChars']) . '...'); } - if ( ! empty( $data ) ) { + if (! empty($data)) { $val_ordered_current_equals_data = $val_ordered_current_key == $data; $key_ordered_current_equals_data = $key_ordered_current_key == $data; } diff --git a/db_datadict.php b/db_datadict.php index 8c61a0404e..efa4d72c09 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -46,7 +46,7 @@ if ($cfgRelation['commwork']) { if (is_array($comment)) { ?> <p> <?php echo $strDBComment; ?> - <i><?php echo htmlspecialchars( implode( ' ', $comment ) ); ?></i></p> + <i><?php echo htmlspecialchars(implode(' ', $comment)); ?></i></p> <?php } // end if } @@ -77,10 +77,10 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) { * Gets table informations */ // The 'show table' statement works correct since 3.23.03 - $showtable = PMA_DBI_get_tables_full( $db, $table ); + $showtable = PMA_DBI_get_tables_full($db, $table); $num_rows = (isset($showtable[$table]['TABLE_ROWS']) ? $showtable[$table]['TABLE_ROWS'] : 0); $show_comment = (isset($showtable[$table]['TABLE_COMMENT']) ? $showtable[$table]['TABLE_COMMENT'] : ''); - unset( $showtable ); + unset($showtable); /** @@ -103,7 +103,7 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) { $pk_array[$row['Column_name']] = 1; } // Retains keys informations - if ($row['Key_name'] != $lastIndex ){ + if ($row['Key_name'] != $lastIndex){ $indexes[] = $row['Key_name']; $lastIndex = $row['Key_name']; } @@ -294,7 +294,7 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) { </tr> <?php } // end while - PMA_DBI_free_result( $result ); + PMA_DBI_free_result($result); $count++; ?> </table> diff --git a/db_export.php b/db_export.php index 0f63fdcd8a..c1303871a7 100644 --- a/db_export.php +++ b/db_export.php @@ -26,7 +26,7 @@ require_once './libraries/db_info.inc.php'; $export_page_title = $strViewDumpDB; // exit if no tables in db found -if ( $num_tables < 1 ) { +if ($num_tables < 1) { echo $strDatabaseNoTable; require './libraries/footer.inc.php'; exit; @@ -35,20 +35,20 @@ if ( $num_tables < 1 ) { $multi_values = '<div align="center"><select name="table_select[]" size="6" multiple="multiple">'; $multi_values .= "\n"; -foreach ( $tables as $each_table ) { +foreach ($tables as $each_table) { // ok we show also views - //if ( PMA_MYSQL_INT_VERSION >= 50000 && is_null($each_table['Engine']) ) { + //if (PMA_MYSQL_INT_VERSION >= 50000 && is_null($each_table['Engine'])) { // Don't offer to export views yet. // continue; //} - if ( ! empty( $unselectall ) - || ( isset( $tmp_select ) - && false !== strpos( $tmp_select, '|' . $each_table['Name'] . '|') ) ) { + if (! empty($unselectall) + || (isset($tmp_select) + && false !== strpos($tmp_select, '|' . $each_table['Name'] . '|'))) { $is_selected = ''; } else { $is_selected = ' selected="selected"'; } - $table_html = htmlspecialchars( $each_table['Name'] ); + $table_html = htmlspecialchars($each_table['Name']); $multi_values .= ' <option value="' . $table_html . '"' . $is_selected . '>' . $table_html . '</option>' . "\n"; } // end for @@ -56,7 +56,7 @@ $multi_values .= "\n"; $multi_values .= '</select></div>'; $checkall_url = 'db_export.php?' - . PMA_generate_common_url( $db ) + . PMA_generate_common_url($db) . '&goto=db_export.php'; $multi_values .= '<br /> diff --git a/db_qbe.php b/db_qbe.php index 996e9d2a5a..68f42f275a 100644 --- a/db_qbe.php +++ b/db_qbe.php @@ -178,7 +178,7 @@ function showColumnSelectCell($columns, $column_number, $selected = '') $z = 0; for ($x = 0; $x < $col; $x++) { if (isset($ins_col[$x]) && $ins_col[$x] == 'on') { - showColumnSelectCell( $fld, $z ); + showColumnSelectCell($fld, $z); $z++; } @@ -733,7 +733,7 @@ if (isset($Field) && count($Field) > 0) { $master = key($tab_wher); } else { // Now let's find out which of the tables has an index - // ( When the control user is the same as the normal user + // (When the control user is the same as the normal user // because he is using one of his databases as pmadb, // the last db selected is not always the one where we need to work) PMA_DBI_select_db($db); @@ -806,7 +806,7 @@ if (isset($Field) && count($Field) > 0) { // Of course we only want to check each table once $checked_tables = $col_cand; foreach ($col_cand AS $tab) { - if ($checked_tables[$tab] != 1 ) { + if ($checked_tables[$tab] != 1) { $tsize[$tab] = PMA_Table::countRecords($db, $tab, true, false); $checked_tables[$tab] = 1; } diff --git a/db_sql.php b/db_sql.php index 473aeda5f7..13918438ab 100644 --- a/db_sql.php +++ b/db_sql.php @@ -21,7 +21,7 @@ require_once './libraries/sql_query_form.lib.php'; * "db_structure.php" script where table can be created */ require './libraries/db_info.inc.php'; -if ( $num_tables == 0 && empty( $db_query_force ) ) { +if ($num_tables == 0 && empty($db_query_force)) { $sub_part = ''; $is_info = TRUE; require './db_structure.php'; diff --git a/export.php b/export.php index 9082b3210f..ea22cdacae 100644 --- a/export.php +++ b/export.php @@ -336,7 +336,7 @@ if ($save_on_server) { * or not */ if (!$save_on_server) { - if ($asfile ) { + if ($asfile) { // Download if (!empty($content_encoding)) { header('Content-Encoding: ' . $content_encoding); @@ -55,7 +55,7 @@ if (empty($HTTP_HOST)) { // purge querywindow history $cfgRelation = PMA_getRelationsParam(); if ($GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork']) { - PMA_purgeHistory( $GLOBALS['cfg']['Server']['user'] ); + PMA_purgeHistory($GLOBALS['cfg']['Server']['user']); } unset($cfgRelation); diff --git a/libraries/Config.class.php b/libraries/Config.class.php index b20b502207..d57af3caa6 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -256,7 +256,7 @@ class PMA_Config $this->set('PMA_IS_WINDOWS', 0); // If PHP_OS is defined then continue if (defined('PHP_OS')) { - if (stristr(PHP_OS, 'win') ) { + if (stristr(PHP_OS, 'win')) { // Is it some version of Windows $this->set('PMA_IS_WINDOWS', 1); } elseif (stristr(PHP_OS, 'OS/2')) { @@ -569,7 +569,7 @@ class PMA_Config if (PMA_getenv('REQUEST_URI')) { $url = @parse_url(PMA_getenv('REQUEST_URI')); // produces E_WARNING if it cannot get parsed, e.g. '/foobar:/' if ($url === false) { - $url = array( 'path' => $_SERVER['REQUEST_URI'] ); + $url = array('path' => $_SERVER['REQUEST_URI']); } } diff --git a/libraries/PMA_Sql.class.php b/libraries/PMA_Sql.class.php index 6c5af44f4f..5b037c1841 100644 --- a/libraries/PMA_Sql.class.php +++ b/libraries/PMA_Sql.class.php @@ -1099,7 +1099,7 @@ class PMA_Sql // so we track wether we are in the EXTRACT() $in_extract = FALSE; - // for GROUP_CONCAT( ... ) + // for GROUP_CONCAT(...) $in_group_concat = FALSE; // must be sorted @@ -1250,7 +1250,7 @@ class PMA_Sql $previous_was_identifier = FALSE; $current_select_expr = -1; $seen_end_of_table_ref = FALSE; - } // end if ( data == SELECT) + } // end if (data == SELECT) if ($upper_data =='FROM' && ! $in_extract) { $current_table_ref = -1; @@ -1320,7 +1320,7 @@ class PMA_Sql } // end if ($save_table_ref &&!$seen_end_of_table_ref) } // end if (!$seen_from) } // end if (querytype SELECT) - } // end if ( quote_backtick or double quote or alpha_identifier) + } // end if (quote_backtick or double quote or alpha_identifier) // =================================== if ($each_parsed['type'] == 'punct_qualifier') { @@ -1943,7 +1943,7 @@ class PMA_Sql // (we got a bug report about not being able to use // 'no' as an identifier) || ($this->_parsed[$pos + 2]['type'] == 'alpha_identifier' - && strtoupper($this->_parsed[$pos + 2]['data'])=='NO') ) + && strtoupper($this->_parsed[$pos + 2]['data'])=='NO')) ) { $third_upper_data = strtoupper($this->_parsed[$pos + 2]['data']); if ($third_upper_data == 'CASCADE' diff --git a/libraries/Table.class.php b/libraries/Table.class.php index a32805b773..cff9c40d81 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -402,7 +402,7 @@ class PMA_Table { } else { // Counting all rows of a VIEW could be too long, so use // a LIMIT clause. - // Use try_query because it can fail ( a VIEW is based on + // Use try_query because it can fail (a VIEW is based on // a table that no longer exists) $result = PMA_DBI_try_query( 'SELECT 1 FROM ' . PMA_backquote($db) . '.' diff --git a/libraries/Theme_Manager.class.php b/libraries/Theme_Manager.class.php index 1aeec15e55..064ed2e9a7 100644 --- a/libraries/Theme_Manager.class.php +++ b/libraries/Theme_Manager.class.php @@ -108,8 +108,8 @@ class PMA_Theme_Manager $this->theme = new PMA_Theme; - if ( ! $this->checkTheme($GLOBALS['cfg']['ThemeDefault'])) { - $GLOBALS['PMA_errors'][] = sprintf( $GLOBALS['strThemeDefaultNotFound'], + if (! $this->checkTheme($GLOBALS['cfg']['ThemeDefault'])) { + $GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strThemeDefaultNotFound'], htmlspecialchars($GLOBALS['cfg']['ThemeDefault'])); trigger_error( sprintf($GLOBALS['strThemeDefaultNotFound'], @@ -148,7 +148,7 @@ class PMA_Theme_Manager function setActiveTheme($theme = null) { - if ( ! $this->checkTheme($theme)) { + if (! $this->checkTheme($theme)) { $GLOBALS['PMA_errors'][] = sprintf($GLOBALS['strThemeNotFound'], htmlspecialchars($theme)); /* Following code can lead to path disclossure, because headers will be sent later */ diff --git a/libraries/auth/config.auth.lib.php b/libraries/auth/config.auth.lib.php index 817b6c2637..a73775122e 100644 --- a/libraries/auth/config.auth.lib.php +++ b/libraries/auth/config.auth.lib.php @@ -126,8 +126,8 @@ function PMA_auth_fails() } PMA_mysqlDie($conn_error, '', true, '', false); } - if ( ! empty( $GLOBALS['PMA_errors'] ) && is_array( $GLOBALS['PMA_errors'] ) ) { - foreach ( $GLOBALS['PMA_errors'] as $error ) { + if (! empty($GLOBALS['PMA_errors']) && is_array($GLOBALS['PMA_errors'])) { + foreach ($GLOBALS['PMA_errors'] as $error) { echo '<div class="error">' . $error . '</div>' . "\n"; } } diff --git a/libraries/bookmark.lib.php b/libraries/bookmark.lib.php index 77839716e8..3e69f6bd6e 100644 --- a/libraries/bookmark.lib.php +++ b/libraries/bookmark.lib.php @@ -103,7 +103,7 @@ function PMA_queryBookmarks($db, $cfgBookmark, $id, $id_field = 'id', $action_bo $query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table']) . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'' . ($action_bookmark_all? '' : ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'' - . ' OR user = \'\')' ) + . ' OR user = \'\')') . ' AND ' . PMA_backquote($id_field) . ' = ' . $id; $result = PMA_DBI_try_query($query, $controllink); if (!$result) { diff --git a/libraries/charset_conversion.lib.php b/libraries/charset_conversion.lib.php index d4d699ae77..8ec0fa3b9c 100644 --- a/libraries/charset_conversion.lib.php +++ b/libraries/charset_conversion.lib.php @@ -153,7 +153,7 @@ function PMA_convert_display_charset($what) { if (!(isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding) || $convcharset == $charset // rabus: if input and output charset are the same, we don't have to do anything... // this constant is not defined before the login: - || (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) ) { // lem9: even if AllowAnywhereRecoding is TRUE, do not recode for MySQL >= 4.1.x since MySQL does the job + || (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100)) { // lem9: even if AllowAnywhereRecoding is TRUE, do not recode for MySQL >= 4.1.x since MySQL does the job return $what; } elseif (is_array($what)) { $result = array(); diff --git a/libraries/common.lib.php b/libraries/common.lib.php index c6f5c14c09..dfc1600622 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -216,7 +216,7 @@ function PMA_unQuote($quoted_string, $quote = null) foreach ($quotes as $quote) { if (substr($quoted_string, 0, 1) === $quote - && substr($quoted_string, -1, 1) === $quote ) { + && substr($quoted_string, -1, 1) === $quote) { $unquoted_string = substr($quoted_string, 1, -1); // replace escaped quotes $unquoted_string = str_replace($quote . $quote, $quote, $unquoted_string); @@ -732,7 +732,7 @@ function PMA_getTableList($db, $tables = null) { $sep = $GLOBALS['cfg']['LeftFrameTableSeparator']; - if ( null === $tables ) { + if (null === $tables) { $tables = PMA_DBI_get_tables_full($db); if ($GLOBALS['cfg']['NaturalOrder']) { uksort($tables, 'strnatcasecmp'); @@ -1348,7 +1348,7 @@ function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false) 6 => 'E', 7 => 'Z', 8 => 'Y' - ); + ); // we need at least 3 digits to be displayed if (3 > $length + $comma) { @@ -1478,7 +1478,7 @@ function PMA_getTab($tab) 'args' => '', 'warning' => '', 'fragment' => '', - ); + ); $tab = array_merge($defaults, $tab); diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 61543e4803..bc44d7599b 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -21,11 +21,11 @@ define('PMA_DBI_GETVAR_GLOBAL', 2); * * @param string $extension mysql extension to load */ -function PMA_DBI_checkAndLoadMysqlExtension( $extension = 'mysql' ) { - if ( ! function_exists( $extension . '_connect' ) ) { - PMA_dl( $extension ); +function PMA_DBI_checkAndLoadMysqlExtension($extension = 'mysql') { + if (! function_exists($extension . '_connect')) { + PMA_dl($extension); // check whether mysql is available - if ( ! function_exists( $extension . '_connect' ) ) { + if (! function_exists($extension . '_connect')) { return false; } } @@ -37,7 +37,7 @@ function PMA_DBI_checkAndLoadMysqlExtension( $extension = 'mysql' ) { /** * check for requested extension */ -if ( ! PMA_DBI_checkAndLoadMysqlExtension( $GLOBALS['cfg']['Server']['extension'] ) ) { +if (! PMA_DBI_checkAndLoadMysqlExtension($GLOBALS['cfg']['Server']['extension'])) { // if it fails try alternative extension ... // and display an error ... @@ -47,18 +47,18 @@ if ( ! PMA_DBI_checkAndLoadMysqlExtension( $GLOBALS['cfg']['Server']['extension' * and complete fail (no alternativ extension too) */ $GLOBALS['PMA_errors'][] = - sprintf( PMA_sanitize( $GLOBALS['strCantLoad'] ), - $GLOBALS['cfg']['Server']['extension'] ) + sprintf(PMA_sanitize($GLOBALS['strCantLoad']), + $GLOBALS['cfg']['Server']['extension']) .' - <a href="./Documentation.html#faqmysql" target="documentation">' .$GLOBALS['strDocu'] . '</a>'; - if ( $GLOBALS['cfg']['Server']['extension'] === 'mysql' ) { + if ($GLOBALS['cfg']['Server']['extension'] === 'mysql') { $alternativ_extension = 'mysqli'; } else { $alternativ_extension = 'mysql'; } - if ( ! PMA_DBI_checkAndLoadMysqlExtension( $alternativ_extension ) ) { + if (! PMA_DBI_checkAndLoadMysqlExtension($alternativ_extension)) { // if alternativ fails too ... PMA_fatalError( sprintf($GLOBALS['strCantLoad'], @@ -68,7 +68,7 @@ if ( ! PMA_DBI_checkAndLoadMysqlExtension( $GLOBALS['cfg']['Server']['extension' } $GLOBALS['cfg']['Server']['extension'] = $alternativ_extension; - unset( $alternativ_extension ); + unset($alternativ_extension); } /** @@ -104,7 +104,7 @@ function PMA_DBI_query($query, $link = null, $options = 0) { * @param string $message * @return string $message */ -function PMA_DBI_convert_message( $message ) { +function PMA_DBI_convert_message($message) { // latin always last! $encodings = array( 'japanese' => 'EUC-JP', //'ujis', @@ -133,33 +133,33 @@ function PMA_DBI_convert_message( $message ) { 'german' => 'CP1252', //'latin1', ); - if ( $server_language = PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE \'language\';', 0, 1 ) ) { + if ($server_language = PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'language\';', 0, 1)) { $found = array(); - if ( preg_match( '&(?:\\\|\\/)([^\\\\\/]*)(?:\\\|\\/)$&i', $server_language, $found )) { + if (preg_match('&(?:\\\|\\/)([^\\\\\/]*)(?:\\\|\\/)$&i', $server_language, $found)) { $server_language = $found[1]; } } - if ( ! empty( $server_language ) && isset( $encodings[$server_language] ) ) { - if ( function_exists( 'iconv' ) ) { + if (! empty($server_language) && isset($encodings[$server_language])) { + if (function_exists('iconv')) { if ((@stristr(PHP_OS, 'AIX')) && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) { require_once './libraries/iconv_wrapper.lib.php'; - $message = PMA_aix_iconv_wrapper( $encodings[$server_language], + $message = PMA_aix_iconv_wrapper($encodings[$server_language], $GLOBALS['charset'] . $GLOBALS['cfg']['IconvExtraParams'], $message); } else { - $message = iconv( $encodings[$server_language], + $message = iconv($encodings[$server_language], $GLOBALS['charset'] . $GLOBALS['cfg']['IconvExtraParams'], $message); } - } elseif ( function_exists( 'recode_string' ) ) { - $message = recode_string( $encodings[$server_language] . '..' . $GLOBALS['charset'], - $message ); - } elseif ( function_exists( 'libiconv' ) ) { - $message = libiconv( $encodings[$server_language], $GLOBALS['charset'], $message ); - } elseif ( function_exists( 'mb_convert_encoding' ) ) { + } elseif (function_exists('recode_string')) { + $message = recode_string($encodings[$server_language] . '..' . $GLOBALS['charset'], + $message); + } elseif (function_exists('libiconv')) { + $message = libiconv($encodings[$server_language], $GLOBALS['charset'], $message); + } elseif (function_exists('mb_convert_encoding')) { // do not try unsupported charsets - if ( ! in_array( $server_language, array( 'ukrainian', 'greek', 'serbian' ) ) ) { - $message = mb_convert_encoding( $message, $GLOBALS['charset'], - $encodings[$server_language] ); + if (! in_array($server_language, array('ukrainian', 'greek', 'serbian'))) { + $message = mb_convert_encoding($message, $GLOBALS['charset'], + $encodings[$server_language]); } } } else { @@ -194,10 +194,10 @@ function PMA_DBI_get_tables($database, $link = null) * if $tbl_is_group is 'comment, $table is used as filter for table comments * * <code> - * PMA_DBI_get_tables_full( 'my_database' ); - * PMA_DBI_get_tables_full( 'my_database', 'my_table' ) ); - * PMA_DBI_get_tables_full( 'my_database', 'my_tables_', true ) ); - * PMA_DBI_get_tables_full( 'my_database', 'my_tables_', 'comment' ) ); + * PMA_DBI_get_tables_full('my_database'); + * PMA_DBI_get_tables_full('my_database', 'my_table')); + * PMA_DBI_get_tables_full('my_database', 'my_tables_', true)); + * PMA_DBI_get_tables_full('my_database', 'my_tables_', 'comment')); * </code> * * @uses PMA_MYSQL_INT_VERSION @@ -218,7 +218,7 @@ function PMA_DBI_get_tables_full($database, $table = false, $tbl_is_group = false, $link = null) { // prepare and check parameters - if ( ! is_array($database) ) { + if (! is_array($database)) { $databases = array(addslashes($database)); } else { $databases = array_map('addslashes', $database); @@ -226,13 +226,13 @@ function PMA_DBI_get_tables_full($database, $table = false, $tables = array(); - if ( PMA_MYSQL_INT_VERSION >= 50002 ) { + if (PMA_MYSQL_INT_VERSION >= 50002) { // get table information from information_schema - if ( $table ) { - if ( true === $tbl_is_group ) { + if ($table) { + if (true === $tbl_is_group) { $sql_where_table = 'AND `TABLE_NAME` LIKE \'' . PMA_escape_mysql_wildcards(addslashes($table)) . '%\''; - } elseif ( 'comment' === $tbl_is_group ) { + } elseif ('comment' === $tbl_is_group) { $sql_where_table = 'AND `TABLE_COMMENT` LIKE \'' . PMA_escape_mysql_wildcards(addslashes($table)) . '%\''; } else { @@ -277,14 +277,14 @@ function PMA_DBI_get_tables_full($database, $table = false, $tables = PMA_DBI_fetch_result($sql, array('TABLE_SCHEMA', 'TABLE_NAME'), null, $link); - unset( $sql_where_table, $sql ); + unset($sql_where_table, $sql); } // If permissions are wrong on even one database directory, // information_schema does not return any table info for any database // this is why we fall back to SHOW TABLE STATUS even for MySQL >= 50002 - if ( PMA_MYSQL_INT_VERSION < 50002 || empty($tables)) { - foreach ( $databases as $each_database ) { - if ( true === $tbl_is_group ) { + if (PMA_MYSQL_INT_VERSION < 50002 || empty($tables)) { + foreach ($databases as $each_database) { + if (true === $tbl_is_group) { $sql = 'SHOW TABLE STATUS FROM ' . PMA_backquote($each_database) .' LIKE \'' . PMA_escape_mysql_wildcards(addslashes($table)) . '%\''; @@ -293,22 +293,22 @@ function PMA_DBI_get_tables_full($database, $table = false, . PMA_backquote($each_database) . ';'; } $each_tables = PMA_DBI_fetch_result($sql, 'Name', null, $link); - foreach ( $each_tables as $table_name => $each_table ) { - if ( 'comment' === $tbl_is_group - && 0 === strpos($each_table['Comment'], $table) ) + foreach ($each_tables as $table_name => $each_table) { + if ('comment' === $tbl_is_group + && 0 === strpos($each_table['Comment'], $table)) { // remove table from list - unset( $each_tables[$table_name] ); + unset($each_tables[$table_name]); continue; } - if ( ! isset( $each_tables[$table_name]['Type'] ) - && isset( $each_tables[$table_name]['Engine'] ) ) { + if (! isset($each_tables[$table_name]['Type']) + && isset($each_tables[$table_name]['Engine'])) { // pma BC, same parts of PMA still uses 'Type' $each_tables[$table_name]['Type'] =& $each_tables[$table_name]['Engine']; - } elseif ( ! isset( $each_tables[$table_name]['Engine'] ) - && isset( $each_tables[$table_name]['Type'] ) ) { + } elseif (! isset($each_tables[$table_name]['Engine']) + && isset($each_tables[$table_name]['Type'])) { // old MySQL reports Type, newer MySQL reports Engine $each_tables[$table_name]['Engine'] =& $each_tables[$table_name]['Type']; @@ -336,7 +336,7 @@ function PMA_DBI_get_tables_full($database, $table = false, $each_tables[$table_name]['CREATE_OPTIONS'] =& $each_tables[$table_name]['Create_options']; $each_tables[$table_name]['TABLE_COMMENT'] =& $each_tables[$table_name]['Comment']; - if ( strtoupper( $each_tables[$table_name]['Comment'] ) === 'VIEW' ) { + if (strtoupper($each_tables[$table_name]['Comment']) === 'VIEW') { $each_tables[$table_name]['TABLE_TYPE'] = 'VIEW'; } else { /** @@ -350,8 +350,8 @@ function PMA_DBI_get_tables_full($database, $table = false, } } - if ( $GLOBALS['cfg']['NaturalOrder'] ) { - foreach ( $tables as $key => $val ) { + if ($GLOBALS['cfg']['NaturalOrder']) { + foreach ($tables as $key => $val) { uksort($tables[$key], 'strnatcasecmp'); } } @@ -419,9 +419,9 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, } // get table information from information_schema - if ( $database ) { + if ($database) { $sql_where_schema = 'WHERE `SCHEMA_NAME` LIKE \'' - . addslashes( $database ) . '\''; + . addslashes($database) . '\''; } else { $sql_where_schema = ''; } @@ -484,11 +484,11 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, // so pma could use this array as if every server is of version >5.0 $databases[$database_name]['SCHEMA_NAME'] = $database_name; - if ( $force_stats ) { + if ($force_stats) { require_once 'mysql_charsets.lib.php'; $databases[$database_name]['DEFAULT_COLLATION_NAME'] - = PMA_getDbCollation( $database_name ); + = PMA_getDbCollation($database_name); // get additonal info about tables $databases[$database_name]['SCHEMA_TABLES'] = 0; @@ -499,8 +499,8 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, $databases[$database_name]['SCHEMA_LENGTH'] = 0; $databases[$database_name]['SCHEMA_DATA_FREE'] = 0; - $res = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote( $database_name ) . ';'); - while ( $row = PMA_DBI_fetch_assoc( $res ) ) { + $res = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($database_name) . ';'); + while ($row = PMA_DBI_fetch_assoc($res)) { $databases[$database_name]['SCHEMA_TABLES']++; $databases[$database_name]['SCHEMA_TABLE_ROWS'] += $row['Rows']; @@ -515,8 +515,8 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false, $databases[$database_name]['SCHEMA_LENGTH'] += $row['Data_length'] + $row['Index_length']; } - PMA_DBI_free_result( $res ); - unset( $res ); + PMA_DBI_free_result($res); + unset($res); } } } @@ -569,22 +569,22 @@ function PMA_DBI_get_columns_full($database = null, $table = null, { $columns = array(); - if ( PMA_MYSQL_INT_VERSION >= 50002 ) { + if (PMA_MYSQL_INT_VERSION >= 50002) { $sql_wheres = array(); $array_keys = array(); // get columns information from information_schema - if ( null !== $database ) { + if (null !== $database) { $sql_wheres[] = '`TABLE_SCHEMA` = \'' . addslashes($database) . '\' '; } else { $array_keys[] = 'TABLE_SCHEMA'; } - if ( null !== $table ) { + if (null !== $table) { $sql_wheres[] = '`TABLE_NAME` = \'' . addslashes($table) . '\' '; } else { $array_keys[] = 'TABLE_NAME'; } - if ( null !== $column ) { + if (null !== $column) { $sql_wheres[] = '`COLUMN_NAME` = \'' . addslashes($column) . '\' '; } else { $array_keys[] = 'COLUMN_NAME'; @@ -604,22 +604,22 @@ function PMA_DBI_get_columns_full($database = null, $table = null, `PRIVILEGES` AS `Privileges`, `COLUMN_COMMENT` AS `Comment` FROM `information_schema`.`COLUMNS`'; - if ( count($sql_wheres) ) { + if (count($sql_wheres)) { $sql .= "\n" . ' WHERE ' . implode(' AND ', $sql_wheres); } $columns = PMA_DBI_fetch_result($sql, $array_keys, null, $link); - unset( $sql_wheres, $sql ); + unset($sql_wheres, $sql); } else { - if ( null === $database ) { + if (null === $database) { foreach ($GLOBALS['PMA_List_Database']->items as $database) { $columns[$database] = PMA_DBI_get_columns_full($database, null, null, $link); } return $columns; - } elseif ( null === $table ) { + } elseif (null === $table) { $tables = PMA_DBI_get_tables($database); - foreach ( $tables as $table ) { + foreach ($tables as $table) { $columns[$table] = PMA_DBI_get_columns_full( $database, $table, null, $link); } @@ -628,14 +628,14 @@ function PMA_DBI_get_columns_full($database = null, $table = null, $sql = 'SHOW FULL COLUMNS FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table); - if ( null !== $column ) { + if (null !== $column) { $sql .= " LIKE '" . $column . "'"; } - $columns = PMA_DBI_fetch_result( $sql, 'Field', null, $link ); + $columns = PMA_DBI_fetch_result($sql, 'Field', null, $link); $ordinal_position = 1; - foreach ( $columns as $column_name => $each_column ) { + foreach ($columns as $column_name => $each_column) { // MySQL forward compatibility // so pma could use this array as if every server is of version >5.0 @@ -673,7 +673,7 @@ function PMA_DBI_get_columns_full($database = null, $table = null, $ordinal_position++; } - if ( null !== $column ) { + if (null !== $column) { reset($columns); $columns = current($columns); } @@ -699,7 +699,7 @@ function PMA_DBI_get_fields($database, $table, $link = null) 'SHOW FULL COLUMNS FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table), null, null, $link); - if ( ! is_array($fields) || count($fields) < 1 ) { + if (! is_array($fields) || count($fields) < 1) { return false; } return $fields; @@ -720,7 +720,7 @@ function PMA_DBI_get_columns($database, $table, $full = false, $link = null) 'SHOW ' . ($full ? 'FULL' : '') . ' COLUMNS FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table), 'Fields', ($full ? null : 'Fields'), $link); - if ( ! is_array($fields) || count($fields) < 1 ) { + if (! is_array($fields) || count($fields) < 1) { return false; } return $fields; @@ -794,7 +794,7 @@ function PMA_DBI_postConnect($link, $is_controluser = false) if (!defined('PMA_MYSQL_INT_VERSION')) { $mysql_version = PMA_DBI_fetch_value( 'SELECT VERSION()', 0, 0, $link, PMA_DBI_QUERY_STORE); - if ( $mysql_version ) { + if ($mysql_version) { $match = explode('.', $mysql_version); define('PMA_MYSQL_INT_VERSION', (int) sprintf('%d%02d%02d', $match[0], $match[1], @@ -820,9 +820,9 @@ function PMA_DBI_postConnect($link, $is_controluser = false) // If $lang is defined and we are on MySQL >= 4.1.x, // we auto-switch the lang to its UTF-8 version (if it exists and user // didn't force language) - if ( !empty($GLOBALS['lang']) + if (!empty($GLOBALS['lang']) && (substr($GLOBALS['lang'], -5) != 'utf-8') - && !isset($GLOBALS['cfg']['Lang']) ) { + && !isset($GLOBALS['cfg']['Lang'])) { $lang_utf_8_version = substr($GLOBALS['lang'], 0, strpos($GLOBALS['lang'], '-')) . '-utf-8'; @@ -835,16 +835,16 @@ function PMA_DBI_postConnect($link, $is_controluser = false) // and we remove the non-UTF-8 choices to avoid confusion if (!defined('PMA_REMOVED_NON_UTF_8')) { - foreach ( $GLOBALS['available_languages'] as $each_lang => $dummy ) { - if ( substr($each_lang, -5) != 'utf-8' ) { - unset( $GLOBALS['available_languages'][$each_lang] ); + foreach ($GLOBALS['available_languages'] as $each_lang => $dummy) { + if (substr($each_lang, -5) != 'utf-8') { + unset($GLOBALS['available_languages'][$each_lang]); } } define('PMA_REMOVED_NON_UTF_8', 1); } $mysql_charset = $GLOBALS['mysql_charset_map'][$GLOBALS['charset']]; - if ( $is_controluser + if ($is_controluser || empty($GLOBALS['collation_connection']) || (strpos($GLOBALS['collation_connection'], '_') ? substr($GLOBALS['collation_connection'], 0, strpos($GLOBALS['collation_connection'], '_')) @@ -886,7 +886,7 @@ function PMA_DBI_postConnect($link, $is_controluser = false) * * <code> * $sql = 'SELECT `name` FROM `user` WHERE `id` = 123'; - * $user_name = PMA_DBI_fetch_value( $sql ); + * $user_name = PMA_DBI_fetch_value($sql); * // produces * // $user_name = 'John Doe' * </code> @@ -908,37 +908,37 @@ function PMA_DBI_postConnect($link, $is_controluser = false) * @return mixed value of first field in first row from result * or false if not found */ -function PMA_DBI_fetch_value( $result, $row_number = 0, $field = 0, $link = null, $options = 0 ) { +function PMA_DBI_fetch_value($result, $row_number = 0, $field = 0, $link = null, $options = 0) { $value = false; - if ( is_string( $result ) ) { - $result = PMA_DBI_try_query( $result, $link, $options | PMA_DBI_QUERY_STORE ); + if (is_string($result)) { + $result = PMA_DBI_try_query($result, $link, $options | PMA_DBI_QUERY_STORE); } // return false if result is empty or false // or requested row is larger than rows in result - if ( PMA_DBI_num_rows( $result ) < ( $row_number + 1 ) ) { + if (PMA_DBI_num_rows($result) < ($row_number + 1)) { return $value; } // if $field is an integer use non associative mysql fetch function - if ( is_int( $field ) ) { + if (is_int($field)) { $fetch_function = 'PMA_DBI_fetch_row'; } else { $fetch_function = 'PMA_DBI_fetch_assoc'; } // get requested row - for ( $i = 0; $i <= $row_number; $i++ ) { - $row = $fetch_function( $result ); + for ($i = 0; $i <= $row_number; $i++) { + $row = $fetch_function($result); } - PMA_DBI_free_result( $result ); + PMA_DBI_free_result($result); // return requested field - if ( isset( $row[$field] ) ) { + if (isset($row[$field])) { $value = $row[$field]; } - unset( $row ); + unset($row); return $value; } @@ -948,9 +948,9 @@ function PMA_DBI_fetch_value( $result, $row_number = 0, $field = 0, $link = null * * <code> * $sql = 'SELECT * FROM `user` WHERE `id` = 123'; - * $user = PMA_DBI_fetch_single_row( $sql ); + * $user = PMA_DBI_fetch_single_row($sql); * // produces - * // $user = array( 'id' => 123, 'name' => 'John Doe' ) + * // $user = array('id' => 123, 'name' => 'John Doe') * </code> * * @uses is_string() @@ -969,17 +969,17 @@ function PMA_DBI_fetch_value( $result, $row_number = 0, $field = 0, $link = null * @return array|boolean first row from result * or false if result is empty */ -function PMA_DBI_fetch_single_row( $result, $type = 'ASSOC', $link = null, $options = 0 ) { - if ( is_string( $result ) ) { - $result = PMA_DBI_try_query( $result, $link, $options | PMA_DBI_QUERY_STORE ); +function PMA_DBI_fetch_single_row($result, $type = 'ASSOC', $link = null, $options = 0) { + if (is_string($result)) { + $result = PMA_DBI_try_query($result, $link, $options | PMA_DBI_QUERY_STORE); } // return null if result is empty or false - if ( ! PMA_DBI_num_rows( $result ) ) { + if (! PMA_DBI_num_rows($result)) { return false; } - switch ( $type ) { + switch ($type) { case 'NUM' : $fetch_function = 'PMA_DBI_fetch_row'; break; @@ -992,8 +992,8 @@ function PMA_DBI_fetch_single_row( $result, $type = 'ASSOC', $link = null, $opti break; } - $row = $fetch_function( $result ); - PMA_DBI_free_result( $result ); + $row = $fetch_function($result); + PMA_DBI_free_result($result); return $row; } @@ -1002,29 +1002,29 @@ function PMA_DBI_fetch_single_row( $result, $type = 'ASSOC', $link = null, $opti * * <code> * $sql = 'SELECT * FROM `user`'; - * $users = PMA_DBI_fetch_result( $sql ); + * $users = PMA_DBI_fetch_result($sql); * // produces - * // $users[] = array( 'id' => 123, 'name' => 'John Doe' ) + * // $users[] = array('id' => 123, 'name' => 'John Doe') * * $sql = 'SELECT `id`, `name` FROM `user`'; - * $users = PMA_DBI_fetch_result( $sql, 'id' ); + * $users = PMA_DBI_fetch_result($sql, 'id'); * // produces - * // $users['123'] = array( 'id' => 123, 'name' => 'John Doe' ) + * // $users['123'] = array('id' => 123, 'name' => 'John Doe') * * $sql = 'SELECT `id`, `name` FROM `user`'; - * $users = PMA_DBI_fetch_result( $sql, 0 ); + * $users = PMA_DBI_fetch_result($sql, 0); * // produces - * // $users['123'] = array( 0 => 123, 1 => 'John Doe' ) + * // $users['123'] = array(0 => 123, 1 => 'John Doe') * * $sql = 'SELECT `id`, `name` FROM `user`'; - * $users = PMA_DBI_fetch_result( $sql, 'id', 'name' ); + * $users = PMA_DBI_fetch_result($sql, 'id', 'name'); * // or - * $users = PMA_DBI_fetch_result( $sql, 0, 1 ); + * $users = PMA_DBI_fetch_result($sql, 0, 1); * // produces * // $users['123'] = 'John Doe' * * $sql = 'SELECT `name` FROM `user`'; - * $users = PMA_DBI_fetch_result( $sql ); + * $users = PMA_DBI_fetch_result($sql); * // produces * // $users[] = 'John Doe' * </code> @@ -1046,47 +1046,47 @@ function PMA_DBI_fetch_single_row( $result, $type = 'ASSOC', $link = null, $opti * @param mixed $options * @return array resultrows or values indexed by $key */ -function PMA_DBI_fetch_result( $result, $key = null, $value = null, - $link = null, $options = 0 ) +function PMA_DBI_fetch_result($result, $key = null, $value = null, + $link = null, $options = 0) { $resultrows = array(); - if ( is_string($result) ) { + if (is_string($result)) { $result = PMA_DBI_try_query($result, $link, $options); } // return empty array if result is empty or false - if ( ! $result ) { + if (! $result) { return $resultrows; } $fetch_function = 'PMA_DBI_fetch_assoc'; // no nested array if only one field is in result - if ( null === $key && 1 === PMA_DBI_num_fields($result) ) { + if (null === $key && 1 === PMA_DBI_num_fields($result)) { $value = 0; $fetch_function = 'PMA_DBI_fetch_row'; } // if $key is an integer use non associative mysql fetch function - if ( is_int($key) ) { + if (is_int($key)) { $fetch_function = 'PMA_DBI_fetch_row'; } - if ( null === $key && null === $value ) { - while ( $row = $fetch_function($result) ) { + if (null === $key && null === $value) { + while ($row = $fetch_function($result)) { $resultrows[] = $row; } - } elseif ( null === $key ) { - while ( $row = $fetch_function($result) ) { + } elseif (null === $key) { + while ($row = $fetch_function($result)) { $resultrows[] = $row[$value]; } - } elseif ( null === $value ) { - if ( is_array($key) ) { - while ( $row = $fetch_function($result) ) { + } elseif (null === $value) { + if (is_array($key)) { + while ($row = $fetch_function($result)) { $result_target =& $resultrows; - foreach ( $key as $key_index ) { - if ( ! isset( $result_target[$row[$key_index]] ) ) { + foreach ($key as $key_index) { + if (! isset($result_target[$row[$key_index]])) { $result_target[$row[$key_index]] = array(); } $result_target =& $result_target[$row[$key_index]]; @@ -1094,16 +1094,16 @@ function PMA_DBI_fetch_result( $result, $key = null, $value = null, $result_target = $row; } } else { - while ( $row = $fetch_function($result) ) { + while ($row = $fetch_function($result)) { $resultrows[$row[$key]] = $row; } } } else { - if ( is_array($key) ) { - while ( $row = $fetch_function($result) ) { + if (is_array($key)) { + while ($row = $fetch_function($result)) { $result_target =& $resultrows; - foreach ( $key as $key_index ) { - if ( ! isset( $result_target[$row[$key_index]] ) ) { + foreach ($key as $key_index) { + if (! isset($result_target[$row[$key_index]])) { $result_target[$row[$key_index]] = array(); } $result_target =& $result_target[$row[$key_index]]; @@ -1111,7 +1111,7 @@ function PMA_DBI_fetch_result( $result, $key = null, $value = null, $result_target = $row[$value]; } } else { - while ( $row = $fetch_function($result) ) { + while ($row = $fetch_function($result)) { $resultrows[$row[$key]] = $row[$value]; } } @@ -1128,10 +1128,10 @@ function PMA_DBI_fetch_result( $result, $key = null, $value = null, */ function PMA_DBI_get_default_engine() { - if ( PMA_MYSQL_INT_VERSION > 50002 ) { - return PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE \'storage_engine\';', 0, 1 ); + if (PMA_MYSQL_INT_VERSION > 50002) { + return PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'storage_engine\';', 0, 1); } else { - return PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE \'table_type\';', 0, 1 ); + return PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'table_type\';', 0, 1); } } @@ -1172,8 +1172,8 @@ function PMA_DBI_getCompatibilities() * @return integer $is_superuser */ function PMA_isSuperuser() { - return PMA_DBI_try_query( 'SELECT COUNT(*) FROM mysql.user', - $GLOBALS['userlink'], PMA_DBI_QUERY_STORE ); + return PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', + $GLOBALS['userlink'], PMA_DBI_QUERY_STORE); } @@ -1214,6 +1214,6 @@ function PMA_DBI_get_procedure_or_function_def($db, $which, $proc_or_function_na $returned_field = array('PROCEDURE' => 'Create Procedure', 'FUNCTION' => 'Create Function'); $query = 'SHOW CREATE ' . $which . ' ' . PMA_backquote($db) . '.' . PMA_backquote($proc_or_function_name); - return(PMA_DBI_fetch_value( $query, 0, $returned_field[$which])); + return(PMA_DBI_fetch_value($query, 0, $returned_field[$which])); } ?> diff --git a/libraries/db_common.inc.php b/libraries/db_common.inc.php index 7f0ebbe654..f21437acb2 100644 --- a/libraries/db_common.inc.php +++ b/libraries/db_common.inc.php @@ -15,7 +15,7 @@ PMA_checkParameters(array('db')); $is_show_stats = $cfg['ShowStats']; -if ( PMA_MYSQL_INT_VERSION >= 50002 && $db == 'information_schema' ) { +if (PMA_MYSQL_INT_VERSION >= 50002 && $db == 'information_schema') { $is_show_stats = false; $db_is_information_schema = true; } else { diff --git a/libraries/db_links.inc.php b/libraries/db_links.inc.php index 80b10b3e43..d22e59e114 100644 --- a/libraries/db_links.inc.php +++ b/libraries/db_links.inc.php @@ -49,7 +49,7 @@ if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_info /** * export, search and qbe links if there is at least one table */ -if ( $num_tables == 0 ) { +if ($num_tables == 0) { $tab_qbe['warning'] = $strDbIsEmpty; $tab_search['warning'] = $strDbIsEmpty; $tab_export['warning'] = $strDbIsEmpty; @@ -82,7 +82,7 @@ if ($cfgRelation['designerwork']) { $tab_designer['link'] = 'pmd_general.php'; } -if ( ! $db_is_information_schema ) { +if (! $db_is_information_schema) { $tab_import['link'] = 'db_import.php'; $tab_import['text'] = $GLOBALS['strImport']; $tab_import['icon'] = 'b_import.png'; @@ -92,7 +92,7 @@ if ( ! $db_is_information_schema ) { $tab_operation['link'] = 'db_operations.php'; $tab_operation['text'] = $GLOBALS['strOperations']; $tab_operation['icon'] = 'b_tblops.png'; - if ( $is_superuser ) { + if ($is_superuser) { $tab_privileges['link'] = 'server_privileges.php'; $tab_privileges['args']['checkprivs'] = $db; // stay on database view @@ -111,22 +111,22 @@ $tabs[] =& $tab_sql; $tabs[] =& $tab_search; $tabs[] =& $tab_qbe; $tabs[] =& $tab_export; -if ( ! $db_is_information_schema ) { +if (! $db_is_information_schema) { $tabs[] =& $tab_import; if ($cfgRelation['designerwork']) { $tabs[] =& $tab_designer; } $tabs[] =& $tab_operation; - if ( $is_superuser ) { + if ($is_superuser) { $tabs[] =& $tab_privileges; } - if ( $is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase'] ) { + if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) { $tabs[] =& $tab_drop; } } -echo PMA_getTabs( $tabs ); -unset( $tabs ); +echo PMA_getTabs($tabs); +unset($tabs); /** * Displays a message diff --git a/libraries/db_routines.inc.php b/libraries/db_routines.inc.php index 9ca1498f8c..46d83eba67 100644 --- a/libraries/db_routines.inc.php +++ b/libraries/db_routines.inc.php @@ -14,11 +14,11 @@ * get the number of rows affected. We would have to * use the CLIENT_MULTI_RESULTS flag to get the result set * and also the call status. All this does not fit well with - * our current sql.php. + * our current sql.php. * Of course the interface would need a way to pass calling parameters. * Also, support DEFINER (like we do in export). */ -if ( PMA_MYSQL_INT_VERSION >= 50002 ) { +if (PMA_MYSQL_INT_VERSION >= 50002) { $url_query .= '&goto=db_structure.php'; $routines = PMA_DBI_fetch_result('SELECT SPECIFIC_NAME,ROUTINE_NAME,ROUTINE_TYPE,DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';'); diff --git a/libraries/dbg/setup.php b/libraries/dbg/setup.php index 7ff6f5bfac..30d8700008 100644 --- a/libraries/dbg/setup.php +++ b/libraries/dbg/setup.php @@ -10,13 +10,13 @@ * allways use $GLOBALS here, as this script is included by footer.inc.hp * which can also be included from inside a function */ -if ( $GLOBALS['cfg']['DBG']['enable'] ) { +if ($GLOBALS['cfg']['DBG']['enable']) { /** * Loads the DBG extension if needed */ - if ( ! @extension_loaded('dbg') && ! PMA_dl('dbg') ) { + if (! @extension_loaded('dbg') && ! PMA_dl('dbg')) { echo '<div class="warning">' - .sprintf( $GLOBALS['strCantLoad'], 'DBG' ) + .sprintf($GLOBALS['strCantLoad'], 'DBG') .' <a href="./Documentation.html#faqdbg" target="documentation">' .$GLOBALS['strDocu'] . '</a>' .'</div>'; diff --git a/libraries/dbi/mysql.dbi.lib.php b/libraries/dbi/mysql.dbi.lib.php index 40f866ec70..951daf05c9 100644 --- a/libraries/dbi/mysql.dbi.lib.php +++ b/libraries/dbi/mysql.dbi.lib.php @@ -194,9 +194,9 @@ function PMA_DBI_fetch_row($result) { * @param result $result,... one or more mysql result resources */ function PMA_DBI_free_result() { - foreach ( func_get_args() as $result ) { - if ( is_resource($result) - && get_resource_type($result) === 'mysql result' ) { + foreach (func_get_args() as $result) { + if (is_resource($result) + && get_resource_type($result) === 'mysql result') { mysql_free_result($result); } } @@ -298,7 +298,7 @@ function PMA_DBI_getError($link = null) // Some errors messages cannot be obtained by mysql_error() if ($error_number == 2002) { $error = '#' . ((string) $error_number) . ' - ' . $GLOBALS['strServerNotResponding'] . ' ' . $GLOBALS['strSocketProblem']; - } elseif ($error_number == 2003 ) { + } elseif ($error_number == 2003) { $error = '#' . ((string) $error_number) . ' - ' . $GLOBALS['strServerNotResponding']; } elseif (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) { $error = '#' . ((string) $error_number) . ' - ' . $error_message; diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index 9f1b996a32..c5b5354b27 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -379,7 +379,7 @@ function PMA_DBI_get_host_info($link = null) * @param resource $link mysql link * @return integer version of the MySQL protocol used */ -function PMA_DBI_get_proto_info( $link = null ) +function PMA_DBI_get_proto_info($link = null) { if (null === $link) { if (isset($GLOBALS['userlink'])) { diff --git a/libraries/display_create_table.lib.php b/libraries/display_create_table.lib.php index 4e9e5b772c..62d522b687 100644 --- a/libraries/display_create_table.lib.php +++ b/libraries/display_create_table.lib.php @@ -39,7 +39,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100) { $is_create_table_priv = true; } -foreach ( $dbs_where_create_table_allowed as $allowed_db ) { +foreach ($dbs_where_create_table_allowed as $allowed_db) { // if we find the exact db name, we stop here if ($allowed_db == $db) { @@ -104,14 +104,14 @@ unset($i, $max_position, $chunk, $pattern); <fieldset> <legend> <?php -if ( $GLOBALS['cfg']['PropertiesIconic'] ) { +if ($GLOBALS['cfg']['PropertiesIconic']) { echo '<img class="icon" src="' . $pmaThemeImage . 'b_newtbl.png" width="16" height="16" alt="" />'; } -echo sprintf( $strCreateNewTable, PMA_getDbLink() ); +echo sprintf($strCreateNewTable, PMA_getDbLink()); ?> </legend> -<?php if ( $is_create_table_priv ) { ?> - <?php echo PMA_generate_common_hidden_inputs( $db ); ?> +<?php if ($is_create_table_priv) { ?> + <?php echo PMA_generate_common_hidden_inputs($db); ?> <div class="formelement"> <?php echo $strName; ?>: <input type="text" name="table" maxlength="64" size="30" /> diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php index ee8047bea9..88b3292ead 100644 --- a/libraries/display_export.lib.php +++ b/libraries/display_export.lib.php @@ -80,7 +80,7 @@ echo PMA_pluginGetJavascript($export_list); <fieldset id="exportoptions"> <legend><?php echo $strExport; ?></legend> - <?php if ( ! empty( $multi_values ) ) { ?> + <?php if (! empty($multi_values)) { ?> <div class="formelementrow"> <?php echo $multi_values; ?> </div> @@ -102,12 +102,12 @@ echo PMA_pluginGetJavascript($export_list); //]]> </script> -<?php if ( strlen($table) && ! isset( $num_tables ) ) { ?> +<?php if (strlen($table) && ! isset($num_tables)) { ?> <div class="formelementrow"> <?php - echo sprintf( $strDumpXRows, + echo sprintf($strDumpXRows, '<input type="text" name="limit_to" size="5" value="' - . ( isset( $unlim_num_rows ) ? $unlim_num_rows : PMA_Table::countRecords( $db, $table, TRUE ) ) + . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_Table::countRecords($db, $table, TRUE)) . '" onfocus="this.select()" />', '<input type="text" name="limit_from" value="0" size="5"' .' onfocus="this.select()" /> '); @@ -201,11 +201,11 @@ echo PMA_pluginGetJavascript($export_list); <?php // zip, gzip and bzip2 encode features -$is_zip = ( $cfg['ZipDump'] && @function_exists('gzcompress') ); -$is_gzip = ( $cfg['GZipDump'] && @function_exists('gzencode') ); -$is_bzip = ( $cfg['BZipDump'] && @function_exists('bzcompress') ); +$is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress')); +$is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode')); +$is_bzip = ($cfg['BZipDump'] && @function_exists('bzcompress')); -if ( $is_zip || $is_gzip || $is_bzip ) { ?> +if ($is_zip || $is_gzip || $is_bzip) { ?> <div class="formelementrow"> <?php echo $strCompression; ?>: <input type="radio" name="compression" value="none" diff --git a/libraries/display_import.lib.php b/libraries/display_import.lib.php index af1296ec08..b3ce9c3a53 100644 --- a/libraries/display_import.lib.php +++ b/libraries/display_import.lib.php @@ -93,17 +93,17 @@ if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) { echo '<label for="charset_of_file">' . $strCharsetOfFile . '</label>' . "\n"; $temp_charset = reset($cfg['AvailableCharsets']); echo ' <select id="charset_of_file" name="charset_of_file" size="1">' . "\n" - . ' <option value="' . htmlentities( $temp_charset ) . '"'; + . ' <option value="' . htmlentities($temp_charset) . '"'; if ($temp_charset == $charset) { echo ' selected="selected"'; } - echo '>' . htmlentities( $temp_charset ) . '</option>' . "\n"; + echo '>' . htmlentities($temp_charset) . '</option>' . "\n"; while ($temp_charset = next($cfg['AvailableCharsets'])) { - echo ' <option value="' . htmlentities( $temp_charset ) . '"'; + echo ' <option value="' . htmlentities($temp_charset) . '"'; if ($temp_charset == $charset) { echo ' selected="selected"'; } - echo '>' . htmlentities( $temp_charset ) . '</option>' . "\n"; + echo '>' . htmlentities($temp_charset) . '</option>' . "\n"; } echo ' </select><br />' . "\n" . ' '; } elseif (PMA_MYSQL_INT_VERSION >= 40100) { @@ -128,7 +128,7 @@ if ($cfg['ZipDump'] && @function_exists('gzinflate')) { // We don't have show anything about compression, when no supported if ($compressions != $strNone) { echo '<div class="formelementrow">' . "\n"; - printf( $strCompressionWillBeDetected, $compressions); + printf($strCompressionWillBeDetected, $compressions); echo '</div>' . "\n"; } echo "\n"; diff --git a/libraries/display_select_lang.lib.php b/libraries/display_select_lang.lib.php index 073fd25690..e7a48ab474 100644 --- a/libraries/display_select_lang.lib.php +++ b/libraries/display_select_lang.lib.php @@ -14,7 +14,7 @@ * @return the sorted array * @access private */ -function PMA_language_cmp( &$a, &$b ) { +function PMA_language_cmp(&$a, &$b) { return (strcmp($a[1], $b[1])); } // end of the 'PMA_language_cmp()' function @@ -51,9 +51,9 @@ function PMA_select_language($use_fieldset = FALSE) { } $language_title = $GLOBALS['strLanguage'] . ($GLOBALS['strLanguage'] != 'Language' ? ' - Language' : '') . ' <a href="./translators.html" target="documentation">' . - ( $cfg['ReplaceHelpImg'] ? + ($cfg['ReplaceHelpImg'] ? '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />' : - '(*)' ) . '</a>'; + '(*)') . '</a>'; if ($use_fieldset) { echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>'; } else { diff --git a/libraries/display_tbl_links.lib.php b/libraries/display_tbl_links.lib.php index 52e28f4e27..f9a42ec2fe 100644 --- a/libraries/display_tbl_links.lib.php +++ b/libraries/display_tbl_links.lib.php @@ -13,7 +13,7 @@ /** * */ -if ( $doWriteModifyAt == 'left' ){ +if ($doWriteModifyAt == 'left') { if (!empty($del_url) && $is_display['del_lnk'] != 'kp') { echo ' <td align="center">' . "\n" diff --git a/libraries/engines/innodb.lib.php b/libraries/engines/innodb.lib.php index 87c8b8abcc..88cb10f689 100644 --- a/libraries/engines/innodb.lib.php +++ b/libraries/engines/innodb.lib.php @@ -189,7 +189,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine SHOW STATUS WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' OR Variable_name = \'Innodb_page_size\';'; - $status = PMA_DBI_fetch_result( $sql, 0, 1 ); + $status = PMA_DBI_fetch_result($sql, 0, 1); $output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n" . ' <caption class="tblHeaders">' . "\n" @@ -321,7 +321,7 @@ class PMA_StorageEngine_innodb extends PMA_StorageEngine */ function getPage($id) { - if ( ! array_key_exists( $id, $this->getInfoPages() ) ) { + if (! array_key_exists($id, $this->getInfoPages())) { return false; } diff --git a/libraries/export/htmlexcel.php b/libraries/export/htmlexcel.php index 71b212d28a..b380cd52e8 100644 --- a/libraries/export/htmlexcel.php +++ b/libraries/export/htmlexcel.php @@ -71,7 +71,7 @@ xmlns="http://www.w3.org/TR/REC-html40"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <meta http-equiv="Content-type" content="text/html;charset=' . ( isset($charset_of_file) ? $charset_of_file : $charset ) .'" /> + <meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : $charset) .'" /> <style id="Classeur1_16681_Styles"> </style> diff --git a/libraries/export/htmlword.php b/libraries/export/htmlword.php index 70ec09967b..94d0add9cb 100644 --- a/libraries/export/htmlword.php +++ b/libraries/export/htmlword.php @@ -64,7 +64,7 @@ xmlns="http://www.w3.org/TR/REC-html40"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <meta http-equiv="Content-type" content="text/html;charset=' . ( isset($charset_of_file) ? $charset_of_file : $charset ) .'" /> + <meta http-equiv="Content-type" content="text/html;charset=' . (isset($charset_of_file) ? $charset_of_file : $charset) .'" /> </head> <body>'); } @@ -324,10 +324,10 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $schema_insert .= '<td class="print">' . (isset($res_rel[$field_name]) ? htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') : '') . '</td>'; } if ($do_comments && $cfgRelation['commwork']) { - $schema_insert .= '<td class="print">' . ( isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>'; + $schema_insert .= '<td class="print">' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>'; } if ($do_mime && $cfgRelation['mimework']) { - $schema_insert .= '<td class="print">' . ( isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>'; + $schema_insert .= '<td class="print">' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>'; } $schema_insert .= '</tr>'; diff --git a/libraries/export/latex.php b/libraries/export/latex.php index 6c21e87694..4ea8188d6e 100644 --- a/libraries/export/latex.php +++ b/libraries/export/latex.php @@ -242,7 +242,8 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { $buffer = ''; // print each row for ($i = 0; $i < $columns_cnt; $i++) { - if ( isset($record[$columns[$i]]) && (!function_exists('is_null') || !is_null($record[$columns[$i]]))) { + if (isset($record[$columns[$i]]) + && (! function_exists('is_null') || !is_null($record[$columns[$i]]))) { $column_value = PMA_texEscape(stripslashes($record[$columns[$i]])); } else { $column_value = $GLOBALS['latex_null']; diff --git a/libraries/export/sql.php b/libraries/export/sql.php index 7fcc782b39..ffb6692128 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -127,7 +127,7 @@ $GLOBALS['comment_marker'] = '-- '; /** * Avoids undefined variables, use NULL so isset() returns false */ -if ( ! isset( $sql_backquotes ) ) { +if (! isset($sql_backquotes)) { $sql_backquotes = null; } @@ -348,7 +348,7 @@ function PMA_exportDBFooter($db) $procs_funcs .= PMA_DBI_get_procedure_or_function_def($db, 'FUNCTION', $function_name) . $crlf . $crlf; } } - if ( !empty($procs_funcs)) { + if (!empty($procs_funcs)) { $result = PMA_exportOutputHandler($procs_funcs); } } @@ -830,12 +830,12 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) } elseif ($fields_meta[$j]->numeric && $fields_meta[$j]->type != 'timestamp' && ! $fields_meta[$j]->blob) { $values[] = $row[$j]; - // a true BLOB + // a true BLOB // - mysqldump only generates hex data when the --hex-blob // option is used, for fields having the binary attribute // no hex is generated - // - a TEXT field returns type blob but a real blob - // returns also the 'binary' flag + // - a TEXT field returns type blob but a real blob + // returns also the 'binary' flag } elseif (stristr($field_flags[$j], 'BINARY') && $fields_meta[$j]->blob && isset($GLOBALS['sql_hex_for_blob'])) { diff --git a/libraries/export/xml.php b/libraries/export/xml.php index 009c17d828..9f3da10219 100644 --- a/libraries/export/xml.php +++ b/libraries/export/xml.php @@ -157,7 +157,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) { while ($record = PMA_DBI_fetch_row($result)) { $buffer = ' <' . $table . '>' . $crlf; for ($i = 0; $i < $columns_cnt; $i++) { - if ( isset($record[$i]) && !is_null($record[$i])) { + if (isset($record[$i]) && !is_null($record[$i])) { $buffer .= ' <' . $columns[$i] . '>' . htmlspecialchars($record[$i]) . '</' . $columns[$i] . '>' . $crlf; } diff --git a/libraries/export/yaml.php b/libraries/export/yaml.php index b33c78645e..e5850ae9fa 100644 --- a/libraries/export/yaml.php +++ b/libraries/export/yaml.php @@ -133,7 +133,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) $cnt++; $buffer = $cnt . ":$crlf"; for ($i = 0; $i < $columns_cnt; $i++) { - if ( isset($record[$i]) && !is_null($record[$i])) { + if (isset($record[$i]) && !is_null($record[$i])) { $buffer .= ' ' . $columns[$i] . ': ' . htmlspecialchars($record[$i]) . $crlf; } } diff --git a/libraries/grab_globals.lib.php b/libraries/grab_globals.lib.php index b4dbf39b21..ccd0ad172b 100644 --- a/libraries/grab_globals.lib.php +++ b/libraries/grab_globals.lib.php @@ -25,11 +25,11 @@ */ function PMA_gpc_extract($array, &$target, $sanitize = true) { - if ( ! is_array($array) ) { + if (! is_array($array)) { return false; } - if ( $sanitize ) { + if ($sanitize) { $valid_variables = preg_replace($GLOBALS['_import_blacklist'], '', array_keys($array)); $valid_variables = array_unique($valid_variables); @@ -37,16 +37,16 @@ function PMA_gpc_extract($array, &$target, $sanitize = true) $valid_variables = array_keys($array); } - foreach ( $valid_variables as $key ) { + foreach ($valid_variables as $key) { - if ( strlen($key) === 0 ) { + if (strlen($key) === 0) { continue; } - if ( is_array($array[$key]) ) { + if (is_array($array[$key])) { // there could be a variable coming from a cookie of // another application, with the same name as this array - unset( $target[$key] ); + unset($target[$key]); PMA_gpc_extract($array[$key], $target[$key], false); } else { diff --git a/libraries/header.inc.php b/libraries/header.inc.php index 20b9b2cb55..030ec13ed8 100644 --- a/libraries/header.inc.php +++ b/libraries/header.inc.php @@ -180,46 +180,46 @@ if (empty($GLOBALS['is_header_sent'])) { ) ); $item = '<a href="%1$s?%2$s" class="item">'; - if ( $GLOBALS['cfg']['NavigationBarIconic'] ) { + if ($GLOBALS['cfg']['NavigationBarIconic']) { $separator = ' <span class="separator"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'item_ltr.png" width="5" height="9" alt="-" /></span>' . "\n"; $item .= ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . '%5$s" width="16" height="16" alt="" /> ' . "\n"; } else { $separator = ' <span class="separator"> - </span>' . "\n"; } - if ( $GLOBALS['cfg']['NavigationBarIconic'] !== true ) { + if ($GLOBALS['cfg']['NavigationBarIconic'] !== true) { $item .= '%4$s: '; } $item .= '%3$s</a>' . "\n"; echo '<div id="serverinfo">' . "\n"; - printf( $item, + printf($item, $GLOBALS['cfg']['DefaultTabServer'], PMA_generate_common_url(), htmlspecialchars($server_info), $GLOBALS['strServer'], - 's_host.png' ); + 's_host.png'); if (strlen($GLOBALS['db'])) { echo $separator; - printf( $item, + printf($item, $GLOBALS['cfg']['DefaultTabDatabase'], PMA_generate_common_url($GLOBALS['db']), htmlspecialchars($GLOBALS['db']), $GLOBALS['strDatabase'], - 's_db.png' ); + 's_db.png'); if (strlen($GLOBALS['table'])) { require_once './libraries/tbl_info.inc.php'; echo $separator; - printf( $item, + printf($item, $GLOBALS['cfg']['DefaultTabTable'], PMA_generate_common_url($GLOBALS['db'], $GLOBALS['table']), htmlspecialchars($GLOBALS['table']), (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? $GLOBALS['strView'] : $GLOBALS['strTable']), - (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png' ); + (isset($GLOBALS['tbl_is_view']) && $GLOBALS['tbl_is_view'] ? 'b_views' : 's_tbl') . '.png'); /** * Displays table comment @@ -245,12 +245,12 @@ if (empty($GLOBALS['is_header_sent'])) { // Get additional information about tables for tooltip is done // in libraries/db_info.inc.php only once if ($cfgRelation['commwork']) { - $comment = PMA_getComments( $GLOBALS['db'] ); + $comment = PMA_getComments($GLOBALS['db']); /** * Displays table comment */ - if ( is_array( $comment ) ) { + if (is_array($comment)) { echo '<span class="table_comment"' .' id="span_table_comment">"' .htmlspecialchars(implode(' ', $comment)) diff --git a/libraries/header_printview.inc.php b/libraries/header_printview.inc.php index 0eb0ab3005..f3530ee32b 100644 --- a/libraries/header_printview.inc.php +++ b/libraries/header_printview.inc.php @@ -44,7 +44,7 @@ if ($text_dir == 'ltr') { <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" /> <title><?php echo $strSQLResult; ?> - phpMyAdmin <?php echo PMA_VERSION ?></title> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" /> -<link rel="stylesheet" type="text/css" href="phpmyadmin.css.php?<?php echo PMA_generate_common_url( '', '' ); ?>&js_frame=print&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" /> +<link rel="stylesheet" type="text/css" href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&js_frame=print&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" /> </style> </head> diff --git a/libraries/iconv_wrapper.lib.php b/libraries/iconv_wrapper.lib.php index 2e75eeb2d5..6104e82d47 100644 --- a/libraries/iconv_wrapper.lib.php +++ b/libraries/iconv_wrapper.lib.php @@ -56,7 +56,7 @@ function PMA_aix_iconv_wrapper($in_charset, $out_charset, $str) { $using_translit = (!($translit_search === FALSE)); // Extract "plain" output character set name (without any transliteration argument) - $out_charset_plain = ( $using_translit ? substr($out_charset, 0, $translit_search) : $out_charset ); + $out_charset_plain = ($using_translit ? substr($out_charset, 0, $translit_search) : $out_charset); // Transform name of input character set (if found) if (array_key_exists(strtolower($in_charset), $gnu_iconv_to_aix_iconv_codepage_map)) { @@ -70,7 +70,7 @@ function PMA_aix_iconv_wrapper($in_charset, $out_charset, $str) { // Add transliteration argument again (exactly as specified by user) if used // Build the output character set name that we will use - $out_charset = ( $using_translit ? $out_charset_plain . substr($out_charset, $translit_search) : $out_charset_plain ); + $out_charset = ($using_translit ? $out_charset_plain . substr($out_charset, $translit_search) : $out_charset_plain); // NOTE: Transliteration not supported; we will use the "plain" output character set name $out_charset = $out_charset_plain; diff --git a/libraries/import/docsql.php b/libraries/import/docsql.php index c12556ec28..fd669980fc 100644 --- a/libraries/import/docsql.php +++ b/libraries/import/docsql.php @@ -57,7 +57,7 @@ if ($data === TRUE && !$error && !$timeout_passed) { $qry = ' INSERT INTO ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . ' - ( db_name, table_name, column_name, ' . PMA_backquote('comment') . ' ) + (db_name, table_name, column_name, ' . PMA_backquote('comment') . ') VALUES ( \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\', \'' . PMA_sqlAddslashes(trim($tab)) . '\', @@ -70,7 +70,7 @@ if ($data === TRUE && !$error && !$timeout_passed) { $qry = ' INSERT INTO ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['relation']) . ' - ( master_db, master_table, master_field, foreign_db, foreign_table, foreign_field) + (master_db, master_table, master_field, foreign_db, foreign_table, foreign_field) VALUES ( \'' . PMA_sqlAddslashes($GLOBALS['db']) . '\', \'' . PMA_sqlAddslashes(trim($tab)) . '\', diff --git a/libraries/import/sql.php b/libraries/import/sql.php index 2ee1b66f9f..d286764c54 100644 --- a/libraries/import/sql.php +++ b/libraries/import/sql.php @@ -217,7 +217,7 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) { } } // Change delimiter, if redefined, and skip it (don't send to server!) - if ((substr($buffer, $i, 9) == "DELIMITER") && ($buffer[$i + 9] <= ' ') && ($i<$len-11) && (!(strpos($buffer,"\n",$i+11)===FALSE) )) { + if ((substr($buffer, $i, 9) == "DELIMITER") && ($buffer[$i + 9] <= ' ') && ($i<$len-11) && (!(strpos($buffer,"\n",$i+11)===FALSE))) { $new_line_pos = strpos($buffer, "\n", $i + 10); $sql_delimiter = substr($buffer, $i+10, $new_line_pos - $i -10); $i= $new_line_pos + 1; diff --git a/libraries/mult_submits.inc.php b/libraries/mult_submits.inc.php index 9b7b7f2790..71f79bc2c5 100644 --- a/libraries/mult_submits.inc.php +++ b/libraries/mult_submits.inc.php @@ -8,13 +8,12 @@ /** * Prepares the work and runs some other scripts if required */ -if (!empty($submit_mult) - && ($submit_mult != $strWithChecked) - && ( ( isset($selected_db) && !empty($selected_db) ) - || ( isset($selected_tbl) && !empty($selected_tbl) ) - || ( isset($selected_fld) && !empty($selected_fld) ) - || !empty($rows_to_delete) - )) { +if (! empty($submit_mult) + && $submit_mult != $strWithChecked + && (! empty($selected_db) + || ! empty($selected_tbl) + || ! empty($selected_fld) + || ! empty($rows_to_delete))) { define('PMA_SUBMIT_MULT', 1); if (isset($selected_db) && !empty($selected_db)) { $selected = $selected_db; @@ -125,7 +124,7 @@ if (!empty($submit_mult) /** * Displays the confirmation form if required */ -if ( !empty($submit_mult) && !empty($what)) { +if (!empty($submit_mult) && !empty($what)) { $js_to_run = 'functions.js'; unset($message); if (strlen($table)) { @@ -257,7 +256,7 @@ if ( !empty($submit_mult) && !empty($what)) { echo '<input type="hidden" name="disp_direction" value="' . $disp_direction . '" />' . "\n"; echo '<input type="hidden" name="repeat_cells" value="' . $repeat_cells . '" />' . "\n"; echo '<input type="hidden" name="dontlimitchars" value="' . $dontlimitchars . '" />' . "\n"; - echo '<input type="hidden" name="pos" value="' . ( isset( $pos ) ? $pos : 0 ) . '" />' . "\n"; + echo '<input type="hidden" name="pos" value="' . (isset($pos) ? $pos : 0) . '" />' . "\n"; echo '<input type="hidden" name="session_max_rows" value="' . $session_max_rows . '" />' . "\n"; } ?> @@ -375,7 +374,7 @@ elseif ($mult_btn == $strYes) { break; case 'primary_fld': - $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ( empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( ' : ', ') + $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . (empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( ' : ', ') . PMA_backquote(urldecode($selected[$i])) . (($i == $selected_cnt-1) ? ');' : ''); break; diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php index a390cb0b7e..510246fd73 100644 --- a/libraries/mysql_charsets.lib.php +++ b/libraries/mysql_charsets.lib.php @@ -19,7 +19,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ //$mysql_charsets_maxlen[$row['Charset']] = $row['Maxlen']; $mysql_charsets_descriptions[$row['Charset']] = $row['Description']; } - @PMA_DBI_free_result( $res ); + @PMA_DBI_free_result($res); $mysql_charsets_count = count($mysql_charsets); sort($mysql_charsets, SORT_STRING); @@ -42,8 +42,8 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ $mysql_collations_available[$row['Collation']] = TRUE; $mysql_charsets_available[$row['Charset']] = !empty($mysql_charsets_available[$row['Charset']]) || !empty($mysql_collations_available[$row['Collation']]); } - @PMA_DBI_free_result( $res ); - unset( $res, $row ); + @PMA_DBI_free_result($res); + unset($res, $row); $mysql_collations_count = count($mysql_collations_flat); sort($mysql_collations_flat, SORT_STRING); @@ -51,7 +51,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ sort($mysql_collations[$key], SORT_STRING); reset($mysql_collations[$key]); } - unset( $key, $value ); + unset($key, $value); define('PMA_CSDROPDOWN_COLLATION', 0); define('PMA_CSDROPDOWN_CHARSET', 1); @@ -114,24 +114,24 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ * @param string $db name of db * @return string collation of $db */ - function PMA_getDbCollation( $db ) { - if ( PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema' ) { + function PMA_getDbCollation($db) { + if (PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema') { // We don't have to check the collation of the virtual // information_schema database: We know it! return 'utf8_general_ci'; } - if ( PMA_MYSQL_INT_VERSION >= 50006 ) { + if (PMA_MYSQL_INT_VERSION >= 50006) { // Since MySQL 5.0.6, we don't have to parse SHOW CREATE DATABASE anymore. return PMA_DBI_fetch_value('SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = \'' . PMA_sqlAddSlashes($db) . '\' LIMIT 1;'); - } elseif ( PMA_MYSQL_INT_VERSION >= 40101 ) { + } elseif (PMA_MYSQL_INT_VERSION >= 40101) { // MySQL 4.1.0 does not support seperate charset settings // for databases. - PMA_DBI_select_db( $db ); + PMA_DBI_select_db($db); // the query does not work if this string is in double quotes // and MySQL is running in ANSI mode - $return = PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE \'collation_database\'', 0, 1 ); - if ( isset( $GLOBALS['db'] ) && $db !== $GLOBALS['db'] ) { - PMA_DBI_select_db( $GLOBALS['db'] ); + $return = PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'collation_database\'', 0, 1); + if (isset($GLOBALS['db']) && $db !== $GLOBALS['db']) { + PMA_DBI_select_db($GLOBALS['db']); } return $return; } @@ -139,7 +139,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ } } else { - function PMA_getDbCollation( $db ) { return PMA_getServerCollation(); } + function PMA_getDbCollation($db) { return PMA_getServerCollation(); } } /** @@ -150,7 +150,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ */ function PMA_getServerCollation() { return PMA_DBI_fetch_value( - 'SHOW VARIABLES LIKE \'collation_server\'', 0, 1 ); + 'SHOW VARIABLES LIKE \'collation_server\'', 0, 1); } /** @@ -164,7 +164,7 @@ function PMA_getServerCollation() { * @param string $collation MySQL collation string * @return string collation description */ -function PMA_getCollationDescr( $collation ) { +function PMA_getCollationDescr($collation) { static $collation_cache; if (!is_array($collation_cache)) { diff --git a/libraries/navigation_header.inc.php b/libraries/navigation_header.inc.php index f84920f3bb..360c489bd4 100644 --- a/libraries/navigation_header.inc.php +++ b/libraries/navigation_header.inc.php @@ -9,19 +9,19 @@ /** * */ -if ( empty( $query_url ) ) { - $db = ! isset( $db ) ? '' : $db; - $table = ! isset( $table ) ? '' : $table; - $query_url = PMA_generate_common_url( $db, $table ); +if (empty($query_url)) { + $db = ! isset($db) ? '' : $db; + $table = ! isset($table) ? '' : $table; + $query_url = PMA_generate_common_url($db, $table); } // display Logo, depending on $GLOBALS['cfg']['LeftDisplayLogo'] -if ( $GLOBALS['cfg']['LeftDisplayLogo'] ) { +if ($GLOBALS['cfg']['LeftDisplayLogo']) { $logo = 'phpMyAdmin'; - if ( @file_exists( $GLOBALS['pmaThemeImage'] . 'logo_left.png' ) ) { + if (@file_exists($GLOBALS['pmaThemeImage'] . 'logo_left.png')) { $logo = '<img src="' . $GLOBALS['pmaThemeImage'] . 'logo_left.png" ' .'alt="' . $logo . '" id="imgpmalogo" />'; - } elseif ( @file_exists( $GLOBALS['pmaThemeImage'] . 'pma_logo2.png' ) ) { + } elseif (@file_exists($GLOBALS['pmaThemeImage'] . 'pma_logo2.png')) { $logo = '<img src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo2.png" ' .'alt="' . $logo . '" id="imgpmalogo" />'; } @@ -43,27 +43,27 @@ if ( $GLOBALS['cfg']['LeftDisplayLogo'] ) { <?php echo '<a href="main.php?' . $query_url . '"' .' title="' . $strHome . '">' - .( $GLOBALS['cfg']['MainPageIconic'] + .($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_home.png" width="16" ' .' height="16" alt="' . $strHome . '" />' - : $strHome ) + : $strHome) .'</a>' . "\n"; // if we have chosen server - if ( $server != 0 ) { + if ($server != 0) { // Logout for advanced authentication - if ( $GLOBALS['cfg']['Server']['auth_type'] != 'config' ) { + if ($GLOBALS['cfg']['Server']['auth_type'] != 'config') { echo ($GLOBALS['cfg']['MainPageIconic'] ? '' : ' - '); echo '<a href="index.php?' . $query_url . '&old_usr=' .urlencode($PHP_AUTH_USER) . '" target="_parent"' .' title="' . $strLogout . '" >' - .( $GLOBALS['cfg']['MainPageIconic'] + .($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_loggoff.png" ' .' width="16" height="16" alt="' . $strLogout . '" />' - : $strLogout ) + : $strLogout) .'</a>' . "\n"; } // end if ($GLOBALS['cfg']['Server']['auth_type'] != 'config' - $anchor = 'querywindow.php?' . PMA_generate_common_url( $db, $table ); + $anchor = 'querywindow.php?' . PMA_generate_common_url($db, $table); if ($GLOBALS['cfg']['MainPageIconic']) { $query_frame_link_text = diff --git a/libraries/plugin_interface.lib.php b/libraries/plugin_interface.lib.php index c5aec14eab..6b53ee0a7e 100644 --- a/libraries/plugin_interface.lib.php +++ b/libraries/plugin_interface.lib.php @@ -124,7 +124,7 @@ function PMA_pluginGetDefault($section, $opt) */ function PMA_pluginIsActive($section, $opt, $val) { - if ( ! empty($GLOBALS['timeout_passed']) && isset($_REQUEST[$opt])) { + if (! empty($GLOBALS['timeout_passed']) && isset($_REQUEST[$opt])) { if ($_REQUEST[$opt] == $val) { return ' checked="checked"'; } @@ -213,8 +213,8 @@ function PMA_pluginGetOneOption($section, $plugin_name, $id, &$opt) $ret .= '<input type="text" name="' . $plugin_name . '_' . $opt['name'] . '"' . ' value="' . PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']) . '"' . ' id="text_' . $plugin_name . '_' . $opt['name'] . '"' - . (isset($opt['size']) ? ' size="' . $opt['size'] . '"' : '' ) - . (isset($opt['len']) ? ' maxlength="' . $opt['len'] . '"' : '' ) . ' />'; + . (isset($opt['size']) ? ' size="' . $opt['size'] . '"' : '') + . (isset($opt['len']) ? ' maxlength="' . $opt['len'] . '"' : '') . ' />'; $ret .= '</div>' . "\n"; } elseif ($opt['type'] == 'message_only') { $ret .= '<div class="formelementrow">' . "\n"; diff --git a/libraries/server_links.inc.php b/libraries/server_links.inc.php index 321a68e295..96ad5bb1fd 100644 --- a/libraries/server_links.inc.php +++ b/libraries/server_links.inc.php @@ -81,8 +81,8 @@ $tabs['import']['icon'] = 'b_import.png'; $tabs['import']['link'] = 'server_import.php'; $tabs['import']['text'] = $strImport; -echo PMA_getTabs( $tabs ); -unset( $tabs ); +echo PMA_getTabs($tabs); +unset($tabs); /** diff --git a/libraries/sql_query_form.lib.php b/libraries/sql_query_form.lib.php index 9941a48504..6f500253ca 100644 --- a/libraries/sql_query_form.lib.php +++ b/libraries/sql_query_form.lib.php @@ -151,7 +151,7 @@ function PMA_sqlQueryForm($query = true, $display_tab = false, $delimiter = ';') // Bookmark Support if ($display_tab === 'full' || $display_tab === 'history') { - if (! empty( $GLOBALS['cfg']['Bookmark']) + if (! empty($GLOBALS['cfg']['Bookmark']) && $GLOBALS['cfg']['Bookmark']['db'] && $GLOBALS['cfg']['Bookmark']['table']) { PMA_sqlQueryFormBookmark(); @@ -200,7 +200,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter // enable auto select text in textarea if ($GLOBALS['cfg']['TextareaAutoSelect']) { - $auto_sel = ' onfocus="selectContent( this, sql_box_locked, true )"'; + $auto_sel = ' onfocus="selectContent(this, sql_box_locked, true)"'; } else { $auto_sel = ''; } @@ -272,7 +272,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter str_replace('%d', PMA_backquote($db), str_replace('%t', PMA_backquote($table), str_replace('%f', - implode(', ', $field_names ), + implode(', ', $field_names), $GLOBALS['cfg']['DefaultQueryTable']))); unset($field_names); } @@ -310,11 +310,11 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter if (isset($field['Field']) && strlen($field['Field']) && isset($field['Comment'])) { echo ' title="' . htmlspecialchars($field['Comment']) . '"'; } - echo '>' . htmlspecialchars( $field['Field'] ) . '</option>' . "\n"; + echo '>' . htmlspecialchars($field['Field']) . '</option>' . "\n"; } echo '</select>' . "\n" .'<div id="tablefieldinsertbuttoncontainer">' . "\n"; - if ( $GLOBALS['cfg']['PropertiesIconic'] ) { + if ($GLOBALS['cfg']['PropertiesIconic']) { echo '<input type="button" name="insert" value="<<"' .' onclick="insertValueQuery()"' .' title="' . $GLOBALS['strInsert'] . '" />' . "\n"; @@ -414,7 +414,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter */ function PMA_sqlQueryFormBookmark() { - $bookmark_list = PMA_listBookmarks($GLOBALS['db'], $GLOBALS['cfg']['Bookmark'] ); + $bookmark_list = PMA_listBookmarks($GLOBALS['db'], $GLOBALS['cfg']['Bookmark']); if (! $bookmark_list || count($bookmark_list) < 1) { return; } @@ -540,9 +540,9 @@ function PMA_sqlQueryFormUpload(){ echo '<fieldset id="" class="tblFooters">'; - if ( PMA_MYSQL_INT_VERSION < 40100 + if (PMA_MYSQL_INT_VERSION < 40100 && $GLOBALS['cfg']['AllowAnywhereRecoding'] - && $GLOBALS['allow_recoding'] ) { + && $GLOBALS['allow_recoding']) { echo $GLOBALS['strCharsetOfFile'] . "\n" . '<select name="charset_of_file" size="1">' . "\n"; foreach ($GLOBALS['cfg']['AvailableCharsets'] as $temp_charset) { @@ -563,7 +563,7 @@ function PMA_sqlQueryFormUpload(){ echo '<div class="clearfloat"></div>' . "\n"; echo '</fieldset>'; - foreach ( $errors as $error => $message ) { + foreach ($errors as $error => $message) { echo '<div>' . $error . '</div>'; echo '<div>' . $message . '</div>'; } diff --git a/libraries/sqlparser.data.php b/libraries/sqlparser.data.php index 4d36b3fd19..cb2f8aa435 100644 --- a/libraries/sqlparser.data.php +++ b/libraries/sqlparser.data.php @@ -1253,8 +1253,8 @@ $PMA_SQPdata_column_type_cnt = 54; /* * check counts -foreach ( $GLOBALS as $n => $a ) { - echo is_array( $a ) ? $n . ': ' . count( $a ) . '<br />' : ''; +foreach ($GLOBALS as $n => $a) { + echo is_array($a) ? $n . ': ' . count($a) . '<br />' : ''; } */ ?> diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 2c38b44f9a..30041324b4 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -34,7 +34,7 @@ /** * Minimum inclusion? (i.e. for the stylesheet builder) */ -if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { +if (! defined('PMA_MINIMUM_COMMON')) { /** * Include the string library as we use it heavily */ @@ -588,7 +588,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { if (($first == ',') || ($first == ';') || ($first == '.') || ($first == '*')) { $count2 = $count1 + 1; $punct_data = $first; - } elseif (($last2 == '/*') || (($last2 == '--') && ($count2 == $len || PMA_substr($sql, $count2, 1) <= ' ') )) { + } elseif (($last2 == '/*') || (($last2 == '--') && ($count2 == $len || PMA_substr($sql, $count2, 1) <= ' '))) { $count2 -= 2; $punct_data = PMA_substr($sql, $count1, $count2 - $count1); } elseif (($last == '-') || ($last == '+') || ($last == '!')) { @@ -829,7 +829,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { // so we track wether we are in the EXTRACT() $in_extract = FALSE; - // for GROUP_CONCAT( ... ) + // for GROUP_CONCAT(...) $in_group_concat = FALSE; /* Description of analyzer results by lem9 @@ -1078,7 +1078,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { $previous_was_identifier = FALSE; $current_select_expr = -1; $seen_end_of_table_ref = FALSE; - } // end if ( data == SELECT) + } // end if (data == SELECT) if ($upper_data =='FROM' && !$in_extract) { $current_table_ref = -1; @@ -1148,7 +1148,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { } // end if ($save_table_ref &&!$seen_end_of_table_ref) } // end if (!$seen_from) } // end if (querytype SELECT) - } // end if ( quote_backtick or double quote or alpha_identifier) + } // end if (quote_backtick or double quote or alpha_identifier) // =================================== if ($arr[$i]['type'] == 'punct_qualifier') { @@ -1172,9 +1172,8 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { // the "*" is not saved if (isset($chain) && !$seen_end_of_table_ref - && ( (!$seen_from - && $arr[$i]['type'] == 'punct_listsep') - || ($arr[$i]['type'] == 'alpha_reservedWord' && $upper_data == 'FROM')) ) { + && ((!$seen_from && $arr[$i]['type'] == 'punct_listsep') + || ($arr[$i]['type'] == 'alpha_reservedWord' && $upper_data == 'FROM'))) { $size_chain = count($chain); $current_select_expr++; $subresult['select_expr'][$current_select_expr] = array( @@ -1241,7 +1240,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { && ($arr[$i]['type'] == 'punct_listsep' || ($arr[$i]['type'] == 'alpha_reservedWord' && $upper_data!="AS") || $seen_end_of_table_ref - || $i==$size-1 )) { + || $i==$size-1)) { $size_chain = count($chain); $current_table_ref++; @@ -1762,7 +1761,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { // (we got a bug report about not being able to use // 'no' as an identifier) || ($arr[$i+2]['type'] == 'alpha_identifier' - && strtoupper($arr[$i+2]['data'])=='NO') ) + && strtoupper($arr[$i+2]['data'])=='NO')) ) { $third_upper_data = strtoupper($arr[$i+2]['data']); if ($third_upper_data == 'CASCADE' @@ -2247,7 +2246,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { // the alpha_identifier exception is there to // catch cases like // GRANT SELECT ON mydb.mytable TO myuser@localhost - // (else, we get mydb.mytableTO ) + // (else, we get mydb.mytableTO) // // the quote_single exception is there to // catch cases like @@ -2427,7 +2426,7 @@ function PMA_SQP_buildCssData() return $css_string; } // end of the "PMA_SQP_buildCssData()" function -if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { +if (! defined('PMA_MINIMUM_COMMON')) { /** * Gets SQL queries with no format * diff --git a/libraries/sqlvalidator.class.php b/libraries/sqlvalidator.class.php index 95ccd498a5..8f46b07373 100644 --- a/libraries/sqlvalidator.class.php +++ b/libraries/sqlvalidator.class.php @@ -100,7 +100,7 @@ if (!function_exists('class_exists') || !class_exists('SOAP_Client')) { $connection_technology, $connection_technology_version, $interactive) { - $use_array = array( "a_userName" => $username, "a_password" => $password, "a_callingProgram" => $calling_program, "a_callingProgramVersion" => $calling_program_version, "a_targetDbms" => $target_dbms, "a_targetDbmsVersion" => $target_dbms_version, "a_connectionTechnology" => $connection_technology, "a_connectionTechnologyVersion" => $connection_technology_version, "a_interactive" => $interactive); + $use_array = array("a_userName" => $username, "a_password" => $password, "a_callingProgram" => $calling_program, "a_callingProgramVersion" => $calling_program_version, "a_targetDbms" => $target_dbms, "a_targetDbmsVersion" => $target_dbms_version, "a_connectionTechnology" => $connection_technology, "a_connectionTechnologyVersion" => $connection_technology_version, "a_interactive" => $interactive); $ret = $obj->call("openSession", $use_array); // This is the old version that needed the overload extension diff --git a/libraries/storage_engines.lib.php b/libraries/storage_engines.lib.php index 6471e6a1a9..201960b52f 100644 --- a/libraries/storage_engines.lib.php +++ b/libraries/storage_engines.lib.php @@ -82,7 +82,7 @@ function PMA_generateEnginesDropdown($name = 'engine', $id = null, $offerUnavailableEngines = false, $selected = null, $indent = 0) { $selected = strtolower($selected); - $spaces = str_repeat( ' ', $indent ); + $spaces = str_repeat(' ', $indent); $output = $spaces . '<select name="' . $name . '"' . (empty($id) ? '' : ' id="' . $id . '"') . '>' . "\n"; diff --git a/libraries/tbl_common.php b/libraries/tbl_common.php index 1c259a6a0f..75dab272a5 100644 --- a/libraries/tbl_common.php +++ b/libraries/tbl_common.php @@ -14,7 +14,7 @@ require_once './libraries/bookmark.lib.php'; // Check parameters PMA_checkParameters(array('db', 'table')); -if ( PMA_MYSQL_INT_VERSION >= 50002 && $db === 'information_schema' ) { +if (PMA_MYSQL_INT_VERSION >= 50002 && $db === 'information_schema') { $db_is_information_schema = true; } else { $db_is_information_schema = false; @@ -32,8 +32,8 @@ $url_params['table'] = $table; /** * Defines the urls to return to in case of error in a sql statement */ -$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url( array( 'db' => $db, ) ); -$err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url( $url_params ); +$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url(array('db' => $db,)); +$err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params); /** diff --git a/libraries/tbl_indexes.lib.php b/libraries/tbl_indexes.lib.php index 62ee73d9ef..ee59d8370e 100644 --- a/libraries/tbl_indexes.lib.php +++ b/libraries/tbl_indexes.lib.php @@ -145,7 +145,7 @@ function PMA_extract_indexes(&$ret_keys, &$indexes, &$indexes_info, &$indexes_da $prev_index = ''; foreach ($ret_keys as $row) { - if ($row['Key_name'] != $prev_index ){ + if ($row['Key_name'] != $prev_index){ $indexes[] = $row['Key_name']; $prev_index = $row['Key_name']; } @@ -198,7 +198,7 @@ function PMA_show_indexes($table, &$indexes, &$indexes_info, &$indexes_data, if ($display_html) { $row_span = ' rowspan="' . count($indexes_info[$index_name]['Sequences']) . '" '; - echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n"; + echo ' <tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n"; echo ' <th ' . $row_span . '>' . "\n" . ' ' . htmlspecialchars($index_name) . "\n" . ' </th>' . "\n"; @@ -267,11 +267,11 @@ function PMA_show_indexes($table, &$indexes, &$indexes_info, &$indexes_data, if ($display_html) { if ($row_no > 0) { - echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n"; + echo ' <tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n"; } - if ( isset($indexes_data[$index_name][$seq_index]['Sub_part']) - && strlen($indexes_data[$index_name][$seq_index]['Sub_part']) ) { + if (isset($indexes_data[$index_name][$seq_index]['Sub_part']) + && strlen($indexes_data[$index_name][$seq_index]['Sub_part'])) { echo ' <td>' . $col_name . '</td>' . "\n"; echo ' <td align="right">' . "\n" . ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n" diff --git a/libraries/tbl_info.inc.php b/libraries/tbl_info.inc.php index cda254ae3a..670b1a5d73 100644 --- a/libraries/tbl_info.inc.php +++ b/libraries/tbl_info.inc.php @@ -51,15 +51,15 @@ $table_info_result = PMA_DBI_query( if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) { $showtable = PMA_DBI_fetch_assoc($table_info_result); PMA_DBI_free_result($table_info_result); - unset( $table_info_result ); + unset($table_info_result); if (!isset($showtable['Type']) && isset($showtable['Engine'])) { $showtable['Type'] =& $showtable['Engine']; } // MySQL < 5.0.13 returns "view", >= 5.0.13 returns "VIEW" - if ( PMA_MYSQL_INT_VERSION >= 50000 && !isset($showtable['Type']) - && isset($showtable['Comment']) - && strtoupper($showtable['Comment']) == 'VIEW' ) { + if (PMA_MYSQL_INT_VERSION >= 50000 && !isset($showtable['Type']) + && isset($showtable['Comment']) + && strtoupper($showtable['Comment']) == 'VIEW') { $tbl_is_view = true; $tbl_type = $GLOBALS['strView']; $show_comment = null; @@ -82,9 +82,9 @@ if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) { ? '' : $showtable['Collation']; - if ( null === $showtable['Rows'] ) { - $showtable['Rows'] = PMA_Table::countRecords( $GLOBALS['db'], - $showtable['Name'], true, true ); + if (null === $showtable['Rows']) { + $showtable['Rows'] = PMA_Table::countRecords($GLOBALS['db'], + $showtable['Name'], true, true); } $table_info_num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0; $auto_increment = isset($showtable['Auto_increment']) @@ -98,14 +98,14 @@ if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) { // export create options by its name as variables into gloabel namespace // f.e. pack_keys=1 becomes available as $pack_keys with value of '1' unset($pack_keys); - foreach ( $create_options as $each_create_option ) { + foreach ($create_options as $each_create_option) { $each_create_option = explode('=', $each_create_option); - if ( isset( $each_create_option[1] ) ) { + if (isset($each_create_option[1])) { $$each_create_option[0] = $each_create_option[1]; } } // we need explicit DEFAULT value here (different from '0') $pack_keys = (!isset($pack_keys) || strlen($pack_keys) == 0) ? 'DEFAULT' : $pack_keys; - unset( $create_options, $each_create_option ); + unset($create_options, $each_create_option); } // end if ?> diff --git a/libraries/tbl_links.inc.php b/libraries/tbl_links.inc.php index 3691b6046d..3300078342 100644 --- a/libraries/tbl_links.inc.php +++ b/libraries/tbl_links.inc.php @@ -31,8 +31,8 @@ $url_params['table'] = $table; /** * Defines the urls to return to in case of error in a sql statement */ -$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url( array( 'db' => $db, ) ); -$err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url( $url_params ); +$err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url(array('db' => $db,)); +$err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params); /** * Displays headers @@ -62,7 +62,7 @@ $tabs['search']['icon'] = 'b_search.png'; $tabs['search']['text'] = $strSearch; $tabs['search']['link'] = 'tbl_select.php'; -if ( ! (isset($db_is_information_schema) && $db_is_information_schema) ) { +if (! (isset($db_is_information_schema) && $db_is_information_schema)) { $tabs['insert']['icon'] = 'b_insrow.png'; $tabs['insert']['link'] = 'tbl_change.php'; $tabs['insert']['text'] = $strInsert; @@ -77,7 +77,7 @@ $tabs['export']['text'] = $strExport; * Don't display "Import", "Operations" and "Empty" * for views and information_schema */ -if ( ! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema )) { +if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) { $tabs['import']['icon'] = 'b_tblimport.png'; $tabs['import']['link'] = 'tbl_import.php'; $tabs['import']['text'] = $strImport; @@ -105,7 +105,7 @@ if ( ! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information /** * no drop in information_schema */ -if ( ! (isset($db_is_information_schema) && $db_is_information_schema) ) { +if (! (isset($db_is_information_schema) && $db_is_information_schema)) { $tabs['drop']['icon'] = 'b_deltbl.png'; $tabs['drop']['link'] = 'sql.php'; $tabs['drop']['text'] = $strDrop; @@ -125,8 +125,8 @@ if ($table_info_num_rows == 0 && !$tbl_is_view) { $tabs['search']['warning'] = $strTableIsEmpty; } -echo PMA_getTabs( $tabs ); -unset( $tabs ); +echo PMA_getTabs($tabs); +unset($tabs); /** * Displays a message diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index c4807192c1..eeea295f74 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -179,7 +179,7 @@ if (isset($field_fulltext) && is_array($field_fulltext)) { } } -for ( $i = 0 ; $i <= $num_fields; $i++ ) { +for ($i = 0 ; $i <= $num_fields; $i++) { $submit_null = FALSE; if (isset($regenerate) && $regenerate == TRUE) { // An error happened with previous inputs, so we will restore the data @@ -377,7 +377,7 @@ for ( $i = 0 ; $i <= $num_fields; $i++ ) { $attribute = 'ON UPDATE CURRENT_TIMESTAMP'; } if ((isset($row['Field']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp'])) - || (isset($submit_default_current_timestamp) && $submit_default_current_timestamp) ) { + || (isset($submit_default_current_timestamp) && $submit_default_current_timestamp)) { $default_current_timestamp = TRUE; } else { $default_current_timestamp = FALSE; @@ -559,26 +559,26 @@ for ( $i = 0 ; $i <= $num_fields; $i++ ) { } } // end for -if ( is_array( $content_cells ) && is_array( $header_cells ) ) { +if (is_array($content_cells) && is_array($header_cells)) { // last row is for javascript insert - $empty_row = array_pop( $content_cells ); + $empty_row = array_pop($content_cells); echo '<table id="table_columns">'; - if ( $display_type == 'horizontal' ) { + if ($display_type == 'horizontal') { ?> <tr> - <?php foreach ( $header_cells as $header_val ) { ?> + <?php foreach ($header_cells as $header_val) { ?> <th><?php echo $header_val; ?></th> <?php } ?> </tr> <?php $odd_row = true; - foreach ( $content_cells as $content_row ) { - echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . ' noclick">'; + foreach ($content_cells as $content_row) { + echo '<tr class="' . ($odd_row ? 'odd' : 'even') . ' noclick">'; $odd_row = ! $odd_row; - if ( is_array( $content_row ) ) { + if (is_array($content_row)) { foreach ($content_row as $content_row_val) { ?> <td align="center"><?php echo $content_row_val; ?></td> @@ -590,14 +590,14 @@ if ( is_array( $content_cells ) && is_array( $header_cells ) ) { } else { $i = 0; $odd_row = true; - foreach ( $header_cells as $header_val ) { - echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . ' noclick">'; + foreach ($header_cells as $header_val) { + echo '<tr class="' . ($odd_row ? 'odd' : 'even') . ' noclick">'; $odd_row = ! $odd_row; ?> <th><?php echo $header_val; ?></th> <?php - foreach ( $content_cells as $content_cell ) { - if ( isset( $content_cell[$i] ) && $content_cell[$i] != '' ) { + foreach ($content_cells as $content_cell) { + if (isset($content_cell[$i]) && $content_cell[$i] != '') { ?> <td><?php echo $content_cell[$i]; ?></td> <?php @@ -617,9 +617,9 @@ if ( is_array( $content_cells ) && is_array( $header_cells ) ) { * needs to be finished * * -if ( $display_type == 'horizontal' ) { +if ($display_type == 'horizontal') { $new_field = ''; - foreach ( $empty_row as $content_row_val ) { + foreach ($empty_row as $content_row_val) { $new_field .= '<td align="center">' . $content_row_val . '</td>'; } ?> @@ -630,10 +630,10 @@ var odd_row = <?php echo $odd_row; ?>; function addField() { var new_fields = document.getElementById('added_fields').value; var new_field_container = document.getElementById('table_columns'); - var new_field = '<?php echo preg_replace( '�\s+�', ' ', preg_replace( '�\'�', '\\\'', $new_field ) ); ?>'; + var new_field = '<?php echo preg_replace('�\s+�', ' ', preg_replace('�\'�', '\\\'', $new_field)); ?>'; var i = 0; - for ( i = 0; i < new_fields; i++ ) { - if ( odd_row ) { + for (i = 0; i < new_fields; i++) { + if (odd_row) { new_field_container.innerHTML += '<tr class="odd">' + new_field + '</tr>'; } else { new_field_container.innerHTML += '<tr class="even">' + new_field + '</tr>'; @@ -658,7 +658,7 @@ if ($action == 'tbl_create.php') { <th><?php echo $strStorageEngine; ?>: <?php echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?> </th> <?php - if ( PMA_MYSQL_INT_VERSION >= 40100 ) { + if (PMA_MYSQL_INT_VERSION >= 40100) { echo ' <td width="25"> </td>' . "\n" . ' <th>' . $strCollation . ': </th>' . "\n"; } @@ -673,7 +673,7 @@ if ($action == 'tbl_create.php') { <?php echo PMA_generateEnginesDropdown('tbl_type', null, FALSE, (isset($GLOBALS['tbl_type']) ? $GLOBALS['tbl_type'] : null), 3); ?> </td> <?php - if ( PMA_MYSQL_INT_VERSION >= 40100 ) { + if (PMA_MYSQL_INT_VERSION >= 40100) { echo ' <td width="25"> </td>' . "\n" . ' <td>' . "\n" . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', null, (isset($tbl_collation) ? $tbl_collation : null), FALSE, 3) @@ -691,10 +691,10 @@ if ($action == 'tbl_create.php') { <input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" onclick="return checkTableEditForm(this.form, <?php echo $num_fields; ?>)" /> <?php if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') { ?> <?php echo $GLOBALS['strOr']; ?> - <?php echo sprintf( $strAddFields, '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />' ); ?> + <?php echo sprintf($strAddFields, '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?> <input type="submit" name="submit_num_fields" value="<?php echo $GLOBALS['strGo']; ?>" -<?php /* onclick="if ( addField() ) return false;" */ ?> +<?php /* onclick="if (addField()) return false;" */ ?> onclick="return checkFormElementInRange(this.form, 'added_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']); ?>', 1)" /> <?php } ?> @@ -709,10 +709,10 @@ if ($action == 'tbl_create.php') { if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { echo '<p> <a name="footnoote_mime"><sup>3</sup></a> ' . $strMIME_transformation_options_note . '</p>'; echo '<p> '; - printf( $strMIME_transformation_note, + printf($strMIME_transformation_note, '<a href="transformation_overview.php?' . PMA_generate_common_url($db, $table) . '" target="_blank">', - '</a>' ); + '</a>'); echo '</p>'; } ?> diff --git a/libraries/zip.lib.php b/libraries/zip.lib.php index eb62a91207..2d377cc081 100644 --- a/libraries/zip.lib.php +++ b/libraries/zip.lib.php @@ -145,14 +145,14 @@ class zipfile $cdrec .= pack('V', $crc); // crc32 $cdrec .= pack('V', $c_len); // compressed filesize $cdrec .= pack('V', $unc_len); // uncompressed filesize - $cdrec .= pack('v', strlen($name) ); // length of filename - $cdrec .= pack('v', 0 ); // extra field length - $cdrec .= pack('v', 0 ); // file comment length - $cdrec .= pack('v', 0 ); // disk number start - $cdrec .= pack('v', 0 ); // internal file attributes - $cdrec .= pack('V', 32 ); // external file attributes - 'archive' bit set - - $cdrec .= pack('V', $this -> old_offset ); // relative offset of local header + $cdrec .= pack('v', strlen($name)); // length of filename + $cdrec .= pack('v', 0); // extra field length + $cdrec .= pack('v', 0); // file comment length + $cdrec .= pack('v', 0); // disk number start + $cdrec .= pack('v', 0); // internal file attributes + $cdrec .= pack('V', 32); // external file attributes - 'archive' bit set + + $cdrec .= pack('V', $this -> old_offset); // relative offset of local header $this -> old_offset += strlen($fr); $cdrec .= $name; diff --git a/pdf_pages.php b/pdf_pages.php index 70394a361d..4deef20d0a 100644 --- a/pdf_pages.php +++ b/pdf_pages.php @@ -356,7 +356,7 @@ foreach ($array_sh_page AS $key => $temp_sh_page) { $reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n"; $local_query = 'SHOW FIELDS FROM ' - . PMA_backquote($temp_sh_page['table_name'] ) + . PMA_backquote($temp_sh_page['table_name']) . ' FROM ' . PMA_backquote($db); $fields_rs = PMA_DBI_query($local_query); unset($local_query); diff --git a/phpinfo.php b/phpinfo.php index 7ce16b5472..56a4c9cdae 100644 --- a/phpinfo.php +++ b/phpinfo.php @@ -8,14 +8,14 @@ /** * Gets core libraries and defines some variables */ -define( 'PMA_MINIMUM_COMMON', true ); +define('PMA_MINIMUM_COMMON', true); require_once './libraries/common.inc.php'; /** * Displays PHP information */ -if ( $GLOBALS['cfg']['ShowPhpInfo'] ) { +if ($GLOBALS['cfg']['ShowPhpInfo']) { phpinfo(); } ?> diff --git a/phpmyadmin.css.php b/phpmyadmin.css.php index c47ba856e3..543ad5664e 100644 --- a/phpmyadmin.css.php +++ b/phpmyadmin.css.php @@ -15,7 +15,7 @@ require_once './libraries/sqlparser.lib.php'; // MSIE 6 (at least some unpatched versions) has problems loading CSS // when zlib_compression is on if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER == '6' - && (ini_get('zlib.output_compression')) ) { + && (ini_get('zlib.output_compression'))) { ini_set('zlib.output_compression', 'Off'); } diff --git a/pmd_common.php b/pmd_common.php index 4ba84212ac..23f2855123 100644 --- a/pmd_common.php +++ b/pmd_common.php @@ -131,7 +131,7 @@ function get_script_contr() while ($val = @PMA_DBI_fetch_row($alltab_rs)) { $row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'internal'); //echo "<br> internal ".$GLOBALS['db']." - ".$val[0]." - "; - //print_r($row ); + //print_r($row); if ($row !== false) { foreach ($row as $field => $value) { $con['C_NAME'][$i] = ''; @@ -144,7 +144,7 @@ function get_script_contr() } $row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'innodb'); //echo "<br> INNO "; - //print_r($row ); + //print_r($row); if ($row !== false) { foreach ($row as $field => $value) { $con['C_NAME'][$i] = ''; diff --git a/pmd_general.php b/pmd_general.php index dce1d96723..4ebc29d030 100644 --- a/pmd_general.php +++ b/pmd_general.php @@ -44,7 +44,7 @@ echo ' var strLang = Array(); strLang["strModifications"] = "' . PMA_escapeJsString($strModifications) . '"; strLang["strRelationDeleted"] = "' . PMA_escapeJsString($strRelationDeleted) . '"; - strLang["strInnoDBRelationAdded"] = "' . PMA_escapeJsString($strInnoDBRelationAdded ). '"; + strLang["strInnoDBRelationAdded"] = "' . PMA_escapeJsString($strInnoDBRelationAdded). '"; strLang["strGeneralRelationFeat:strDisabled"] = "' . PMA_escapeJsString($strGeneralRelationFeat . ' : ' . $strDisabled) . '"; strLang["strInternalRelationAdded"] = "' . PMA_escapeJsString($strInternalRelationAdded) . '"; strLang["strErrorRelationAdded"] = "' . PMA_escapeJsString($strErrorRelationAdded) . '"; diff --git a/pmd_pdf.php b/pmd_pdf.php index ca9f6e120d..20b9464433 100644 --- a/pmd_pdf.php +++ b/pmd_pdf.php @@ -10,7 +10,7 @@ * */ include_once 'pmd_common.php'; -if ( ! isset($scale)) { +if (! isset($scale)) { $no_die_save_pos = 1; include_once 'pmd_save_pos.php'; } diff --git a/pmd_relation_new.php b/pmd_relation_new.php index 6ec0b6ea5f..2f2cf96f9a 100644 --- a/pmd_relation_new.php +++ b/pmd_relation_new.php @@ -82,7 +82,7 @@ if ($type_T1 == 'INNODB' and $type_T2 == 'INNODB') { . '\'' . PMA_sqlAddslashes($T1) . '\',' . '\'' . PMA_sqlAddslashes($F1) . '\')'; - if (PMA_query_as_cu( $q , false, PMA_DBI_QUERY_STORE)) { + if (PMA_query_as_cu($q , false, PMA_DBI_QUERY_STORE)) { PMD_return(1, 'strInternalRelationAdded'); } else { PMD_return(0, 'strErrorRelationAdded'); diff --git a/pmd_save_pos.php b/pmd_save_pos.php index 649bcf30d6..e0b312e89f 100644 --- a/pmd_save_pos.php +++ b/pmd_save_pos.php @@ -22,7 +22,7 @@ while ($tab_name = @PMA_DBI_fetch_row($alltab_rs)) { } } -if ( ! $seen_pmd_table) { +if (! $seen_pmd_table) { PMD_err_sav(); } diff --git a/scripts/setup.php b/scripts/setup.php index 8fa45e52df..9b8590ed63 100644 --- a/scripts/setup.php +++ b/scripts/setup.php @@ -14,7 +14,7 @@ */ // Grab phpMyAdmin version and PMA_dl function -define( 'PMA_MINIMUM_COMMON', TRUE ); +define('PMA_MINIMUM_COMMON', TRUE); chdir('..'); require_once './libraries/common.inc.php'; @@ -54,7 +54,7 @@ if ($eoltype == 'dos') { $crlf = "\n"; } -if (isset($_POST['configuration']) && $action != 'clear' ) { +if (isset($_POST['configuration']) && $action != 'clear') { // Grab previous configuration, if it should not be cleared $configuration = unserialize($_POST['configuration']); } else { @@ -1229,17 +1229,17 @@ function get_server_selection($cfg) { * @return mixed FALSE on failure, new config array on success */ function load_config($config_file) { - if ( file_exists( $config_file ) ) { + if (file_exists($config_file)) { $success_apply_user_config = FALSE; - $old_error_reporting = error_reporting( 0 ); - if ( function_exists( 'file_get_contents' ) ) { + $old_error_reporting = error_reporting(0); + if (function_exists('file_get_contents')) { $success_apply_user_config = eval('?>' . trim(file_get_contents($config_file))); } else { $success_apply_user_config = eval('?>' . trim(implode("\n", file($config_file)))); } - error_reporting( $old_error_reporting ); - unset( $old_error_reporting ); + error_reporting($old_error_reporting); + unset($old_error_reporting); if ($success_apply_user_config === FALSE) { message('error', 'Error while parsing configuration file!'); } elseif (!isset($cfg) || count($cfg) == 0) { @@ -1360,7 +1360,7 @@ switch ($action) { message('error', 'Empty signon URL while using signon authentication method!'); $err = TRUE; } - if ( isset($new_server['pmadb']) && strlen($new_server['pmadb'])) { + if (isset($new_server['pmadb']) && strlen($new_server['pmadb'])) { // Just use defaults, should be okay for most users $pmadb = array(); $pmadb['bookmarktable'] = 'pma_bookmark'; @@ -1879,7 +1879,7 @@ switch ($action) { break; } - $version_local = version_to_int( $PMA_Config_Setup->get('PMA_VERSION') ); + $version_local = version_to_int($PMA_Config_Setup->get('PMA_VERSION')); if ($version_local === FALSE) { message('error', 'Unparsable version string.'); break; @@ -1907,7 +1907,7 @@ switch ($action) { case '': message('notice', 'You want to configure phpMyAdmin using web interface. Please note that this only allows basic setup, please read <a href="../Documentation.html#config">documentation</a> to see full description of all configuration directives.', 'Welcome'); - if ( $PMA_Config_Setup->get( 'PMA_PHP_INT_VERSION' ) < 40100) { + if ($PMA_Config_Setup->get('PMA_PHP_INT_VERSION') < 40100) { message('warning', 'Please upgrade to PHP 4.1.0, it is required for phpMyAdmin.', 'Too old PHP'); } @@ -1994,9 +1994,9 @@ echo get_action('load', 'Load', '', !$fail_dir); echo get_action('clear', 'Clear'); echo get_action('seteol', 'Change end of line', '<select name="neweol">' . - '<option value="unix" ' . ( $eoltype == 'unix' ? ' selected="selected"' : '' ) . '>UNIX/Linux (\\n)</option>' . - '<option value="dos" ' . ( $eoltype == 'dos' ? ' selected="selected"' : '' ) . '>DOS/Windows (\\r\\n)</option>' . - '<option value="mac" ' . ( $eoltype == 'mac' ? ' selected="selected"' : '' ) . '>Macintosh (\\r)</option>' . ' + '<option value="unix" ' . ($eoltype == 'unix' ? ' selected="selected"' : '') . '>UNIX/Linux (\\n)</option>' . + '<option value="dos" ' . ($eoltype == 'dos' ? ' selected="selected"' : '') . '>DOS/Windows (\\r\\n)</option>' . + '<option value="mac" ' . ($eoltype == 'mac' ? ' selected="selected"' : '') . '>Macintosh (\\r)</option>' . ' </select>'); echo '</fieldset>' . "\n\n"; diff --git a/server_binlog.php b/server_binlog.php index 413f26a587..7ba706f5d3 100644 --- a/server_binlog.php +++ b/server_binlog.php @@ -106,7 +106,7 @@ if (empty($_REQUEST['dontlimitchars'])) { * Displays the sub-page heading */ echo '<h2>' . "\n" - . ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '' ) + . ($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $pmaThemeImage . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="" />' : '') . ' ' . $GLOBALS['strBinaryLog'] . "\n" . '</h2>' . "\n"; diff --git a/server_collations.php b/server_collations.php index cea97a2a19..f815d6ac3c 100644 --- a/server_collations.php +++ b/server_collations.php @@ -8,8 +8,8 @@ /** * requirements */ -if ( ! defined( 'PMA_NO_VARIABLES_IMPORT' ) ) { - define( 'PMA_NO_VARIABLES_IMPORT', true ); +if (! defined('PMA_NO_VARIABLES_IMPORT')) { + define('PMA_NO_VARIABLES_IMPORT', true); } require_once './libraries/common.inc.php'; @@ -85,7 +85,7 @@ foreach ($mysql_charsets as $current_charset) { foreach ($mysql_collations[$current_charset] as $current_collation) { $i++; echo '<tr class="' - . ( $odd_row ? 'odd' : 'even' ) + . ($odd_row ? 'odd' : 'even') . ($mysql_default_collations[$current_charset] == $current_collation ? ' marked' : '') diff --git a/server_databases.php b/server_databases.php index b35228eed0..8f8ba38678 100644 --- a/server_databases.php +++ b/server_databases.php @@ -75,11 +75,11 @@ require './libraries/server_links.inc.php'; * Displays the sub-page heading */ echo '<h2>' . "\n" - . ( $GLOBALS['cfg']['MainPageIconic'] + . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_db.png" width="16"' .' height="16" alt="" />' - : '' ) - . ( $dbstats ? $strDatabasesStats : $strDatabases ) . "\n" + : '') + . ($dbstats ? $strDatabasesStats : $strDatabases) . "\n" .'</h2>' . "\n"; /** @@ -224,9 +224,9 @@ if ($databases_count > 0) { . ($sort_by == 'SCHEMA_NAME' ? ' <img class="icon" src="' . $pmaThemeImage . 's_' . $sort_order . '.png" width="11" height="9" alt="' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '" />' . "\n" : '') . ' </a></th>' . "\n"; $table_columns = 3; - foreach ( $column_order as $stat_name => $stat ) { - if ( array_key_exists( $stat_name, $first_database ) ) { - if ( $stat['format'] === 'byte' ) { + foreach ($column_order as $stat_name => $stat) { + if (array_key_exists($stat_name, $first_database)) { + if ($stat['format'] === 'byte') { $table_columns += 2; $colspan = ' colspan="2"'; } else { @@ -243,7 +243,7 @@ if ($databases_count > 0) { } } if ($is_superuser) { - echo ' <th>' . ($cfg['PropertiesIconic'] ? ' ' : $strAction ) . "\n" + echo ' <th>' . ($cfg['PropertiesIconic'] ? ' ' : $strAction) . "\n" . ' </th>' . "\n"; } echo '</tr>' . "\n" @@ -252,10 +252,10 @@ if ($databases_count > 0) { $odd_row = true; foreach ($databases as $current) { - echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n"; + echo '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n"; $odd_row = ! $odd_row; - if ( $is_superuser || $cfg['AllowUserDropDatabase'] ) { + if ($is_superuser || $cfg['AllowUserDropDatabase']) { echo ' <td class="tool">' . "\n"; if ($current['SCHEMA_NAME'] != 'mysql' && (PMA_MYSQL_INT_VERSION < 50002 || $current['SCHEMA_NAME'] != 'information_schema')) { echo ' <input type="checkbox" name="selected_dbs[]" title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" value="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ' . (empty($checkall) ? '' : 'checked="checked" ') . '/>' . "\n"; @@ -265,33 +265,33 @@ if ($databases_count > 0) { echo ' </td>' . "\n"; } echo ' <td class="name">' . "\n" - . ' <a onclick="if ( window.parent.openDb(\'' . urlencode($current['SCHEMA_NAME']) . '\') ) return false;" href="index.php?' . $url_query . '&db=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf($strJumpToDB, htmlspecialchars($current['SCHEMA_NAME'])) . '" target="_parent">' . "\n" + . ' <a onclick="if (window.parent.openDb(\'' . urlencode($current['SCHEMA_NAME']) . '\')) return false;" href="index.php?' . $url_query . '&db=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf($strJumpToDB, htmlspecialchars($current['SCHEMA_NAME'])) . '" target="_parent">' . "\n" . ' ' . htmlspecialchars($current['SCHEMA_NAME']) . "\n" . ' </a>' . "\n" . ' </td>' . "\n"; - foreach ( $column_order as $stat_name => $stat ) { - if ( array_key_exists( $stat_name, $current ) ) { - if ( is_numeric( $stat['footer'] ) ) { + foreach ($column_order as $stat_name => $stat) { + if (array_key_exists($stat_name, $current)) { + if (is_numeric($stat['footer'])) { $column_order[$stat_name]['footer'] += $current[$stat_name]; } - if ( $stat['format'] === 'byte' ) { - list( $value, $unit ) = PMA_formatByteDown( $current[$stat_name], 3, 1 ); - } elseif ( $stat['format'] === 'number' ) { - $value = PMA_formatNumber( $current[$stat_name], 0 ); + if ($stat['format'] === 'byte') { + list($value, $unit) = PMA_formatByteDown($current[$stat_name], 3, 1); + } elseif ($stat['format'] === 'number') { + $value = PMA_formatNumber($current[$stat_name], 0); } else { - $value = htmlentities( $current[$stat_name], 0 ); + $value = htmlentities($current[$stat_name], 0); } echo ' <td class="value">'; - if ( isset( $stat['description_function'] ) ) { - echo '<dfn title="' . $stat['description_function']( $current[$stat_name] ) . '">'; + if (isset($stat['description_function'])) { + echo '<dfn title="' . $stat['description_function']($current[$stat_name]) . '">'; } echo $value; - if ( isset( $stat['description_function'] ) ) { + if (isset($stat['description_function'])) { echo '</dfn>'; } echo '</td>' . "\n"; - if ( $stat['format'] === 'byte' ) { + if ($stat['format'] === 'byte') { echo ' <td class="unit">' . $unit . '</td>' . "\n"; } } @@ -300,42 +300,42 @@ if ($databases_count > 0) { if ($is_superuser) { echo ' <td class="tool">' . "\n" . ' <a onclick="window.parent.setDb(\'' . urlencode($current['SCHEMA_NAME']) . '\');" href="./server_privileges.php?' . $url_query . '&checkprivs=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf($strCheckPrivsLong, htmlspecialchars($current['SCHEMA_NAME'])) . '">'. "\n" - . ' ' .($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_rights.png" width="16" height="16" alt=" ' .$strCheckPrivs . '" /> ' : $strCheckPrivs ). "\n" + . ' ' .($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_rights.png" width="16" height="16" alt=" ' .$strCheckPrivs . '" /> ' : $strCheckPrivs). "\n" . ' </a></td>' . "\n"; } echo '</tr>' . "\n"; - } // end foreach ( $databases as $key => $current ) + } // end foreach ($databases as $key => $current) unset($current, $odd_row); echo '<tr>' . "\n"; - if ( $is_superuser || $cfg['AllowUserDropDatabase'] ) { + if ($is_superuser || $cfg['AllowUserDropDatabase']) { echo ' <th> </th>' . "\n"; } echo ' <th>' . $strTotalUC . ': ' . $databases_count . '</th>' . "\n"; - foreach ( $column_order as $stat_name => $stat ) { - if ( array_key_exists( $stat_name, $first_database ) ) { - if ( $stat['format'] === 'byte' ) { - list( $value, $unit ) = PMA_formatByteDown( $stat['footer'], 3, 1 ); - } elseif ( $stat['format'] === 'number' ) { - $value = PMA_formatNumber( $stat['footer'], 0 ); + foreach ($column_order as $stat_name => $stat) { + if (array_key_exists($stat_name, $first_database)) { + if ($stat['format'] === 'byte') { + list($value, $unit) = PMA_formatByteDown($stat['footer'], 3, 1); + } elseif ($stat['format'] === 'number') { + $value = PMA_formatNumber($stat['footer'], 0); } else { - $value = htmlentities( $stat['footer'], 0 ); + $value = htmlentities($stat['footer'], 0); } echo ' <th class="value">'; - if ( isset( $stat['description_function'] ) ) { - echo '<dfn title="' . $stat['description_function']( $stat['footer'] ) . '">'; + if (isset($stat['description_function'])) { + echo '<dfn title="' . $stat['description_function']($stat['footer']) . '">'; } echo $value; - if ( isset( $stat['description_function'] ) ) { + if (isset($stat['description_function'])) { echo '</dfn>'; } echo '</th>' . "\n"; - if ( $stat['format'] === 'byte' ) { + if ($stat['format'] === 'byte') { echo ' <th class="unit">' . $unit . '</th>' . "\n"; } } } - if ( $is_superuser ) { + if ($is_superuser) { echo ' <th> </th>' . "\n"; } echo '</tr>' . "\n"; @@ -346,16 +346,16 @@ if ($databases_count > 0) { if ($is_superuser || $cfg['AllowUserDropDatabase']) { $common_url_query = PMA_generate_common_url() . '&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="' . $strWithChecked . '" />' . "\n" - . '<a href="./server_databases.php?' . $common_url_query . '&checkall=1" onclick="if ( markAllRows(\'tabledatabases\') ) return false;">' . "\n" + . '<a href="./server_databases.php?' . $common_url_query . '&checkall=1" onclick="if (markAllRows(\'tabledatabases\')) return false;">' . "\n" . ' ' . $strCheckAll . '</a> / ' . "\n" - . '<a href="./server_databases.php?' . $common_url_query . '" onclick="if ( unMarkAllRows(\'tabledatabases\') ) return false;">' . "\n" + . '<a href="./server_databases.php?' . $common_url_query . '" onclick="if (unMarkAllRows(\'tabledatabases\')) return false;">' . "\n" . ' ' . $strUncheckAll . '</a>' . "\n" . '<i>' . $strWithChecked . '</i>' . "\n"; - PMA_buttonOrImage( 'drop_selected_dbs', 'mult_submit', 'drop_selected_dbs', $strDrop, 'b_deltbl.png' ); + PMA_buttonOrImage('drop_selected_dbs', 'mult_submit', 'drop_selected_dbs', $strDrop, 'b_deltbl.png'); } echo '<ul><li id="li_switch_dbstats"><strong>' . "\n"; - if ( empty( $dbstats ) ) { + if (empty($dbstats)) { echo ' <a href="./server_databases.php?' . $url_query . '&dbstats=1"' .' title="' . $strDatabasesStatsEnable . '">' . "\n" .' ' . $strDatabasesStatsEnable; diff --git a/server_engines.php b/server_engines.php index 7e73614256..4946a45d3e 100644 --- a/server_engines.php +++ b/server_engines.php @@ -9,8 +9,8 @@ /** * */ -if ( ! defined( 'PMA_NO_VARIABLES_IMPORT' ) ) { - define( 'PMA_NO_VARIABLES_IMPORT', true ); +if (! defined('PMA_NO_VARIABLES_IMPORT')) { + define('PMA_NO_VARIABLES_IMPORT', true); } /** @@ -89,15 +89,15 @@ function PMA_generateEngineDetails($variables, $like = null) { $is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC; - $dt_table .= '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n" + $dt_table .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n" . ' <td>' . "\n"; if (!empty($variables[$var]['desc'])) { $dt_table .= ' ' . PMA_showHint($details['desc']) . "\n"; } $dt_table .= ' </td>' . "\n" . ' <th>' - . htmlspecialchars( empty($details['title']) - ? $var : $details['title'] ) . "\n" + . htmlspecialchars(empty($details['title']) + ? $var : $details['title']) . "\n" . ' </th>' . "\n" . ' <td class="value">'; switch ($details['type']) { @@ -131,8 +131,8 @@ function PMA_generateEngineDetails($variables, $like = null) { /** * Did the user request information about a certain storage engine? */ -if ( empty($_REQUEST['engine']) - || empty($mysql_storage_engines[$_REQUEST['engine']]) ) { +if (empty($_REQUEST['engine']) + || empty($mysql_storage_engines[$_REQUEST['engine']])) { /** * Displays the sub-page heading @@ -140,7 +140,7 @@ if ( empty($_REQUEST['engine']) echo '<h2>' . "\n" . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"' - .' width="16" height="16" alt="" />' : '' ) + .' width="16" height="16" alt="" />' : '') . "\n" . $strStorageEngines . "\n" . '</h2>' . "\n"; @@ -171,7 +171,7 @@ if ( empty($_REQUEST['engine']) : '') . '">' . "\n" . ' <td><a href="./server_engines.php' - . PMA_generate_common_url(array( 'engine' => $engine )) . '">' . "\n" + . PMA_generate_common_url(array('engine' => $engine)) . '">' . "\n" . ' ' . htmlspecialchars($details['Engine']) . "\n" . ' </a>' . "\n" . ' </td>' . "\n"; @@ -196,9 +196,9 @@ if ( empty($_REQUEST['engine']) echo '<h2>' . "\n" . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_engine.png"' - .' width="16" height="16" alt="" />' : '' ) + .' width="16" height="16" alt="" />' : '') . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n" - . ' ' . PMA_showMySQLDocu( '', $engine_plugin->getMysqlHelpPage() ) . "\n" + . ' ' . PMA_showMySQLDocu('', $engine_plugin->getMysqlHelpPage()) . "\n" . '</h2>' . "\n\n"; if (PMA_MYSQL_INT_VERSION >= 40102) { echo '<p>' . "\n" @@ -215,7 +215,7 @@ if ( empty($_REQUEST['engine']) echo ' <strong>' . $strServerTabVariables . '</strong>' . "\n"; } else { echo ' <a href="./server_engines.php' - . PMA_generate_common_url(array( 'engine' => $_REQUEST['engine'] )) . '">' + . PMA_generate_common_url(array('engine' => $_REQUEST['engine'])) . '">' . $strServerTabVariables . '</a>' . "\n"; } foreach ($infoPages as $current => $label) { @@ -225,7 +225,7 @@ if ( empty($_REQUEST['engine']) } else { echo ' <a href="./server_engines.php' . PMA_generate_common_url( - array( 'engine' => $_REQUEST['engine'], 'page' => $current )) + array('engine' => $_REQUEST['engine'], 'page' => $current)) . '">' . htmlspecialchars($label) . '</a>' . "\n"; } } diff --git a/server_privileges.php b/server_privileges.php index 28f156bbb1..9efd8f1d23 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -30,9 +30,9 @@ if (isset($pred_tablename) && strlen($pred_tablename)) { } // check if given $dbanem is a wildcard or not -if ( isset( $dbname ) ) { - //if ( preg_match( '/\\\\(?:_|%)/i', $dbname ) ) { - if ( preg_match( '/(?<!\\\\)(?:_|%)/i', $dbname ) ) { +if (isset($dbname)) { + //if (preg_match('/\\\\(?:_|%)/i', $dbname)) { + if (preg_match('/(?<!\\\\)(?:_|%)/i', $dbname)) { $dbname_is_wildcard = true; } else { $dbname_is_wildcard = false; @@ -123,7 +123,7 @@ function PMA_extractPrivInfo($row = '', $enableHTML = FALSE) if (!empty($row) && isset($row['Table_priv'])) { $res = PMA_DBI_query( 'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', - $GLOBALS['userlink'] ); + $GLOBALS['userlink']); $row1 = PMA_DBI_fetch_assoc($res); PMA_DBI_free_result($res); $av_grants = explode ('\',\'', substr($row1['Type'], 5, strlen($row1['Type']) - 7)); @@ -219,7 +219,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = if ($db == '*') { $table = '*'; } - $spaces = str_repeat( ' ', $indent ); + $spaces = str_repeat(' ', $indent); if (isset($GLOBALS['username'])) { $username = $GLOBALS['username']; @@ -238,8 +238,8 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = .' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') .' AND ' . PMA_convert_using('`Host`') .' = ' . PMA_convert_using($hostname, 'quoted') - .' AND ' . PMA_convert_using( PMA_unescape_mysql_wildcards( $db ), 'quoted' ) - .' LIKE ' . PMA_convert_using( '`Db`' ) . ';'; + .' AND ' . PMA_convert_using(PMA_unescape_mysql_wildcards($db), 'quoted') + .' LIKE ' . PMA_convert_using('`Db`') . ';'; } else { $sql_query = 'SELECT `Table_priv`' @@ -247,9 +247,9 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = .' WHERE ' . PMA_convert_using('`User`') .' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') .' AND ' .PMA_convert_using('`Host`') - .' = ' . PMA_convert_using( $hostname, 'quoted' ) + .' = ' . PMA_convert_using($hostname, 'quoted') .' AND ' .PMA_convert_using('`Db`') - .' = ' . PMA_convert_using( PMA_unescape_mysql_wildcards( $db ), 'quoted' ) + .' = ' . PMA_convert_using(PMA_unescape_mysql_wildcards($db), 'quoted') .' AND ' . PMA_convert_using('`Table_name`') .' = ' . PMA_convert_using($table, 'quoted') . ';'; } @@ -280,7 +280,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = if (isset($row['Table_priv'])) { $res = PMA_DBI_query( 'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', - $GLOBALS['userlink'] ); + $GLOBALS['userlink']); // note: in MySQL 5.0.3 we get "Create View', 'Show view'; // the View for Create is spelled with uppercase V // the view for Show is spelled with lowercase v @@ -298,9 +298,9 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = unset($row['Table_priv'], $current_grant, $av_grants, $users_grants); // get collumns - $res = PMA_DBI_try_query('SHOW COLUMNS FROM `' . PMA_unescape_mysql_wildcards( $db ) . '`.`' . $table . '`;'); + $res = PMA_DBI_try_query('SHOW COLUMNS FROM `' . PMA_unescape_mysql_wildcards($db) . '`.`' . $table . '`;'); $columns = array(); - if ( $res ) { + if ($res) { while ($row1 = PMA_DBI_fetch_row($res)) { $columns[$row1[0]] = array( 'Select' => FALSE, @@ -314,7 +314,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = unset($res, $row1); } // t a b l e - s p e c i f i c p r i v i l e g e s - if ( ! empty( $columns ) ) { + if (! empty($columns)) { $res = PMA_DBI_query( 'SELECT `Column_name`, `Column_priv`' .' FROM `mysql`.`columns_priv`' @@ -323,7 +323,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = .' AND ' . PMA_convert_using('`Host`') .' = ' . PMA_convert_using($hostname, 'quoted') .' AND ' . PMA_convert_using('`Db`') - .' = ' . PMA_convert_using( PMA_unescape_mysql_wildcards( $db ), 'quoted') + .' = ' . PMA_convert_using(PMA_unescape_mysql_wildcards($db), 'quoted') .' AND ' . PMA_convert_using('`Table_name`') .' = ' . PMA_convert_using($table, 'quoted') . ';'); @@ -334,7 +334,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = } } PMA_DBI_free_result($res); - unset( $res, $row1, $current ); + unset($res, $row1, $current); echo $spaces . '<input type="hidden" name="grant_count" value="' . count($row) . '" />' . "\n" . $spaces . '<input type="hidden" name="column_count" value="' . count($columns) . '" />' . "\n" @@ -476,13 +476,13 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = . $spaces . '<fieldset id="fieldset_user_global_rights">' . "\n" . $spaces . ' <legend>' . "\n" . $spaces . ' ' . ($db == '*' ? $GLOBALS['strGlobalPrivileges'] : ($table == '*' ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges'])) . "\n" - . $spaces . ' ( <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&checkall=1" onclick="setCheckboxes(\'usersForm\', true); return false;">' . $GLOBALS['strCheckAll'] . '</a> /' . "\n" - . $spaces . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'usersForm\', false); return false;">' . $GLOBALS['strUncheckAll'] . '</a> )' . "\n" + . $spaces . ' (<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&checkall=1" onclick="setCheckboxes(\'usersForm\', true); return false;">' . $GLOBALS['strCheckAll'] . '</a> /' . "\n" + . $spaces . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '" onclick="setCheckboxes(\'usersForm\', false); return false;">' . $GLOBALS['strUncheckAll'] . '</a>)' . "\n" . $spaces . ' </legend>' . "\n" . $spaces . ' <p><small><i>' . $GLOBALS['strEnglishPrivileges'] . '</i></small></p>' . "\n" . $spaces . ' <fieldset>' . "\n" . $spaces . ' <legend>' . $GLOBALS['strData'] . '</legend>' . "\n"; - foreach ( $privTable[0] as $priv ) + foreach ($privTable[0] as $priv) { echo $spaces . ' <div class="item">' . "\n" . $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n" @@ -492,7 +492,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = echo $spaces . ' </fieldset>' . "\n" . $spaces . ' <fieldset>' . "\n" . $spaces . ' <legend>' . $GLOBALS['strStructure'] . '</legend>' . "\n"; - foreach ( $privTable[1] as $priv ) + foreach ($privTable[1] as $priv) { echo $spaces . ' <div class="item">' . "\n" . $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n" @@ -502,7 +502,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = echo $spaces . ' </fieldset>' . "\n" . $spaces . ' <fieldset>' . "\n" . $spaces . ' <legend>' . $GLOBALS['strAdministration'] . '</legend>' . "\n"; - foreach ( $privTable[2] as $priv ) + foreach ($privTable[2] as $priv) { echo $spaces . ' <div class="item">' . "\n" . $spaces . ' <input type="checkbox"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' name="' . $priv[0] . '_priv" id="checkbox_' . $priv[0] . '_priv" value="Y" ' . ($row[$priv[0] . '_priv'] == 'Y' ? 'checked="checked" ' : '') . 'title="' . $priv[2] . '"/>' . "\n" @@ -562,8 +562,8 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE, $indent = * * @return void */ -function PMA_displayLoginInformationFields($mode = 'new', $indent = 0 ) { - $spaces = str_repeat( ' ', $indent); +function PMA_displayLoginInformationFields($mode = 'new', $indent = 0) { + $spaces = str_repeat(' ', $indent); // Get user/host name lengths $fields_info = PMA_DBI_get_fields('mysql', 'user'); @@ -586,7 +586,7 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0 ) { } unset($fields_info); - if ( isset( $GLOBALS['username'] ) && strlen( $GLOBALS['username'] ) === 0 ) { + if (isset($GLOBALS['username']) && strlen($GLOBALS['username']) === 0) { $GLOBALS['pred_username'] = 'any'; } echo $spaces . '<fieldset id="fieldset_add_user_login">' . "\n" @@ -650,7 +650,7 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0 ) { . $spaces . ' <option value="userdefined"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'userdefined') ? ' selected="selected"' : '') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" . $spaces . ' </select>' . "\n" . $spaces . '</span>' . "\n" - . $spaces . '<input type="text" name="hostname" maxlength="' . $hostname_length . '" value="' . ( isset($GLOBALS['hostname']) ? $GLOBALS['hostname'] : '' ) . '" title="' . $GLOBALS['strHost'] . '" onchange="pred_hostname.value = \'userdefined\';" />' . "\n" + . $spaces . '<input type="text" name="hostname" maxlength="' . $hostname_length . '" value="' . (isset($GLOBALS['hostname']) ? $GLOBALS['hostname'] : '') . '" title="' . $GLOBALS['strHost'] . '" onchange="pred_hostname.value = \'userdefined\';" />' . "\n" . $spaces . '</div>' . "\n" . $spaces . '<div class="item">' . "\n" . $spaces . '<label for="select_pred_password">' . "\n" @@ -661,11 +661,11 @@ function PMA_displayLoginInformationFields($mode = 'new', $indent = 0 ) { . $spaces . ' onchange="if (this.value == \'none\') { pma_pw.value = \'\'; pma_pw2.value = \'\'; } else if (this.value == \'userdefined\') { pma_pw.focus(); pma_pw.select(); }">' . "\n" . ($mode == 'change' ? $spaces . ' <option value="keep" selected="selected">' . $GLOBALS['strKeepPass'] . '</option>' . "\n" : '') . $spaces . ' <option value="none"'; - if ( isset( $GLOBALS['username'] ) && $mode != 'change' ) { + if (isset($GLOBALS['username']) && $mode != 'change') { echo ' selected="selected"'; } echo $spaces . '>' . $GLOBALS['strNoPassword'] . '</option>' . "\n" - . $spaces . ' <option value="userdefined"' . ( isset( $GLOBALS['username'] ) ? '' : ' selected="selected"') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" + . $spaces . ' <option value="userdefined"' . (isset($GLOBALS['username']) ? '' : ' selected="selected"') . '>' . $GLOBALS['strUseTextField'] . ':</option>' . "\n" . $spaces . ' </select>' . "\n" . $spaces . '</span>' . "\n" . $spaces . '<input type="password" id="text_pma_pw" name="pma_pw" title="' . $GLOBALS['strPassword'] . '" onchange="pred_password.value = \'userdefined\';" />' . "\n" @@ -773,19 +773,19 @@ if (!empty($adduser_submit) || !empty($change_copy)) { $pma_pw_hidden = str_repeat('*', strlen($pma_pw)); $sql_query = $real_sql_query . ' IDENTIFIED BY \'' . $pma_pw_hidden . '\''; $real_sql_query .= ' IDENTIFIED BY \'' . PMA_sqlAddslashes($pma_pw) . '\''; - if ( isset( $create_user_real ) ) { + if (isset($create_user_real)) { $create_user_show = $create_user_real . ' IDENTIFIED BY \'' . $pma_pw_hidden . '\''; $create_user_real .= ' IDENTIFIED BY \'' . PMA_sqlAddslashes($pma_pw) . '\''; } } else { if ($pred_password == 'keep' && !empty($password)) { $real_sql_query .= ' IDENTIFIED BY PASSWORD \'' . $password . '\''; - if ( isset( $create_user_real ) ) { + if (isset($create_user_real)) { $create_user_real .= ' IDENTIFIED BY PASSWORD \'' . $password . '\''; } } $sql_query = $real_sql_query; - if ( isset( $create_user_real ) ) { + if (isset($create_user_real)) { $create_user_show = $create_user_real; } } @@ -825,14 +825,14 @@ if (!empty($adduser_submit) || !empty($change_copy)) { } } } - if ( isset( $create_user_real ) ) { + if (isset($create_user_real)) { $create_user_real .= ';'; $create_user_show .= ';'; } $real_sql_query .= ';'; $sql_query .= ';'; if (empty($change_copy)) { - if ( isset( $create_user_real ) ) { + if (isset($create_user_real)) { PMA_DBI_try_query($create_user_real) or PMA_mysqlDie(PMA_DBI_getError(), $create_user_show); $sql_query = $create_user_show . $sql_query; } @@ -858,7 +858,7 @@ if (!empty($adduser_submit) || !empty($change_copy)) { } } } else { - if ( isset( $create_user_real ) ) { + if (isset($create_user_real)) { $queries[] = $create_user_real; } $queries[] = $real_sql_query; @@ -866,7 +866,7 @@ if (!empty($adduser_submit) || !empty($change_copy)) { // $queries_for_display, at the same position occupied // by the real query in $queries $tmp_count = count($queries); - if ( isset( $create_user_real ) ) { + if (isset($create_user_real)) { $queries_for_display[$tmp_count - 2] = $create_user_show; } $queries_for_display[$tmp_count - 1] = $sql_query; @@ -885,19 +885,19 @@ if (!empty($change_copy)) { .' = ' . PMA_convert_using(PMA_sqlAddslashes($old_username), 'quoted') .' AND ' . PMA_convert_using('Host') .' = ' . PMA_convert_using($old_hostname, 'quoted') . ';'; - $res = PMA_DBI_query('SELECT * FROM `mysql`.`db`' . $user_host_condition ); + $res = PMA_DBI_query('SELECT * FROM `mysql`.`db`' . $user_host_condition); while ($row = PMA_DBI_fetch_assoc($res)) { $queries[] = 'GRANT ' . join(', ', PMA_extractPrivInfo($row)) .' ON `' . $row['Db'] . '`.*' .' TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\'' - . ( $row['Grant_priv'] == 'Y' ? ' WITH GRANT OPTION;' : ';' ); + . ($row['Grant_priv'] == 'Y' ? ' WITH GRANT OPTION;' : ';'); } PMA_DBI_free_result($res); $res = PMA_DBI_query( 'SELECT `Db`, `Table_name`, `Table_priv`' .' FROM `mysql`.`tables_priv`' . $user_host_condition, - $GLOBALS['userlink'], PMA_DBI_QUERY_STORE ); + $GLOBALS['userlink'], PMA_DBI_QUERY_STORE); while ($row = PMA_DBI_fetch_assoc($res)) { $res2 = PMA_DBI_QUERY( @@ -977,11 +977,11 @@ if (!empty($update_privs)) { if (! isset($dbname) || ! strlen($dbname)) { $db_and_table = '*.*'; } else { - if ( isset( $tablename ) && strlen($tablename) ) { - $db_and_table = PMA_backquote( PMA_unescape_mysql_wildcards( $dbname ) ) . '.'; - $db_and_table .= PMA_backquote( $tablename ); + if (isset($tablename) && strlen($tablename)) { + $db_and_table = PMA_backquote(PMA_unescape_mysql_wildcards($dbname)) . '.'; + $db_and_table .= PMA_backquote($tablename); } else { - $db_and_table = PMA_backquote( $dbname ) . '.'; + $db_and_table = PMA_backquote($dbname) . '.'; $db_and_table .= '*'; } } @@ -1002,9 +1002,9 @@ if (!empty($update_privs)) { /** * @todo similar code appears twice in this script */ - if ( ( isset($Grant_priv) && $Grant_priv == 'Y') - || ( ( ! isset($dbname) || ! strlen($dbname) ) && PMA_MYSQL_INT_VERSION >= 40002 - && ( isset($max_questions) || isset($max_connections) + if ((isset($Grant_priv) && $Grant_priv == 'Y') + || ((! isset($dbname) || ! strlen($dbname)) && PMA_MYSQL_INT_VERSION >= 40002 + && (isset($max_questions) || isset($max_connections) || isset($max_updates) || isset($max_user_connections)))) { $sql_query2 .= 'WITH'; @@ -1056,15 +1056,15 @@ if (!empty($update_privs)) { */ if (!empty($revokeall)) { - if ( ! isset($dbname) || ! strlen($dbname) ) { + if (! isset($dbname) || ! strlen($dbname)) { $db_and_table = '*.*'; } else { - if ( ! isset( $tablename ) || ! strlen($tablename) ) { - $db_and_table = PMA_backquote( $dbname ) . '.'; + if (! isset($tablename) || ! strlen($tablename)) { + $db_and_table = PMA_backquote($dbname) . '.'; $db_and_table .= '*'; } else { - $db_and_table = PMA_backquote( PMA_unescape_mysql_wildcards( $dbname ) ) . '.'; - $db_and_table .= PMA_backquote( $tablename ); + $db_and_table = PMA_backquote(PMA_unescape_mysql_wildcards($dbname)) . '.'; + $db_and_table .= PMA_backquote($tablename); } } @@ -1080,7 +1080,7 @@ if (!empty($revokeall)) { } $sql_query = $sql_query0 . (isset($sql_query1) ? ' ' . $sql_query1 : ''); $message = sprintf($GLOBALS['strRevokeMessage'], '\'' . $username . '\'@\'' . $hostname . '\''); - if ( ! isset($tablename) || ! strlen($tablename) ) { + if (! isset($tablename) || ! strlen($tablename)) { unset($dbname); } else { unset($tablename); @@ -1128,7 +1128,7 @@ if (!empty($delete) || (!empty($change_copy) && $mode < 4)) { for ($i = 0; isset($selected_usr[$i]); $i++) { list($this_user, $this_host) = explode($user_host_separator, $selected_usr[$i]); $queries[] = '# ' . sprintf($GLOBALS['strDeleting'], '\'' . $this_user . '\'@\'' . $this_host . '\'') . ' ...'; - if ( PMA_MYSQL_INT_VERSION >= 50002 ) { + if (PMA_MYSQL_INT_VERSION >= 50002) { $queries[] = 'DROP USER \'' . PMA_sqlAddslashes($this_user) . '\'@\'' . $this_host . '\';'; } else { if ($mode == 2) { @@ -1152,7 +1152,7 @@ if (!empty($delete) || (!empty($change_copy) && $mode < 4)) { } unset($res); } - if ( PMA_MYSQL_INT_VERSION >= 40101 ) { + if (PMA_MYSQL_INT_VERSION >= 40101) { if (PMA_MYSQL_INT_VERSION < 50002) { $queries[] = 'REVOKE GRANT OPTION ON *.* FROM \'' . PMA_sqlAddslashes($this_user) . '\'@\'' . $this_host . '\';'; } @@ -1256,7 +1256,7 @@ $link_edit = '<a href="server_privileges.php?' . $GLOBALS['url_query'] .'&hostname=%s' .'&dbname=%s' .'&tablename=%s">'; -if ( $GLOBALS['cfg']['PropertiesIconic'] ) { +if ($GLOBALS['cfg']['PropertiesIconic']) { $link_edit .= '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_usredit.png" width="16" height="16" alt="' . $GLOBALS['strEditPrivileges'] . '" title="' . $GLOBALS['strEditPrivileges'] . '" />'; } else { $link_edit .= $GLOBALS['strEditPrivileges']; @@ -1269,7 +1269,7 @@ $link_revoke = '<a href="server_privileges.php?' . $GLOBALS['url_query'] .'&dbname=%s' .'&tablename=%s' .'&revokeall=1">'; -if ( $GLOBALS['cfg']['PropertiesIconic'] ) { +if ($GLOBALS['cfg']['PropertiesIconic']) { $link_revoke .= '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_usrdrop.png" width="16" height="16" alt="' . $GLOBALS['strRevoke'] . '" title="' . $GLOBALS['strRevoke'] . '" />'; } else { $link_revoke .= $GLOBALS['strRevoke']; @@ -1279,8 +1279,8 @@ $link_revoke .= '</a>'; /** * Displays the page */ -if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) { - if ( ! isset( $username ) ) { +if (empty($adduser) && (! isset($checkprivs) || ! strlen($checkprivs))) { + if (! isset($username)) { // No username is given --> display the overview echo '<h2>' . "\n" . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="'. $GLOBALS['pmaThemeImage'] . 'b_usrlist.png" alt="" />' : '') @@ -1356,8 +1356,8 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) ); $db_rights_sqls = array(); - foreach ( $tables_to_search_for_users as $table_search_in ) { - if ( in_array( $table_search_in, $tables ) ) { + foreach ($tables_to_search_for_users as $table_search_in) { + if (in_array($table_search_in, $tables)) { $db_rights_sqls[] = 'SELECT DISTINCT `User`, `Host` FROM `mysql`.`' . $table_search_in . '` ' . (isset($initial) ? PMA_RangeOfUsers($initial) : ''); } } @@ -1367,7 +1367,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) 'Host' => '%', 'Password' => '?', 'Grant_priv' => 'N', - 'privs' => array( 'USAGE' ), + 'privs' => array('USAGE'), ); // for all initials, even non A-Z @@ -1377,31 +1377,31 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) // do not use UNION DISTINCT, as it's not allowed before // MySQL 4.0.17, and because "it does nothing" (cf manual) - if ( PMA_MYSQL_INT_VERSION >= 40000 ) { - $db_rights_sql = '(' . implode( ') UNION (', $db_rights_sqls ) . ')' + if (PMA_MYSQL_INT_VERSION >= 40000) { + $db_rights_sql = '(' . implode(') UNION (', $db_rights_sqls) . ')' .' ORDER BY `User` ASC, `Host` ASC'; - $db_rights_result = PMA_DBI_query( $db_rights_sql ); + $db_rights_result = PMA_DBI_query($db_rights_sql); - while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { - $db_rights_row = array_merge( $user_defaults, $db_rights_row ); + while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) { + $db_rights_row = array_merge($user_defaults, $db_rights_row); $db_rights[$db_rights_row['User']][$db_rights_row['Host']] = $db_rights_row; } } else { - foreach ( $db_rights_sqls as $db_rights_sql ) { - $db_rights_result = PMA_DBI_query( $db_rights_sql ); + foreach ($db_rights_sqls as $db_rights_sql) { + $db_rights_result = PMA_DBI_query($db_rights_sql); - while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { - $db_rights_row = array_merge( $user_defaults, $db_rights_row ); + while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) { + $db_rights_row = array_merge($user_defaults, $db_rights_row); $db_rights[$db_rights_row['User']][$db_rights_row['Host']] = $db_rights_row; } } } - PMA_DBI_free_result( $db_rights_result ); - unset( $db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row ); - ksort( $db_rights ); + PMA_DBI_free_result($db_rights_result); + unset($db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row); + ksort($db_rights); /** * Displays the initials @@ -1409,7 +1409,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) // initialize to FALSE the letters A-Z for ($letter_counter = 1; $letter_counter < 27; $letter_counter++) { - if ( ! isset( $array_initials[chr($letter_counter + 64)] ) ) { + if (! isset($array_initials[chr($letter_counter + 64)])) { $array_initials[chr($letter_counter + 64)] = FALSE; } } @@ -1423,7 +1423,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) // just letters. For letters A-Z, we add the non-used letters // as greyed out. - uksort( $array_initials, "strnatcasecmp" ); + uksort($array_initials, "strnatcasecmp"); echo '<table cellspacing="5"><tr>'; foreach ($array_initials as $tmp_initial => $initial_was_found) { @@ -1443,12 +1443,12 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) if (isset($initial) || isset($showall) || PMA_DBI_num_rows($res) < 50) { - while ( $row = PMA_DBI_fetch_assoc( $res ) ) { - $row['privs'] = PMA_extractPrivInfo( $row, true ); + while ($row = PMA_DBI_fetch_assoc($res)) { + $row['privs'] = PMA_extractPrivInfo($row, true); $db_rights[$row['User']][$row['Host']] = $row; } - @PMA_DBI_free_result( $res ); - unset( $res ); + @PMA_DBI_free_result($res); + unset($res); echo '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post">' . "\n" . PMA_generate_common_hidden_inputs('', '', 1) @@ -1459,7 +1459,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) . ' <th>' . $GLOBALS['strHost'] . '</th>' . "\n" . ' <th>' . $GLOBALS['strPassword'] . '</th>' . "\n" . ' <th>' . $GLOBALS['strGlobalPrivileges'] . ' ' - . PMA_showHint( $GLOBALS['strEnglishPrivileges'] ) . '</th>' . "\n" + . PMA_showHint($GLOBALS['strEnglishPrivileges']) . '</th>' . "\n" . ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n" . ' ' . ($GLOBALS['cfg']['PropertiesIconic'] ? '<td></td>' : '<th>' . $GLOBALS['strAction'] . '</th>') . "\n"; echo ' </tr>' . "\n"; @@ -1467,13 +1467,13 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) echo ' <tbody>' . "\n"; $odd_row = true; $index_checkbox = -1; - foreach ( $db_rights as $user ) { + foreach ($db_rights as $user) { $index_checkbox++; - ksort( $user ); - foreach ( $user as $host ) { + ksort($user); + foreach ($user as $host) { $index_checkbox++; - echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n" - . ' <td><input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_' . $index_checkbox . '" value="' . str_replace( chr(27), '', htmlentities($host['User'] . $user_host_separator . $host['Host'] ) ) . '"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' /></td>' . "\n" + echo ' <tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n" + . ' <td><input type="checkbox" name="selected_usr[]" id="checkbox_sel_users_' . $index_checkbox . '" value="' . str_replace(chr(27), '', htmlentities($host['User'] . $user_host_separator . $host['Host'])) . '"' . (empty($GLOBALS['checkall']) ? '' : ' checked="checked"') . ' /></td>' . "\n" . ' <td><label for="checkbox_sel_users_' . $index_checkbox . '">' . (empty($host['User']) ? '<span style="color: #FF0000">' . $GLOBALS['strAny'] . '</span>' : htmlspecialchars($host['User'])) . '</label></td>' . "\n" . ' <td>' . htmlspecialchars($host['Host']) . '</td>' . "\n"; echo ' <td>'; @@ -1491,41 +1491,41 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) } // end switch echo '</td>' . "\n" . ' <td><tt>' . "\n" - . ' ' . implode( ',' . "\n" . ' ', $host['privs'] ) . "\n" + . ' ' . implode(',' . "\n" . ' ', $host['privs']) . "\n" . ' </tt></td>' . "\n" . ' <td>' . ($host['Grant_priv'] == 'Y' ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n" . ' <td align="center">'; - printf( $link_edit, urlencode( $host['User'] ), - urlencode( $host['Host'] ), '', '' ); + printf($link_edit, urlencode($host['User']), + urlencode($host['Host']), '', ''); echo '</td>' . "\n" . ' </tr>' . "\n"; $odd_row = ! $odd_row; } } - unset( $user, $host, $odd_row ); + unset($user, $host, $odd_row); echo ' </tbody></table>' . "\n" .'<img class="selectallarrow"' .' src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"' .' width="38" height="22"' .' alt="' . $GLOBALS['strWithChecked'] . '" />' . "\n" .'<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&checkall=1"' - .' onclick="if ( markAllRows(\'usersForm\') ) return false;">' + .' onclick="if (markAllRows(\'usersForm\')) return false;">' . $GLOBALS['strCheckAll'] . '</a>' . "\n" .'/' . "\n" .'<a href="server_privileges.php?' . $GLOBALS['url_query'] . '"' - .' onclick="if ( unMarkAllRows(\'usersForm\') ) return false;">' + .' onclick="if (unMarkAllRows(\'usersForm\')) return false;">' . $GLOBALS['strUncheckAll'] . '</a>' . "\n"; // add/delete user fieldset echo ' <fieldset id="fieldset_add_user">' . "\n" . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1">' . "\n" - . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' . "\n" : '' ) + . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' . "\n" : '') . ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n" . ' </fieldset>' . "\n" . ' <fieldset id="fieldset_delete_user">' . ' <legend>' . "\n" - . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usrdrop.png" width="16" height="16" alt="" />' . "\n" : '' ) + . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usrdrop.png" width="16" height="16" alt="" />' . "\n" : '') . ' ' . $GLOBALS['strRemoveSelectedUsers'] . '' . "\n" . ' </legend>' . "\n"; @@ -1548,7 +1548,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) . ' </label><br />' . "\n"; } else { echo ' <input type="hidden" name="mode" value="2" />' . "\n" - . '( ' . $GLOBALS['strRevokeAndDelete'] . ' )<br />' . "\n"; + . '(' . $GLOBALS['strRevokeAndDelete'] . ')<br />' . "\n"; } echo ' <input type="checkbox" title="' . $GLOBALS['strDropUsersDb'] . '" name="drop_users_db" id="checkbox_drop_users_db" />' . "\n" @@ -1564,7 +1564,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) unset ($row); echo ' <fieldset id="fieldset_add_user">' . "\n" . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1">' . "\n" - . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' . "\n" : '' ) + . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' . "\n" : '') . ' ' . $GLOBALS['strAddUser'] . '</a>' . "\n" . ' </fieldset>' . "\n"; } // end if (display overview) @@ -1580,27 +1580,27 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) // A user was selected -> display the user's properties echo '<h2>' . "\n" - . ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usredit.png" width="16" height="16" alt="" />' : '' ) + . ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usredit.png" width="16" height="16" alt="" />' : '') . $GLOBALS['strUser'] . ' <i><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=' . urlencode($username) . '&hostname=' . urlencode($hostname) . '">\'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname) . '\'</a></i>' . "\n"; - if ( isset( $dbname ) && strlen($dbname) ) { - if ( $dbname_is_wildcard ) { + if (isset($dbname) && strlen($dbname)) { + if ($dbname_is_wildcard) { echo ' - ' . $GLOBALS['strDatabases']; } else { echo ' - ' . $GLOBALS['strDatabase']; } $url_dbname = urlencode(str_replace('\_', '_', $dbname)); echo ' <i><a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&db=' . $url_dbname . '&reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n"; - if ( isset( $tablename ) && strlen($tablename) ) { + if (isset($tablename) && strlen($tablename)) { echo ' - ' . $GLOBALS['strTable'] . ' <i><a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&db=' . $url_dbname . '&table=' . urlencode($tablename) . '&reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n"; } unset($url_dbname); } echo ' : ' . $GLOBALS['strEditPrivileges'] . '</h2>' . "\n"; $res = PMA_DBI_query('SELECT \'foo\' FROM `mysql`.`user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';', null, PMA_DBI_QUERY_STORE); - $user_does_not_exists = (PMA_DBI_num_rows( $res ) < 1); + $user_does_not_exists = (PMA_DBI_num_rows($res) < 1); PMA_DBI_free_result($res); unset($res); - if ( $user_does_not_exists ) { + if ($user_does_not_exists) { echo $GLOBALS['strUserNotFound']; PMA_displayLoginInformationFields(); //require_once './libraries/footer.inc.php'; @@ -1609,18 +1609,18 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) . PMA_generate_common_hidden_inputs('', '', 3) . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n"; - if ( isset( $dbname ) && strlen($dbname) ) { + if (isset($dbname) && strlen($dbname)) { echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n"; - if ( isset( $tablename ) && strlen($tablename) ) { + if (isset($tablename) && strlen($tablename)) { echo ' <input type="hidden" name="tablename" value="' . htmlspecialchars($tablename) . '" />' . "\n"; } } - PMA_displayPrivTable((( ! isset( $dbname ) || ! strlen($dbname) ) ? '*' : $dbname), - ((( ! isset( $dbname ) || ! strlen($dbname) ) || ( ! isset( $tablename ) || ! strlen($tablename) )) ? '*' : $tablename), + PMA_displayPrivTable(((! isset($dbname) || ! strlen($dbname)) ? '*' : $dbname), + (((! isset($dbname) || ! strlen($dbname)) || (! isset($tablename) || ! strlen($tablename))) ? '*' : $tablename), TRUE, 3); echo '</form>' . "\n"; - if ( ( ! isset( $tablename ) || ! strlen($tablename) ) && empty( $dbname_is_wildcard ) ) { + if ((! isset($tablename) || ! strlen($tablename)) && empty($dbname_is_wildcard)) { // no table name was given, display all table specific rights // but only if $dbname contains no wildcards @@ -1631,13 +1631,13 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<fieldset>' . "\n" - . '<legend>' . (( ! isset( $dbname ) || ! strlen($dbname) ) ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges']) . '</legend>' . "\n" + . '<legend>' . ((! isset($dbname) || ! strlen($dbname)) ? $GLOBALS['strDbPrivileges'] : $GLOBALS['strTblPrivileges']) . '</legend>' . "\n" . '<table class="data">' . "\n" . '<thead>' . "\n" - . '<tr><th>' . (( ! isset( $dbname ) || ! strlen($dbname) ) ? $GLOBALS['strDatabase'] : $GLOBALS['strTable']) . '</th>' . "\n" + . '<tr><th>' . ((! isset($dbname) || ! strlen($dbname)) ? $GLOBALS['strDatabase'] : $GLOBALS['strTable']) . '</th>' . "\n" . ' <th>' . $GLOBALS['strPrivileges'] . '</th>' . "\n" . ' <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n" - . ' <th>' . (( ! isset( $dbname ) || ! strlen($dbname) ) ? $GLOBALS['strTblPrivileges'] : $GLOBALS['strColumnPrivileges']) . '</th>' . "\n" + . ' <th>' . ((! isset($dbname) || ! strlen($dbname)) ? $GLOBALS['strTblPrivileges'] : $GLOBALS['strColumnPrivileges']) . '</th>' . "\n" . ' <th colspan="2">' . $GLOBALS['strAction'] . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n" @@ -1654,7 +1654,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) // we also want privielgs for this user not in table `db` but in other table $tables = PMA_DBI_fetch_result('SHOW TABLES FROM `mysql`;'); - if ( ( ! isset( $dbname ) || ! strlen($dbname) ) ) { + if ((! isset($dbname) || ! strlen($dbname))) { // no db name given, so we want all privs for the given user @@ -1663,8 +1663,8 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) ); $db_rights_sqls = array(); - foreach ( $tables_to_search_for_users as $table_search_in ) { - if ( in_array( $table_search_in, $tables ) ) { + foreach ($tables_to_search_for_users as $table_search_in) { + if (in_array($table_search_in, $tables)) { $db_rights_sqls[] = ' SELECT DISTINCT `Db` FROM `mysql`.`' . $table_search_in . '` @@ -1675,48 +1675,48 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) $user_defaults = array( 'Db' => '', 'Grant_priv' => 'N', - 'privs' => array( 'USAGE' ), + 'privs' => array('USAGE'), 'Table_privs' => true, ); // for the rights $db_rights = array(); - if ( PMA_MYSQL_INT_VERSION >= 40000 ) { - $db_rights_sql = '(' . implode( ') UNION (', $db_rights_sqls ) . ')' + if (PMA_MYSQL_INT_VERSION >= 40000) { + $db_rights_sql = '(' . implode(') UNION (', $db_rights_sqls) . ')' .' ORDER BY `Db` ASC'; - $db_rights_result = PMA_DBI_query( $db_rights_sql ); + $db_rights_result = PMA_DBI_query($db_rights_sql); - while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { - $db_rights_row = array_merge( $user_defaults, $db_rights_row ); + while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) { + $db_rights_row = array_merge($user_defaults, $db_rights_row); // only Db names in the table `mysql`.`db` uses wildcards // as we are in the db specific rights display we want // all db names escaped, also from other sources $db_rights_row['Db'] = PMA_escape_mysql_wildcards( - $db_rights_row['Db'] ); + $db_rights_row['Db']); $db_rights[$db_rights_row['Db']] = $db_rights_row; } } else { - foreach ( $db_rights_sqls as $db_rights_sql ) { - $db_rights_result = PMA_DBI_query( $db_rights_sql ); + foreach ($db_rights_sqls as $db_rights_sql) { + $db_rights_result = PMA_DBI_query($db_rights_sql); - while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { - $db_rights_row = array_merge( $user_defaults, $db_rights_row ); + while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) { + $db_rights_row = array_merge($user_defaults, $db_rights_row); $db_rights[$db_rights_row['Db']] = $db_rights_row; } } } - PMA_DBI_free_result( $db_rights_result ); - unset( $db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row ); + PMA_DBI_free_result($db_rights_result); + unset($db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row); $sql_query = 'SELECT * FROM `mysql`.`db`' . $user_host_condition . ' ORDER BY `Db` ASC'; - $res = PMA_DBI_query( $sql_query ); + $res = PMA_DBI_query($sql_query); $sql_query = ''; - while ( $row = PMA_DBI_fetch_assoc( $res ) ) { - if ( isset( $db_rights[$row['Db']] ) ) { - $db_rights[$row['Db']] = array_merge( $db_rights[$row['Db']], $row ); + while ($row = PMA_DBI_fetch_assoc($res)) { + if (isset($db_rights[$row['Db']])) { + $db_rights[$row['Db']] = array_merge($db_rights[$row['Db']], $row); } else { $db_rights[$row['Db']] = $row; } @@ -1724,8 +1724,8 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) // so we can drop this db rights $db_rights[$row['Db']]['can_delete'] = true; } - PMA_DBI_free_result( $res ); - unset( $row, $res ); + PMA_DBI_free_result($res); + unset($row, $res); } else { @@ -1734,15 +1734,15 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) $user_host_condition .= ' AND ' . PMA_convert_using('`Db`') - .' LIKE ' . PMA_convert_using( $dbname, 'quoted' ); + .' LIKE ' . PMA_convert_using($dbname, 'quoted'); $tables_to_search_for_users = array( 'columns_priv', ); $db_rights_sqls = array(); - foreach ( $tables_to_search_for_users as $table_search_in ) { - if ( in_array( $table_search_in, $tables ) ) { + foreach ($tables_to_search_for_users as $table_search_in) { + if (in_array($table_search_in, $tables)) { $db_rights_sqls[] = ' SELECT DISTINCT `Table_name` FROM `mysql`.`' . $table_search_in . '` @@ -1753,35 +1753,35 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) $user_defaults = array( 'Table_name' => '', 'Grant_priv' => 'N', - 'privs' => array( 'USAGE' ), + 'privs' => array('USAGE'), 'Column_priv' => true, ); // for the rights $db_rights = array(); - if ( PMA_MYSQL_INT_VERSION >= 40000 ) { - $db_rights_sql = '(' . implode( ') UNION (', $db_rights_sqls ) . ')' + if (PMA_MYSQL_INT_VERSION >= 40000) { + $db_rights_sql = '(' . implode(') UNION (', $db_rights_sqls) . ')' .' ORDER BY `Table_name` ASC'; - $db_rights_result = PMA_DBI_query( $db_rights_sql ); + $db_rights_result = PMA_DBI_query($db_rights_sql); - while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { - $db_rights_row = array_merge( $user_defaults, $db_rights_row ); + while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) { + $db_rights_row = array_merge($user_defaults, $db_rights_row); $db_rights[$db_rights_row['Table_name']] = $db_rights_row; } } else { - foreach ( $db_rights_sqls as $db_rights_sql ) { - $db_rights_result = PMA_DBI_query( $db_rights_sql ); + foreach ($db_rights_sqls as $db_rights_sql) { + $db_rights_result = PMA_DBI_query($db_rights_sql); - while ( $db_rights_row = PMA_DBI_fetch_assoc( $db_rights_result ) ) { - $db_rights_row = array_merge( $user_defaults, $db_rights_row ); + while ($db_rights_row = PMA_DBI_fetch_assoc($db_rights_result)) { + $db_rights_row = array_merge($user_defaults, $db_rights_row); $db_rights[$db_rights_row['Table_name']] = $db_rights_row; } } } - PMA_DBI_free_result( $db_rights_result ); - unset( $db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row ); + PMA_DBI_free_result($db_rights_result); + unset($db_rights_sql, $db_rights_sqls, $db_rights_result, $db_rights_row); $sql_query = 'SELECT `Table_name`,' @@ -1791,58 +1791,58 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) .' FROM `mysql`.`tables_priv`' . $user_host_condition .' ORDER BY `Table_name` ASC;'; - $res = PMA_DBI_query( $sql_query ); + $res = PMA_DBI_query($sql_query); $sql_query = ''; - while ( $row = PMA_DBI_fetch_assoc( $res ) ) { - if ( isset( $db_rights[$row['Table_name']] ) ) { - $db_rights[$row['Table_name']] = array_merge( $db_rights[$row['Table_name']], $row ); + while ($row = PMA_DBI_fetch_assoc($res)) { + if (isset($db_rights[$row['Table_name']])) { + $db_rights[$row['Table_name']] = array_merge($db_rights[$row['Table_name']], $row); } else { $db_rights[$row['Table_name']] = $row; } } - PMA_DBI_free_result( $res ); - unset( $row, $res ); + PMA_DBI_free_result($res); + unset($row, $res); } - ksort( $db_rights ); + ksort($db_rights); // display rows - if ( count( $db_rights ) < 1 ) { + if (count($db_rights) < 1) { echo '<tr class="odd">' . "\n" . ' <td colspan="6"><center><i>' . $GLOBALS['strNone'] . '</i></center></td>' . "\n" . '</tr>' . "\n"; } else { $odd_row = true; $found_rows = array(); - //while ( $row = PMA_DBI_fetch_assoc( $res ) ) { - foreach ( $db_rights as $row ) { - $found_rows[] = ( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $row['Table_name']; + //while ($row = PMA_DBI_fetch_assoc($res)) { + foreach ($db_rights as $row) { + $found_rows[] = (! isset($dbname) || ! strlen($dbname)) ? $row['Db'] : $row['Table_name']; - echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n" - . ' <td>' . htmlspecialchars(( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $row['Table_name']) . '</td>' . "\n" + echo '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n" + . ' <td>' . htmlspecialchars((! isset($dbname) || ! strlen($dbname)) ? $row['Db'] : $row['Table_name']) . '</td>' . "\n" . ' <td><tt>' . "\n" . ' ' . join(',' . "\n" . ' ', PMA_extractPrivInfo($row, TRUE)) . "\n" . ' </tt></td>' . "\n" - . ' <td>' . (((( ! isset( $dbname ) || ! strlen($dbname) ) && $row['Grant_priv'] == 'Y') || (isset($dbname) && strlen($dbname) && in_array('Grant', explode(',', $row['Table_priv'])))) ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n" + . ' <td>' . ((((! isset($dbname) || ! strlen($dbname)) && $row['Grant_priv'] == 'Y') || (isset($dbname) && strlen($dbname) && in_array('Grant', explode(',', $row['Table_priv'])))) ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . '</td>' . "\n" . ' <td>'; - if ( ! empty( $row['Table_privs'] ) || ! empty ( $row['Column_priv'] ) ) { + if (! empty($row['Table_privs']) || ! empty ($row['Column_priv'])) { echo $GLOBALS['strYes']; } else { echo $GLOBALS['strNo']; } echo '</td>' . "\n" . ' <td>'; - printf( $link_edit, urlencode( $username ), - urlencode( $hostname ), - urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $dbname ), - urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? '' : $row['Table_name'] ) ); + printf($link_edit, urlencode($username), + urlencode($hostname), + urlencode((! isset($dbname) || ! strlen($dbname)) ? $row['Db'] : $dbname), + urlencode((! isset($dbname) || ! strlen($dbname)) ? '' : $row['Table_name'])); echo '</td>' . "\n" . ' <td>'; - if ( ! empty( $row['can_delete'] ) || isset( $row['Table_name'] ) && strlen($row['Table_name']) ) { - printf( $link_revoke, urlencode( $username ), - urlencode( $hostname ), - urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? $row['Db'] : $dbname ), - urlencode( ( ! isset( $dbname ) || ! strlen($dbname) ) ? '' : $row['Table_name'] ) ); + if (! empty($row['can_delete']) || isset($row['Table_name']) && strlen($row['Table_name'])) { + printf($link_revoke, urlencode($username), + urlencode($hostname), + urlencode((! isset($dbname) || ! strlen($dbname)) ? $row['Db'] : $dbname), + urlencode((! isset($dbname) || ! strlen($dbname)) ? '' : $row['Table_name'])); } echo '</td>' . "\n" . '</tr>' . "\n"; @@ -1853,16 +1853,16 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) echo '</tbody>' . "\n" . '</table>' . "\n"; - if ( ! isset( $dbname ) || ! strlen($dbname) ) { + if (! isset($dbname) || ! strlen($dbname)) { // no database name was give, display select db - if ( ! empty( $found_rows ) ) { + if (! empty($found_rows)) { $pred_db_array = array_diff( - PMA_DBI_fetch_result( 'SHOW DATABASES;' ), - $found_rows ); + PMA_DBI_fetch_result('SHOW DATABASES;'), + $found_rows); } else { - $pred_db_array =PMA_DBI_fetch_result( 'SHOW DATABASES;' ); + $pred_db_array =PMA_DBI_fetch_result('SHOW DATABASES;'); } echo ' <label for="text_dbname">' . $GLOBALS['strAddPrivilegesOnDb'] . ':</label>' . "\n"; @@ -1870,14 +1870,14 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) echo ' <select name="pred_dbname" onchange="this.form.submit();">' . "\n" . ' <option value="" selected="selected">' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"; foreach ($pred_db_array as $current_db) { - $current_db = PMA_escape_mysql_wildcards( $current_db ); - echo ' <option value="' . htmlspecialchars( $current_db ) . '">' - . htmlspecialchars( $current_db ) . '</option>' . "\n"; + $current_db = PMA_escape_mysql_wildcards($current_db); + echo ' <option value="' . htmlspecialchars($current_db) . '">' + . htmlspecialchars($current_db) . '</option>' . "\n"; } echo ' </select>' . "\n"; } echo ' <input type="text" id="text_dbname" name="dbname" />' . "\n" - .PMA_showHint( $GLOBALS['strEscapeWildcards'] ); + .PMA_showHint($GLOBALS['strEscapeWildcards']); } else { echo ' <input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '"/>' . "\n" . ' <label for="text_tablename">' . $GLOBALS['strAddPrivilegesOnTbl'] . ':</label>' . "\n"; @@ -1889,7 +1889,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) } } PMA_DBI_free_result($res); - unset( $res, $row ); + unset($res, $row); if (!empty($pred_tbl_array)) { echo ' <select name="pred_tablename" onchange="this.form.submit();">' . "\n" . ' <option value="" selected="selected">' . $GLOBALS['strUseTextField'] . ':</option>' . "\n"; @@ -1910,7 +1910,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) . '</form>' . "\n"; } - if ( ( ! isset( $dbname ) || ! strlen($dbname) ) && ! $user_does_not_exists ) { + if ((! isset($dbname) || ! strlen($dbname)) && ! $user_does_not_exists) { echo '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n" . PMA_generate_common_hidden_inputs('', '', 3) . '<input type="hidden" name="username" value="' . htmlspecialchars($username) . '" />' . "\n" @@ -1944,7 +1944,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) . '<input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<fieldset id="fieldset_change_copy_user">' . "\n" . ' <legend>' . $GLOBALS['strChangeCopyUser'] . '</legend>' . "\n"; - PMA_displayLoginInformationFields('change', 3 ); + PMA_displayLoginInformationFields('change', 3); echo ' <fieldset>' . "\n" . ' <legend>' . $GLOBALS['strChangeCopyMode'] . '</legend>' . "\n" . ' <input type="radio" name="mode" value="4" id="radio_mode_4" checked="checked" /><label for="radio_mode_4">' . "\n" @@ -1971,7 +1971,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) // Add a new user $GLOBALS['url_query'] .= '&adduser=1'; echo '<h2>' . "\n" - . ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' : '' ) + . ($GLOBALS['cfg']['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_usradd.png" width="16" height="16" alt="" />' : '') . ' ' . $GLOBALS['strAddUser'] . "\n" . '</h2>' . "\n" . '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post" onsubmit="return checkAddUser(this);">' . "\n" @@ -2001,7 +2001,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) // check the privileges for a particular database. echo '<table id="tablespecificuserrights" class="data">' . "\n" . '<caption class="tblHeaders">' . "\n" - . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usrcheck.png" width="16" height="16" alt="" />' . "\n" : '' ) + . ($GLOBALS['cfg']['PropertiesIconic'] ? ' <img class="icon" src="' . $pmaThemeImage . 'b_usrcheck.png" width="16" height="16" alt="" />' . "\n" : '') . ' ' . sprintf($GLOBALS['strUsersHavingAccessToDb'], '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n" . '</caption>' . "\n" . '<thead>' . "\n" @@ -2051,7 +2051,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) . PMA_convert_using('`Db`') . ' AS `Db`, ' . $list_of_privileges .' FROM `mysql`.`db`' - .' WHERE ' . PMA_convert_using( $checkprivs, 'quoted' ) + .' WHERE ' . PMA_convert_using($checkprivs, 'quoted') .' LIKE ' . PMA_convert_using('`Db`') .' AND NOT (' . $list_of_compared_privileges. ')) ' .'UNION ' @@ -2121,7 +2121,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) $row2 = PMA_DBI_fetch_assoc($res2); } } - echo ' <tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n" + echo ' <tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n" . ' <td'; if (count($current_privileges) > 1) { echo ' rowspan="' . count($current_privileges) . '"'; @@ -2138,7 +2138,7 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) . ' '; if (!isset($current['Db']) || $current['Db'] == '*') { echo $GLOBALS['strGlobal']; - } elseif ( $current['Db'] == PMA_escape_mysql_wildcards( $checkprivs ) ) { + } elseif ($current['Db'] == PMA_escape_mysql_wildcards($checkprivs)) { echo $GLOBALS['strDbSpecific']; } else { echo $GLOBALS['strWildcard'], ': <tt>' . htmlspecialchars($current['Db']) . '</tt>'; @@ -2154,10 +2154,10 @@ if ( empty( $adduser ) && ( ! isset( $checkprivs ) || ! strlen($checkprivs) ) ) . ' ' . ($current['Grant_priv'] == 'Y' ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . "\n" . ' </td>' . "\n" . ' <td>' . "\n"; - printf( $link_edit, urlencode( $current_user ), - urlencode( $current_host ), - urlencode( ! isset( $current['Db'] ) || $current['Db'] == '*' ? '' : $current['Db'] ), - '' ); + printf($link_edit, urlencode($current_user), + urlencode($current_host), + urlencode(! isset($current['Db']) || $current['Db'] == '*' ? '' : $current['Db']), + ''); echo '</td>' . "\n" . ' </tr>' . "\n"; } diff --git a/server_processlist.php b/server_processlist.php index a112da32da..d41e132e4c 100644 --- a/server_processlist.php +++ b/server_processlist.php @@ -38,7 +38,7 @@ require './libraries/server_links.inc.php'; * Displays the sub-page heading */ echo '<h2>' . "\n" - . ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_process.png" width="16" height="16" alt="" />' : '' ) + . ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_process.png" width="16" height="16" alt="" />' : '') . $strProcesslist . "\n" . '</h2>' . "\n"; @@ -46,10 +46,10 @@ echo '<h2>' . "\n" /** * Sends the query */ -$sql_query = 'SHOW' . ( empty( $full ) ? '' : ' FULL' ) . ' PROCESSLIST'; +$sql_query = 'SHOW' . (empty($full) ? '' : ' FULL') . ' PROCESSLIST'; $result = PMA_DBI_query($sql_query); -PMA_showMessage( $GLOBALS['strSuccess'] ); +PMA_showMessage($GLOBALS['strSuccess']); /** @@ -83,7 +83,7 @@ while($process = PMA_DBI_fetch_assoc($result)) { <td class="value"><?php echo $process['Id']; ?></td> <td><?php echo $process['User']; ?></td> <td><?php echo $process['Host']; ?></td> - <td><?php echo (( ! isset( $process['db'] ) || ! strlen($process['db']) ) ? '<i>' . $strNone . '</i>' : $process['db']); ?></td> + <td><?php echo ((! isset($process['db']) || ! strlen($process['db'])) ? '<i>' . $strNone . '</i>' : $process['db']); ?></td> <td><?php echo $process['Command']; ?></td> <td class="value"><?php echo $process['Time']; ?></td> <td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td> diff --git a/server_variables.php b/server_variables.php index 40a8058538..ac18cea84f 100644 --- a/server_variables.php +++ b/server_variables.php @@ -8,8 +8,8 @@ /** * */ -if ( ! defined( 'PMA_NO_VARIABLES_IMPORT' ) ) { - define( 'PMA_NO_VARIABLES_IMPORT', true ); +if (! defined('PMA_NO_VARIABLES_IMPORT')) { + define('PMA_NO_VARIABLES_IMPORT', true); } require_once './libraries/common.inc.php'; @@ -29,7 +29,7 @@ require './libraries/server_links.inc.php'; * Displays the sub-page heading */ echo '<h2>' . "\n" - . ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_vars.png" width="16" height="16" alt="" />' : '' ) + . ($cfg['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_vars.png" width="16" height="16" alt="" />' : '') . '' . $strServerVars . "\n" . '</h2>' . "\n"; diff --git a/tbl_alter.php b/tbl_alter.php index 520e024e76..8fa3d28802 100644 --- a/tbl_alter.php +++ b/tbl_alter.php @@ -199,8 +199,8 @@ if ($abort == FALSE) { $show_create_table = PMA_DBI_fetch_value( 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), - 0, 1 ); - $analyzed_sql = PMA_SQP_analyze( PMA_SQP_parse( $show_create_table ) ); + 0, 1); + $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); require './libraries/tbl_properties.inc.php'; } diff --git a/tbl_change.php b/tbl_change.php index 3480665d02..c6b641ff26 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -126,8 +126,8 @@ require_once './libraries/tbl_links.inc.php'; */ $show_create_table = PMA_DBI_fetch_value( 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), - 0, 1 ); -$analyzed_sql = PMA_SQP_analyze( PMA_SQP_parse( $show_create_table ) ); + 0, 1); +$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); unset($show_create_table); /** @@ -366,9 +366,9 @@ foreach ($loop_array as $vrowcount => $vrow) { // Note: (tested in MySQL 4.0.16): when lang is some UTF-8, // $row_table_def['Default'] is not set if it contains NULL: - // Array ( [Field] => d [Type] => datetime [Null] => YES [Key] => [Extra] => [True_Type] => datetime ) + // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Extra] => [True_Type] => datetime) // but, look what we get if we switch to iso: (Default is NULL) - // Array ( [Field] => d [Type] => datetime [Null] => YES [Key] => [Default] => [Extra] => [True_Type] => datetime ) + // Array ([Field] => d [Type] => datetime [Null] => YES [Key] => [Default] => [Extra] => [True_Type] => datetime) // so I force a NULL into it (I don't think it's possible // to have an empty default value for DATETIME) // then, the "if" after this one will work @@ -533,7 +533,7 @@ foreach ($loop_array as $vrowcount => $vrow) { // Is current function defined as default? // For MySQL < 4.1.2, for the first timestamp we set as // default function the one defined in config (which - // should be NOW() ). + // should be NOW()). // For MySQL >= 4.1.2, we don't set the default function // if there is a default value for the timestamp // (not including CURRENT_TIMESTAMP) @@ -596,7 +596,7 @@ foreach ($loop_array as $vrowcount => $vrow) { } echo ' />' . "\n"; - if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary)) ) { + if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary))) { echo ' <input type="checkbox" tabindex="' . ($tabindex + $tabindex_for_null) . '"' . ' name="fields_null' . $field_name_appendix . '"'; @@ -915,7 +915,7 @@ foreach ($loop_array as $vrowcount => $vrow) { echo '</td>'; - } // end elseif ( binary or blob) + } // end elseif (binary or blob) else { // field size should be at least 4 and max 40 $fieldsize = min(max($len, 4), 40); diff --git a/tbl_export.php b/tbl_export.php index 9a553ae102..d7d000a1a4 100644 --- a/tbl_export.php +++ b/tbl_export.php @@ -56,7 +56,7 @@ if (! empty($sql_query)) { $wheres[] = $analyzed_sql[0]['where_clause']; } - if (count($wheres) > 0 ) { + if (count($wheres) > 0) { $sql_query .= ' WHERE (' . implode(') AND (', $wheres) . ')'; } diff --git a/tbl_indexes.php b/tbl_indexes.php index f846c24849..2a0ec52c29 100644 --- a/tbl_indexes.php +++ b/tbl_indexes.php @@ -23,8 +23,8 @@ if (!defined('PMA_IDX_INCLUDED')) { $is_db = PMA_DBI_select_db($db); } if (!strlen($db) || !$is_db) { - $uri_params = array( 'reload' => '1' ); - if ( isset($message) ) { + $uri_params = array('reload' => '1'); + if (isset($message)) { $uri_params['message'] = $message; } PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php' @@ -32,21 +32,21 @@ if (!defined('PMA_IDX_INCLUDED')) { exit; } // Not a valid table name -> back to the default db sub-page - if (strlen($table) ) { + if (strlen($table)) { $is_table = PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'', null, PMA_DBI_QUERY_STORE); } if (! strlen($table) - || !( $is_table && PMA_DBI_num_rows($is_table) ) ) { - $uri_params = array( 'reload' => '1', 'db' => $db ); - if ( isset($message) ) { + || !($is_table && PMA_DBI_num_rows($is_table))) { + $uri_params = array('reload' => '1', 'db' => $db); + if (isset($message)) { $uri_params['message'] = $message; } PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . $cfg['DefaultTabDatabase'] . PMA_generate_common_url($uri_params, '&')); exit; - } elseif ( isset($is_table) ) { + } elseif (isset($is_table)) { PMA_DBI_free_result($is_table); } @@ -347,7 +347,7 @@ elseif (!defined('PMA_IDX_INCLUDED') . '<option value="' . htmlspecialchars($val) . '"' . (($val == $selected) ? ' selected="selected"' : '') . '>' . htmlspecialchars($val) . (($add_type) ? ' [' - . $fields_types[$key] . ']' : '' ) . '</option>' . "\n"; + . $fields_types[$key] . ']' : '') . '</option>' . "\n"; } } // end foreach $fields_names ?> @@ -393,7 +393,7 @@ elseif (!defined('PMA_IDX_INCLUDED') '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidColumnCount']); ?>', 1)"> <?php - echo PMA_generate_common_hidden_inputs( $db, $table ); + echo PMA_generate_common_hidden_inputs($db, $table); ?> <table id="table_indexes" class="data"> <caption class="tblHeaders"> diff --git a/tbl_printview.php b/tbl_printview.php index e3e9178d29..3d1540edee 100644 --- a/tbl_printview.php +++ b/tbl_printview.php @@ -256,7 +256,7 @@ foreach ($the_tables as $key => $table) { if ($have_rel) { echo ' <td>'; if (isset($res_rel[$field_name])) { - echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'] ); + echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']); } echo ' </td>' . "\n"; } @@ -288,9 +288,8 @@ foreach ($the_tables as $key => $table) { <?php - if ( ! $tbl_is_view - && ( $db != 'information_schema' - || PMA_MYSQL_INT_VERSION < 50002 ) ) { + if (! $tbl_is_view + && ($db != 'information_schema' || PMA_MYSQL_INT_VERSION < 50002)) { /** * Displays indexes diff --git a/tbl_relation.php b/tbl_relation.php index 11387a825b..4d13362e96 100644 --- a/tbl_relation.php +++ b/tbl_relation.php @@ -124,7 +124,7 @@ if (isset($destination) && $cfgRelation['relwork']) { } // end if (updates for internal relations) // u p d a t e s f o r I n n o D B -// ( for now, one index name only; we keep the definitions if the +// (for now, one index name only; we keep the definitions if the // foreign db is not the same) // I use $sql_query to be able to display directly the query via // PMA_showMessage() @@ -142,7 +142,7 @@ if (isset($_REQUEST['destination_innodb'])) { // could be put in an include file // Note: I tried to enclose the db and table name with // backquotes but MySQL 4.0.16 did not like the syntax - // (for example: `base2`.`table1` ) + // (for example: `base2`.`table1`) $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FOREIGN KEY (' @@ -163,8 +163,8 @@ if (isset($_REQUEST['destination_innodb'])) { // end repeated code } elseif (($existrel_innodb[$master_field]['foreign_db'] . '.' .$existrel_innodb[$master_field]['foreign_table'] . '.' . $existrel_innodb[$master_field]['foreign_field'] != $foreign_string) - || ( $_REQUEST['on_delete'][$master_field] != (!empty($existrel_innodb[$master_field]['on_delete']) ? $existrel_innodb[$master_field]['on_delete'] : '')) - || ( $_REQUEST['on_update'][$master_field] != (!empty($existrel_innodb[$master_field]['on_update']) ? $existrel_innodb[$master_field]['on_update'] : '')) + || ($_REQUEST['on_delete'][$master_field] != (!empty($existrel_innodb[$master_field]['on_delete']) ? $existrel_innodb[$master_field]['on_delete'] : '')) + || ($_REQUEST['on_update'][$master_field] != (!empty($existrel_innodb[$master_field]['on_update']) ? $existrel_innodb[$master_field]['on_update'] : '')) ) { // another foreign key is already defined for this field // or @@ -400,14 +400,14 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) { <table> <tr><th></th> <?php - if ( $cfgRelation['relwork'] ) { + if ($cfgRelation['relwork']) { echo '<th>' . $strInternalRelations; if ($tbl_type=='INNODB') { - echo PMA_showHint( $strInternalNotNecessary ); + echo PMA_showHint($strInternalNotNecessary); } echo '</th>'; } - if ( $tbl_type=='INNODB' ) { + if ($tbl_type=='INNODB') { echo '<th colspan="2">InnoDB'; if (PMA_MYSQL_INT_VERSION < 40013) { echo '(**)'; @@ -506,7 +506,7 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) { PMA_generate_dropdown('ON DELETE', 'on_delete[' . htmlspecialchars($save_row[$i]['Field']) . ']', $options_array, - isset($existrel_innodb[$myfield]['on_delete']) ? $existrel_innodb[$myfield]['on_delete']: '' ); + isset($existrel_innodb[$myfield]['on_delete']) ? $existrel_innodb[$myfield]['on_delete']: ''); echo '</span>' . "\n" .'<span class="formelement">' . "\n"; @@ -514,7 +514,7 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) { PMA_generate_dropdown('ON UPDATE', 'on_update[' . htmlspecialchars($save_row[$i]['Field']) . ']', $options_array, - isset($existrel_innodb[$myfield]['on_update']) ? $existrel_innodb[$myfield]['on_update']: '' ); + isset($existrel_innodb[$myfield]['on_update']) ? $existrel_innodb[$myfield]['on_update']: ''); echo '</span>' . "\n"; } else { echo $strNoIndex; @@ -558,7 +558,7 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) { <?php } // end if (we have columns in this table) -if ( $tbl_type === 'INNODB' && PMA_MYSQL_INT_VERSION < 40013 ) { +if ($tbl_type === 'INNODB' && PMA_MYSQL_INT_VERSION < 40013) { echo '<div class="warning">' .'** ' . sprintf($strUpgrade, 'MySQL', '4.0.13') .'</div>'; diff --git a/tbl_select.php b/tbl_select.php index 9439117c96..60252b0b80 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -12,7 +12,7 @@ require_once './libraries/common.inc.php'; require_once './libraries/relation.lib.php'; // foreign keys require_once './libraries/mysql_charsets.lib.php'; -if ( $GLOBALS['cfg']['PropertiesIconic'] == true ) { +if ($GLOBALS['cfg']['PropertiesIconic'] == true) { $titles['Browse'] = '<img class="icon" width="16" height="16" src="' . $pmaThemeImage .'b_browse.png" alt="' . $strBrowseForeignValues . '" title="' @@ -99,7 +99,7 @@ if (!isset($param) || $param[0] == '') { function PMA_tbl_select_operator(f, index, multiple) { switch (f.elements["func[" + index + "]"].options[f.elements["func[" + index + "]"].selectedIndex].value) { <?php -reset( $GLOBALS['cfg']['UnaryOperators'] ); +reset($GLOBALS['cfg']['UnaryOperators']); while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) { echo ' case "' . $operator . "\":\r\n"; } @@ -127,10 +127,10 @@ while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) { multiple="multiple"> <?php // Displays the list of the fields - foreach ( $fields_list as $each_field ) { + foreach ($fields_list as $each_field) { echo ' ' - .'<option value="' . htmlspecialchars( $each_field ) . '"' - .' selected="selected">' . htmlspecialchars( $each_field ) + .'<option value="' . htmlspecialchars($each_field) . '"' + .' selected="selected">' . htmlspecialchars($each_field) .'</option>' . "\n"; } ?> @@ -150,10 +150,10 @@ while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) { <select name="orderField" style="vertical-align: middle"> <option value="--nil--"></option> <?php - foreach ( $fields_list as $each_field ) { + foreach ($fields_list as $each_field) { echo ' ' - .'<option value="' . htmlspecialchars( $each_field ) . '">' - .htmlspecialchars( $each_field ) . '</option>' . "\n"; + .'<option value="' . htmlspecialchars($each_field) . '">' + .htmlspecialchars($each_field) . '</option>' . "\n"; } // end for ?> </select> @@ -334,9 +334,9 @@ else { if (count($param) == $max_number_of_fields) { $sql_query .= '* '; } else { - $param = PMA_backquote( $param ); - $sql_query .= implode( ', ', $param ); - unset( $param ); + $param = PMA_backquote($param); + $sql_query .= implode(', ', $param); + unset($param); } // end if $sql_query .= ' FROM ' . PMA_backquote($table); diff --git a/themes/darkblue_orange/css/theme_right.css.php b/themes/darkblue_orange/css/theme_right.css.php index c86e2baf0d..29e1f4ac13 100644 --- a/themes/darkblue_orange/css/theme_right.css.php +++ b/themes/darkblue_orange/css/theme_right.css.php @@ -377,10 +377,10 @@ div.notice { margin: 0.5em 0 0.5em 0; border: 0.1em solid #FFD700; width: 90%; - <?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> + <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?> background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_notice.png); background-repeat: no-repeat; - <?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> + <?php if ($GLOBALS['text_dir'] === 'ltr') { ?> background-position: 10px 50%; padding: 10px 10px 10px 36px; <?php } else { ?> @@ -408,10 +408,10 @@ div.warning { margin: 0.5em 0 0.5em 0; border: 0.1em solid #CC0000; width: 90%; - <?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> + <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?> background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_warn.png); background-repeat: no-repeat; - <?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> + <?php if ($GLOBALS['text_dir'] === 'ltr') { ?> background-position: 10px 50%; padding: 10px 10px 10px 36px; <?php } else { ?> @@ -439,10 +439,10 @@ div.error { margin: 0.5em 0 0.5em 0; border: 0.1em solid #ff0000; width: 90%; - <?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> + <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?> background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_error.png); background-repeat: no-repeat; - <?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> + <?php if ($GLOBALS['text_dir'] === 'ltr') { ?> background-position: 10px 50%; padding: 10px 10px 10px 36px; <?php } else { ?> @@ -470,10 +470,10 @@ fieldset.confirmation legend { border-left: 0.1em solid #FF0000; border-right: 0.1em solid #FF0000; font-weight: bold; - <?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> + <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?> background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_really.png); background-repeat: no-repeat; - <?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> + <?php if ($GLOBALS['text_dir'] === 'ltr') { ?> background-position: 5px 50%; padding: 0.2em 0.2em 0.2em 25px; <?php } else { ?> @@ -619,7 +619,7 @@ a.tabcaution:hover { background-color: #FF0000; } -<?php if ( $GLOBALS['cfg']['LightTabs'] ) { ?> +<?php if ($GLOBALS['cfg']['LightTabs']) { ?> /* active tab */ a.tabactive { color: black; diff --git a/themes/original/css/theme_left.css.php b/themes/original/css/theme_left.css.php index a4a56ebd02..8f646e719d 100644 --- a/themes/original/css/theme_left.css.php +++ b/themes/original/css/theme_left.css.php @@ -74,7 +74,7 @@ ul#databaseList { border-bottom: 0.05em solid <?php echo $GLOBALS['cfg']['NaviColor']; ?>; margin-bottom: 0.5em; padding-bottom: 0.5em; - padding-left: 1.5em; + padding-left: 1.5em; } ul#databaseList a { @@ -165,7 +165,7 @@ div#left_tableList > ul li.marked { } <?php } ?> -<?php if ( $GLOBALS['cfg']['LeftPointerEnable'] ) { ?> +<?php if ($GLOBALS['cfg']['LeftPointerEnable']) { ?> div#left_tableList > ul li:hover > a, div#left_tableList > ul li:hover { background: <?php echo $GLOBALS['cfg']['NaviPointerBackground']; ?>; diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php index 148199ce11..be0e56b9a8 100644 --- a/themes/original/css/theme_right.css.php +++ b/themes/original/css/theme_right.css.php @@ -352,10 +352,10 @@ h1.notice, div.notice { margin: 0.5em 0 0.5em 0; border: 0.1em solid #FFD700; - <?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> + <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?> background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_notice.png); background-repeat: no-repeat; - <?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> + <?php if ($GLOBALS['text_dir'] === 'ltr') { ?> background-position: 10px 50%; padding: 10px 10px 10px 36px; <?php } else { ?> @@ -382,10 +382,10 @@ h1.warning, div.warning { margin: 0.5em 0 0.5em 0; border: 0.1em solid #CC0000; - <?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> + <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?> background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_warn.png); background-repeat: no-repeat; - <?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> + <?php if ($GLOBALS['text_dir'] === 'ltr') { ?> background-position: 10px 50%; padding: 10px 10px 10px 36px; <?php } else { ?> @@ -412,10 +412,10 @@ h1.error, div.error { margin: 0.5em 0 0.5em 0; border: 0.1em solid #ff0000; - <?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> + <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?> background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_error.png); background-repeat: no-repeat; - <?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> + <?php if ($GLOBALS['text_dir'] === 'ltr') { ?> background-position: 10px 50%; padding: 10px 10px 10px 36px; <?php } else { ?> @@ -443,10 +443,10 @@ fieldset.confirmation legend { border-left: 0.1em solid #FF0000; border-right: 0.1em solid #FF0000; font-weight: bold; - <?php if ( $GLOBALS['cfg']['ErrorIconic'] ) { ?> + <?php if ($GLOBALS['cfg']['ErrorIconic']) { ?> background-image: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>s_really.png); background-repeat: no-repeat; - <?php if ( $GLOBALS['text_dir'] === 'ltr' ) { ?> + <?php if ($GLOBALS['text_dir'] === 'ltr') { ?> background-position: 5px 50%; padding: 0.2em 0.2em 0.2em 25px; <?php } else { ?> @@ -591,7 +591,7 @@ a.tabcaution:hover { background-color: #FF0000; } -<?php if ( $GLOBALS['cfg']['LightTabs'] ) { ?> +<?php if ($GLOBALS['cfg']['LightTabs']) { ?> /* active tab */ a.tabactive { color: black; diff --git a/transformation_wrapper.php b/transformation_wrapper.php index 1bcd43931f..a2f669f494 100644 --- a/transformation_wrapper.php +++ b/transformation_wrapper.php @@ -79,8 +79,8 @@ if (!isset($resize)) { // it sets $resize to jpeg or png $srcImage = imagecreatefromstring($row[urldecode($transform_key)]); - $srcWidth = ImageSX( $srcImage ); - $srcHeight = ImageSY( $srcImage ); + $srcWidth = ImageSX($srcImage); + $srcHeight = ImageSY($srcImage); // Check to see if the width > height or if width < height // if so adjust accordingly to make sure the image @@ -98,21 +98,21 @@ if (!isset($resize)) { } if ($resize) { - $destImage = ImageCreateTrueColor( $destWidth, $destHeight); + $destImage = ImageCreateTrueColor($destWidth, $destHeight); } -// ImageCopyResized( $destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight ); +// ImageCopyResized($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight); // better quality but slower: - ImageCopyResampled( $destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight ); + ImageCopyResampled($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight); if ($resize == 'jpeg') { - ImageJPEG( $destImage, '', 75 ); + ImageJPEG($destImage, '', 75); } if ($resize == 'png') { - ImagePNG( $destImage); + ImagePNG($destImage); } - ImageDestroy( $srcImage ); - ImageDestroy( $destImage ); + ImageDestroy($srcImage); + ImageDestroy($destImage); } /** diff --git a/view_create.php b/view_create.php index b950fe756d..ee0940db36 100644 --- a/view_create.php +++ b/view_create.php @@ -32,7 +32,7 @@ if (isset($_POST['submitoptions'])) { $create_query .= ' VIEW ' . $_POST['view_name'] . $sep; if (!empty($_POST['column_names'])) { - $create_query .= ' ( ' . $_POST['column_names'] . ')' . $sep; + $create_query .= ' (' . $_POST['column_names'] . ')' . $sep; } $create_query .= ' AS ' . $_POST['sql_statement'] . $sep; |