From 2575cccf2dfbb0ca7b7953fe0c4a8e54d1f85b96 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Wed, 25 Apr 2012 22:04:14 +0530 Subject: [PATCH 1/7] Coding style improvements (Last parameter comment requires a blank newline after it) --- libraries/dbi/mysqli.dbi.lib.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index 2a0f0808a9..c270bad30c 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -61,6 +61,7 @@ if (! defined('MYSQLI_TYPE_VARCHAR')) { * @param string $server_socket * @param int $client_flags * @param bool $persistent + * * @return bool */ function PMA_DBI_real_connect($link, $host, $user, $password, $dbname, $server_port, $server_socket, $client_flags = null, $persistent = false) @@ -105,6 +106,7 @@ function PMA_DBI_real_connect($link, $host, $user, $password, $dbname, $server_p * @param bool $is_controluser * @param array $server host/port/socket * @param bool $auxiliary_connection (when true, don't go back to login if connection fails) + * * @return mixed false on error or a mysqli object on success */ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null, $auxiliary_connection = false) @@ -213,6 +215,7 @@ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = nu * * @param string $dbname database name to select * @param mysqli $link the mysqli object + * * @return boolean */ function PMA_DBI_select_db($dbname, $link = null) @@ -233,6 +236,7 @@ function PMA_DBI_select_db($dbname, $link = null) * @param string $query query to execute * @param mysqli $link mysqli object * @param int $options + * * @return mysqli_result|bool */ function PMA_DBI_real_query($query, $link, $options) @@ -252,6 +256,7 @@ function PMA_DBI_real_query($query, $link, $options) * returns array of rows with associative and numeric keys from $result * * @param mysqli_result $result result set identifier + * * @return array */ function PMA_DBI_fetch_array($result) @@ -263,6 +268,7 @@ function PMA_DBI_fetch_array($result) * returns array of rows with associative keys from $result * * @param mysqli_result $result result set identifier + * * @return array */ function PMA_DBI_fetch_assoc($result) @@ -274,6 +280,7 @@ function PMA_DBI_fetch_assoc($result) * returns array of rows with numeric keys from $result * * @param mysqli_result $result result set identifier + * * @return array */ function PMA_DBI_fetch_row($result) @@ -286,6 +293,7 @@ function PMA_DBI_fetch_row($result) * * @param $result * @param $offset + * * @return bool true on success, false on failure */ function PMA_DBI_data_seek($result, $offset) @@ -309,6 +317,7 @@ function PMA_DBI_free_result($result) * Check if there are any more query results from a multi query * * @param mysqli $link the mysqli object + * * @return bool true or false */ function PMA_DBI_more_results($link = null) @@ -327,6 +336,7 @@ function PMA_DBI_more_results($link = null) * Prepare next result from multi_query * * @param mysqli $link the mysqli object + * * @return bool true or false */ function PMA_DBI_next_result($link = null) @@ -345,6 +355,7 @@ function PMA_DBI_next_result($link = null) * Returns a string representing the type of connection used * * @param resource $link mysql link + * * @return string type of connection used */ function PMA_DBI_get_host_info($link = null) @@ -363,6 +374,7 @@ function PMA_DBI_get_host_info($link = null) * Returns the version of the MySQL protocol used * * @param resource $link mysql link + * * @return integer version of the MySQL protocol used */ function PMA_DBI_get_proto_info($link = null) @@ -391,6 +403,7 @@ function PMA_DBI_get_client_info() * returns last error message or false if no errors occured * * @param resource $link mysql link + * * @return string|bool $error or false */ function PMA_DBI_getError($link = null) @@ -431,6 +444,7 @@ function PMA_DBI_getError($link = null) * returns the number of rows returned by last query * * @param mysqli_result $result result set identifier + * * @return string|int */ function PMA_DBI_num_rows($result) @@ -447,6 +461,7 @@ function PMA_DBI_num_rows($result) * returns last inserted auto_increment id for given $link or $GLOBALS['userlink'] * * @param mysqli $link the mysqli object + * * @return string|int */ function PMA_DBI_insert_id($link = null) @@ -472,6 +487,7 @@ function PMA_DBI_insert_id($link = null) * * @param mysqli $link the mysqli object * @param boolean $get_from_cache + * * @return string|int */ function PMA_DBI_affected_rows($link = null, $get_from_cache = true) @@ -494,6 +510,7 @@ function PMA_DBI_affected_rows($link = null, $get_from_cache = true) * returns metainfo for fields in $result * * @param mysqli_result $result result set identifier + * * @return array meta info for fields in $result */ function PMA_DBI_get_fields_meta($result) @@ -574,6 +591,7 @@ function PMA_DBI_get_fields_meta($result) * return number of fields in given $result * * @param mysqli_result $result result set identifier + * * @return int field count */ function PMA_DBI_num_fields($result) @@ -586,6 +604,7 @@ function PMA_DBI_num_fields($result) * * @param mysqli_result $result result set identifier * @param int $i field + * * @return int length of field */ function PMA_DBI_field_len($result, $i) @@ -598,6 +617,7 @@ function PMA_DBI_field_len($result, $i) * * @param mysqli_result $result result set identifier * @param int $i field + * * @return string name of $i. field in $result */ function PMA_DBI_field_name($result, $i) @@ -610,6 +630,7 @@ function PMA_DBI_field_name($result, $i) * * @param mysqli_result $result result set identifier * @param int $i field + * * @return string field flags */ function PMA_DBI_field_flags($result, $i) From 8efb8624080e9cbda7871498e8823e36444ea594 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Wed, 25 Apr 2012 22:06:29 +0530 Subject: [PATCH 2/7] More coding style fixes --- libraries/dbi/mysqli.dbi.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index c270bad30c..fecaabfb59 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -31,7 +31,7 @@ mysqli_report(MYSQLI_REPORT_OFF); * some older mysql client libs are missing these constants ... */ if (! defined('MYSQLI_BINARY_FLAG')) { - define('MYSQLI_BINARY_FLAG', 128); + define('MYSQLI_BINARY_FLAG', 128); } /** @@ -305,6 +305,8 @@ function PMA_DBI_data_seek($result, $offset) * Frees memory associated with the result * * @param mysqli_result $result + * + * @return void */ function PMA_DBI_free_result($result) { From a817542fda9d84172ea378cc607156ca5d8c1b42 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Wed, 25 Apr 2012 22:27:32 +0530 Subject: [PATCH 3/7] Coding style improvements (Closing parenthesis of a multi-line function call must be on a line by itself) --- libraries/Table.class.php | 3 ++- libraries/common.lib.php | 3 ++- server_privileges.php | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libraries/Table.class.php b/libraries/Table.class.php index fec4f1d419..5d78589bb0 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -293,7 +293,8 @@ class PMA_Table // if called static, with parameters if (! empty($db) && ! empty($table)) { $engine = PMA_Table::sGetStatusInfo( - $db, $table, 'ENGINE', null, true); + $db, $table, 'ENGINE', null, true + ); } return (! empty($engine) && ((strtoupper($engine) == 'MERGE') || (strtoupper($engine) == 'MRG_MYISAM'))); diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 36631ff126..a474f19e56 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -3345,7 +3345,8 @@ function PMA_selectUploadFile($import_list, $uploaddir) echo ''; $extensions = ''; foreach ($import_list as $key => $val) { diff --git a/server_privileges.php b/server_privileges.php index f800d88bc9..b0f9ad8057 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -588,9 +588,11 @@ function PMA_displayPrivTable($db = '*', $table = '*', $submit = true) unset($row['Table_priv'], $current_grant, $av_grants, $users_grants); // get collumns - $res = PMA_DBI_try_query('SHOW COLUMNS FROM ' + $res = PMA_DBI_try_query( + 'SHOW COLUMNS FROM ' . PMA_backquote(PMA_unescape_mysql_wildcards($db)) - . '.' . PMA_backquote($table) . ';'); + . '.' . PMA_backquote($table) . ';' + ); $columns = array(); if ($res) { while ($row1 = PMA_DBI_fetch_row($res)) { From 50e6f3b387379becc11911ff755f3d54579c69f7 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Wed, 25 Apr 2012 23:02:37 +0530 Subject: [PATCH 4/7] Coding style improvements (ControlSignature) --- export.php | 3 +-- libraries/Config.class.php | 11 ++++------- libraries/auth/swekey/swekey.php | 3 +-- libraries/common.lib.php | 3 +-- libraries/core.lib.php | 12 ++++++------ libraries/export/htmlword.php | 2 +- libraries/export/odt.php | 2 +- libraries/export/texytext.php | 2 +- libraries/mult_submits.inc.php | 13 ++++++++----- libraries/rte/rte_list.lib.php | 6 +++--- user_password.php | 2 +- 11 files changed, 28 insertions(+), 31 deletions(-) diff --git a/export.php b/export.php index 3e93bb758f..3c54a82672 100644 --- a/export.php +++ b/export.php @@ -16,8 +16,7 @@ require_once 'libraries/plugin_interface.lib.php'; * Sets globals from all $_POST (in export.php only) * Would it not be tiresome to list all export-plugin options here? */ -foreach ($_POST as $one_post_param => $one_post_value) -{ +foreach ($_POST as $one_post_param => $one_post_value) { $GLOBALS[$one_post_param] = $one_post_value; } diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 20df29d663..cd7a7b2148 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -469,22 +469,19 @@ class PMA_Config $dataline = array_shift($commit); $datalinearr = explode(' ', $dataline, 2); $linetype = $datalinearr[0]; - if (in_array($linetype, array('author', 'committer'))) - { + if (in_array($linetype, array('author', 'committer'))) { $user = $datalinearr[1]; preg_match('/([^<]+)<([^>]+)> ([0-9]+)( [^ ]+)?/', $user, $user); $user2 = array( 'name' => trim($user[1]), 'email' => trim($user[2]), 'date' => date('Y-m-d H:i:s', $user[3])); - if (isset($user[4])) - { + if (isset($user[4])) { $user2['date'] .= $user[4]; } $$linetype = $user2; } - } - while ($dataline != ''); + } while ($dataline != ''); $message = trim(implode(' ', $commit)); } elseif (isset($commit_json)) { @@ -1185,7 +1182,7 @@ class PMA_Config } // Reconstruct URL using parsed parts - if($this->get('SSLPort')) { + if ($this->get('SSLPort')) { $port_number = $this->get('SSLPort'); } else { $port_number = 443; diff --git a/libraries/auth/swekey/swekey.php b/libraries/auth/swekey/swekey.php index 3c6bd8079a..4bf1899340 100644 --- a/libraries/auth/swekey/swekey.php +++ b/libraries/auth/swekey/swekey.php @@ -271,8 +271,7 @@ function Swekey_HttpGet($url, &$response_code) $res = $reply->getBody(); $info = $r->getResponseInfo(); $response_code = $info['response_code']; - if ($response_code != 200) - { + if ($response_code != 200) { $gSwekeyLastError = $response_code; error_log("SWEKEY_ERROR:Error ".$gSwekeyLastError." getting ".$url); return ""; diff --git a/libraries/common.lib.php b/libraries/common.lib.php index a474f19e56..4bac5a0d47 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -3318,8 +3318,7 @@ function PMA_browseUploadFile($max_upload_size) { if ($GLOBALS['is_upload'] && !empty($GLOBALS['cfg']['UploadDir'])) { echo '