Whitespace cleanup

This commit is contained in:
Piotr Przybylski
2011-02-15 17:33:48 +01:00
parent e5e21be62a
commit 651b357f8a
2 changed files with 34 additions and 34 deletions

View File

@@ -63,12 +63,12 @@ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = nu
? false ? false
: true; : true;
} else { } else {
$server_port = (empty($cfg['Server']['port'])) $server_port = (empty($cfg['Server']['port']))
? '' ? ''
: ':' . (int)$cfg['Server']['port']; : ':' . (int)$cfg['Server']['port'];
$server_socket = (empty($cfg['Server']['socket'])) $server_socket = (empty($cfg['Server']['socket']))
? '' ? ''
: ':' . $cfg['Server']['socket']; : ':' . $cfg['Server']['socket'];
} }
if (strtolower($cfg['Server']['connect_type']) == 'tcp') { if (strtolower($cfg['Server']['connect_type']) == 'tcp') {
@@ -97,11 +97,11 @@ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = nu
// Retry with empty password if we're allowed to // Retry with empty password if we're allowed to
if (empty($link) && $cfg['Server']['nopassword'] && !$is_controluser) { if (empty($link) && $cfg['Server']['nopassword'] && !$is_controluser) {
$link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, '', empty($client_flags) ? NULL : $client_flags); $link = PMA_DBI_real_connect($cfg['Server']['host'] . $server_port . $server_socket, $user, '', empty($client_flags) ? NULL : $client_flags);
} }
} else { } else {
if (!isset($server['host'])) { if (!isset($server['host'])) {
$link = PMA_DBI_real_connect($server_socket, $user, $password, NULL, $server_persistant); $link = PMA_DBI_real_connect($server_socket, $user, $password, NULL, $server_persistant);
} else { } else {
$link = PMA_DBI_real_connect($server['host'] . $server_port . $server_socket, $user, $password, NULL, $server_persistant); $link = PMA_DBI_real_connect($server['host'] . $server_port . $server_socket, $user, $password, NULL, $server_persistant);
} }

View File

@@ -66,22 +66,22 @@ if (! defined('MYSQLI_TYPE_BIT')) {
function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null, $auxiliary_connection = false) function PMA_DBI_connect($user, $password, $is_controluser = false, $server = null, $auxiliary_connection = false)
{ {
if ($server) { if ($server) {
$server_port = (empty($server['port'])) $server_port = (empty($server['port']))
? false ? false
: (int)$server['port']; : (int)$server['port'];
$server_socket = (empty($server['socket'])) $server_socket = (empty($server['socket']))
? '' ? ''
: $server['socket']; : $server['socket'];
$server['host'] = (empty($server['host'])) $server['host'] = (empty($server['host']))
? 'localhost' ? 'localhost'
: $server['host']; : $server['host'];
} else { } else {
$server_port = (empty($GLOBALS['cfg']['Server']['port'])) $server_port = (empty($GLOBALS['cfg']['Server']['port']))
? false ? false
: (int) $GLOBALS['cfg']['Server']['port']; : (int) $GLOBALS['cfg']['Server']['port'];
$server_socket = (empty($GLOBALS['cfg']['Server']['socket'])) $server_socket = (empty($GLOBALS['cfg']['Server']['socket']))
? null ? null
: $GLOBALS['cfg']['Server']['socket']; : $GLOBALS['cfg']['Server']['socket'];
} }
@@ -108,25 +108,25 @@ function PMA_DBI_connect($user, $password, $is_controluser = false, $server = nu
} }
if (!$server) { if (!$server) {
$return_value = @mysqli_real_connect($link, $GLOBALS['cfg']['Server']['host'], $user, $password, false, $server_port, $server_socket, $client_flags); $return_value = @mysqli_real_connect($link, $GLOBALS['cfg']['Server']['host'], $user, $password, false, $server_port, $server_socket, $client_flags);
// Retry with empty password if we're allowed to // Retry with empty password if we're allowed to
if ($return_value == false && isset($GLOBALS['cfg']['Server']['nopassword']) && $GLOBALS['cfg']['Server']['nopassword'] && !$is_controluser) { if ($return_value == false && isset($GLOBALS['cfg']['Server']['nopassword']) && $GLOBALS['cfg']['Server']['nopassword'] && !$is_controluser) {
$return_value = @mysqli_real_connect($link, $GLOBALS['cfg']['Server']['host'], $user, '', false, $server_port, $server_socket, $client_flags); $return_value = @mysqli_real_connect($link, $GLOBALS['cfg']['Server']['host'], $user, '', false, $server_port, $server_socket, $client_flags);
} }
} else { } else {
$return_value = @mysqli_real_connect($link, $server['host'], $user, $password, false, $server_port, $server_socket); $return_value = @mysqli_real_connect($link, $server['host'], $user, $password, false, $server_port, $server_socket);
} }
if ($return_value == false) { if ($return_value == false) {
if ($is_controluser) { if ($is_controluser) {
trigger_error(__('Connection for controluser as defined in your configuration failed.'), E_USER_WARNING); trigger_error(__('Connection for controluser as defined in your configuration failed.'), E_USER_WARNING);
return false; return false;
} }
// we could be calling PMA_DBI_connect() to connect to another // we could be calling PMA_DBI_connect() to connect to another
// server, for example in the Synchronize feature, so do not // server, for example in the Synchronize feature, so do not
// go back to main login if it fails // go back to main login if it fails
if (! $auxiliary_connection) { if (! $auxiliary_connection) {
PMA_log_user($user, 'mysql-denied'); PMA_log_user($user, 'mysql-denied');
PMA_auth_fails(); PMA_auth_fails();
} else { } else {
return false; return false;