diff --git a/libraries/gis/pma_gis_geometrycollection.php b/libraries/gis/pma_gis_geometrycollection.php index 91c5a588c9ec..0a770971a304 100644 --- a/libraries/gis/pma_gis_geometrycollection.php +++ b/libraries/gis/pma_gis_geometrycollection.php @@ -59,7 +59,7 @@ public function scaleRow($spatial) // Trim to remove leading 'GEOMETRYCOLLECTION(' and trailing ')' $goem_col = substr($spatial, 19, (strlen($spatial) - 20)); - + // Split the geometry collection object to get its constituents. $sub_parts = $this->_explodeGeomCol($goem_col); diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index 515a406a6b28..29924ab17335 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -928,7 +928,7 @@ private function _renderNode($node, $recursive = -1, $class = '') $title = $node->getComment(); if ($title) { $title = ' title="' - . htmlentities($title, ENT_QUOTES, 'UTF-8') + . htmlentities($title, ENT_QUOTES, 'UTF-8') . '"'; } } else { diff --git a/libraries/navigation/Nodes/Node.class.php b/libraries/navigation/Nodes/Node.class.php index 0a8703ba41d4..a3253ef2e278 100644 --- a/libraries/navigation/Nodes/Node.class.php +++ b/libraries/navigation/Nodes/Node.class.php @@ -362,7 +362,7 @@ public function getData($type, $pos, $searchClause = '') // @todo obey the DisableIS directive $query = "SELECT `SCHEMA_NAME` "; $query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` "; - $query .= $this->_getWhereClause($searchClause); + $query .= $this->_getWhereClause($searchClause); $query .= "ORDER BY `SCHEMA_NAME` ASC "; $query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}"; return PMA_DBI_fetchResult($query); @@ -394,7 +394,7 @@ public function getPresence($type = '', $searchClause = '') if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) { $query = "SELECT COUNT(*) "; $query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` "; - $query .= $this->_getWhereClause($searchClause); + $query .= $this->_getWhereClause($searchClause); $retval = (int)PMA_DBI_fetchValue($query); } else { $query = "SHOW DATABASES "; @@ -412,11 +412,11 @@ public function getPresence($type = '', $searchClause = '') /** * Returns the WHERE clause depending on the $searchClause parameter - * and the hide_db directive + * and the hide_db directive * * @param string $searchClause A string used to filter the results of the query * - * @return string + * @return string */ private function _getWhereClause($searchClause = '') { diff --git a/libraries/replication.inc.php b/libraries/replication.inc.php index d105e6cf3599..da499513ba6f 100644 --- a/libraries/replication.inc.php +++ b/libraries/replication.inc.php @@ -75,7 +75,8 @@ 'Seconds_Behind_Master', ); /** - * define important variables, which need to be watched for correct running of replication in slave mode + * define important variables, which need to be watched for + * correct running of replication in slave mode * * @usedby PMA_replication_print_status_table() */ @@ -110,29 +111,48 @@ } if (${"server_{$type}_status"}) { if ($type == "master") { - ${"server_{$type}_Do_DB"} = explode(",", $server_master_replication[0]["Binlog_Do_DB"]); + ${"server_{$type}_Do_DB"} = explode( + ",", $server_master_replication[0]["Binlog_Do_DB"] + ); $replication_info[$type]['Do_DB'] = ${"server_{$type}_Do_DB"}; - ${"server_{$type}_Ignore_DB"} = explode(",", $server_master_replication[0]["Binlog_Ignore_DB"]); + ${"server_{$type}_Ignore_DB"} = explode( + ",", $server_master_replication[0]["Binlog_Ignore_DB"] + ); $replication_info[$type]['Ignore_DB'] = ${"server_{$type}_Ignore_DB"}; } elseif ($type == "slave") { - ${"server_{$type}_Do_DB"} = explode(",", $server_slave_replication[0]["Replicate_Do_DB"]); + ${"server_{$type}_Do_DB"} = explode( + ",", $server_slave_replication[0]["Replicate_Do_DB"] + ); $replication_info[$type]['Do_DB'] = ${"server_{$type}_Do_DB"}; - ${"server_{$type}_Ignore_DB"} = explode(",", $server_slave_replication[0]["Replicate_Ignore_DB"]); + ${"server_{$type}_Ignore_DB"} = explode( + ",", $server_slave_replication[0]["Replicate_Ignore_DB"] + ); $replication_info[$type]['Ignore_DB'] = ${"server_{$type}_Ignore_DB"}; - ${"server_{$type}_Do_Table"} = explode(",", $server_slave_replication[0]["Replicate_Do_Table"]); + ${"server_{$type}_Do_Table"} = explode( + ",", $server_slave_replication[0]["Replicate_Do_Table"] + ); $replication_info[$type]['Do_Table'] = ${"server_{$type}_Do_Table"}; - ${"server_{$type}_Ignore_Table"} = explode(",", $server_slave_replication[0]["Replicate_Ignore_Table"]); - $replication_info[$type]['Ignore_Table'] = ${"server_{$type}_Ignore_Table"}; - - ${"server_{$type}_Wild_Do_Table"} = explode(",", $server_slave_replication[0]["Replicate_Wild_Do_Table"]); - $replication_info[$type]['Wild_Do_Table'] = ${"server_{$type}_Wild_Do_Table"}; - - ${"server_{$type}_Wild_Ignore_Table"} = explode(",", $server_slave_replication[0]["Replicate_Wild_Ignore_Table"]); - $replication_info[$type]['Wild_Ignore_Table'] = ${"server_{$type}_Wild_Ignore_Table"}; + ${"server_{$type}_Ignore_Table"} = explode( + ",", $server_slave_replication[0]["Replicate_Ignore_Table"] + ); + $replication_info[$type]['Ignore_Table'] + = ${"server_{$type}_Ignore_Table"}; + + ${"server_{$type}_Wild_Do_Table"} = explode( + ",", $server_slave_replication[0]["Replicate_Wild_Do_Table"] + ); + $replication_info[$type]['Wild_Do_Table'] + = ${"server_{$type}_Wild_Do_Table"}; + + ${"server_{$type}_Wild_Ignore_Table"} = explode( + ",", $server_slave_replication[0]["Replicate_Wild_Ignore_Table"] + ); + $replication_info[$type]['Wild_Ignore_Table'] + = ${"server_{$type}_Wild_Ignore_Table"}; } } } @@ -145,7 +165,7 @@ * * @return $string the extracted part */ -function PMA_extract_db_or_table($string, $what = 'db') +function PMA_extractDbOrTable($string, $what = 'db') { $list = explode(".", $string); if ('db' == $what) { @@ -159,13 +179,15 @@ function PMA_extract_db_or_table($string, $what = 'db') * Configures replication slave * * @param string $action possible values: START or STOP - * @param string $control default: null, possible values: SQL_THREAD or IO_THREAD or null. - * If it is set to null, it controls both SQL_THREAD and IO_THREAD + * @param string $control default: null, + * possible values: SQL_THREAD or IO_THREAD or null. + * If it is set to null, it controls both + * SQL_THREAD and IO_THREAD * @param mixed $link mysql link * * @return mixed output of PMA_DBI_tryQuery */ -function PMA_replication_slave_control($action, $control = null, $link = null) +function PMA_Replication_Slave_control($action, $control = null, $link = null) { $action = strtoupper($action); $control = strtoupper($control); @@ -195,11 +217,11 @@ function PMA_replication_slave_control($action, $control = null, $link = null) * * @return output of CHANGE MASTER mysql command */ -function PMA_replication_slave_change_master($user, $password, $host, $port, +function PMA_Replication_Slave_changeMaster($user, $password, $host, $port, $pos, $stop = true, $start = true, $link = null ) { if ($stop) { - PMA_replication_slave_control("STOP", null, $link); + PMA_Replication_Slave_control("STOP", null, $link); } $out = PMA_DBI_tryQuery( @@ -213,7 +235,7 @@ function PMA_replication_slave_change_master($user, $password, $host, $port, ); if ($start) { - PMA_replication_slave_control("START", null, $link); + PMA_Replication_Slave_control("START", null, $link); } return $out; @@ -230,8 +252,9 @@ function PMA_replication_slave_change_master($user, $password, $host, $port, * * @return mixed $link mysql link on success */ -function PMA_replication_connect_to_master($user, $password, $host = null, $port = null, $socket = null) -{ +function PMA_Replication_connectToMaster( + $user, $password, $host = null, $port = null, $socket = null +) { $server = array(); $server["host"] = $host; $server["port"] = $port; @@ -247,9 +270,9 @@ function PMA_replication_connect_to_master($user, $password, $host = null, $port * @param mixed $link mysql link * * @return array an array containing File and Position in MySQL replication - * on master server, useful for PMA_replication_slave_change_master + * on master server, useful for PMA_Replication_Slave_changeMaster */ -function PMA_replication_slave_bin_log_master($link = null) +function PMA_Replication_Slave_binLogMaster($link = null) { $data = PMA_DBI_fetchResult('SHOW MASTER STATUS', null, null, $link); $output = array(); @@ -269,7 +292,7 @@ function PMA_replication_slave_bin_log_master($link = null) * @return array array of replicated databases */ -function PMA_replication_master_replicated_dbs($link = null) +function PMA_Replication_Master_getReplicatedDbs($link = null) { // let's find out, which databases are replicated $data = PMA_DBI_fetchResult('SHOW MASTER STATUS', null, null, $link); diff --git a/libraries/structure.lib.php b/libraries/structure.lib.php index 9121a592079f..cd6ef34f332b 100644 --- a/libraries/structure.lib.php +++ b/libraries/structure.lib.php @@ -961,8 +961,8 @@ function PMA_getServerSlaveStatus($server_slave_status, $truename) $do = true; } foreach ($server_slave_Wild_Do_Table as $db_table) { - $table_part = PMA_extract_db_or_table($db_table, 'table'); - if (($GLOBALS['db'] == PMA_extract_db_or_table($db_table, 'db')) + $table_part = PMA_extractDbOrTable($db_table, 'table'); + if (($GLOBALS['db'] == PMA_extractDbOrTable($db_table, 'db')) && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename)) ) { $do = true; @@ -975,8 +975,8 @@ function PMA_getServerSlaveStatus($server_slave_status, $truename) $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)) + $table_part = PMA_extractDbOrTable($db_table, 'table'); + if (($db == PMA_extractDbOrTable($db_table)) && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename)) ) { $ignored = true; @@ -2508,14 +2508,14 @@ function PMA_moveColumns($db, $table) /** * Get columns with unique index - * + * * @param string $db database name * @param string $table tablename - * + * * @return array $columns_with_unique_index An array of columns with unique index, * with $column name as the array key */ -function PMA_getColumnsWithUniqueIndex($db ,$table) +function PMA_getColumnsWithUniqueIndex($db ,$table) { $columns_with_unique_index = array(); foreach (PMA_Index::getFromTable($table, $db) as $index) { @@ -2531,22 +2531,22 @@ function PMA_getColumnsWithUniqueIndex($db ,$table) /** * Check column names for MySQL reserved words - * + * * @param string $db database name * @param string $table tablename - * + * * @return array $messages array of PMA_Messages */ -function PMA_getReservedWordColumnNameMessages($db ,$table) +function PMA_getReservedWordColumnNameMessages($db ,$table) { $messages = array(); if ($GLOBALS['cfg']['ReservedWordDisableWarning'] === false) { $pma_table = new PMA_Table($table, $db); - $columns = $pma_table->getReservedColumnNames(); + $columns = $pma_table->getReservedColumnNames(); if (!empty($columns)) { foreach ($columns as $column) { $msg = PMA_message::notice( - __('The column name \'%s\' is a MySQL reserved keyword.') + __('The column name \'%s\' is a MySQL reserved keyword.') ); $msg->addParam($column); $messages[] = $msg; diff --git a/server_engines.php b/server_engines.php index 892d52309630..fca316e42f94 100644 --- a/server_engines.php +++ b/server_engines.php @@ -35,19 +35,19 @@ */ function PMA_getServerEnginesHtml() { - /** - * Did the user request information about a certain storage engine? - */ - $html = ''; - if (empty($_REQUEST['engine']) - || ! PMA_StorageEngine::isValid($_REQUEST['engine']) - ) { - $html .= PMA_getAllServerEnginesHtml(); - } else { - $html .= PMA_getSpecifiedServerEnginesHtml(); - } - - return $html; + /** + * Did the user request information about a certain storage engine? + */ + $html = ''; + if (empty($_REQUEST['engine']) + || ! PMA_StorageEngine::isValid($_REQUEST['engine']) + ) { + $html .= PMA_getAllServerEnginesHtml(); + } else { + $html .= PMA_getSpecifiedServerEnginesHtml(); + } + + return $html; } /** diff --git a/server_replication.php b/server_replication.php index 70e6b4fb1801..ab18c22255a5 100644 --- a/server_replication.php +++ b/server_replication.php @@ -79,7 +79,7 @@ $_SESSION['replication']['sr_action_info'] = __('Unknown error'); // Attempt to connect to the new master server - $link_to_master = PMA_replication_connect_to_master( + $link_to_master = PMA_Replication_connectToMaster( $sr['username'], $sr['pma_pw'], $sr['hostname'], $sr['port'] ); @@ -91,7 +91,7 @@ ); } else { // Read the current master position - $position = PMA_replication_slave_bin_log_master($link_to_master); + $position = PMA_Replication_Slave_binLogMaster($link_to_master); if (empty($position)) { $_SESSION['replication']['sr_action_status'] = 'error'; @@ -99,7 +99,7 @@ } else { $_SESSION['replication']['m_correct'] = true; - if (! PMA_replication_slave_change_master($sr['username'], $sr['pma_pw'], $sr['hostname'], $sr['port'], $position, true, false)) { + if (! PMA_Replication_Slave_changeMaster($sr['username'], $sr['pma_pw'], $sr['hostname'], $sr['port'], $position, true, false)) { $_SESSION['replication']['sr_action_status'] = 'error'; $_SESSION['replication']['sr_action_info'] = __('Unable to change master'); } else { @@ -113,11 +113,11 @@ } } elseif (isset($GLOBALS['sr_slave_server_control'])) { if ($GLOBALS['sr_slave_action'] == 'reset') { - PMA_replication_slave_control("STOP"); + PMA_Replication_Slave_control("STOP"); PMA_DBI_tryQuery("RESET SLAVE;"); - PMA_replication_slave_control("START"); + PMA_Replication_Slave_control("START"); } else { - PMA_replication_slave_control( + PMA_Replication_Slave_control( $GLOBALS['sr_slave_action'], $GLOBALS['sr_slave_control_parm'] ); @@ -129,9 +129,9 @@ if (isset($GLOBALS['sr_skip_errors_count'])) { $count = $GLOBALS['sr_skip_errors_count'] * 1; } - PMA_replication_slave_control("STOP"); + PMA_Replication_Slave_control("STOP"); PMA_DBI_tryQuery("SET GLOBAL SQL_SLAVE_SKIP_COUNTER = ".$count.";"); - PMA_replication_slave_control("START"); + PMA_Replication_Slave_control("START"); } diff --git a/server_status_monitor.php b/server_status_monitor.php index 0515ffd2986b..e5d1bded4548 100644 --- a/server_status_monitor.php +++ b/server_status_monitor.php @@ -765,26 +765,26 @@ function PMA_getPopContentHtml() */ function PMA_getClientSideDataAndLinksHtml($ServerStatusData) { - /** - * Define some data needed on the client side + /** + * Define some data needed on the client side */ - $input = ''; - $form = '
'; - $form .= sprintf($input, 'server_time', microtime(true) * 1000); - $form .= sprintf($input, 'server_os', PHP_OS); - $form .= sprintf($input, 'is_superuser', PMA_isSuperuser()); - $form .= sprintf($input, 'server_db_isLocal', $ServerStatusData->db_isLocal); - $form .= '
'; - /** - * Define some links used on client side - */ - $links = '
'; - $links .= PMA_Util::showMySQLDocu('general-thread-states', 'general-thread-states'); - $links .= '
'; - $links .= '
'; - $links .= PMA_Util::showMySQLDocu('explain-output', 'explain-output'); - $links .= '
'; - - return $form . $links; + $input = ''; + $form = '
'; + $form .= sprintf($input, 'server_time', microtime(true) * 1000); + $form .= sprintf($input, 'server_os', PHP_OS); + $form .= sprintf($input, 'is_superuser', PMA_isSuperuser()); + $form .= sprintf($input, 'server_db_isLocal', $ServerStatusData->db_isLocal); + $form .= '
'; + /** + * Define some links used on client side + */ + $links = '
'; + $links .= PMA_Util::showMySQLDocu('general-thread-states', 'general-thread-states'); + $links .= '
'; + $links .= '
'; + $links .= PMA_Util::showMySQLDocu('explain-output', 'explain-output'); + $links .= '
'; + + return $form . $links; } ?> diff --git a/sql.php b/sql.php index 0f428c521fe9..76483f8f7310 100644 --- a/sql.php +++ b/sql.php @@ -127,7 +127,9 @@ } else { $curr_value = $_REQUEST['curr_value']; } - $dropdown = PMA_getHtmlForRelationalColumnDropdown($db, $table, $column, $curr_value); + $dropdown = PMA_getHtmlForRelationalColumnDropdown( + $db, $table, $column, $curr_value + ); $response = PMA_Response::getInstance(); $response->addJSON('dropdown', $dropdown); exit; @@ -543,7 +545,7 @@ } while (PMA_DBI_nextResult()); $is_procedure = false; - + // Since multiple query execution is anyway handled, // ignore the WHERE clause of the first sql statement // which might contain a phrase like 'call ' @@ -870,8 +872,8 @@ $query__type = PMA_DisplayResults::QUERY_TYPE_SELECT; if ($analyzed_sql[0]['querytype'] == $query__type) { $createViewHTML = $displayResultsObject->getCreateViewQueryResultOp( - $analyzed_sql - ); + $analyzed_sql + ); $response->addHTML($createViewHTML.'
'); } @@ -1130,7 +1132,9 @@ $printview, $url_query, $editable ); - $html_output .= $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql); + $html_output .= $displayResultsObject->getTable( + $result, $disp_mode, $analyzed_sql + ); PMA_DBI_freeResult($result); } @@ -1143,7 +1147,9 @@ foreach ($selected as $idx => $tbl_name) { $check = PMA_Index::findDuplicates($tbl_name, $db); if (! empty($check)) { - $html_output .= sprintf(__('Problems with indexes of table `%s`'), $tbl_name); + $html_output .= sprintf( + __('Problems with indexes of table `%s`'), $tbl_name + ); $html_output .= $check; } } diff --git a/tbl_addfield.php b/tbl_addfield.php index 99bd1b617c1a..a3098429aebb 100644 --- a/tbl_addfield.php +++ b/tbl_addfield.php @@ -50,8 +50,8 @@ //avoid an incorrect calling of PMA_updateColumns() via //tbl_structure.php below unset($_REQUEST['do_save_data']); - - require_once 'libraries/create_addfield.lib.php'; + + include_once 'libraries/create_addfield.lib.php'; // get column addition statements $sql_statement = PMA_getColumnCreationStatements(false); diff --git a/tbl_create.php b/tbl_create.php index 160b62607a78..da699ae6ef97 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -67,11 +67,11 @@ */ if (isset($_REQUEST['do_save_data'])) { $sql_query = ''; - - require_once 'libraries/create_addfield.lib.php'; + + include_once 'libraries/create_addfield.lib.php'; // get column addition statements $sql_statement = PMA_getColumnCreationStatements(true); - + // Builds the 'create table' statement $sql_query = 'CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table) . ' (' . $sql_statement . ')'; diff --git a/tbl_structure.php b/tbl_structure.php index 6862097e6460..bdb58e9e44d3 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -30,14 +30,14 @@ */ if (isset($_REQUEST['move_columns']) && is_array($_REQUEST['move_columns']) - && $response->isAjax() + && $response->isAjax() ) { PMA_moveColumns($db, $table); exit; } /** - * A click on Change has been made for one column + * A click on Change has been made for one column */ if (isset($_REQUEST['change_column'])) { PMA_displayHtmlForColumnChange($db, $table, null, 'tbl_structure.php'); @@ -140,7 +140,7 @@ $url_params['back'] = 'tbl_structure.php'; // Check column names for MySQL reserved words -$reserved_word_column_messages = PMA_getReservedWordColumnNameMessages($db ,$table); +$reserved_word_column_messages = PMA_getReservedWordColumnNameMessages($db, $table); $response->addHTML($reserved_word_column_messages); /** @@ -159,7 +159,7 @@ // @todo should be: $server->db($db)->table($table)->primary() $primary = PMA_Index::getPrimary($table, $db); -$columns_with_unique_index = PMA_getColumnsWithUniqueIndex($db ,$table); +$columns_with_unique_index = PMA_getColumnsWithUniqueIndex($db, $table); // 3. Get fields $fields = (array) PMA_DBI_getColumns($db, $table, null, true); diff --git a/test/classes/PMA_Util_test.php b/test/classes/PMA_Util_test.php index 52f7893fe01b..ae157a9bfbc1 100644 --- a/test/classes/PMA_Util_test.php +++ b/test/classes/PMA_Util_test.php @@ -94,7 +94,7 @@ public function testPageSelector() { $this->assertContains( '