diff --git a/ChangeLog b/ChangeLog index 37671bbb10..1ce49af925 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,6 +54,7 @@ phpMyAdmin - ChangeLog - bug #3404886 [navi] Edit SQL statement after error - bug #3403165 [interface] Collation not displayed for long enum fields - bug #3399951 [export] Config for export compression not used +- bug #3400690 [privileges] DB-specific privileges won't submit 3.4.5.0 (2011-09-14) - bug #3375325 [interface] Page list in navigation frame looks odd diff --git a/db_structure.php b/db_structure.php index 8673471ab0..b46fe297b4 100644 --- a/db_structure.php +++ b/db_structure.php @@ -22,7 +22,8 @@ $GLOBALS['js_include'][] = 'jquery/timepicker.js'; if (empty($is_info)) { // Drops/deletes/etc. multiple tables if required if ((!empty($submit_mult) && isset($selected_tbl)) - || isset($mult_btn)) { + || isset($mult_btn) + ) { $action = 'db_structure.php'; $err_url = 'db_structure.php?'. PMA_generate_common_url($db); @@ -96,7 +97,10 @@ if (isset($_REQUEST['sort_order'])) { $_url_params['sort_order'] = $_REQUEST['sort_order']; } -PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']); +PMA_listNavigator( + $total_num_tables, $pos, $_url_params, 'db_structure.php', + 'frame_content', $GLOBALS['cfg']['MaxTableList'] +); ?>
@@ -110,7 +114,9 @@ $sum_size = (double) 0; $overhead_size = (double) 0; $overhead_check = ''; $checked = !empty($checkall) ? ' checked="checked"' : ''; -$num_columns = $cfg['PropertiesNumColumns'] > 1 ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 : 0; +$num_columns = $cfg['PropertiesNumColumns'] > 1 + ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 + : 0; $row_count = 0; @@ -139,83 +145,88 @@ foreach ($tables as $keyname => $each_table) { switch ( $each_table['ENGINE']) { // MyISAM, ISAM or Heap table: Row count, data size and index size // are accurate; data size is accurate for ARCHIVE - case 'MyISAM' : - case 'ISAM' : - case 'HEAP' : - case 'MEMORY' : - case 'ARCHIVE' : - case 'Aria' : - case 'Maria' : - if ($db_is_information_schema) { - $each_table['Rows'] = PMA_Table::countRecords($db, - $each_table['Name']); - } + case 'MyISAM' : + case 'ISAM' : + case 'HEAP' : + case 'MEMORY' : + case 'ARCHIVE' : + case 'Aria' : + case 'Maria' : + if ($db_is_information_schema) { + $each_table['Rows'] = PMA_Table::countRecords( + $db, $each_table['Name'] + ); + } - if ($is_show_stats) { - $tblsize = doubleval($each_table['Data_length']) + doubleval($each_table['Index_length']); - $sum_size += $tblsize; - list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0); - if (isset($each_table['Data_free']) && $each_table['Data_free'] > 0) { - list($formatted_overhead, $overhead_unit) = PMA_formatByteDown($each_table['Data_free'], 3, ($each_table['Data_free'] > 0) ? 1 : 0); - $overhead_size += $each_table['Data_free']; - } + if ($is_show_stats) { + $tblsize = doubleval($each_table['Data_length']) + doubleval($each_table['Index_length']); + $sum_size += $tblsize; + list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0); + if (isset($each_table['Data_free']) && $each_table['Data_free'] > 0) { + list($formatted_overhead, $overhead_unit) = PMA_formatByteDown($each_table['Data_free'], 3, ($each_table['Data_free'] > 0) ? 1 : 0); + $overhead_size += $each_table['Data_free']; } - break; - case 'InnoDB' : - case 'PBMS' : - // InnoDB table: Row count is not accurate but data and index sizes are. - // PBMS table in Drizzle: TABLE_ROWS is taken from table cache, so it may be unavailable + } + break; + case 'InnoDB' : + case 'PBMS' : + // InnoDB table: Row count is not accurate but data and index sizes are. + // PBMS table in Drizzle: TABLE_ROWS is taken from table cache, so it may be unavailable - if (($each_table['ENGINE'] == 'InnoDB' && $each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) - || !isset($each_table['TABLE_ROWS'])) { - $each_table['COUNTED'] = true; - $each_table['TABLE_ROWS'] = PMA_Table::countRecords($db, - $each_table['TABLE_NAME'], $force_exact = true, - $is_view = false); - } else { - $each_table['COUNTED'] = false; - } + if (($each_table['ENGINE'] == 'InnoDB' + && $each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) + || !isset($each_table['TABLE_ROWS']) + ) { + $each_table['COUNTED'] = true; + $each_table['TABLE_ROWS'] = PMA_Table::countRecords( + $db, $each_table['TABLE_NAME'], + $force_exact = true, $is_view = false + ); + } else { + $each_table['COUNTED'] = false; + } - // Drizzle doesn't provide data and index length, check for null - if ($is_show_stats && $each_table['Data_length'] !== null) { - $tblsize = $each_table['Data_length'] + $each_table['Index_length']; - $sum_size += $tblsize; - list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0); - } - //$display_rows = ' - '; - break; - // Mysql 5.0.x (and lower) uses MRG_MyISAM and MySQL 5.1.x (and higher) uses MRG_MYISAM - // Both are aliases for MERGE - case 'MRG_MyISAM' : - case 'MRG_MYISAM' : - case 'MERGE' : - case 'BerkeleyDB' : - // Merge or BerkleyDB table: Only row count is accurate. - if ($is_show_stats) { - $formatted_size = ' - '; - $unit = ''; - } - break; - // for a view, the ENGINE is sometimes reported as null, - // or on some servers it's reported as "SYSTEM VIEW" - case null : - case 'SYSTEM VIEW' : - case 'FunctionEngine' : - // if table is broken, Engine is reported as null, so one more test - if ($each_table['TABLE_TYPE'] == 'VIEW') { - // countRecords() takes care of $cfg['MaxExactCountViews'] - $each_table['TABLE_ROWS'] = PMA_Table::countRecords($db, - $each_table['TABLE_NAME'], $force_exact = true, - $is_view = true); - $table_is_view = true; - } - break; - default : - // Unknown table type. - if ($is_show_stats) { - $formatted_size = 'unknown'; - $unit = ''; - } + // Drizzle doesn't provide data and index length, check for null + if ($is_show_stats && $each_table['Data_length'] !== null) { + $tblsize = $each_table['Data_length'] + $each_table['Index_length']; + $sum_size += $tblsize; + list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0); + } + //$display_rows = ' - '; + break; + // Mysql 5.0.x (and lower) uses MRG_MyISAM and MySQL 5.1.x (and higher) uses MRG_MYISAM + // Both are aliases for MERGE + case 'MRG_MyISAM' : + case 'MRG_MYISAM' : + case 'MERGE' : + case 'BerkeleyDB' : + // Merge or BerkleyDB table: Only row count is accurate. + if ($is_show_stats) { + $formatted_size = ' - '; + $unit = ''; + } + break; + // for a view, the ENGINE is sometimes reported as null, + // or on some servers it's reported as "SYSTEM VIEW" + case null : + case 'SYSTEM VIEW' : + case 'FunctionEngine' : + // if table is broken, Engine is reported as null, so one more test + if ($each_table['TABLE_TYPE'] == 'VIEW') { + // countRecords() takes care of $cfg['MaxExactCountViews'] + $each_table['TABLE_ROWS'] = PMA_Table::countRecords( + $db, $each_table['TABLE_NAME'], + $force_exact = true, $is_view = true + ); + $table_is_view = true; + } + break; + default : + // Unknown table type. + if ($is_show_stats) { + $formatted_size = 'unknown'; + $unit = ''; + } } // end switch if (! PMA_Table::isMerge($db, $each_table['TABLE_NAME'])) { @@ -254,7 +265,8 @@ foreach ($tables as $keyname => $each_table) { $row_count++; if ($table_is_view) { - $hidden_fields[] = ''; + $hidden_fields[] = ''; } if ($each_table['TABLE_ROWS'] > 0 || $table_is_view) { @@ -287,20 +299,27 @@ foreach ($tables as $keyname => $each_table) { . ' ' . PMA_backquote($each_table['TABLE_NAME']); $drop_message = sprintf( $table_is_view ? __('View %s has been dropped') : __('Table %s has been dropped'), - str_replace(' ', ' ', htmlspecialchars($each_table['TABLE_NAME']))); + str_replace(' ', ' ', htmlspecialchars($each_table['TABLE_NAME'])) + ); } $tracking_icon = ''; if (PMA_Tracker::isActive()) { if (PMA_Tracker::isTracked($GLOBALS["db"], $truename)) { - $tracking_icon = '' . __('Tracking is active.') . ''; + $tracking_icon = ''
+                . __('Tracking is active.') . ''; } elseif (PMA_Tracker::getVersion($GLOBALS["db"], $truename) > 0) { - $tracking_icon = '' . __('Tracking is not active.') . ''; + $tracking_icon = ''
+                . __('Tracking is not active.') . ''; } } - if ($num_columns > 0 && $num_tables > $num_columns - && (($row_count % $num_columns) == 0)) { + if ($num_columns > 0 + && $num_tables > $num_columns + && ($row_count % $num_columns) == 0 + ) { $row_count = 1; $odd_row = true; ?> @@ -325,17 +344,23 @@ foreach ($tables as $keyname => $each_table) { } foreach ($server_slave_Wild_Do_Table as $db_table) { $table_part = PMA_extract_db_or_table($db_table, 'table'); - if (($db == PMA_extract_db_or_table($db_table, 'db')) && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename))) { + if (($db == PMA_extract_db_or_table($db_table, 'db')) + && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename)) + ) { $do = true; } } //////////////////////////////////////////////////////////////////// - if ((strlen(array_search($truename, $server_slave_Ignore_Table)) > 0) || (strlen(array_search($db, $server_slave_Ignore_DB)) > 0)) { + if ((strlen(array_search($truename, $server_slave_Ignore_Table)) > 0) + || (strlen(array_search($db, $server_slave_Ignore_DB)) > 0) + ) { $ignored = true; } foreach ($server_slave_Wild_Ignore_Table as $db_table) { $table_part = PMA_extract_db_or_table($db_table, 'table'); - if (($db == PMA_extract_db_or_table($db_table)) && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename))) { + if (($db == PMA_extract_db_or_table($db_table)) + && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename)) + ) { $ignored = true; } } @@ -350,7 +375,13 @@ foreach ($tables as $keyname => $each_table) { - ' : ''. $do ? ' REPLICATED' : ''; ?> + ' + : ''. + $do + ? ' REPLICATED' + : ''; ?> @@ -380,10 +411,20 @@ foreach ($tables as $keyname => $each_table) { if ($table_is_view) { // Drizzle views use FunctionEngine, and the only place where they are available are I_S and D_D // schemas, where we do exact counting - if ($each_table['TABLE_ROWS'] >= $GLOBALS['cfg']['MaxExactCountViews'] && $each_table['ENGINE'] != 'FunctionEngine') { + if ($each_table['TABLE_ROWS'] >= $GLOBALS['cfg']['MaxExactCountViews'] + && $each_table['ENGINE'] != 'FunctionEngine' + ) { $row_count_pre = '~'; $sum_row_count_pre = '~'; - $show_superscript = PMA_showHint(PMA_sanitize(sprintf(__('This view has at least this number of rows. Please refer to %sdocumentation%s.'), '[a@./Documentation.html#cfg_MaxExactCountViews@_blank]', '[/a]'))); + $show_superscript = PMA_showHint( + PMA_sanitize( + sprintf( + __('This view has at least this number of rows. Please refer to %sdocumentation%s.'), + '[a@./Documentation.html#cfg_MaxExactCountViews@_blank]', + '[/a]' + ) + ) + ); } } elseif ($each_table['ENGINE'] == 'InnoDB' && (! $each_table['COUNTED'])) { // InnoDB table: we did not get an accurate row count @@ -437,10 +478,13 @@ if ($is_show_stats) { 1)) { $default_engine = PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'storage_engine\';', 0, 1); echo ' ' . "\n" . ' ' .$default_engine . '' . "\n"; + . sprintf(__('%s is the default storage engine on this MySQL server.'), $default_engine) + . '">' .$default_engine . '' . "\n"; // we got a case where $db_collation was empty echo ' ' . "\n"; if (! empty($db_collation)) { @@ -545,7 +590,10 @@ if (!$db_is_information_schema && !$cfg['DisableMultiTableMaintenance']) {
diff --git a/js/server_privileges.js b/js/server_privileges.js index c695dab478..738d64b821 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -385,7 +385,7 @@ $(document).ready(function() { * @memberOf jQuery * @name edit_user_submit */ - $("#edit_user_dialog").find("form").live('submit', function(event) { + $("#edit_user_dialog").find("form:not(#db_or_table_specific_priv)").live('submit', function(event) { /** @lends jQuery */ event.preventDefault(); diff --git a/server_privileges.php b/server_privileges.php index 2735de9fba..c1a1d835a9 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -112,17 +112,17 @@ if (isset($dbname)) { /** * Checks if the user is allowed to do what he tries to... */ -if (!$is_superuser) { - require './libraries/server_links.inc.php'; +if (! $is_superuser) { + include './libraries/server_links.inc.php'; echo '

' . "\n" . PMA_getIcon('b_usrlist.png') . __('Privileges') . "\n" . '

' . "\n"; PMA_Message::error(__('No Privileges'))->display(); - require './libraries/footer.inc.php'; + include './libraries/footer.inc.php'; } -$random_n = mt_rand(0,1000000); // a random number that will be appended to the id of the user forms +$random_n = mt_rand(0, 1000000); // a random number that will be appended to the id of the user forms /** * Escapes wildcard in a database+table specification @@ -134,8 +134,9 @@ $random_n = mt_rand(0,1000000); // a random number that will be appended to the * no escaping (for example test_db) but in mysql.db you'll see test\_db * for a db-specific privilege. * - * @param string $dbname Database name - * @param string $tablename Table name + * @param string $dbname Database name + * @param string $tablename Table name + * * @return string the escaped (if necessary) database.table */ function PMA_wildcardEscapeForGrant($dbname, $tablename) @@ -158,14 +159,15 @@ function PMA_wildcardEscapeForGrant($dbname, $tablename) /** * Generates a condition on the user name * - * @param string the user's initial + * @param string $initial the user's initial + * * @return string the generated condition */ function PMA_rangeOfUsers($initial = '') { // strtolower() is used because the User field // might be BINARY, so LIKE would be case sensitive - if (!empty($initial)) { + if (! empty($initial)) { $ret = " WHERE `User` LIKE '" . PMA_sqlAddSlashes($initial, true) . "%'" . " OR `User` LIKE '" . PMA_sqlAddSlashes(strtolower($initial), true) . "%'"; } else { @@ -307,10 +309,11 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false) __('Allows executing stored routines.')), ); - if (!empty($row) && isset($row['Table_priv'])) { + if (! empty($row) && isset($row['Table_priv'])) { $row1 = PMA_DBI_fetch_single_row( 'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', - 'ASSOC', $GLOBALS['userlink']); + 'ASSOC', $GLOBALS['userlink'] + ); $av_grants = explode('\',\'', substr($row1['Type'], 5, strlen($row1['Type']) - 7)); unset($row1); $users_grants = explode(',', $row['Table_priv']); @@ -324,10 +327,10 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false) $privs = array(); $allPrivileges = true; foreach ($grants as $current_grant) { - if ((!empty($row) && isset($row[$current_grant[0]])) + if ((! empty($row) && isset($row[$current_grant[0]])) || (empty($row) && isset($GLOBALS[$current_grant[0]])) ) { - if ((!empty($row) && $row[$current_grant[0]] == 'Y') + if ((! empty($row) && $row[$current_grant[0]] == 'Y') || (empty($row) && ($GLOBALS[$current_grant[0]] == 'Y' || (is_array($GLOBALS[$current_grant[0]]) @@ -339,7 +342,7 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false) } else { $privs[] = $current_grant[1]; } - } elseif (!empty($GLOBALS[$current_grant[0]]) + } elseif (! empty($GLOBALS[$current_grant[0]]) && is_array($GLOBALS[$current_grant[0]]) && empty($GLOBALS[$current_grant[0] . '_none'])) { if ($enableHTML) { @@ -375,31 +378,31 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false) function PMA_display_column_privs($columns, $row, $name_for_select, $priv_for_header, $name, $name_for_dfn, $name_for_current) { - echo '
' . "\n" - . '
' . "\n" - . ' ' . "\n"; - foreach ($columns as $current_column => $current_column_privileges) { - echo ' ' . "\n"; + foreach ($columns as $current_column => $current_column_privileges) { + echo ' ' . "\n"; + } - echo ' ' . "\n" - . ' ' . __('Or') . '' . "\n" - . ' ' . "\n" - . '
' . "\n"; + echo ' ' . "\n" + . ' ' . __('Or') . '' . "\n" + . ' ' . "\n" + . ' ' . "\n"; } // end function @@ -409,6 +412,7 @@ function PMA_display_column_privs($columns, $row, $name_for_select, * @param string $db the database * @param string $table the table * @param boolean $submit wheather to display the submit button or not + * * @global array $cfg the phpMyAdmin configuration * @global ressource $user_link the database connection * @@ -426,20 +430,17 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true) $username = $GLOBALS['username']; $hostname = $GLOBALS['hostname']; if ($db == '*') { - $sql_query = - "SELECT * FROM `mysql`.`user`" + $sql_query = "SELECT * FROM `mysql`.`user`" ." WHERE `User` = '" . PMA_sqlAddSlashes($username) . "'" ." AND `Host` = '" . PMA_sqlAddSlashes($hostname) . "';"; } elseif ($table == '*') { - $sql_query = - "SELECT * FROM `mysql`.`db`" + $sql_query = "SELECT * FROM `mysql`.`db`" ." WHERE `User` = '" . PMA_sqlAddSlashes($username) . "'" ." AND `Host` = '" . PMA_sqlAddSlashes($hostname) . "'" ." AND '" . PMA_unescape_mysql_wildcards($db) . "'" ." LIKE `Db`;"; } else { - $sql_query = - "SELECT `Table_priv`" + $sql_query = "SELECT `Table_priv`" ." FROM `mysql`.`tables_priv`" ." WHERE `User` = '" . PMA_sqlAddSlashes($username) . "'" ." AND `Host` = '" . PMA_sqlAddSlashes($hostname) . "'" @@ -471,7 +472,8 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true) if (isset($row['Table_priv'])) { $row1 = PMA_DBI_fetch_single_row( 'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', - 'ASSOC', $GLOBALS['userlink']); + 'ASSOC', $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 @@ -514,7 +516,8 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true) .' AND `Db`' .' = \'' . PMA_sqlAddSlashes(PMA_unescape_mysql_wildcards($db)) . "'" .' AND `Table_name`' - .' = \'' . PMA_sqlAddSlashes($table) . '\';'); + .' = \'' . PMA_sqlAddSlashes($table) . '\';' + ); while ($row1 = PMA_DBI_fetch_row($res)) { $row1[1] = explode(',', $row1[1]); @@ -535,17 +538,25 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true) // privs that are attached to a specific column - PMA_display_column_privs($columns, $row, 'Select_priv', - 'SELECT', 'select', __('Allows reading data.'), 'Select'); + PMA_display_column_privs( + $columns, $row, 'Select_priv', 'SELECT', + 'select', __('Allows reading data.'), 'Select' + ); - PMA_display_column_privs($columns, $row, 'Insert_priv', - 'INSERT', 'insert', __('Allows inserting and replacing data.'), 'Insert'); + PMA_display_column_privs( + $columns, $row, 'Insert_priv', 'INSERT', + 'insert', __('Allows inserting and replacing data.'), 'Insert' + ); - PMA_display_column_privs($columns, $row, 'Update_priv', - 'UPDATE', 'update', __('Allows changing data.'), 'Update'); + PMA_display_column_privs( + $columns, $row, 'Update_priv', 'UPDATE', + 'update', __('Allows changing data.'), 'Update' + ); - PMA_display_column_privs($columns, $row, 'References_priv', - 'REFERENCES', 'references', __('Has no effect in this MySQL version.'), 'References'); + PMA_display_column_privs( + $columns, $row, 'References_priv', 'REFERENCES', 'references', + __('Has no effect in this MySQL version.'), 'References' + ); // privs that are not attached to a specific column @@ -684,7 +695,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true) . ' ' . "\n" . ' ' . "\n" @@ -723,7 +734,7 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true) . $row['max_user_connections'] . '" size="11" maxlength="11" title="' . __('Limits the number of simultaneous connections the user may have.') . '" />' . "\n" . ' ' . "\n" . ' ' . "\n"; - } + } // for Safari 2.0.2 echo '
' . "\n"; } @@ -740,8 +751,9 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true) * Displays the fields used by the "new user" form as well as the * "change login information / copy user" form. * - * @param string $mode are we creating a new user or are we just - * changing one? (allowed values: 'new', 'change') + * @param string $mode are we creating a new user or are we just + * changing one? (allowed values: 'new', 'change') + * * @global array $cfg the phpMyAdmin configuration * @global ressource $user_link the database connection * @@ -816,16 +828,16 @@ function PMA_displayLoginInformationFields($mode = 'new') // when we start editing a user, $GLOBALS['pred_hostname'] is not defined if (! isset($GLOBALS['pred_hostname']) && isset($GLOBALS['hostname'])) { switch (strtolower($GLOBALS['hostname'])) { - case 'localhost': - case '127.0.0.1': - $GLOBALS['pred_hostname'] = 'localhost'; - break; - case '%': - $GLOBALS['pred_hostname'] = 'any'; - break; - default: - $GLOBALS['pred_hostname'] = 'userdefined'; - break; + case 'localhost': + case '127.0.0.1': + $GLOBALS['pred_hostname'] = 'localhost'; + break; + case '%': + $GLOBALS['pred_hostname'] = 'any'; + break; + default: + $GLOBALS['pred_hostname'] = 'userdefined'; + break; } } echo ' ' . "\n"; - if (!empty($thishost)) { + if (! empty($thishost)) { echo '
'."\n" + .' ' . "\n" .'' . "\n" .'' . htmlspecialchars($hostname) . '' . "\n"; $new_user_string .= ''; - if (!empty($password) || isset($pma_pw)) { + if (! empty($password) || isset($pma_pw)) { $new_user_string .= __('Yes'); } else { $new_user_string .= '' . __('No') . ''; @@ -1479,8 +1485,8 @@ if ($GLOBALS['is_ajax_request'] && ! isset($_REQUEST['export']) && (! isset($_RE $new_user_string .=''; - $new_user_string .= ''.sprintf($link_edit, urlencode($username), urlencode($hostname), '', '' ).''."\n"; - $new_user_string .= ''.sprintf($link_export, urlencode($username), urlencode($hostname), (isset($initial) ? $initial : '')).''."\n"; + $new_user_string .= '' . sprintf($link_edit, urlencode($username), urlencode($hostname), '', '') . '' . "\n"; + $new_user_string .= '' . sprintf($link_export, urlencode($username), urlencode($hostname), (isset($initial) ? $initial : '')) . '' . "\n"; $new_user_string .= ''; @@ -1500,7 +1506,7 @@ if ($GLOBALS['is_ajax_request'] && ! isset($_REQUEST['export']) && (! isset($_RE if (isset($update_privs)) { $extra_data['db_specific_privs'] = false; if (isset($dbname_is_wildcard)) { - $extra_data['db_specific_privs'] = !$dbname_is_wildcard; + $extra_data['db_specific_privs'] = ! $dbname_is_wildcard; } $new_privileges = join(', ', PMA_extractPrivInfo('', true)); @@ -1521,10 +1527,10 @@ if (isset($viewing_mode) && $viewing_mode == 'db') { // Gets the database structure $sub_part = '_structure'; - require './libraries/db_info.inc.php'; + include './libraries/db_info.inc.php'; echo "\n"; } else { - require './libraries/server_links.inc.php'; + include './libraries/server_links.inc.php'; } @@ -1555,8 +1561,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . __('User overview') . "\n" . '' . "\n"; - $sql_query = - 'SELECT *,' . + $sql_query = 'SELECT *,' . " IF(`Password` = _latin1 '', 'N', 'Y') AS 'Password'" . ' FROM `mysql`.`user`'; @@ -1574,7 +1579,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs $sql_query = 'SELECT * FROM `mysql`.`user`'; $res = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_STORE); - if (!$res) { + if (! $res) { PMA_Message::error(__('No Privileges'))->display(); PMA_DBI_free_result($res); unset($res); @@ -1634,9 +1639,9 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs /** * Displays the initials - * In an Ajax request, we don't need to show this. Also not necassary if there is less than 20 privileges + * In an Ajax request, we don't need to show this. + * Also not necassary if there is less than 20 privileges */ - if ($GLOBALS['is_ajax_request'] != true && PMA_DBI_num_rows($res) > 20 ) { // initialize to false the letters A-Z @@ -1716,16 +1721,16 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . ' ' . htmlspecialchars($host['Host']) . '' . "\n"; echo ' '; switch ($host['Password']) { - case 'Y': - echo __('Yes'); - break; - case 'N': - echo '' . __('No') . ''; - break; - // this happens if this is a definition not coming from mysql.user - default: - echo '--'; // in future version, replace by "not present" - break; + case 'Y': + echo __('Yes'); + break; + case 'N': + echo '' . __('No') . ''; + break; + // this happens if this is a definition not coming from mysql.user + default: + echo '--'; // in future version, replace by "not present" + break; } // end switch echo '' . "\n" . ' ' . "\n" @@ -1797,7 +1802,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs $flushnote->addParam('', false); $flushnote->addParam('', false); $flushnote->display(); - } + } } else { @@ -1812,7 +1817,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs echo '

' . "\n" . PMA_getIcon('b_usredit.png') . __('Edit Privileges') . ': ' - . __('User') ; + . __('User'); if (isset($dbname)) { echo ' ' . "\n" + echo '
' . "\n" . PMA_generate_common_hidden_inputs('', '') . '' . "\n" . '' . "\n" @@ -1892,8 +1899,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . '' . "\n" . '' . "\n"; - $user_host_condition = - ' WHERE `User`' + $user_host_condition = ' WHERE `User`' . ' = \'' . PMA_sqlAddSlashes($username) . "'" . ' AND `Host`' . ' = \'' . PMA_sqlAddSlashes($hostname) . "'"; @@ -1942,7 +1948,8 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs // 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; } @@ -2011,8 +2018,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs 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`,' + $sql_query = 'SELECT `Table_name`,' .' `Table_priv`,' .' IF(`Column_priv` = _latin1 \'\', 0, 1)' .' AS \'Column_priv\'' @@ -2060,17 +2066,23 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs } echo '' . "\n" . ' '; - printf($link_edit, htmlspecialchars(urlencode($username)), + printf( + $link_edit, + htmlspecialchars(urlencode($username)), urlencode(htmlspecialchars($hostname)), urlencode((! isset($dbname)) ? $row['Db'] : htmlspecialchars($dbname)), - urlencode((! isset($dbname)) ? '' : $row['Table_name'])); + urlencode((! isset($dbname)) ? '' : $row['Table_name']) + ); echo '' . "\n" . ' '; if (! empty($row['can_delete']) || isset($row['Table_name']) && strlen($row['Table_name'])) { - printf($link_revoke, htmlspecialchars(urlencode($username)), + printf( + $link_revoke, + htmlspecialchars(urlencode($username)), urlencode(htmlspecialchars($hostname)), urlencode((! isset($dbname)) ? $row['Db'] : htmlspecialchars($dbname)), - urlencode((! isset($dbname)) ? '' : $row['Table_name'])); + urlencode((! isset($dbname)) ? '' : $row['Table_name']) + ); } echo '' . "\n" . '' . "\n"; @@ -2088,7 +2100,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs $pred_db_array =PMA_DBI_fetch_result('SHOW DATABASES;'); echo ' ' . "\n"; - if (!empty($pred_db_array)) { + if (! empty($pred_db_array)) { echo ' ' . "\n" . ' ' . "\n"; foreach ($pred_tbl_array as $current_table) { @@ -2158,7 +2170,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs } if (! isset($dbname) && ! $user_does_not_exists) { - require_once './libraries/display_change_password.lib.php'; + include_once './libraries/display_change_password.lib.php'; echo '' . "\n" . PMA_generate_common_hidden_inputs('', '') @@ -2205,7 +2217,10 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs '2' => __('Grant all privileges on wildcard name (username\\_%)')); if (! empty($dbname) ) { - $choices['3'] = sprintf( __('Grant all privileges on database "%s"'), htmlspecialchars($dbname)); + $choices['3'] = sprintf( + __('Grant all privileges on database "%s"'), + htmlspecialchars($dbname) + ); $default_choice = 3; echo '' . "\n"; } @@ -2291,8 +2306,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . ' AND `Trigger_priv` = \'N\''; } - $sql_query = - '(SELECT ' . $list_of_privileges . ', `Db`' + $sql_query = '(SELECT ' . $list_of_privileges . ', `Db`' .' FROM `mysql`.`db`' .' WHERE \'' . PMA_sqlAddSlashes($checkprivs) . "'" .' LIKE `Db`' @@ -2358,7 +2372,8 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs urlencode($current_user), urlencode($current_host), urlencode(! isset($current['Db']) || $current['Db'] == '*' ? '' : $current['Db']), - ''); + '' + ); $user_form .= '' . "\n" . ' ' . "\n"; }