diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2012-05-07 21:12:41 +0400 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2012-05-07 21:12:41 +0400 |
commit | 9e20323c8d3dfa40314485e583689df248a7d49a (patch) | |
tree | 29ff036018f9cd341c8dc159907848a7f708b926 /libraries/auth | |
parent | 841636e2ed51a00948a07b5e9312aac40cc45c38 (diff) |
Coding style fixes. Mostly wrapping long lines
Diffstat (limited to 'libraries/auth')
-rw-r--r-- | libraries/auth/config.auth.lib.php | 5 | ||||
-rw-r--r-- | libraries/auth/cookie.auth.lib.php | 52 | ||||
-rw-r--r-- | libraries/auth/http.auth.lib.php | 8 | ||||
-rw-r--r-- | libraries/auth/signon.auth.lib.php | 23 |
4 files changed, 62 insertions, 26 deletions
diff --git a/libraries/auth/config.auth.lib.php b/libraries/auth/config.auth.lib.php index 50eabb1c2e..fbe39e7c8b 100644 --- a/libraries/auth/config.auth.lib.php +++ b/libraries/auth/config.auth.lib.php @@ -101,7 +101,10 @@ function PMA_auth_fails() // Check whether user has configured something if ($GLOBALS['PMA_Config']->source_mtime == 0) { echo '<p>' . sprintf(__('You probably did not create a configuration file. You might want to use the %1$ssetup script%2$s to create one.'), '<a href="setup/">', '</a>') . '</p>' . "\n"; - } elseif (!isset($GLOBALS['errno']) || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) && $GLOBALS['errno'] != 2003) { + } elseif (! isset($GLOBALS['errno']) + || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) + && $GLOBALS['errno'] != 2003 + ) { // if we display the "Server not responding" error, do not confuse users // by telling them they have a settings problem // (note: it's true that they could have a badly typed host name, but diff --git a/libraries/auth/cookie.auth.lib.php b/libraries/auth/cookie.auth.lib.php index d43859f61b..9a09a1900e 100644 --- a/libraries/auth/cookie.auth.lib.php +++ b/libraries/auth/cookie.auth.lib.php @@ -37,7 +37,9 @@ if (function_exists('mcrypt_encrypt')) { * further decryption. I don't think necessary to have one iv * per server so I don't put the server number in the cookie name. */ - if (empty($_COOKIE['pma_mcrypt_iv']) || false === ($iv = base64_decode($_COOKIE['pma_mcrypt_iv'], true))) { + if (empty($_COOKIE['pma_mcrypt_iv']) + || false === ($iv = base64_decode($_COOKIE['pma_mcrypt_iv'], true)) + ) { srand((double) microtime() * 1000000); $td = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, ''); if ($td === false) { @@ -50,8 +52,8 @@ if (function_exists('mcrypt_encrypt')) { /** * Encryption using blowfish algorithm (mcrypt) * - * @param string original data - * @param string the secret + * @param string $data original data + * @param string $secret the secret * * @return string the encrypted result * @@ -61,14 +63,16 @@ if (function_exists('mcrypt_encrypt')) { function PMA_blowfish_encrypt($data, $secret) { global $iv; - return base64_encode(mcrypt_encrypt(MCRYPT_BLOWFISH, $secret, $data, MCRYPT_MODE_CBC, $iv)); + return base64_encode( + mcrypt_encrypt(MCRYPT_BLOWFISH, $secret, $data, MCRYPT_MODE_CBC, $iv) + ); } /** * Decryption using blowfish algorithm (mcrypt) * - * @param string encrypted data - * @param string the secret + * @param string $encdata encrypted data + * @param string $secret the secret * * @return string original data * @@ -135,7 +139,9 @@ function PMA_auth() } /* No recall if blowfish secret is not configured as it would produce garbage */ - if ($GLOBALS['cfg']['LoginCookieRecall'] && !empty($GLOBALS['cfg']['blowfish_secret'])) { + if ($GLOBALS['cfg']['LoginCookieRecall'] + && ! empty($GLOBALS['cfg']['blowfish_secret']) + ) { $default_user = $GLOBALS['PHP_AUTH_USER']; $default_server = $GLOBALS['pma_auth_server']; $autocomplete = ''; @@ -171,10 +177,12 @@ function PMA_auth() <a href="<?php echo PMA_linkURL('http://www.phpmyadmin.net/'); ?>" target="_blank" class="logo"><?php $logo_image = $GLOBALS['pmaThemeImage'] . 'logo_right.png'; if (@file_exists($logo_image)) { - echo '<img src="' . $logo_image . '" id="imLogo" name="imLogo" alt="phpMyAdmin" border="0" />'; + echo '<img src="' . $logo_image + . '" id="imLogo" name="imLogo" alt="phpMyAdmin" border="0" />'; } else { - echo '<img name="imLogo" id="imLogo" src="' . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" ' - . 'border="0" width="88" height="31" alt="phpMyAdmin" />'; + echo '<img name="imLogo" id="imLogo" src="' + . $GLOBALS['pmaThemeImage'] . 'pma_logo.png' . '" ' + . 'border="0" width="88" height="31" alt="phpMyAdmin" />'; } ?></a> <h1> @@ -388,8 +396,12 @@ function PMA_auth_check() if (! empty($_REQUEST['pma_username'])) { // The user just logged in $GLOBALS['PHP_AUTH_USER'] = $_REQUEST['pma_username']; - $GLOBALS['PHP_AUTH_PW'] = empty($_REQUEST['pma_password']) ? '' : $_REQUEST['pma_password']; - if ($GLOBALS['cfg']['AllowArbitraryServer'] && isset($_REQUEST['pma_servername'])) { + $GLOBALS['PHP_AUTH_PW'] = empty($_REQUEST['pma_password']) + ? '' + : $_REQUEST['pma_password']; + if ($GLOBALS['cfg']['AllowArbitraryServer'] + && isset($_REQUEST['pma_servername']) + ) { $GLOBALS['pma_auth_server'] = $_REQUEST['pma_servername']; } return true; @@ -536,10 +548,15 @@ function PMA_auth_set_user() if ($GLOBALS['cfg']['AllowArbitraryServer']) { if (! empty($GLOBALS['pma_auth_server'])) { // Duration = one month for servername - $GLOBALS['PMA_Config']->setCookie('pmaServer-' . $GLOBALS['server'], $cfg['Server']['host']); + $GLOBALS['PMA_Config']->setCookie( + 'pmaServer-' . $GLOBALS['server'], + $cfg['Server']['host'] + ); } else { // Delete servername cookie - $GLOBALS['PMA_Config']->removeCookie('pmaServer-' . $GLOBALS['server']); + $GLOBALS['PMA_Config']->removeCookie( + 'pmaServer-' . $GLOBALS['server'] + ); } } @@ -569,7 +586,9 @@ function PMA_auth_set_user() */ PMA_clearUserCache(); - PMA_sendHeaderLocation($redirect_url . PMA_generate_common_url($url_params, '&')); + PMA_sendHeaderLocation( + $redirect_url . PMA_generate_common_url($url_params, '&') + ); exit(); } // end if @@ -610,7 +629,8 @@ function PMA_auth_fails() } } } elseif (PMA_DBI_getError()) { - $conn_error = '#' . $GLOBALS['errno'] . ' ' . __('Cannot log in to the MySQL server'); + $conn_error = '#' . $GLOBALS['errno'] . ' ' + . __('Cannot log in to the MySQL server'); } else { $conn_error = __('Cannot log in to the MySQL server'); } diff --git a/libraries/auth/http.auth.lib.php b/libraries/auth/http.auth.lib.php index 921fa34438..7881750544 100644 --- a/libraries/auth/http.auth.lib.php +++ b/libraries/auth/http.auth.lib.php @@ -23,7 +23,9 @@ function PMA_auth() { /* Perform logout to custom URL */ - if (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) { + if (! empty($_REQUEST['old_usr']) + && ! empty($GLOBALS['cfg']['Server']['LogoutURL']) + ) { PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']); exit; } @@ -119,7 +121,9 @@ function PMA_auth_check() } elseif (PMA_getenv('AUTH_USER')) { // WebSite Professional $PHP_AUTH_USER = PMA_getenv('AUTH_USER'); - } elseif (PMA_getenv('HTTP_AUTHORIZATION') && false === strpos(PMA_getenv('HTTP_AUTHORIZATION'), '<')) { + } elseif (PMA_getenv('HTTP_AUTHORIZATION') + && false === strpos(PMA_getenv('HTTP_AUTHORIZATION'), '<') + ) { // IIS, might be encoded, see below; also prevent XSS $PHP_AUTH_USER = PMA_getenv('HTTP_AUTHORIZATION'); } elseif (PMA_getenv('Authorization')) { diff --git a/libraries/auth/signon.auth.lib.php b/libraries/auth/signon.auth.lib.php index 400e17039e..332ead3dc3 100644 --- a/libraries/auth/signon.auth.lib.php +++ b/libraries/auth/signon.auth.lib.php @@ -24,7 +24,9 @@ function PMA_auth() unset($_SESSION['LAST_SIGNON_URL']); if (empty($GLOBALS['cfg']['Server']['SignonURL'])) { PMA_fatalError('You must set SignonURL!'); - } elseif (!empty($_REQUEST['old_usr']) && !empty($GLOBALS['cfg']['Server']['LogoutURL'])) { + } elseif (! empty($_REQUEST['old_usr']) + && ! empty($GLOBALS['cfg']['Server']['LogoutURL']) + ) { /* Perform logout to custom URL */ PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']); } else { @@ -58,7 +60,9 @@ function PMA_auth_check() global $PHP_AUTH_USER, $PHP_AUTH_PW; /* Check if we're using same sigon server */ - if (isset($_SESSION['LAST_SIGNON_URL']) && $_SESSION['LAST_SIGNON_URL'] != $GLOBALS['cfg']['Server']['SignonURL']) { + if (isset($_SESSION['LAST_SIGNON_URL']) + && $_SESSION['LAST_SIGNON_URL'] != $GLOBALS['cfg']['Server']['SignonURL'] + ) { return false; } @@ -86,14 +90,16 @@ function PMA_auth_check() /* Handle script based auth */ if (!empty($script_name)) { if (! file_exists($script_name)) { - PMA_fatalError(__('Can not find signon authentication script:') . ' ' . $script_name); + PMA_fatalError( + __('Can not find signon authentication script:') . ' ' . $script_name + ); } include $script_name; - list ($PHP_AUTH_USER, $PHP_AUTH_PW) = get_login_credentials($cfg['Server']['user']); + list ($PHP_AUTH_USER, $PHP_AUTH_PW) + = get_login_credentials($cfg['Server']['user']); - /* Does session exist? */ - } elseif (isset($_COOKIE[$session_name])) { + } elseif (isset($_COOKIE[$session_name])) { /* Does session exist? */ /* End current session */ $old_session = session_name(); $old_id = session_id(); @@ -158,7 +164,10 @@ function PMA_auth_check() $GLOBALS['cfg']['Server']['port'] = $single_signon_port; /* Configuration update */ - $GLOBALS['cfg']['Server'] = array_merge($GLOBALS['cfg']['Server'], $single_signon_cfgupdate); + $GLOBALS['cfg']['Server'] = array_merge( + $GLOBALS['cfg']['Server'], + $single_signon_cfgupdate + ); /* Restore our token */ if (!empty($pma_token)) { |