diff --git a/libraries/auth/config.auth.lib.php b/libraries/auth/config.auth.lib.php
index 187fa16217..fbe39e7c8b 100644
--- a/libraries/auth/config.auth.lib.php
+++ b/libraries/auth/config.auth.lib.php
@@ -101,14 +101,17 @@ function PMA_auth_fails()
// Check whether user has configured something
if ($GLOBALS['PMA_Config']->source_mtime == 0) {
echo '
' . sprintf(__('You probably did not create a configuration file. You might want to use the %1$ssetup script%2$s to create one.'), '', '') . '
' . "\n";
- } 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
- // anyway the current message tells that the server
- // rejected the connection, which is not really what happened)
- // 2002 is the error given by mysqli
- // 2003 is the error given by mysql
+ } 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
+ // anyway the current message tells that the server
+ // rejected the connection, which is not really what happened)
+ // 2002 is the error given by mysqli
+ // 2003 is the error given by mysql
trigger_error(__('phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.'), E_USER_WARNING);
}
PMA_mysqlDie($conn_error, '', true, '', false);
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()
';
+ echo '';
} else {
- echo '';
+ echo '';
}
?>
@@ -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)) {
diff --git a/libraries/config/Form.class.php b/libraries/config/Form.class.php
index 0670e72f45..f17c747e30 100644
--- a/libraries/config/Form.class.php
+++ b/libraries/config/Form.class.php
@@ -47,9 +47,9 @@ class Form
/**
* Constructor, reads default config values
*
- * @param string $form_name
- * @param array $form
- * @param int $index arbitrary index, stored in Form::$index
+ * @param string $form_name
+ * @param array $form
+ * @param int $index arbitrary index, stored in Form::$index
*/
public function __construct($form_name, array $form, $index = null)
{
@@ -60,7 +60,7 @@ class Form
/**
* Returns type of given option
*
- * @param string $option_name path or field name
+ * @param string $option_name path or field name
*
* @return string|null one of: boolean, integer, double, string, select, array
*/
@@ -75,7 +75,7 @@ class Form
/**
* Returns allowed values for select fields
*
- * @param string $option_path
+ * @param string $option_path
*
* @return array
*/
@@ -118,9 +118,11 @@ class Form
* array_walk callback function, reads path of form fields from
* array (see file comment in setup.forms.php or user_preferences.forms.inc)
*
- * @param mixed $value
- * @param mixed $key
- * @param mixed $prefix
+ * @param mixed $value
+ * @param mixed $key
+ * @param mixed $prefix
+ *
+ * @return void
*/
private function _readFormPathsCallback($value, $key, $prefix)
{
@@ -146,6 +148,8 @@ class Form
* Reads form paths to {@link $fields}
*
* @param array $form
+ *
+ * @return void
*/
protected function readFormPaths($form)
{
@@ -167,6 +171,7 @@ class Form
/**
* Reads fields' types to $this->fieldsTypes
*
+ * @return void
*/
protected function readTypes()
{
@@ -192,6 +197,8 @@ class Form
*
* @param string $form_name
* @param array $form
+ *
+ * @return void
*/
public function loadForm($form_name, $form)
{
diff --git a/libraries/config/FormDisplay.class.php b/libraries/config/FormDisplay.class.php
index 5147094238..0d40c15872 100644
--- a/libraries/config/FormDisplay.class.php
+++ b/libraries/config/FormDisplay.class.php
@@ -112,10 +112,11 @@ class FormDisplay
/**
* Processes forms, returns true on successful save
*
- * @param bool $allow_partial_save allows for partial form saving on failed validation
- * @param bool $check_form_submit whether check for $_POST['submit_save']
+ * @param bool $allow_partial_save allows for partial form saving
+ * on failed validation
+ * @param bool $check_form_submit whether check for $_POST['submit_save']
*
- * @return boolean
+ * @return boolean whether processing was successful
*/
public function process($allow_partial_save = true, $check_form_submit = true)
{
@@ -133,6 +134,7 @@ class FormDisplay
/**
* Runs validation for all registered forms
*
+ * @return void
*/
private function _validate()
{
@@ -177,7 +179,9 @@ class FormDisplay
* Outputs HTML for forms
*
* @param bool $tabbed_form
- * @param bool $show_restore_default whether show "restore default" button besides the input field
+ * @param bool $show_restore_default whether show "restore default" button
+ * besides the input field
+ * @return void
*/
public function display($tabbed_form = false, $show_restore_default = false)
{
@@ -279,14 +283,20 @@ class FormDisplay
* Prepares data for input field display and outputs HTML code
*
* @param Form $form
- * @param string $field field name as it appears in $form
- * @param string $system_path field path, eg. Servers/1/verbose
- * @param string $work_path work path, eg. Servers/4/verbose
- * @param string $translated_path work path changed so that it can be used as XHTML id
- * @param bool $show_restore_default whether show "restore default" button besides the input field
- * @param mixed $userprefs_allow whether user preferences are enabled for this field
- * (null - no support, true/false - enabled/disabled)
- * @param array &$js_default array which stores JavaScript code to be displayed
+ * @param string $field field name as it appears in $form
+ * @param string $system_path field path, eg. Servers/1/verbose
+ * @param string $work_path work path, eg. Servers/4/verbose
+ * @param string $translated_path work path changed so that it can be
+ * used as XHTML id
+ * @param bool $show_restore_default whether show "restore default" button
+ * besides the input field
+ * @param mixed $userprefs_allow whether user preferences are enabled
+ * for this field (null - no support,
+ * true/false - enabled/disabled)
+ * @param array &$js_default array which stores JavaScript code
+ * to be displayed
+ *
+ * @return void
*/
private function _displayFieldInput(
Form $form, $field, $system_path, $work_path,
@@ -341,7 +351,8 @@ class FormDisplay
$value_default = (array) $value_default;
break;
case 'group':
- if (substr($field, 7, 4) != 'end:') { // :group:end is changed to :group:end:{unique id} in Form class
+ // :group:end is changed to :group:end:{unique id} in Form class
+ if (substr($field, 7, 4) != 'end:') {
display_group_header(substr($field, 7));
} else {
display_group_footer();
@@ -380,7 +391,8 @@ class FormDisplay
$js_line .= '[\'' . PMA_escapeJsString($value_default_js) . '\']';
break;
case 'list':
- $js_line .= '\'' . PMA_escapeJsString(implode("\n", $value_default)) . '\'';
+ $js_line .= '\'' . PMA_escapeJsString(implode("\n", $value_default))
+ . '\'';
break;
}
$js_default[] = $js_line;
@@ -394,6 +406,7 @@ class FormDisplay
/**
* Displays errors
*
+ * @return void
*/
public function displayErrors()
{
@@ -416,7 +429,7 @@ class FormDisplay
/**
* Reverts erroneous fields to their default values
*
- *
+ * @return void
*/
public function fixErrors()
{
@@ -438,8 +451,8 @@ class FormDisplay
/**
* Validates select field and casts $value to correct type
*
- * @param string $value
- * @param array $allowed
+ * @param string $value
+ * @param array $allowed
*
* @return bool
*/
@@ -450,7 +463,8 @@ class FormDisplay
: $value;
foreach ($allowed as $vk => $v) {
// equality comparison only if both values are numeric or not numeric
- // (allows to skip 0 == 'string' equalling to true) or identity (for string-string)
+ // (allows to skip 0 == 'string' equalling to true)
+ // or identity (for string-string)
if (($vk == $value && !(is_numeric($value_cmp) xor is_numeric($vk)))
|| $vk === $value
) {
@@ -467,10 +481,11 @@ class FormDisplay
/**
* Validates and saves form data to session
*
- * @param array|string $forms array of form names
- * @param bool $allow_partial_save allows for partial form saving on failed validation
+ * @param array|string $forms array of form names
+ * @param bool $allow_partial_save allows for partial form saving on
+ * failed validation
*
- * @return boolean true on success (no errors and all saved)
+ * @return boolean true on success (no errors and all saved)
*/
public function save($forms, $allow_partial_save = true)
{
@@ -547,12 +562,18 @@ class FormDisplay
break;
case 'select':
// special treatment for NavigationBarIconic and PropertiesIconic
- if ($key === 'NavigationBarIconic' || $key === 'PropertiesIconic') {
+ if ($key === 'NavigationBarIconic'
+ || $key === 'PropertiesIconic'
+ ) {
if ($_POST[$key] !== 'both') {
settype($_POST[$key], 'boolean');
}
}
- if (!$this->_validateSelect($_POST[$key], $form->getOptionValueList($system_path))) {
+ $successfully_validated = $this->_validateSelect(
+ $_POST[$key],
+ $form->getOptionValueList($system_path)
+ );
+ if (! $successfully_validated) {
$this->errors[$work_path][] = __('Incorrect value');
$result = false;
continue;
@@ -598,7 +619,10 @@ class FormDisplay
$i = 0;
foreach ($values[$path] as $value) {
$matches = array();
- if (preg_match("/^(.+):(?:[ ]?)(\\w+)$/", $value, $matches)) {
+ $match = preg_match(
+ "/^(.+):(?:[ ]?)(\\w+)$/", $value, $matches
+ );
+ if ($match) {
// correct 'IP: HTTP header' pair
$ip = trim($matches[1]);
$proxies[$ip] = trim($matches[2]);
@@ -694,6 +718,7 @@ class FormDisplay
/**
* Fills out {@link userprefs_keys} and {@link userprefs_disallow}
*
+ * @return void
*/
private function _loadUserprefsInfo()
{
@@ -712,6 +737,8 @@ class FormDisplay
*
* @param string $system_path
* @param array $opts
+ *
+ * @return void
*/
private function _setComments($system_path, array &$opts)
{
@@ -720,7 +747,9 @@ class FormDisplay
$comment = '';
if (!function_exists('iconv')) {
$opts['values']['iconv'] .= ' (' . __('unavailable') . ')';
- $comment = sprintf(__('"%s" requires %s extension'), 'iconv', 'iconv');
+ $comment = sprintf(
+ __('"%s" requires %s extension'), 'iconv', 'iconv'
+ );
}
if (!function_exists('recode_string')) {
$opts['values']['recode'] .= ' (' . __('unavailable') . ')';
@@ -733,7 +762,10 @@ class FormDisplay
$opts['comment_warning'] = true;
}
// ZipDump, GZipDump, BZipDump - check function availability
- if ($system_path == 'ZipDump' || $system_path == 'GZipDump' || $system_path == 'BZipDump') {
+ if ($system_path == 'ZipDump'
+ || $system_path == 'GZipDump'
+ || $system_path == 'BZipDump'
+ ) {
$comment = '';
$funcs = array(
'ZipDump' => array('zip_open', 'gzcompress'),
@@ -754,7 +786,9 @@ class FormDisplay
$opts['comment'] = $comment;
$opts['comment_warning'] = true;
}
- if ($system_path == 'SQLQuery/Validate' && !$GLOBALS['cfg']['SQLValidator']['use']) {
+ if ($system_path == 'SQLQuery/Validate'
+ && ! $GLOBALS['cfg']['SQLValidator']['use']
+ ) {
$opts['comment'] = __('SQL Validator is disabled');
$opts['comment_warning'] = true;
}
@@ -771,7 +805,9 @@ class FormDisplay
if (($system_path == 'MaxDbList' || $system_path == 'MaxTableList'
|| $system_path == 'QueryHistoryMax')
) {
- $opts['comment'] = sprintf(__('maximum %s'), $GLOBALS['cfg'][$system_path]);
+ $opts['comment'] = sprintf(
+ __('maximum %s'), $GLOBALS['cfg'][$system_path]
+ );
}
}
}
diff --git a/libraries/config/FormDisplay.tpl.php b/libraries/config/FormDisplay.tpl.php
index fa81e1e7a8..9d009dd115 100644
--- a/libraries/config/FormDisplay.tpl.php
+++ b/libraries/config/FormDisplay.tpl.php
@@ -9,9 +9,11 @@
/**
* Displays top part of the form
*
- * @param string $action default: $_SERVER['REQUEST_URI']
- * @param string $method 'post' or 'get'
- * @param array $hidden_fields array of form hidden fields (key: field name)
+ * @param string $action default: $_SERVER['REQUEST_URI']
+ * @param string $method 'post' or 'get'
+ * @param array $hidden_fields array of form hidden fields (key: field name)
+ *
+ * @return void
*/
function display_form_top($action = null, $method = 'post', $hidden_fields = null)
{
@@ -42,7 +44,9 @@ function display_form_top($action = null, $method = 'post', $hidden_fields = nul
* Displays form tabs which are given by an array indexed by fieldset id
* ({@link display_fieldset_top}), with values being tab titles.
*
- * @param array $tabs
+ * @param array $tabs tab names
+ *
+ * @return void
*/
function display_tabs_top($tabs)
{
@@ -66,8 +70,9 @@ function display_tabs_top($tabs)
* @param array $errors
* @param array $attributes
*/
-function display_fieldset_top($title = '', $description = '', $errors = null, $attributes = array())
-{
+function display_fieldset_top($title = '', $description = '', $errors = null,
+ $attributes = array()
+) {
global $_FormDisplayGroup;
$_FormDisplayGroup = 0;
@@ -103,11 +108,12 @@ function display_fieldset_top($title = '', $description = '', $errors = null, $a
* o errors - error array
* o setvalue - (string) shows button allowing to set poredefined value
* o show_restore_default - (boolean) whether show "restore default" button
- * o userprefs_allow - whether user preferences are enabled for this field (null - no support,
- * true/false - enabled/disabled)
+ * o userprefs_allow - whether user preferences are enabled for this field
+ * (null - no support, true/false - enabled/disabled)
* o userprefs_comment - (string) field comment
* o values - key - value paris for