diff options
author | Hugues Peccatte <hugues.peccatte@gmail.com> | 2014-01-04 23:46:18 +0400 |
---|---|---|
committer | Hugues Peccatte <hugues.peccatte@gmail.com> | 2014-01-04 23:46:18 +0400 |
commit | 6b01f835cb95cbb5c0b0eb90dd1ae65b65b835fb (patch) | |
tree | b3f21a917f4b6640929847a38922cd93656fb6ed | |
parent | 5e104749c2b3b6549149982e3e5228eae6689ccb (diff) |
Rename too short variables.
Remove useless initializations.
Rename too long variables.
Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
-rw-r--r-- | index.php | 6 | ||||
-rw-r--r-- | libraries/DatabaseInterface.class.php | 23 | ||||
-rw-r--r-- | libraries/PDF.class.php | 4 | ||||
-rw-r--r-- | libraries/TableSearch.class.php | 99 | ||||
-rw-r--r-- | libraries/operations.lib.php | 96 | ||||
-rw-r--r-- | libraries/relation.lib.php | 24 | ||||
-rw-r--r-- | libraries/rte/rte_list.lib.php | 6 | ||||
-rw-r--r-- | libraries/rte/rte_routines.lib.php | 12 | ||||
-rw-r--r-- | libraries/server_collations.lib.php | 54 | ||||
-rw-r--r-- | libraries/server_databases.lib.php | 132 | ||||
-rw-r--r-- | libraries/server_privileges.lib.php | 79 | ||||
-rw-r--r-- | libraries/server_status.lib.php | 8 | ||||
-rw-r--r-- | libraries/server_status_monitor.lib.php | 40 | ||||
-rw-r--r-- | libraries/transformations.lib.php | 26 | ||||
-rw-r--r-- | setup/lib/form_processing.lib.php | 12 | ||||
-rw-r--r-- | setup/lib/index.lib.php | 8 | ||||
-rw-r--r-- | test/libraries/PMA_server_privileges_test.php | 5 | ||||
-rw-r--r-- | user_password.php | 22 |
18 files changed, 319 insertions, 337 deletions
@@ -607,7 +607,7 @@ if (file_exists('libraries/language_stats.inc.php')) { * prints list item for main page * * @param string $name displayed text - * @param string $id id, used for css styles + * @param string $htmlId id, used for css styles * @param string $url make item as link with $url as target * @param string $mysql_help_page display a link to MySQL's manual * @param string $target special target for $url @@ -618,11 +618,11 @@ if (file_exists('libraries/language_stats.inc.php')) { * * @return void */ -function PMA_printListItem($name, $id = null, $url = null, +function PMA_printListItem($name, $htmlId = null, $url = null, $mysql_help_page = null, $target = null, $a_id = null, $class = null, $a_class = null ) { - echo '<li id="' . $id . '"'; + echo '<li id="' . $htmlId . '"'; if (null !== $class) { echo ' class="' . $class . '"'; } diff --git a/libraries/DatabaseInterface.class.php b/libraries/DatabaseInterface.class.php index 128cf61ffc..90545ea35d 100644 --- a/libraries/DatabaseInterface.class.php +++ b/libraries/DatabaseInterface.class.php @@ -794,9 +794,6 @@ class PMA_DatabaseInterface $limit_count = $GLOBALS['cfg']['MaxDbList']; } - // initialize to avoid errors when there are no databases - $databases = array(); - $apply_limit_and_order_manual = true; /** @@ -1238,9 +1235,9 @@ class PMA_DatabaseInterface AND i.table_name = '" . PMA_Util::sqlAddSlashes($table) . "' AND i.is_unique AND NOT i.is_nullable"; - $fs = $this->fetchResult($sql, 'index_name', null, $link); - $fs = $fs ? array_shift($fs) : array(); - foreach ($fs as $f) { + $result = $this->fetchResult($sql, 'index_name', null, $link); + $result = $result ? array_shift($result) : array(); + foreach ($result as $f) { $fields[$f]['Key'] = 'PRI'; } } @@ -1506,11 +1503,11 @@ class PMA_DatabaseInterface 5 ); } - $set_collation_con_query = "SET collation_connection = '" + $setCollationConQuery = "SET collation_connection = '" . PMA_Util::sqlAddSlashes($GLOBALS['collation_connection']) . "';"; $this->query( - $set_collation_con_query, + $setCollationConQuery, $link, self::QUERY_STORE ); @@ -2052,18 +2049,18 @@ class PMA_DatabaseInterface * Checks whether given schema is a system schema: information_schema * (MySQL and Drizzle) or data_dictionary (Drizzle) * - * @param string $schema_name Name of schema (database) to test - * @param bool $test_for_mysql_schema Whether 'mysql' schema should - * be treated the same as IS and DD + * @param string $schema_name Name of schema (database) to test + * @param bool $testForMysqlSchema Whether 'mysql' schema should + * be treated the same as IS and DD * * @return bool */ - public function isSystemSchema($schema_name, $test_for_mysql_schema = false) + public function isSystemSchema($schema_name, $testForMysqlSchema = false) { return strtolower($schema_name) == 'information_schema' || (!PMA_DRIZZLE && strtolower($schema_name) == 'performance_schema') || (PMA_DRIZZLE && strtolower($schema_name) == 'data_dictionary') - || ($test_for_mysql_schema && !PMA_DRIZZLE && $schema_name == 'mysql'); + || ($testForMysqlSchema && !PMA_DRIZZLE && $schema_name == 'mysql'); } /** diff --git a/libraries/PDF.class.php b/libraries/PDF.class.php index 026a87f707..1d32cb7df0 100644 --- a/libraries/PDF.class.php +++ b/libraries/PDF.class.php @@ -105,8 +105,8 @@ class PMA_PDF extends TCPDF function _putpages() { if (count($this->Alias) > 0) { - $nb = count($this->pages); - for ($n = 1;$n <= $nb;$n++) { + $nbPages = count($this->pages); + for ($n = 1; $n <= $nbPages; $n++) { $this->pages[$n] = strtr($this->pages[$n], $this->Alias); } } diff --git a/libraries/TableSearch.class.php b/libraries/TableSearch.class.php index 60dbe840f0..ffcfc85d6d 100644 --- a/libraries/TableSearch.class.php +++ b/libraries/TableSearch.class.php @@ -549,7 +549,6 @@ EOT; $backquoted_name = PMA_Util::backquote($names); $where = ''; if ($unaryFlag) { - $criteriaValues = ''; $where = $backquoted_name . ' ' . $func_type; } elseif (strncasecmp($types, 'enum', 4) == 0 && ! empty($criteriaValues)) { @@ -579,54 +578,11 @@ EOT; $criteriaValues = '^' . $criteriaValues . '$'; } - if ('IN (...)' == $func_type - || 'NOT IN (...)' == $func_type - || 'BETWEEN' == $func_type - || 'NOT BETWEEN' == $func_type + if ('IN (...)' != $func_type + && 'NOT IN (...)' != $func_type + && 'BETWEEN' != $func_type + && 'NOT BETWEEN' != $func_type ) { - $func_type = str_replace(' (...)', '', $func_type); - - //Don't explode if this is already an array - //(Case for (NOT) IN/BETWEEN.) - if (is_array($criteriaValues)) { - $values = $criteriaValues; - } else { - $values = explode(',', $criteriaValues); - } - // quote values one by one - $emptyKey = false; - foreach ($values as $key => &$value) { - if ('' === $value) { - $emptyKey = $key; - $value = 'NULL'; - continue; - } - $value = $quot . PMA_Util::sqlAddSlashes(trim($value)) - . $quot; - } - - if ('BETWEEN' == $func_type || 'NOT BETWEEN' == $func_type) { - $where = $backquoted_name . ' ' . $func_type . ' ' - . (isset($values[0]) ? $values[0] : '') - . ' AND ' . (isset($values[1]) ? $values[1] : ''); - } else { //[NOT] IN - if (false !== $emptyKey) { - unset($values[$emptyKey]); - } - $wheres = array(); - if (!empty($values)) { - $wheres[] = $backquoted_name . ' ' . $func_type - . ' (' . implode(',', $values) . ')'; - } - if (false !== $emptyKey) { - $wheres[] = $backquoted_name . ' IS NULL'; - } - $where = implode(' OR ', $wheres); - if (1 < count($wheres)) { - $where = '(' . $where . ')'; - } - } - } else { if ($func_type == 'LIKE %...%' || $func_type == 'LIKE') { $where = $backquoted_name . ' ' . $func_type . ' ' . $quot . PMA_Util::sqlAddSlashes($criteriaValues, true) . $quot; @@ -634,6 +590,49 @@ EOT; $where = $backquoted_name . ' ' . $func_type . ' ' . $quot . PMA_Util::sqlAddSlashes($criteriaValues) . $quot; } + return $where; + } + $func_type = str_replace(' (...)', '', $func_type); + + //Don't explode if this is already an array + //(Case for (NOT) IN/BETWEEN.) + if (is_array($criteriaValues)) { + $values = $criteriaValues; + } else { + $values = explode(',', $criteriaValues); + } + // quote values one by one + $emptyKey = false; + foreach ($values as $key => &$value) { + if ('' === $value) { + $emptyKey = $key; + $value = 'NULL'; + continue; + } + $value = $quot . PMA_Util::sqlAddSlashes(trim($value)) + . $quot; + } + + if ('BETWEEN' == $func_type || 'NOT BETWEEN' == $func_type) { + $where = $backquoted_name . ' ' . $func_type . ' ' + . (isset($values[0]) ? $values[0] : '') + . ' AND ' . (isset($values[1]) ? $values[1] : ''); + } else { //[NOT] IN + if (false !== $emptyKey) { + unset($values[$emptyKey]); + } + $wheres = array(); + if (!empty($values)) { + $wheres[] = $backquoted_name . ' ' . $func_type + . ' (' . implode(',', $values) . ')'; + } + if (false !== $emptyKey) { + $wheres[] = $backquoted_name . ' IS NULL'; + } + $where = implode(' OR ', $wheres); + if (1 < count($wheres)) { + $where = '(' . $where . ')'; + } } } // end if @@ -1384,7 +1383,7 @@ EOT; $sql_query .= " GROUP BY " . PMA_Util::backquote($column) . " ORDER BY " . PMA_Util::backquote($column) . " ASC"; - $rs = $GLOBALS['dbi']->query( + $res = $GLOBALS['dbi']->query( $sql_query, null, PMA_DatabaseInterface::QUERY_STORE ); @@ -1411,7 +1410,7 @@ EOT; $htmlOutput .= '<tbody>'; $odd = true; - while ($row = $GLOBALS['dbi']->fetchRow($rs)) { + while ($row = $GLOBALS['dbi']->fetchRow($res)) { $val = $row[0]; $replaced = $row[1]; $count = $row[2]; diff --git a/libraries/operations.lib.php b/libraries/operations.lib.php index e3a16c96bc..46d9bfbb39 100644 --- a/libraries/operations.lib.php +++ b/libraries/operations.lib.php @@ -332,10 +332,10 @@ function PMA_getSqlQueryAndCreateDbBeforeCopy() { // lower_case_table_names=1 `DB` becomes `db` if (! PMA_DRIZZLE) { - $lower_case_table_names = $GLOBALS['dbi']->fetchValue( + $lowerCaseTableNames = $GLOBALS['dbi']->fetchValue( 'SHOW VARIABLES LIKE "lower_case_table_names"', 0, 1 ); - if ($lower_case_table_names === '1') { + if ($lowerCaseTableNames === '1') { $_REQUEST['newname'] = $GLOBALS['PMA_String']->strtolower( $_REQUEST['newname'] ); @@ -384,7 +384,7 @@ function PMA_getSqlConstraintsQueryForFullDb( $tables_full, $export_sql_plugin, $move, $db ) { global $sql_constraints, $sql_drop_foreign_keys; - $sql_constraints_query_full_db = array(); + $sqlConstrQueryFullDb = array(); foreach ($tables_full as $each_table => $tmp) { /* Following globals are set in getTableDef */ $sql_constraints = ''; @@ -397,10 +397,10 @@ function PMA_getSqlConstraintsQueryForFullDb( } // keep the constraint we just dropped if (! empty($sql_constraints)) { - $sql_constraints_query_full_db[] = $sql_constraints; + $sqlConstrQueryFullDb[] = $sql_constraints; } } - return $sql_constraints_query_full_db; + return $sqlConstrQueryFullDb; } /** @@ -969,15 +969,15 @@ function PMA_getPossibleRowFormat() ) ); - $innodb_engine_plugin = PMA_StorageEngine::getEngine('innodb'); - $innodb_plugin_version = $innodb_engine_plugin->getInnodbPluginVersion(); - if (!empty($innodb_plugin_version)) { - $innodb_file_format = $innodb_engine_plugin->getInnodbFileFormat(); + $innodbEnginePlugin = PMA_StorageEngine::getEngine('innodb'); + $innodbPluginVersion = $innodbEnginePlugin->getInnodbPluginVersion(); + if (!empty($innodbPluginVersion)) { + $innodb_file_format = $innodbEnginePlugin->getInnodbFileFormat(); } else { $innodb_file_format = ''; } if ('Barracuda' == $innodb_file_format - && $innodb_engine_plugin->supportsFilePerTable() + && $innodbEnginePlugin->supportsFilePerTable() ) { $possible_row_formats['INNODB']['DYNAMIC'] = 'DYNAMIC'; $possible_row_formats['INNODB']['COMPRESSED'] = 'COMPRESSED'; @@ -1232,14 +1232,14 @@ function PMA_getMaintainActionlink($action, $params, $url_params, $link) /** * Get HTML for Delete data or table (truncate table, drop table) * - * @param array $truncate_table_url_params url parameter array for truncate table - * @param array $drop_table_url_params url parameter array for drop table + * @param array $truncateTblUrlParams url parameter array for truncate table + * @param array $dropTableUrlParams url parameter array for drop table * * @return string $html_output */ function PMA_getHtmlForDeleteDataOrTable( - $truncate_table_url_params, - $drop_table_url_params + $truncateTblUrlParams, + $dropTableUrlParams ) { $html_output = '<div class="operations_half_width">' . '<fieldset class="caution">' @@ -1247,17 +1247,17 @@ function PMA_getHtmlForDeleteDataOrTable( $html_output .= '<ul>'; - if (! empty($truncate_table_url_params)) { + if (! empty($truncateTblUrlParams)) { $html_output .= PMA_getDeleteDataOrTablelink( - $truncate_table_url_params, + $truncateTblUrlParams, 'TRUNCATE_TABLE', __('Empty the table (TRUNCATE)'), 'truncate_tbl_anchor' ); } - if (!empty ($drop_table_url_params)) { + if (!empty ($dropTableUrlParams)) { $html_output .= PMA_getDeleteDataOrTablelink( - $drop_table_url_params, + $dropTableUrlParams, 'DROP_TABLE', __('Delete the table (DROP)'), 'drop_tbl_anchor' @@ -1274,15 +1274,15 @@ function PMA_getHtmlForDeleteDataOrTable( * @param array $url_params url parameter array for delete data or table * @param string $syntax TRUNCATE_TABLE or DROP_TABLE or DROP_DATABASE * @param string $link link to be shown - * @param string $id id of the link + * @param string $htmlId id of the link * * @return String html output */ -function PMA_getDeleteDataOrTablelink($url_params, $syntax, $link, $id) +function PMA_getDeleteDataOrTablelink($url_params, $syntax, $link, $htmlId) { return '<li><a ' . 'href="sql.php' . PMA_URL_getCommon($url_params) . '"' - . ' id="' . $id . '" class="ajax">' + . ' id="' . $htmlId . '" class="ajax">' . $link . '</a>' . PMA_Util::showMySQLDocu($syntax) . '</li>'; @@ -1439,25 +1439,25 @@ function PMA_getQueryAndResultForReorderingTable() /** * Get table alters array * - * @param boolean $is_myisam_or_aria whether MYISAM | ARIA or not - * @param boolean $is_isam whether ISAM or not - * @param string $pack_keys pack keys - * @param string $checksum value of checksum - * @param boolean $is_aria whether ARIA or not - * @param string $page_checksum value of page checksum - * @param string $delay_key_write delay key write - * @param boolean $is_innodb whether INNODB or not - * @param boolean $is_pbxt whether PBXT or not - * @param string $row_format row format - * @param string $new_tbl_storage_engine table storage engine - * @param string $transactional value of transactional - * @param string $tbl_collation collation of the table + * @param boolean $is_myisam_or_aria whether MYISAM | ARIA or not + * @param boolean $is_isam whether ISAM or not + * @param string $pack_keys pack keys + * @param string $checksum value of checksum + * @param boolean $is_aria whether ARIA or not + * @param string $page_checksum value of page checksum + * @param string $delay_key_write delay key write + * @param boolean $is_innodb whether INNODB or not + * @param boolean $is_pbxt whether PBXT or not + * @param string $row_format row format + * @param string $newTblStorageEngine table storage engine + * @param string $transactional value of transactional + * @param string $tbl_collation collation of the table * * @return array $table_alters */ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys, $checksum, $is_aria, $page_checksum, $delay_key_write, $is_innodb, - $is_pbxt, $row_format, $new_tbl_storage_engine, $transactional, $tbl_collation + $is_pbxt, $row_format, $newTblStorageEngine, $transactional, $tbl_collation ) { global $auto_increment; @@ -1469,10 +1469,10 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys, $table_alters[] = 'COMMENT = \'' . PMA_Util::sqlAddSlashes($_REQUEST['comment']) . '\''; } - if (! empty($new_tbl_storage_engine) - && strtolower($new_tbl_storage_engine) !== strtolower($GLOBALS['tbl_storage_engine']) + if (! empty($newTblStorageEngine) + && strtolower($newTblStorageEngine) !== strtolower($GLOBALS['tbl_storage_engine']) ) { - $table_alters[] = 'ENGINE = ' . $new_tbl_storage_engine; + $table_alters[] = 'ENGINE = ' . $newTblStorageEngine; } if (! empty($_REQUEST['tbl_collation']) && $_REQUEST['tbl_collation'] !== $tbl_collation @@ -1550,21 +1550,19 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys, */ function PMA_setGlobalVariablesForEngine($tbl_storage_engine) { - $is_myisam_or_aria = $is_isam = $is_innodb = $is_berkeleydb - = $is_aria = $is_pbxt = false; - $upper_tbl_storage_engine = strtoupper($tbl_storage_engine); + $upperTblStorEngine = strtoupper($tbl_storage_engine); //Options that apply to MYISAM usually apply to ARIA - $is_myisam_or_aria = ($upper_tbl_storage_engine == 'MYISAM' - || $upper_tbl_storage_engine == 'ARIA' - || $upper_tbl_storage_engine == 'MARIA' + $is_myisam_or_aria = ($upperTblStorEngine == 'MYISAM' + || $upperTblStorEngine == 'ARIA' + || $upperTblStorEngine == 'MARIA' ); - $is_aria = ($upper_tbl_storage_engine == 'ARIA'); + $is_aria = ($upperTblStorEngine == 'ARIA'); - $is_isam = ($upper_tbl_storage_engine == 'ISAM'); - $is_innodb = ($upper_tbl_storage_engine == 'INNODB'); - $is_berkeleydb = ($upper_tbl_storage_engine == 'BERKELEYDB'); - $is_pbxt = ($upper_tbl_storage_engine == 'PBXT'); + $is_isam = ($upperTblStorEngine == 'ISAM'); + $is_innodb = ($upperTblStorEngine == 'INNODB'); + $is_berkeleydb = ($upperTblStorEngine == 'BERKELEYDB'); + $is_pbxt = ($upperTblStorEngine == 'PBXT'); return array( $is_myisam_or_aria, $is_innodb, $is_isam, diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index 3326bdfac2..47f4bf7941 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -343,25 +343,25 @@ function PMA_getDiagMessageForFeature($feature_name, /** * prints out one diagnostic message for a configuration parameter * - * @param string $parameter config parameter name to display - * @param boolean $relation_parameter_set whether this parameter is set - * @param array $messages utility messages - * @param string $doc_anchor anchor in documentation + * @param string $parameter config parameter name to display + * @param boolean $relationParameterSet whether this parameter is set + * @param array $messages utility messages + * @param string $docAnchor anchor in documentation * * @return string */ function PMA_getDiagMessageForParameter($parameter, - $relation_parameter_set, $messages, $doc_anchor + $relationParameterSet, $messages, $docAnchor ) { $retval = '<tr><th class="left">'; $retval .= '$cfg[\'Servers\'][$i][\'' . $parameter . '\'] ... '; $retval .= '</th><td class="right">'; - if ($relation_parameter_set) { + if ($relationParameterSet) { $retval .= $messages['ok']; } else { $retval .= sprintf( $messages['error'], - PMA_Util::getDocuLink('config', 'cfg_Servers_' . $doc_anchor) + PMA_Util::getDocuLink('config', 'cfg_Servers_' . $docAnchor) ); } $retval .= '</td></tr>' . "\n"; @@ -574,10 +574,10 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') if (($source == 'both' || $source == 'foreign') && strlen($table)) { - $show_create_table_query = 'SHOW CREATE TABLE ' + $showCreateTableQuery = 'SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table); $show_create_table = $GLOBALS['dbi']->fetchValue( - $show_create_table_query, 0, 1 + $showCreateTableQuery, 0, 1 ); $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); @@ -625,12 +625,12 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both') /** * Emulating relations for some information_schema and data_dictionary tables */ - $is_information_schema = strtolower($db) == 'information_schema'; + $isInformationSchema = strtolower($db) == 'information_schema'; $is_data_dictionary = PMA_DRIZZLE && strtolower($db) == 'data_dictionary'; - if (($is_information_schema || $is_data_dictionary) + if (($isInformationSchema || $is_data_dictionary) && ($source == 'internal' || $source == 'both') ) { - if ($is_information_schema) { + if ($isInformationSchema) { $relations_key = 'information_schema_relations'; include_once './libraries/information_schema_relations.lib.php'; } else { diff --git a/libraries/rte/rte_list.lib.php b/libraries/rte/rte_list.lib.php index 7cc0c1c6d3..e6d119bffd 100644 --- a/libraries/rte/rte_list.lib.php +++ b/libraries/rte/rte_list.lib.php @@ -89,9 +89,9 @@ function PMA_RTE_getList($type, $items) } $retval .= " </tr>\n"; $retval .= " <!-- TABLE DATA -->\n"; - $ct = 0; + $count = 0; foreach ($items as $item) { - $rowclass = ($ct % 2 == 0) ? 'odd' : 'even'; + $rowclass = ($count % 2 == 0) ? 'odd' : 'even'; if ($GLOBALS['is_ajax_request'] && empty($_REQUEST['ajax_page_request'])) { $rowclass .= ' ajaxInsert hide'; } @@ -109,7 +109,7 @@ function PMA_RTE_getList($type, $items) default: break; } - $ct++; + $count++; } $retval .= " </table>\n"; $retval .= "</fieldset>\n"; diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php index e2b68dd22c..d4efbde3e5 100644 --- a/libraries/rte/rte_routines.lib.php +++ b/libraries/rte/rte_routines.lib.php @@ -910,9 +910,9 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine) unset($routine['item_param_opts_text'][$routine['item_num_params']-1]); $routine['item_num_params']--; } - $disable_remove_parameter = ''; + $disableRemoveParam = ''; if (! $routine['item_num_params']) { - $disable_remove_parameter = " color: gray;' disabled='disabled"; + $disableRemoveParam = " color: gray;' disabled='disabled"; } $original_routine = ''; if ($mode == 'edit') { @@ -997,7 +997,7 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine) $retval .= " <input style='width: 49%;' type='button' \n"; $retval .= " name='routine_addparameter'\n"; $retval .= " value='" . __('Add parameter') . "' />\n"; - $retval .= " <input style='width: 49%;$disable_remove_parameter'\n"; + $retval .= " <input style='width: 49%;$disableRemoveParam'\n"; $retval .= " type='submit' \n"; $retval .= " name='routine_removeparameter'\n"; $retval .= " value='" . __('Remove last parameter') . "' />\n"; @@ -1412,7 +1412,7 @@ function PMA_RTN_handleExecute() ); $output .= "</legend>"; - $num_of_rusults_set_to_display = 0; + $nbResultsetToDisplay = 0; do { @@ -1448,7 +1448,7 @@ function PMA_RTN_handleExecute() } $output .= "</table>"; - $num_of_rusults_set_to_display++; + $nbResultsetToDisplay++; $affected = $num_rows; } @@ -1483,7 +1483,7 @@ function PMA_RTN_handleExecute() } $message = PMA_message::success($message); - if ($num_of_rusults_set_to_display == 0) { + if ($nbResultsetToDisplay == 0) { $notice = __( 'MySQL returned an empty result set (i.e. zero rows).' ); diff --git a/libraries/server_collations.lib.php b/libraries/server_collations.lib.php index 39855c8205..b7c55e0c55 100644 --- a/libraries/server_collations.lib.php +++ b/libraries/server_collations.lib.php @@ -15,17 +15,17 @@ if (! defined('PHPMYADMIN')) { /** * Returns the html for server Character Sets and Collations. * - * @param Array $mysql_charsets Mysql Charsets list - * @param Array $mysql_collations Mysql Collations list - * @param Array $mysql_charsets_descriptions Charsets descriptions - * @param Array $mysql_default_collations Default Collations list - * @param Array $mysql_collations_available Available Collations list + * @param Array $mysqlCharsets Mysql Charsets list + * @param Array $mysqlCollations Mysql Collations list + * @param Array $mysqlCharsetsDesc Charsets descriptions + * @param Array $mysqlDftCollations Default Collations list + * @param Array $mysqlCollAvailable Available Collations list * * @return string */ -function PMA_getHtmlForCharsets($mysql_charsets, $mysql_collations, - $mysql_charsets_descriptions, $mysql_default_collations, - $mysql_collations_available +function PMA_getHtmlForCharsets($mysqlCharsets, $mysqlCollations, + $mysqlCharsetsDesc, $mysqlDftCollations, + $mysqlCollAvailable ) { /** * Outputs the result @@ -36,27 +36,27 @@ function PMA_getHtmlForCharsets($mysql_charsets, $mysql_collations, . ' <th>' . __('Description') . '</th>' . "\n" . '</tr>' . "\n"; - $table_row_count = count($mysql_charsets) + count($mysql_collations); + $table_row_count = count($mysqlCharsets) + count($mysqlCollations); + + foreach ($mysqlCharsets as $current_charset) { - foreach ($mysql_charsets as $current_charset) { - $html .= '<tr><th colspan="2" class="right">' . "\n" . ' ' . htmlspecialchars($current_charset) . "\n" - . (empty($mysql_charsets_descriptions[$current_charset]) + . (empty($mysqlCharsetsDesc[$current_charset]) ? '' : ' (<i>' . htmlspecialchars( - $mysql_charsets_descriptions[$current_charset] + $mysqlCharsetsDesc[$current_charset] ) . '</i>)' . "\n") . ' </th>' . "\n" . '</tr>' . "\n"; $html .= PMA_getHtmlForCollationCurrentCharset( $current_charset, - $mysql_collations, - $mysql_default_collations, - $mysql_collations_available + $mysqlCollations, + $mysqlDftCollations, + $mysqlCollAvailable ); - + } unset($table_row_count); $html .= '</table>' . "\n" @@ -68,27 +68,27 @@ function PMA_getHtmlForCharsets($mysql_charsets, $mysql_collations, /** * Returns the html for Collations of Current Charset. * - * @param String $current_charset Current Charset - * @param Array $mysql_collations Collations list - * @param Array $mysql_default_collations Default Collations list - * @param Array $mysql_collations_available Available Collations list + * @param String $currCharset Current Charset + * @param Array $mysqlColl Collations list + * @param Array $mysqlDftColl Default Collations list + * @param Array $mysqlCollAvailable Available Collations list * * @return string */ function PMA_getHtmlForCollationCurrentCharset( - $current_charset, $mysql_collations, - $mysql_default_collations, $mysql_collations_available + $currCharset, $mysqlColl, + $mysqlDftColl, $mysqlCollAvailable ) { $odd_row = true; $html = ''; - foreach ($mysql_collations[$current_charset] as $current_collation) { - + foreach ($mysqlColl[$currCharset] as $current_collation) { + $html .= '<tr class="' . ($odd_row ? 'odd' : 'even') - . ($mysql_default_collations[$current_charset] == $current_collation + . ($mysqlDftColl[$currCharset] == $current_collation ? ' marked' : '') - . ($mysql_collations_available[$current_collation] ? '' : ' disabled') + . ($mysqlCollAvailable[$current_collation] ? '' : ' disabled') . '">' . "\n" . ' <td>' . htmlspecialchars($current_collation) . '</td>' . "\n" . ' <td>' . PMA_getCollationDescr($current_collation) . '</td>' . "\n" diff --git a/libraries/server_databases.lib.php b/libraries/server_databases.lib.php index 15d439df3b..7a125c1b0c 100644 --- a/libraries/server_databases.lib.php +++ b/libraries/server_databases.lib.php @@ -109,10 +109,7 @@ function PMA_getHtmlForDatabase( $html .= PMA_getHtmlForTableFooterButtons( $cfg['AllowUserDropDatabase'], - $is_superuser, - $sort_by, - $sort_order, - $dbstats + $is_superuser ); if (empty($dbstats)) { @@ -128,56 +125,53 @@ function PMA_getHtmlForDatabase( /** * Returns the html for Table footer buttons * - * @param bool $is_allowUserDropDatabase Allow user drop database - * @param bool $is_superuser User status - * @param string $sort_by sort by string - * @param string $sort_order sort order string - * @param Array $dbstats database status + * @param bool $is_allowUserDropDb Allow user drop database + * @param bool $is_superuser User status * * @return string */ -function PMA_getHtmlForTableFooterButtons( - $is_allowUserDropDatabase, $is_superuser, - $sort_by, $sort_order, $dbstats -) { - $html = ""; - if ($is_superuser || $is_allowUserDropDatabase) { - $html .= '<img class="selectallarrow" src="' - . $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png"' - . ' width="38" height="22" alt="' . __('With selected:') . '" />' . "\n" - . '<input type="checkbox" id="dbStatsForm_checkall" ' - . 'class="checkall_box" title="' . __('Check All') . '" /> ' - . '<label for="dbStatsForm_checkall">' . __('Check All') . '</label> ' - . '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n"; - $html .= PMA_Util::getButtonOrImage( - '', - 'mult_submit' . ' ajax', - 'drop_selected_dbs', - __('Drop'), 'b_deltbl.png' - ); +function PMA_getHtmlForTableFooterButtons($is_allowUserDropDb, $is_superuser) +{ + if (!$is_superuser && !$is_allowUserDropDb) { + return ''; } + + $html = '<img class="selectallarrow" src="' + . $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png"' + . ' width="38" height="22" alt="' . __('With selected:') . '" />' . "\n" + . '<input type="checkbox" id="dbStatsForm_checkall" ' + . 'class="checkall_box" title="' . __('Check All') . '" /> ' + . '<label for="dbStatsForm_checkall">' . __('Check All') . '</label> ' + . '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n"; + $html .= PMA_Util::getButtonOrImage( + '', + 'mult_submit' . ' ajax', + 'drop_selected_dbs', + __('Drop'), 'b_deltbl.png' + ); + return $html; } /** * Returns the html for Table footer * - * @param bool $is_allowUserDropDatabase Allow user drop database - * @param bool $is_superuser User status - * @param Array $databases_count Database count - * @param string $column_order column order - * @param array $replication_types replication types - * @param string $first_database First database + * @param bool $is_allowUserDropDb Allow user drop database + * @param bool $is_superuser User status + * @param Array $databases_count Database count + * @param string $column_order column order + * @param array $replication_types replication types + * @param string $first_database First database * * @return string */ function PMA_getHtmlForTableFooter( - $is_allowUserDropDatabase, $is_superuser, + $is_allowUserDropDb, $is_superuser, $databases_count, $column_order, $replication_types, $first_database ) { $html = '<tfoot><tr>' . "\n"; - if ($is_superuser || $is_allowUserDropDatabase) { + if ($is_superuser || $is_allowUserDropDb) { $html .= ' <th></th>' . "\n"; } $html .= ' <th>' . __('Total') . ': <span id="databases_count">' @@ -288,22 +282,22 @@ function PMA_getHtmlForColumnOrder($column_order, $first_database) /** * Returns the html for Column Order with Sort * - * @param bool $is_superuser User status - * @param bool $is_allowUserDropDatabase Allow user drop database - * @param Array $_url_params Url params - * @param string $sort_by sort colume name - * @param string $sort_order order - * @param array $column_order column order - * @param array $first_database database to show + * @param bool $is_superuser User status + * @param bool $is_allowUserDropDb Allow user drop database + * @param Array $_url_params Url params + * @param string $sort_by sort colume name + * @param string $sort_order order + * @param array $column_order column order + * @param array $first_database database to show * * @return string */ function PMA_getHtmlForColumnOrderWithSort( - $is_superuser, $is_allowUserDropDatabase, + $is_superuser, $is_allowUserDropDb, $_url_params, $sort_by, $sort_order, $column_order, $first_database ) { - $html = ($is_superuser || $is_allowUserDropDatabase + $html = ($is_superuser || $is_allowUserDropDb ? ' <th></th>' . "\n" : '') . ' <th><a href="server_databases.php' @@ -319,30 +313,32 @@ function PMA_getHtmlForColumnOrderWithSort( . ' </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') { - $table_columns += 2; - $colspan = ' colspan="2"'; - } else { - $table_columns++; - $colspan = ''; - } - $_url_params['sort_by'] = $stat_name; - $_url_params['sort_order'] - = ($sort_by == $stat_name && $sort_order == 'desc') ? 'asc' : 'desc'; - $html .= ' <th' . $colspan . '>' - . '<a href="server_databases.php' - . PMA_URL_getCommon($_url_params) . '">' . "\n" - . ' ' . $stat['disp_name'] . "\n" - . ($sort_by == $stat_name - ? ' ' . PMA_Util::getImage( - 's_' . $sort_order . '.png', - ($sort_order == 'asc' ? __('Ascending') : __('Descending')) - ) . "\n" - : '' - ) - . ' </a></th>' . "\n"; + if (!array_key_exists($stat_name, $first_database)) { + continue; + } + + if ($stat['format'] === 'byte') { + $table_columns += 2; + $colspan = ' colspan="2"'; + } else { + $table_columns++; + $colspan = ''; } + $_url_params['sort_by'] = $stat_name; + $_url_params['sort_order'] + = ($sort_by == $stat_name && $sort_order == 'desc') ? 'asc' : 'desc'; + $html .= ' <th' . $colspan . '>' + . '<a href="server_databases.php' + . PMA_URL_getCommon($_url_params) . '">' . "\n" + . ' ' . $stat['disp_name'] . "\n" + . ($sort_by == $stat_name + ? ' ' . PMA_Util::getImage( + 's_' . $sort_order . '.png', + ($sort_order == 'asc' ? __('Ascending') : __('Descending')) + ) . "\n" + : '' + ) + . ' </a></th>' . "\n"; } return $html; } diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index fdfb23a357..d50013a0b8 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -422,16 +422,16 @@ function PMA_getHtmlForColumnPrivileges($columns, $row, $name_for_select, . '<select id="select_' . $name . '_priv" name="' . $name_for_select . '[]" multiple="multiple" size="8">' . "\n"; - foreach ($columns as $current_column => $current_column_privileges) { + foreach ($columns as $currCol => $currColPrivs) { $html_output .= '<option ' - . 'value="' . htmlspecialchars($current_column) . '"'; + . 'value="' . htmlspecialchars($currCol) . '"'; if ($row[$name_for_select] == 'Y' - || $current_column_privileges[$name_for_current] + || $currColPrivs[$name_for_current] ) { $html_output .= ' selected="selected"'; } $html_output .= '>' - . htmlspecialchars($current_column) . '</option>' . "\n"; + . htmlspecialchars($currCol) . '</option>' . "\n"; } $html_output .= '</select>' . "\n" @@ -1134,7 +1134,7 @@ function PMA_getStructurePrivilegeTable($table, $row) */ function PMA_getAdministrationPrivilegeTable($db) { - $administration_privTable = array( + $adminPrivTable = array( array('Grant', 'GRANT', __( @@ -1144,7 +1144,7 @@ function PMA_getAdministrationPrivilegeTable($db) ), ); if ($db == '*') { - $administration_privTable[] = array('Super', + $adminPrivTable[] = array('Super', 'SUPER', __( 'Allows connecting, even if maximum number ' @@ -1153,46 +1153,46 @@ function PMA_getAdministrationPrivilegeTable($db) . 'setting global variables or killing threads of other users.' ) ); - $administration_privTable[] = array('Process', + $adminPrivTable[] = array('Process', 'PROCESS', __('Allows viewing processes of all users') ); - $administration_privTable[] = array('Reload', + $adminPrivTable[] = array('Reload', 'RELOAD', __('Allows reloading server settings and flushing the server\'s caches.') ); - $administration_privTable[] = array('Shutdown', + $adminPrivTable[] = array('Shutdown', 'SHUTDOWN', __('Allows shutting down the server.') ); - $administration_privTable[] = array('Show_db', + $adminPrivTable[] = array('Show_db', 'SHOW DATABASES', __('Gives access to the complete list of databases.') ); } - $administration_privTable[] = array('Lock_tables', + $adminPrivTable[] = array('Lock_tables', 'LOCK TABLES', __('Allows locking tables for the current thread.') ); - $administration_privTable[] = array('References', + $adminPrivTable[] = array('References', 'REFERENCES', __('Has no effect in this MySQL version.') ); if ($db == '*') { - $administration_privTable[] = array('Repl_client', + $adminPrivTable[] = array('Repl_client', 'REPLICATION CLIENT', __('Allows the user to ask where the slaves / masters are.') ); - $administration_privTable[] = array('Repl_slave', + $adminPrivTable[] = array('Repl_slave', 'REPLICATION SLAVE', __('Needed for the replication slaves.') ); - $administration_privTable[] = array('Create_user', + $adminPrivTable[] = array('Create_user', 'CREATE USER', __('Allows creating, dropping and renaming user accounts.') ); } - return $administration_privTable; + return $adminPrivTable; } /** @@ -1755,7 +1755,7 @@ function PMA_getListOfPrivilegesAndComparedPrivileges() . '`Alter_routine_priv`, ' . '`Execute_priv`'; - $list_of_compared_privileges + $listOfComparedPrivs = '`Select_priv` = \'N\'' . ' AND `Insert_priv` = \'N\'' . ' AND `Update_priv` = \'N\'' @@ -1776,11 +1776,11 @@ function PMA_getListOfPrivilegesAndComparedPrivileges() $list_of_privileges .= ', `Event_priv`, ' . '`Trigger_priv`'; - $list_of_compared_privileges .= + $listOfComparedPrivs .= ' AND `Event_priv` = \'N\'' . ' AND `Trigger_priv` = \'N\''; } - return array($list_of_privileges, $list_of_compared_privileges); + return array($list_of_privileges, $listOfComparedPrivs); } /** @@ -1819,19 +1819,19 @@ function PMA_getHtmlForSpecificDbPrivileges($db) . '</tr>' . "\n" . '</thead>' . "\n"; // now, we build the table... - list($list_of_privileges, $list_of_compared_privileges) + list($listOfPrivs, $listOfComparedPrivs) = PMA_getListOfPrivilegesAndComparedPrivileges(); - $sql_query = '(SELECT ' . $list_of_privileges . ', `Db`, \'d\' AS `Type`' + $sql_query = '(SELECT ' . $listOfPrivs . ', `Db`, \'d\' AS `Type`' .' FROM `mysql`.`db`' .' WHERE \'' . PMA_Util::sqlAddSlashes($db) . "'" .' LIKE `Db`' - .' AND NOT (' . $list_of_compared_privileges. ')) ' + .' AND NOT (' . $listOfComparedPrivs. ')) ' .'UNION ' - .'(SELECT ' . $list_of_privileges . ', \'*\' AS `Db`, \'g\' AS `Type`' + .'(SELECT ' . $listOfPrivs . ', \'*\' AS `Db`, \'g\' AS `Type`' .' FROM `mysql`.`user` ' - .' WHERE NOT (' . $list_of_compared_privileges . ')) ' + .' WHERE NOT (' . $listOfComparedPrivs . ')) ' .' ORDER BY `User` ASC,' .' `Host` ASC,' .' `Db` ASC;'; @@ -1926,20 +1926,20 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table) . '</tr>' . '</thead>'; - list($list_of_privileges, $list_of_compared_privileges) + list($listOfPrivs, $listOfComparedPrivs) = PMA_getListOfPrivilegesAndComparedPrivileges(); $sql_query = "(" - . " SELECT " . $list_of_privileges . ", '*' AS `Db`, 'g' AS `Type`" + . " SELECT " . $listOfPrivs . ", '*' AS `Db`, 'g' AS `Type`" . " FROM `mysql`.`user`" - . " WHERE NOT (" . $list_of_compared_privileges . ")" + . " WHERE NOT (" . $listOfComparedPrivs . ")" . ")" . " UNION " . "(" - . " SELECT " . $list_of_privileges . ", `Db`, 'd' AS `Type`" + . " SELECT " . $listOfPrivs . ", `Db`, 'd' AS `Type`" . " FROM `mysql`.`db`" . " WHERE '" . PMA_Util::sqlAddSlashes($db) . "' LIKE `Db`" - . " AND NOT (" . $list_of_compared_privileges. ")" + . " AND NOT (" . $listOfComparedPrivs. ")" . ")" . " ORDER BY `User` ASC, `Host` ASC, `Db` ASC;"; $res = $GLOBALS['dbi']->query($sql_query); @@ -1978,9 +1978,7 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table) $privMap[$user][$host][] = $row; } - $html_output .= PMA_getHtmlTableBodyForSpecificDbOrTablePrivs( - $privMap, $db, $table - ); + $html_output .= PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db); $html_output .= '</table>'; $html_output .= '</fieldset>'; $html_output .= '</form>'; @@ -2011,11 +2009,10 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table) * * @param array $privMap priviledge map * @param boolean $db database - * @param boolean $table table * * @return string $html_output */ -function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = null) +function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db) { $html_output = '<tbody>'; $odd_row = true; @@ -2402,11 +2399,11 @@ function PMA_getExtraDataForAjaxBehavior( * pagination */ $new_user_initial = strtoupper(substr($username, 0, 1)); - $new_user_initial_string = '<a href="server_privileges.php' + $newUserInitialString = '<a href="server_privileges.php' . PMA_URL_getCommon(array('initial' => $new_user_initial)) .'">' . $new_user_initial . '</a>'; $extra_data['new_user_initial'] = $new_user_initial; - $extra_data['new_user_initial_string'] = $new_user_initial_string; + $extra_data['new_user_initial_string'] = $newUserInitialString; } if (isset($_POST['update_privs'])) { @@ -2552,7 +2549,7 @@ function PMA_getLinkToDbAndTable($url_dbname, $dbname, $tablename) function PMA_getUserSpecificRights($tables, $user_host_condition, $dbname) { if (! strlen($dbname)) { - $tables_to_search_for_users = array( + $tablesSearchForUsers = array( 'tables_priv', 'columns_priv', ); $dbOrTableName = 'Db'; @@ -2561,12 +2558,12 @@ function PMA_getUserSpecificRights($tables, $user_host_condition, $dbname) ' AND `Db`' .' LIKE \'' . PMA_Util::sqlAddSlashes($dbname, true) . "'"; - $tables_to_search_for_users = array('columns_priv',); + $tablesSearchForUsers = array('columns_priv',); $dbOrTableName = 'Table_name'; } $db_rights_sqls = array(); - foreach ($tables_to_search_for_users as $table_search_in) { + foreach ($tablesSearchForUsers as $table_search_in) { if (in_array($table_search_in, $tables)) { $db_rights_sqls[] = ' SELECT DISTINCT `' . $dbOrTableName .'` @@ -3207,12 +3204,12 @@ function PMA_getDbRightsForUserOverview() // we also want users not in table `user` but in other table $tables = $GLOBALS['dbi']->fetchResult('SHOW TABLES FROM `mysql`;'); - $tables_to_search_for_users = array( + $tablesSearchForUsers = array( 'user', 'db', 'tables_priv', 'columns_priv', 'procs_priv', ); $db_rights_sqls = array(); - foreach ($tables_to_search_for_users as $table_search_in) { + foreach ($tablesSearchForUsers as $table_search_in) { if (in_array($table_search_in, $tables)) { $db_rights_sqls[] = 'SELECT DISTINCT `User`, `Host` FROM `mysql`.`' . $table_search_in . '` ' diff --git a/libraries/server_status.lib.php b/libraries/server_status.lib.php index a602e2494c..f3eef5958a 100644 --- a/libraries/server_status.lib.php +++ b/libraries/server_status.lib.php @@ -312,11 +312,9 @@ function PMA_getHtmlForServerStateConnections($ServerStatusData) /** * Prints Server Process list * - * @param PMA_ServerStatusData $ServerStatusData Server status data - * * @return string */ -function PMA_getHtmlForServerProcesslist($ServerStatusData) +function PMA_getHtmlForServerProcesslist() { $url_params = array(); @@ -368,7 +366,7 @@ function PMA_getHtmlForServerProcesslist($ServerStatusData) 'order_by_field' => 'Info' ) ); - $sortable_columns_count = count($sortable_columns); + $sortableColCount = count($sortable_columns); if (PMA_DRIZZLE) { $left_str = 'left(p.info, ' @@ -455,7 +453,7 @@ function PMA_getHtmlForServerProcesslist($ServerStatusData) $retval .= '</a>'; - if (! PMA_DRIZZLE && (0 === --$sortable_columns_count)) { + if (! PMA_DRIZZLE && (0 === --$sortableColCount)) { $retval .= '<a href="' . $full_text_link . '">'; if ($show_full_sql) { $retval .= PMA_Util::getImage( diff --git a/libraries/server_status_monitor.lib.php b/libraries/server_status_monitor.lib.php index 842745935e..c655211fba 100644 --- a/libraries/server_status_monitor.lib.php +++ b/libraries/server_status_monitor.lib.php @@ -552,20 +552,19 @@ function PMA_getJsonForChartingData() */ function PMA_getJsonForLogDataTypeSlow($start, $end) { - $q = 'SELECT start_time, user_host, '; - $q .= 'Sec_to_Time(Sum(Time_to_Sec(query_time))) as query_time, '; - $q .= 'Sec_to_Time(Sum(Time_to_Sec(lock_time))) as lock_time, '; - $q .= 'SUM(rows_sent) AS rows_sent, '; - $q .= 'SUM(rows_examined) AS rows_examined, db, sql_text, '; - $q .= 'COUNT(sql_text) AS \'#\' '; - $q .= 'FROM `mysql`.`slow_log` '; - $q .= 'WHERE start_time > FROM_UNIXTIME(' . $start . ') '; - $q .= 'AND start_time < FROM_UNIXTIME(' . $end . ') GROUP BY sql_text'; - - $result = $GLOBALS['dbi']->tryQuery($q); + $query = 'SELECT start_time, user_host, '; + $query .= 'Sec_to_Time(Sum(Time_to_Sec(query_time))) as query_time, '; + $query .= 'Sec_to_Time(Sum(Time_to_Sec(lock_time))) as lock_time, '; + $query .= 'SUM(rows_sent) AS rows_sent, '; + $query .= 'SUM(rows_examined) AS rows_examined, db, sql_text, '; + $query .= 'COUNT(sql_text) AS \'#\' '; + $query .= 'FROM `mysql`.`slow_log` '; + $query .= 'WHERE start_time > FROM_UNIXTIME(' . $start . ') '; + $query .= 'AND start_time < FROM_UNIXTIME(' . $end . ') GROUP BY sql_text'; + + $result = $GLOBALS['dbi']->tryQuery($query); $return = array('rows' => array(), 'sum' => array()); - $type = ''; while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { $type = strtolower( @@ -621,18 +620,17 @@ function PMA_getJsonForLogDataTypeGeneral($start, $end) = 'AND argument REGEXP \'^(INSERT|SELECT|UPDATE|DELETE)\' '; } - $q = 'SELECT TIME(event_time) as event_time, user_host, thread_id, '; - $q .= 'server_id, argument, count(argument) as \'#\' '; - $q .= 'FROM `mysql`.`general_log` '; - $q .= 'WHERE command_type=\'Query\' '; - $q .= 'AND event_time > FROM_UNIXTIME(' . $start . ') '; - $q .= 'AND event_time < FROM_UNIXTIME(' . $end . ') '; - $q .= $limitTypes . 'GROUP by argument'; // HAVING count > 1'; + $query = 'SELECT TIME(event_time) as event_time, user_host, thread_id, '; + $query .= 'server_id, argument, count(argument) as \'#\' '; + $query .= 'FROM `mysql`.`general_log` '; + $query .= 'WHERE command_type=\'Query\' '; + $query .= 'AND event_time > FROM_UNIXTIME(' . $start . ') '; + $query .= 'AND event_time < FROM_UNIXTIME(' . $end . ') '; + $query .= $limitTypes . 'GROUP by argument'; // HAVING count > 1'; - $result = $GLOBALS['dbi']->tryQuery($q); + $result = $GLOBALS['dbi']->tryQuery($query); $return = array('rows' => array(), 'sum' => array()); - $type = ''; $insertTables = array(); $insertTablesFirst = -1; $i = 0; diff --git a/libraries/transformations.lib.php b/libraries/transformations.lib.php index ddf1c60aac..661d611908 100644 --- a/libraries/transformations.lib.php +++ b/libraries/transformations.lib.php @@ -232,21 +232,21 @@ function PMA_getMIME($db, $table, $strict = false) /** * Set a single mimetype to a certain value. * - * @param string $db the name of the db - * @param string $table the name of the table - * @param string $key the name of the column - * @param string $mimetype the mimetype of the column - * @param string $transformation the transformation of the column - * @param string $transformation_options the transformation options of the column - * @param boolean $forcedelete force delete, will erase any existing - * comments for this column + * @param string $db the name of the db + * @param string $table the name of the table + * @param string $key the name of the column + * @param string $mimetype the mimetype of the column + * @param string $transformation the transformation of the column + * @param string $transformationOpt the transformation options of the column + * @param boolean $forcedelete force delete, will erase any existing + * comments for this column * * @access public * * @return boolean true, if comment-query was made. */ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, - $transformation_options, $forcedelete = false + $transformationOpt, $forcedelete = false ) { $cfgRelation = PMA_getRelationsParam(); @@ -287,7 +287,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, if (! $forcedelete && (strlen($mimetype) || strlen($transformation) - || strlen($transformation_options) || strlen($row['comment'])) + || strlen($transformationOpt) || strlen($row['comment'])) ) { $upd_query = 'UPDATE ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['column_info']) @@ -297,7 +297,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, . '`transformation` = \'' . PMA_Util::sqlAddSlashes($transformation) . '\', ' . '`transformation_options` = \'' - . PMA_Util::sqlAddSlashes($transformation_options) . '\''; + . PMA_Util::sqlAddSlashes($transformationOpt) . '\''; } else { $upd_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['column_info']); @@ -308,7 +308,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, AND `column_name` = \'' . PMA_Util::sqlAddSlashes($key) . '\''; } elseif (strlen($mimetype) || strlen($transformation) - || strlen($transformation_options) + || strlen($transformationOpt) ) { $upd_query = 'INSERT INTO ' . PMA_Util::backquote($cfgRelation['db']) @@ -321,7 +321,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation, . '\'' . PMA_Util::sqlAddSlashes($key) . '\',' . '\'' . PMA_Util::sqlAddSlashes($mimetype) . '\',' . '\'' . PMA_Util::sqlAddSlashes($transformation) . '\',' - . '\'' . PMA_Util::sqlAddSlashes($transformation_options) . '\')'; + . '\'' . PMA_Util::sqlAddSlashes($transformationOpt) . '\')'; } if (isset($upd_query)) { diff --git a/setup/lib/form_processing.lib.php b/setup/lib/form_processing.lib.php index a35a3b87d0..e32a2bdd1b 100644 --- a/setup/lib/form_processing.lib.php +++ b/setup/lib/form_processing.lib.php @@ -38,17 +38,17 @@ function PMA_process_formset(FormDisplay $form_display) $page = filter_input(INPUT_GET, 'page'); $formset = filter_input(INPUT_GET, 'formset'); $formset = $formset ? "{$separator}formset=$formset" : ''; - $id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT); - if ($id === null && $page == 'servers') { + $formId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT); + if ($formId === null && $page == 'servers') { // we've just added a new server, get its id - $id = $form_display->getConfigFile()->getServerCount(); + $formId = $form_display->getConfigFile()->getServerCount(); } - $id = $id ? "{$separator}id=$id" : ''; + $formId = $formId ? "{$separator}id=$formId" : ''; ?> <div class="error"> <h4><?php echo __('Warning') ?></h4> <?php echo __('Submitted form contains errors') ?><br /> - <a href="?page=<?php echo $page . $formset . $id . $separator ?>mode=revert"> + <a href="?page=<?php echo $page . $formset . $formId . $separator ?>mode=revert"> <?php echo __('Try to revert erroneous fields to their default values') ?> </a> @@ -56,7 +56,7 @@ function PMA_process_formset(FormDisplay $form_display) <?php $form_display->displayErrors() ?> <a class="btn" href="index.php"><?php echo __('Ignore errors') ?></a> - <a class="btn" href="?page=<?php echo $page . $formset . $id + <a class="btn" href="?page=<?php echo $page . $formset . $formId . $separator ?>mode=edit"><?php echo __('Show form') ?></a> <?php } diff --git a/setup/lib/index.lib.php b/setup/lib/index.lib.php index c34c58785d..5d838bf8ab 100644 --- a/setup/lib/index.lib.php +++ b/setup/lib/index.lib.php @@ -34,16 +34,16 @@ function PMA_messagesBegin() * Adds a new message to message list * * @param string $type one of: notice, error - * @param string $id unique message identifier + * @param string $msgId unique message identifier * @param string $title language string id (in $str array) * @param string $message message text * * @return void */ -function PMA_messagesSet($type, $id, $title, $message) +function PMA_messagesSet($type, $msgId, $title, $message) { - $fresh = ! isset($_SESSION['messages'][$type][$id]); - $_SESSION['messages'][$type][$id] = array( + $fresh = ! isset($_SESSION['messages'][$type][$msgId]); + $_SESSION['messages'][$type][$msgId] = array( 'fresh' => $fresh, 'active' => true, 'title' => $title, diff --git a/test/libraries/PMA_server_privileges_test.php b/test/libraries/PMA_server_privileges_test.php index f16590cb67..2d14684b45 100644 --- a/test/libraries/PMA_server_privileges_test.php +++ b/test/libraries/PMA_server_privileges_test.php @@ -1411,10 +1411,9 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase { $privMap = null; $db = "pma_dbname"; - $table = "pma_table"; //$privMap = null - $html = PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table); + $html = PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db); $this->assertContains( __('No user found.'), $html @@ -1431,7 +1430,7 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase ) ); - $html = PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table); + $html = PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db); //validate 1: $current_privileges $current_privileges = $privMap["user1"]["hostname1"]; diff --git a/user_password.php b/user_password.php index c440cf8cad..affb8c4d64 100644 --- a/user_password.php +++ b/user_password.php @@ -68,24 +68,24 @@ exit; /** * Send the message as an ajax request * - * @param array $change_password_message Message to display - * @param string $sql_query SQL query executed + * @param array $chgPasswdMsg Message to display + * @param string $sql_query SQL query executed * * @return void */ -function PMA_getChangePassMessage($change_password_message, $sql_query = '') +function PMA_getChangePassMessage($chgPasswdMsg, $sql_query = '') { if ($GLOBALS['is_ajax_request'] == true) { /** * If in an Ajax request, we don't need to show the rest of the page */ $response = PMA_Response::getInstance(); - if ($change_password_message['error']) { - $response->addJSON('message', $change_password_message['msg']); + if ($chgPasswdMsg['error']) { + $response->addJSON('message', $chgPasswdMsg['msg']); $response->isSuccess(false); } else { $sql_query = PMA_Util::getMessage( - $change_password_message['msg'], + $chgPasswdMsg['msg'], $sql_query, 'success' ); @@ -120,13 +120,13 @@ function PMA_setChangePasswordMsg() /** * Change the password * - * @param string $password New password - * @param string $message Message - * @param array $change_password_message Message to show + * @param string $password New password + * @param string $message Message + * @param array $chgPasswdMsg Message to show * * @return void */ -function PMA_changePassword($password, $message, $change_password_message) +function PMA_changePassword($password, $message, $chgPasswdMsg) { // Defines the url to return to in case of error in the sql statement $_url_params = array(); @@ -138,7 +138,7 @@ function PMA_changePassword($password, $message, $change_password_message) ); $new_url_params = PMA_changePassAuthType($_url_params, $password); - PMA_getChangePassMessage($change_password_message, $sql_query); + PMA_getChangePassMessage($chgPasswdMsg, $sql_query); PMA_changePassDisplayPage($message, $sql_query, $new_url_params); } |