Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Coding style improvements. Mostly wrapping long lines

  • Loading branch information...
commit e2e2bc47e6932b741ad166f2ca91199e1fe40cc7 1 parent 2187d7d
@madhuracj madhuracj authored
View
46 libraries/Advisor.class.php
@@ -55,8 +55,10 @@ function run()
/**
* Stores current error in run results.
*
- * @param $description string Description of an error.
- * @param $exception object Exception raised
+ * @param string $description description of an error.
+ * @param object $exception exception raised
+ *
+ * @return void
*/
function storeError($description, $exception)
{
@@ -83,7 +85,10 @@ function runRules()
$precond = $this->ruleExprEvaluate($rule['precondition']);
} catch (Exception $e) {
$this->storeError(
- sprintf(__('Failed evaluating precondition for rule \'%s\''), $rule['name']),
+ sprintf(
+ __('Failed evaluating precondition for rule \'%s\''),
+ $rule['name']
+ ),
$e
);
continue;
@@ -97,7 +102,10 @@ function runRules()
$value = $this->ruleExprEvaluate($rule['formula']);
} catch(Exception $e) {
$this->storeError(
- sprintf(__('Failed calculating value for rule \'%s\''), $rule['name']),
+ sprintf(
+ __('Failed calculating value for rule \'%s\''),
+ $rule['name']
+ ),
$e
);
continue;
@@ -113,7 +121,10 @@ function runRules()
}
} catch(Exception $e) {
$this->storeError(
- sprintf(__('Failed running test for rule \'%s\''), $rule['name']),
+ sprintf(
+ __('Failed running test for rule \'%s\''),
+ $rule['name']
+ ),
$e
);
}
@@ -138,8 +149,8 @@ static function escapePercent($str)
/**
* Wrapper function for translating.
*
- * @param string $str
- * @param mixed $param
+ * @param string $str the string
+ * @param mixed $param the parameters
*
* @return string
*/
@@ -159,7 +170,7 @@ function translate($str, $param = null)
/**
* Splits justification to text and formula.
*
- * @param string $rule
+ * @param string $rule the rule
*
* @return array
*/
@@ -175,8 +186,10 @@ static function splitJustification($rule)
/**
* Adds a rule to the result list
*
- * @param $type string type of rule
- * @param $rule array rule itslef
+ * @param string $type type of rule
+ * @param array $rule rule itslef
+ *
+ * @return void
*/
function addRule($type, $rule)
{
@@ -190,7 +203,10 @@ function addRule($type, $rule)
$str = $this->translate($jst[0], $jst[1]);
} catch (Exception $e) {
$this->storeError(
- sprintf(__('Failed formatting string for rule \'%s\'.'), $rule['name']),
+ sprintf(
+ __('Failed formatting string for rule \'%s\'.'),
+ $rule['name']
+ ),
$e
);
return;
@@ -243,8 +259,8 @@ private function ruleExprEvaluate_var2($matches)
* Runs a code expression, replacing variable names with their respective
* values
*
- * @param $expr string expressoin to evaluate
- * @param $ignoreUntil int if > 0, it doesn't replace any variables until that string
+ * @param string $expr expressoin to evaluate
+ * @param int $ignoreUntil if > 0, it doesn't replace any variables until that string
* position, but still evaluates the whole expr
*
* @return result of evaluated expression
@@ -293,7 +309,9 @@ static function parseRulesFile()
$errors = array();
$rules = array();
$lines = array();
- $ruleSyntax = array('name', 'formula', 'test', 'issue', 'recommendation', 'justification');
+ $ruleSyntax = array(
+ 'name', 'formula', 'test', 'issue', 'recommendation', 'justification'
+ );
$numRules = count($ruleSyntax);
$numLines = count($file);
$j = -1;
View
29 libraries/Config.class.php
@@ -219,9 +219,7 @@ function checkClient()
} elseif (preg_match('@rv:1.9(.*)Gecko@', $HTTP_USER_AGENT)) {
$this->set('PMA_USR_BROWSER_VER', '1.9');
$this->set('PMA_USR_BROWSER_AGENT', 'GECKO');
- } elseif (
- preg_match('@Mozilla/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)
- ) {
+ } elseif (preg_match('@Mozilla/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) {
$this->set('PMA_USR_BROWSER_VER', $log_version[1]);
$this->set('PMA_USR_BROWSER_AGENT', 'MOZILLA');
} else {
@@ -411,10 +409,13 @@ function checkGitRevision()
// check if commit exists in Github
$is_remote_commit = false;
- if ($commit !== false && isset($_SESSION['PMA_VERSION_REMOTECOMMIT_' . $hash])) {
+ if ($commit !== false
+ && isset($_SESSION['PMA_VERSION_REMOTECOMMIT_' . $hash])
+ ) {
$is_remote_commit = $_SESSION['PMA_VERSION_REMOTECOMMIT_' . $hash];
} else {
- $link = 'https://api.github.com/repos/phpmyadmin/phpmyadmin/git/commits/' . $hash;
+ $link = 'https://api.github.com/repos/phpmyadmin/phpmyadmin/git/commits/'
+ . $hash;
$is_found = $this->checkHTTP($link, !$commit);
switch($is_found) {
case false:
@@ -820,8 +821,9 @@ function loadUserPreferences()
*
* @return void
*/
- function setUserValue($cookie_name, $cfg_path, $new_cfg_value, $default_value = null)
- {
+ function setUserValue($cookie_name, $cfg_path, $new_cfg_value,
+ $default_value = null
+ ) {
// use permanent user preferences if possible
$prefs_type = $this->get('user_preferences');
if ($prefs_type) {
@@ -1349,11 +1351,15 @@ function detectHttps()
// Scheme
if (PMA_getenv('HTTP_SCHEME')) {
$url['scheme'] = PMA_getenv('HTTP_SCHEME');
- } elseif (PMA_getenv('HTTPS') && strtolower(PMA_getenv('HTTPS')) == 'on') {
+ } elseif (PMA_getenv('HTTPS')
+ && strtolower(PMA_getenv('HTTPS')) == 'on'
+ ) {
$url['scheme'] = 'https';
} elseif (PMA_getenv('HTTP_X_FORWARDED_PROTO')) {
$url['scheme'] = strtolower(PMA_getenv('HTTP_X_FORWARDED_PROTO'));
- } elseif (PMA_getenv('HTTP_FRONT_END_HTTPS') && strtolower(PMA_getenv('HTTP_FRONT_END_HTTPS')) == 'on') {
+ } elseif (PMA_getenv('HTTP_FRONT_END_HTTPS')
+ && strtolower(PMA_getenv('HTTP_FRONT_END_HTTPS')) == 'on'
+ ) {
$url['scheme'] = 'https';
} else {
$url['scheme'] = 'http';
@@ -1597,8 +1603,9 @@ function removeCookie($cookie)
*
* @return boolean result of setcookie()
*/
- function setCookie($cookie, $value, $default = null, $validity = null, $httponly = true)
- {
+ function setCookie($cookie, $value, $default = null, $validity = null,
+ $httponly = true
+ ) {
if ($validity == null) {
$validity = 2592000;
}
View
57 libraries/bookmark.lib.php
@@ -60,17 +60,23 @@ function PMA_Bookmark_getList($db)
return array();
}
- $query = 'SELECT label, id FROM '. PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
- . ' WHERE dbase = \'' . PMA_sqlAddSlashes($db) . '\''
- . ' AND user = \'' . PMA_sqlAddSlashes($cfgBookmark['user']) . '\''
- . ' ORDER BY label';
- $per_user = PMA_DBI_fetch_result($query, 'id', 'label', $controllink, PMA_DBI_QUERY_STORE);
-
- $query = 'SELECT label, id FROM '. PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
- . ' WHERE dbase = \'' . PMA_sqlAddSlashes($db) . '\''
- . ' AND user = \'\''
- . ' ORDER BY label';
- $global = PMA_DBI_fetch_result($query, 'id', 'label', $controllink, PMA_DBI_QUERY_STORE);
+ $query = 'SELECT label, id FROM '. PMA_backquote($cfgBookmark['db'])
+ . '.' . PMA_backquote($cfgBookmark['table'])
+ . ' WHERE dbase = \'' . PMA_sqlAddSlashes($db) . '\''
+ . ' AND user = \'' . PMA_sqlAddSlashes($cfgBookmark['user']) . '\''
+ . ' ORDER BY label';
+ $per_user = PMA_DBI_fetch_result(
+ $query, 'id', 'label', $controllink, PMA_DBI_QUERY_STORE
+ );
+
+ $query = 'SELECT label, id FROM '. PMA_backquote($cfgBookmark['db'])
+ . '.' . PMA_backquote($cfgBookmark['table'])
+ . ' WHERE dbase = \'' . PMA_sqlAddSlashes($db) . '\''
+ . ' AND user = \'\''
+ . ' ORDER BY label';
+ $global = PMA_DBI_fetch_result(
+ $query, 'id', 'label', $controllink, PMA_DBI_QUERY_STORE
+ );
foreach ($global as $key => $val) {
$global[$key] = $val . ' (' . __('shared') . ')';
@@ -90,7 +96,8 @@ function PMA_Bookmark_getList($db)
* @param string $db the current database name
* @param mixed $id the id of the bookmark to get
* @param string $id_field which field to look up the $id
- * @param boolean $action_bookmark_all true: get all bookmarks regardless of the owning user
+ * @param boolean $action_bookmark_all true: get all bookmarks regardless
+ * of the owning user
* @param boolean $exact_user_match whether to ignore bookmarks with no user
*
* @return string the sql query
@@ -100,8 +107,9 @@ function PMA_Bookmark_getList($db)
* @global resource the controluser db connection handle
*
*/
-function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = false, $exact_user_match = false)
-{
+function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = false,
+ $exact_user_match = false
+) {
global $controllink;
$cfgBookmark = PMA_Bookmark_getParams();
@@ -110,7 +118,8 @@ function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = fal
return '';
}
- $query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
+ $query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db'])
+ . '.' . PMA_backquote($cfgBookmark['table'])
. ' WHERE dbase = \'' . PMA_sqlAddSlashes($db) . '\'';
if (!$action_bookmark_all) {
@@ -149,8 +158,13 @@ function PMA_Bookmark_save($fields, $all_users = false)
return false;
}
- $query = 'INSERT INTO ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
- . ' (id, dbase, user, query, label) VALUES (NULL, \'' . PMA_sqlAddSlashes($fields['dbase']) . '\', \'' . ($all_users ? '' : PMA_sqlAddSlashes($fields['user'])) . '\', \'' . PMA_sqlAddSlashes(urldecode($fields['query'])) . '\', \'' . PMA_sqlAddSlashes($fields['label']) . '\')';
+ $query = 'INSERT INTO ' . PMA_backquote($cfgBookmark['db'])
+ . '.' . PMA_backquote($cfgBookmark['table'])
+ . ' (id, dbase, user, query, label)'
+ . ' VALUES (NULL, \'' . PMA_sqlAddSlashes($fields['dbase']) . '\', '
+ . '\'' . ($all_users ? '' : PMA_sqlAddSlashes($fields['user'])) . '\', '
+ . '\'' . PMA_sqlAddSlashes(urldecode($fields['query'])) . '\', '
+ . '\'' . PMA_sqlAddSlashes($fields['label']) . '\')';
return PMA_DBI_query($query, $controllink);
} // end of the 'PMA_Bookmark_save()' function
@@ -177,10 +191,11 @@ function PMA_Bookmark_delete($db, $id)
return false;
}
- $query = 'DELETE FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table'])
- . ' WHERE (user = \'' . PMA_sqlAddSlashes($cfgBookmark['user']) . '\''
- . ' OR user = \'\')'
- . ' AND id = ' . $id;
+ $query = 'DELETE FROM ' . PMA_backquote($cfgBookmark['db'])
+ . '.' . PMA_backquote($cfgBookmark['table'])
+ . ' WHERE (user = \'' . PMA_sqlAddSlashes($cfgBookmark['user']) . '\''
+ . ' OR user = \'\')'
+ . ' AND id = ' . $id;
return PMA_DBI_try_query($query, $controllink);
} // end of the 'PMA_Bookmark_delete()' function
View
39 libraries/build_html_for_db.lib.php
@@ -79,7 +79,9 @@ function PMA_buildHtmlForDb(
$out = '';
if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
$out .= '<td class="tool">';
- $out .= '<input type="checkbox" name="selected_dbs[]" title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" value="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ';
+ $out .= '<input type="checkbox" name="selected_dbs[]" '
+ . 'title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" '
+ . 'value="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ';
if (!PMA_is_system_schema($current['SCHEMA_NAME'], true)) {
$out .= (empty($checkall) ? '' : 'checked="checked" ') . '/>';
@@ -90,10 +92,14 @@ function PMA_buildHtmlForDb(
}
$out .= '<td class="name">'
. ' <a onclick="'
- . 'if (window.parent.openDb &amp;&amp; window.parent.openDb(\'' . PMA_jsFormat($current['SCHEMA_NAME'], false) . '\')) return false;'
+ . 'if (window.parent.openDb &amp;&amp; window.parent.openDb(\''
+ . PMA_jsFormat($current['SCHEMA_NAME'], false) . '\')) return false;'
. '" href="index.php?' . $url_query . '&amp;db='
. urlencode($current['SCHEMA_NAME']) . '" title="'
- . sprintf(__('Jump to database'), htmlspecialchars($current['SCHEMA_NAME']))
+ . sprintf(
+ __('Jump to database'),
+ htmlspecialchars($current['SCHEMA_NAME'])
+ )
. '" target="_parent">'
. ' ' . htmlspecialchars($current['SCHEMA_NAME'])
. '</a>'
@@ -113,7 +119,8 @@ function PMA_buildHtmlForDb(
}
$out .= '<td class="value">';
if (isset($stat['description_function'])) {
- $out .= '<dfn title="' . $stat['description_function']($current[$stat_name]) . '">';
+ $out .= '<dfn title="'
+ . $stat['description_function']($current[$stat_name]) . '">';
}
$out .= $value;
if (isset($stat['description_function'])) {
@@ -129,12 +136,21 @@ function PMA_buildHtmlForDb(
if ($replication_info[$type]['status']) {
$out .= '<td class="tool" style="text-align: center;">';
- if (strlen(array_search($current["SCHEMA_NAME"], $replication_info[$type]['Ignore_DB'])) > 0) {
+ $key = array_search(
+ $current["SCHEMA_NAME"],
+ $replication_info[$type]['Ignore_DB']
+ );
+ if (strlen($key) > 0) {
$out .= PMA_getIcon('s_cancel.png', __('Not replicated'));
} else {
- $key = array_search($current["SCHEMA_NAME"], $replication_info[$type]['Do_DB']);
+ $key = array_search(
+ $current["SCHEMA_NAME"], $replication_info[$type]['Do_DB']
+ );
- if (strlen($key) > 0 || ($replication_info[$type]['Do_DB'][0] == "" && count($replication_info[$type]['Do_DB']) == 1)) {
+ if (strlen($key) > 0
+ || ($replication_info[$type]['Do_DB'][0] == ""
+ && count($replication_info[$type]['Do_DB']) == 1)
+ ) {
// if ($key != null) did not work for index "0"
$out .= PMA_getIcon('s_success.png', __('Replicated'));
}
@@ -147,10 +163,15 @@ function PMA_buildHtmlForDb(
if ($is_superuser && !PMA_DRIZZLE) {
$out .= '<td class="tool">'
. '<a onclick="'
- . 'if (window.parent.setDb) window.parent.setDb(\'' . PMA_jsFormat($current['SCHEMA_NAME']) . '\');'
+ . 'if (window.parent.setDb) window.parent.setDb(\''
+ . PMA_jsFormat($current['SCHEMA_NAME']) . '\');'
. '" href="server_privileges.php?' . $url_query
. '&amp;checkprivs=' . urlencode($current['SCHEMA_NAME'])
- . '" title="' . sprintf(__('Check privileges for database &quot;%s&quot;.'), htmlspecialchars($current['SCHEMA_NAME']))
+ . '" title="'
+ . sprintf(
+ __('Check privileges for database &quot;%s&quot;.'),
+ htmlspecialchars($current['SCHEMA_NAME'])
+ )
. '">'
. ' '
. PMA_getIcon('s_rights.png', __('Check Privileges'))
View
18 libraries/charset_conversion.lib.php
@@ -17,7 +17,10 @@
// Finally detect which function we will use:
if ($cfg['RecodingEngine'] == 'iconv') {
if (@function_exists('iconv')) {
- if ((@stristr(PHP_OS, 'AIX')) && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) {
+ if ((@stristr(PHP_OS, 'AIX'))
+ && (@strcasecmp(ICONV_IMPL, 'unknown') == 0)
+ && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)
+ ) {
$PMA_recoding_engine = PMA_CHARSET_ICONV_AIX;
} else {
$PMA_recoding_engine = PMA_CHARSET_ICONV;
@@ -35,7 +38,10 @@
}
} elseif ($cfg['RecodingEngine'] == 'auto') {
if (@function_exists('iconv')) {
- if ((@stristr(PHP_OS, 'AIX')) && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) {
+ if ((@stristr(PHP_OS, 'AIX'))
+ && (@strcasecmp(ICONV_IMPL, 'unknown') == 0)
+ && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)
+ ) {
$PMA_recoding_engine = PMA_CHARSET_ICONV_AIX;
} else {
$PMA_recoding_engine = PMA_CHARSET_ICONV;
@@ -76,9 +82,13 @@ function PMA_convert_string($src_charset, $dest_charset, $what)
case PMA_CHARSET_RECODE:
return recode_string($src_charset . '..' . $dest_charset, $what);
case PMA_CHARSET_ICONV:
- return iconv($src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what);
+ return iconv(
+ $src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what
+ );
case PMA_CHARSET_ICONV_AIX:
- return PMA_aix_iconv_wrapper($src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what);
+ return PMA_aix_iconv_wrapper(
+ $src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what
+ );
default:
return $what;
}
View
25 libraries/check_user_privileges.lib.php
@@ -12,7 +12,7 @@
/**
*
*/
-$GLOBALS['is_superuser'] = PMA_isSuperuser();
+$GLOBALS['is_superuser'] = PMA_isSuperuser();
/**
* sets privilege information extracted from SHOW GRANTS result
@@ -113,13 +113,19 @@ function PMA_analyseShowGrant()
* Do not handle the underscore wildcard
* (this case must be rare anyway)
*/
- $GLOBALS['db_to_create'] = preg_replace('/' . $re0 . '%/', '\\1...', $show_grants_dbname);
- $GLOBALS['db_to_create'] = preg_replace('/' . $re1 . '(%|_)/', '\\1\\3', $GLOBALS['db_to_create']);
+ $GLOBALS['db_to_create'] = preg_replace(
+ '/' . $re0 . '%/', '\\1...',
+ $show_grants_dbname
+ );
+ $GLOBALS['db_to_create'] = preg_replace(
+ '/' . $re1 . '(%|_)/', '\\1\\3',
+ $GLOBALS['db_to_create']
+ );
$GLOBALS['is_create_db_priv'] = true;
/**
- * @todo collect $GLOBALS['db_to_create'] into an array, to display a
- * drop-down in the "Create database" dialog
+ * @todo collect $GLOBALS['db_to_create'] into an array,
+ * to display a drop-down in the "Create database" dialog
*/
// we don't break, we want all possible databases
//break;
@@ -135,13 +141,18 @@ function PMA_analyseShowGrant()
PMA_cacheSet('is_process_priv', $GLOBALS['is_process_priv'], true);
PMA_cacheSet('is_reload_priv', $GLOBALS['is_reload_priv'], true);
PMA_cacheSet('db_to_create', $GLOBALS['db_to_create'], true);
- PMA_cacheSet('dbs_where_create_table_allowed', $GLOBALS['dbs_where_create_table_allowed'], true);
+ PMA_cacheSet(
+ 'dbs_where_create_table_allowed',
+ $GLOBALS['dbs_where_create_table_allowed'],
+ true
+ );
} // end function
if (!PMA_DRIZZLE) {
PMA_analyseShowGrant();
} else {
- // todo: for simple_user_policy only database with user's login can be created (unless logged in as root)
+ // todo: for simple_user_policy only database with user's login can be created
+ // (unless logged in as root)
$GLOBALS['is_create_db_priv'] = $GLOBALS['is_superuser'];
$GLOBALS['is_process_priv'] = false;
$GLOBALS['is_reload_priv'] = false;
View
4 libraries/cleanup.lib.php
@@ -22,7 +22,9 @@ function PMA_remove_request_vars(&$whitelist)
// do not check only $_REQUEST because it could have been overwritten
// and use type casting because the variables could have become
// strings
- $keys = array_keys(array_merge((array)$_REQUEST, (array)$_GET, (array)$_POST, (array)$_COOKIE));
+ $keys = array_keys(
+ array_merge((array)$_REQUEST, (array)$_GET, (array)$_POST, (array)$_COOKIE)
+ );
foreach ($keys as $key) {
if (! in_array($key, $whitelist)) {
View
68 libraries/common.inc.php
@@ -288,7 +288,7 @@
date_default_timezone_set(@date_default_timezone_get());
/******************************************************************************/
-/* parsing configuration file LABEL_parsing_config_file */
+/* parsing configuration file LABEL_parsing_config_file */
/**
* We really need this one!
@@ -320,7 +320,8 @@
*/
$pma_cookie_version = 4;
if (isset($_COOKIE)
- && (isset($_COOKIE['pmaCookieVer']) && $_COOKIE['pmaCookieVer'] < $pma_cookie_version)
+ && (isset($_COOKIE['pmaCookieVer'])
+ && $_COOKIE['pmaCookieVer'] < $pma_cookie_version)
) {
// delete all cookies
foreach ($_COOKIE as $cookie_name => $tmp) {
@@ -472,7 +473,9 @@
* @todo variables should be handled by their respective owners (objects)
* f.e. lang, server, collation_connection in PMA_Config
*/
-if (! PMA_isValid($_REQUEST['token']) || $_SESSION[' PMA_token '] != $_REQUEST['token']) {
+if (! PMA_isValid($_REQUEST['token'])
+ || $_SESSION[' PMA_token '] != $_REQUEST['token']
+) {
/**
* List of parameters which are allowed from unsafe source
*/
@@ -608,10 +611,10 @@
* this check is done here after loading language files to present errors in locale
*/
if ($GLOBALS['PMA_Config']->error_config_file) {
- $error = '[strong]' . __('Failed to read configuration file') . '[/strong][br][br]'
+ $error = '[strong]' . __('Failed to read configuration file') . '[/strong]'
+ . '[br][br]'
. _('This usually means there is a syntax error in it, please check any errors shown below.')
- . '[br]'
- . '[br]'
+ . '[br][br]'
. '[conferr]';
trigger_error($error, E_USER_ERROR);
}
@@ -623,7 +626,10 @@
trigger_error($error, E_USER_ERROR);
}
if ($GLOBALS['PMA_Config']->error_pma_uri) {
- trigger_error(__('The [code]$cfg[\'PmaAbsoluteUri\'][/code] directive MUST be set in your configuration file!'), E_USER_ERROR);
+ trigger_error(
+ __('The [code]$cfg[\'PmaAbsoluteUri\'][/code] directive MUST be set in your configuration file!'),
+ E_USER_ERROR
+ );
}
@@ -653,14 +659,23 @@
// Detect wrong configuration
if (!is_int($server_index) || $server_index < 1) {
- trigger_error(sprintf(__('Invalid server index: %s'), $server_index), E_USER_ERROR);
+ trigger_error(
+ sprintf(__('Invalid server index: %s'), $server_index),
+ E_USER_ERROR
+ );
}
$each_server = array_merge($default_server, $each_server);
// Don't use servers with no hostname
if ($each_server['connect_type'] == 'tcp' && empty($each_server['host'])) {
- trigger_error(sprintf(__('Invalid hostname for server %1$s. Please review your configuration.'), $server_index), E_USER_ERROR);
+ trigger_error(
+ sprintf(
+ __('Invalid hostname for server %1$s. Please review your configuration.'),
+ $server_index
+ ),
+ E_USER_ERROR
+ );
}
// Final solution to bug #582890
@@ -668,7 +683,10 @@
// and there is nothing in the verbose server name
// or the host field, then generate a name for the server
// in the form of "Server 2", localized of course!
- if ($each_server['connect_type'] == 'socket' && empty($each_server['host']) && empty($each_server['verbose'])) {
+ if ($each_server['connect_type'] == 'socket'
+ && empty($each_server['host'])
+ && empty($each_server['verbose'])
+ ) {
$each_server['verbose'] = __('Server') . $server_index;
}
@@ -793,7 +811,11 @@
* and '$cfg['ServerDefault'] = 0' is set.
*/
- if (isset($_REQUEST['server']) && (is_string($_REQUEST['server']) || is_numeric($_REQUEST['server'])) && ! empty($_REQUEST['server']) && ! empty($cfg['Servers'][$_REQUEST['server']])) {
+ if (isset($_REQUEST['server'])
+ && (is_string($_REQUEST['server']) || is_numeric($_REQUEST['server']))
+ && ! empty($_REQUEST['server'])
+ && ! empty($cfg['Servers'][$_REQUEST['server']])
+ ) {
$GLOBALS['server'] = $_REQUEST['server'];
$cfg['Server'] = $cfg['Servers'][$GLOBALS['server']];
} else {
@@ -840,8 +862,8 @@
include_once './libraries/logging.lib.php';
// get LoginCookieValidity from preferences cache
- // no generic solution for loading preferences from cache as some settings need to be kept
- // for processing in PMA_Config::loadUserPreferences()
+ // no generic solution for loading preferences from cache as some settings
+ // need to be kept for processing in PMA_Config::loadUserPreferences()
$cache_key = 'server_' . $GLOBALS['server'];
if (isset($_SESSION['cache'][$cache_key]['userprefs']['LoginCookieValidity'])) {
$value = $_SESSION['cache'][$cache_key]['userprefs']['LoginCookieValidity'];
@@ -857,7 +879,9 @@
// to allow HTTP or http
$cfg['Server']['auth_type'] = strtolower($cfg['Server']['auth_type']);
if (! file_exists('./libraries/auth/' . $cfg['Server']['auth_type'] . '.auth.lib.php')) {
- PMA_fatalError(__('Invalid authentication method set in configuration:') . ' ' . $cfg['Server']['auth_type']);
+ PMA_fatalError(
+ __('Invalid authentication method set in configuration:') . ' ' . $cfg['Server']['auth_type']
+ );
}
/**
* the required auth type plugin
@@ -947,12 +971,15 @@
if (! empty($cfg['Server']['controlhost'])) {
$controllink = PMA_DBI_connect(
$cfg['Server']['controluser'],
- $cfg['Server']['controlpass'], true,
+ $cfg['Server']['controlpass'],
+ true,
array('host' => $cfg['Server']['controlhost'])
);
} else {
$controllink = PMA_DBI_connect(
- $cfg['Server']['controluser'], $cfg['Server']['controlpass'], true
+ $cfg['Server']['controluser'],
+ $cfg['Server']['controlpass'],
+ true
);
}
}
@@ -975,7 +1002,10 @@
* - > 5.0.15
*/
if (PMA_MYSQL_INT_VERSION < 50015) {
- PMA_fatalError(__('You should upgrade to %s %s or later.'), array('MySQL', '5.0.15'));
+ PMA_fatalError(
+ __('You should upgrade to %s %s or later.'),
+ array('MySQL', '5.0.15')
+ );
}
/**
@@ -1016,7 +1046,9 @@
/**
* some resetting has to be done when switching servers
*/
- if (isset($_SESSION['tmp_user_values']['previous_server']) && $_SESSION['tmp_user_values']['previous_server'] != $GLOBALS['server']) {
+ if (isset($_SESSION['tmp_user_values']['previous_server'])
+ && $_SESSION['tmp_user_values']['previous_server'] != $GLOBALS['server']
+ ) {
unset($_SESSION['tmp_user_values']['navi_limit_offset']);
}
$_SESSION['tmp_user_values']['previous_server'] = $GLOBALS['server'];
View
111 libraries/common.lib.php
@@ -226,8 +226,9 @@ function PMA_generateHiddenMaxFileSize($max_size)
*
* @access public
*/
-function PMA_sqlAddSlashes($a_string = '', $is_like = false, $crlf = false, $php_code = false)
-{
+function PMA_sqlAddSlashes($a_string = '', $is_like = false, $crlf = false,
+ $php_code = false
+) {
if ($is_like) {
$a_string = str_replace('\\', '\\\\\\\\', $a_string);
} else {
@@ -416,8 +417,9 @@ function PMA_showDocLink($link, $target = 'documentation')
*
* @access public
*/
-function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $just_open = false)
-{
+function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '',
+ $just_open = false
+) {
global $cfg;
if ($cfg['MySQLManualType'] == 'none' || empty($cfg['MySQLManualBase'])) {
@@ -564,8 +566,11 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice')
}
// footnotemarker used in js/tooltip.js
- return '<sup class="footnotemarker">' . $nr . '</sup>' .
- PMA_getImage('b_help.png', '', array('class' => 'footnotemarker footnote_' . $nr));
+ return '<sup class="footnotemarker">' . $nr . '</sup>'
+ . PMA_getImage(
+ 'b_help.png', '',
+ array('class' => 'footnotemarker footnote_' . $nr)
+ );
}
/**
@@ -577,6 +582,8 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice')
* @param string $back_url the "back" link url (full path is not required)
* @param bool $exit EXIT the page?
*
+ * @return void
+ *
* @global string the curent table
* @global string the current db
*
@@ -609,14 +616,18 @@ function PMA_mysqlDie(
$formatted_sql = '';
} else {
if (strlen($the_query) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
- $formatted_sql = htmlspecialchars(substr($the_query, 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'])) . '[...]';
+ $formatted_sql = htmlspecialchars(
+ substr($the_query, 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'])
+ )
+ . '[...]';
} else {
$formatted_sql = PMA_formatSql(PMA_SQP_parse($the_query), $the_query);
}
}
// ---
$error_msg_output .= "\n" . '<!-- PMA-SQL-ERROR -->' . "\n";
- $error_msg_output .= ' <div class="error"><h1>' . __('Error') . '</h1>' . "\n";
+ $error_msg_output .= ' <div class="error"><h1>' . __('Error')
+ . '</h1>' . "\n";
// if the config password is wrong, or the MySQL server does not
// respond, do not show the query that would reveal the
// username/password
@@ -641,12 +652,15 @@ function PMA_mysqlDie(
if (strlen($table)) {
$_url_params['db'] = $db;
$_url_params['table'] = $table;
- $doedit_goto = '<a href="tbl_sql.php' . PMA_generate_common_url($_url_params) . '">';
+ $doedit_goto = '<a href="tbl_sql.php'
+ . PMA_generate_common_url($_url_params) . '">';
} elseif (strlen($db)) {
$_url_params['db'] = $db;
- $doedit_goto = '<a href="db_sql.php' . PMA_generate_common_url($_url_params) . '">';
+ $doedit_goto = '<a href="db_sql.php'
+ . PMA_generate_common_url($_url_params) . '">';
} else {
- $doedit_goto = '<a href="server_sql.php' . PMA_generate_common_url($_url_params) . '">';
+ $doedit_goto = '<a href="server_sql.php'
+ . PMA_generate_common_url($_url_params) . '">';
}
$error_msg_output .= $doedit_goto
@@ -735,12 +749,15 @@ function PMA_mysqlDie(
*
* @return array (recursive) grouped table list
*/
-function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count = false)
-{
+function PMA_getTableList($db, $tables = null, $limit_offset = 0,
+ $limit_count = false
+) {
$sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
if (null === $tables) {
- $tables = PMA_DBI_get_tables_full($db, false, false, null, $limit_offset, $limit_count);
+ $tables = PMA_DBI_get_tables_full(
+ $db, false, false, null, $limit_offset, $limit_count
+ );
if ($GLOBALS['cfg']['NaturalOrder']) {
uksort($tables, 'strnatcasecmp');
}
@@ -1000,15 +1017,16 @@ function PMA_reloadNavigation($jsonly=false)
*
* @access public
*/
-function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view = false)
-{
+function PMA_showMessage($message, $sql_query = null, $type = 'notice',
+ $is_view = false
+) {
/*
* PMA_ajaxResponse uses this function to collect the string of HTML generated
* for showing the message. Use output buffering to collect it and return it
* in a string. In some special cases on sql.php, buffering has to be disabled
* and hence we check with $GLOBALS['buffer_message']
*/
- if ( $GLOBALS['is_ajax_request'] == true && ! isset($GLOBALS['buffer_message']) ) {
+ if ($GLOBALS['is_ajax_request'] == true && ! isset($GLOBALS['buffer_message'])) {
ob_start();
}
global $cfg;
@@ -1016,7 +1034,9 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
if (null === $sql_query) {
if (! empty($GLOBALS['display_query'])) {
$sql_query = $GLOBALS['display_query'];
- } elseif ($cfg['SQP']['fmtType'] == 'none' && ! empty($GLOBALS['unparsed_sql'])) {
+ } elseif ($cfg['SQP']['fmtType'] == 'none'
+ && ! empty($GLOBALS['unparsed_sql'])
+ ) {
$sql_query = $GLOBALS['unparsed_sql'];
} elseif (! empty($GLOBALS['sql_query'])) {
$sql_query = $GLOBALS['sql_query'];
@@ -1050,7 +1070,9 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
if (strlen($GLOBALS['table'])
&& $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])
) {
- if (PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Index_length') > 1024 && ! PMA_DRIZZLE) {
+ if (PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Index_length') > 1024
+ && ! PMA_DRIZZLE
+ ) {
PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
}
}
@@ -1059,7 +1081,9 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
// In an Ajax request, $GLOBALS['cell_align_left'] may not be defined. Hence,
// check for it's presence before using it
echo '<div id="result_query"'
- . ( isset($GLOBALS['cell_align_left']) ? ' style="text-align: ' . $GLOBALS['cell_align_left'] . '"' : '' )
+ . ( isset($GLOBALS['cell_align_left'])
+ ? ' style="text-align: ' . $GLOBALS['cell_align_left'] . '"'
+ : '' )
. '>' . "\n";
if ($message instanceof PMA_Message) {
@@ -1088,7 +1112,9 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
$new_line = '\\n"<br />' . "\n"
. '&nbsp;&nbsp;&nbsp;&nbsp;. "';
$query_base = htmlspecialchars(addslashes($sql_query));
- $query_base = preg_replace('/((\015\012)|(\015)|(\012))/', $new_line, $query_base);
+ $query_base = preg_replace(
+ '/((\015\012)|(\015)|(\012))/', $new_line, $query_base
+ );
} else {
$query_base = $sql_query;
}
@@ -1231,7 +1257,11 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
}
$edit_link .= PMA_generate_common_url($url_params) . '#querybox';
- $edit_link = ' [' . PMA_linkOrButton($edit_link, __('Edit'), array('onclick' => $onclick)) . ']';
+ $edit_link = ' ['
+ . PMA_linkOrButton(
+ $edit_link, __('Edit'), array('onclick' => $onclick)
+ )
+ . ']';
} else {
$edit_link = '';
}
@@ -1398,6 +1428,8 @@ function PMA_profilingSupported()
*
* @param string $sql_query sql query
*
+ * @return void
+ *
* @access public
*/
function PMA_profilingCheckbox($sql_query)
@@ -1821,9 +1853,11 @@ function PMA_generate_html_tab($tab, $url_params = array(), $base_dir = '')
*
* @return string html-code for tab-navigation
*/
-function PMA_generate_html_tabs($tabs, $url_params, $base_dir = '', $menu_id = 'topmenu')
-{
- $tab_navigation = '<div id="' . htmlentities($menu_id) . 'container" class="menucontainer">'
+function PMA_generate_html_tabs($tabs, $url_params, $base_dir = '',
+ $menu_id = 'topmenu'
+) {
+ $tab_navigation = '<div id="' . htmlentities($menu_id)
+ . 'container" class="menucontainer">'
.'<ul id="' . htmlentities($menu_id) . '">';
foreach ($tabs as $tab) {
@@ -1869,7 +1903,8 @@ function PMA_linkOrButton($url, $message, $tag_params = array(),
$tmp = $tag_params;
$tag_params = array();
if (! empty($tmp)) {
- $tag_params['onclick'] = 'return confirmLink(this, \'' . PMA_escapeJsString($tmp) . '\')';
+ $tag_params['onclick'] = 'return confirmLink(this, \''
+ . PMA_escapeJsString($tmp) . '\')';
}
unset($tmp);
}
@@ -2131,8 +2166,9 @@ function PMA_checkParameters($params, $request = true)
*
* @return array the calculated condition and whether condition is unique
*/
-function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force_unique = false)
-{
+function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row,
+ $force_unique = false
+) {
$primary_key = '';
$unique_key = '';
$nonprimary_condition = '';
@@ -2281,6 +2317,8 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force
* @param string $image image to display
* @param string $value value
*
+ * @return void
+ *
* @access public
*/
function PMA_buttonOrImage($button_name, $button_class, $image_name, $text,
@@ -2461,6 +2499,8 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1,
* @param string $frame target frame
* @param int $max_count maximum number of elements to display from the list
*
+ * @return void
+ *
* @access public
*
* @todo use $pos from $_url_params
@@ -2597,6 +2637,8 @@ function PMA_getDbLink($database = null)
* @param string $component 'mysql' (eventually, 'php')
* @param string $minimum_version of this component
* @param string $bugref bug reference for this component
+ *
+ * @return void
*/
function PMA_externalBug($functionality, $component, $minimum_version, $bugref)
{
@@ -2619,7 +2661,7 @@ function PMA_externalBug($functionality, $component, $minimum_version, $bugref)
* @param boolean $checked is it initially checked?
* @param boolean $onclick should it submit the form on click?
*
- * @return the HTML for the checkbox
+ * @return void
*/
function PMA_display_html_checkbox($html_field_name, $label, $checked, $onclick)
{
@@ -2640,7 +2682,7 @@ function PMA_display_html_checkbox($html_field_name, $label, $checked, $onclick)
* @param boolean $escape_label whether to use htmlspecialchars() on label
* @param string $class enclose each choice with a div of this class
*
- * @return the HTML for the tadio buttons
+ * @return void
*/
function PMA_display_html_radio($html_field_name, $choices, $checked_choice = '',
$line_break = true, $escape_label = true, $class=''
@@ -3662,7 +3704,8 @@ function PMA_getGISFunctions($geom_type = null, $binary = true, $display = false
*
* @global array $cfg PMA configuration
* @global array $analyzed_sql Analyzed SQL query
- * @global mixed $data data of currently edited row (used to detect whether to choose defaults)
+ * @global mixed $data data of currently edited row
+ * (used to detect whether to choose defaults)
*
* @return string An HTML snippet of a dropdown list with function
* names appropriate for the requested column.
@@ -3738,9 +3781,9 @@ function PMA_getFunctionsForField($field, $insert_mode)
) {
// Is current function defined as default?
$selected = ($field['first_timestamp'] && $functions[$j] == $cfg['DefaultFunctions']['first_timestamp'])
- || (! $field['first_timestamp'] && $functions[$j] == $default_function)
- ? ' selected="selected"'
- : '';
+ || (! $field['first_timestamp'] && $functions[$j] == $default_function)
+ ? ' selected="selected"'
+ : '';
if ($op_spacing_needed == true) {
$retval .= ' ';
$retval .= '<option value="">--------</option>' . "\n";
Please sign in to comment.
Something went wrong with that request. Please try again.