diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index f232b985cb..4b286d3b71 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -76,7 +76,8 @@ function PMA_pow($base, $exp, $use_function = false)
* @param string $icon name of icon file
* @param string $alternate alternate text
* @param boolean $force_text whether to force alternate text to be displayed
- * @param boolean $noSprite If true, the image source will be not replaced with a CSS Sprite
+ * @param boolean $noSprite If true, the image source will be not replaced
+ * with a CSS Sprite
*
* @return html img tag
*/
@@ -153,13 +154,13 @@ function PMA_generateHiddenMaxFileSize($max_size)
* Add slashes before "'" and "\" characters so a value containing them can
* be used in a sql comparison.
*
- * @param string $a_string the string to slash
- * @param bool $is_like whether the string will be used in a 'LIKE' clause
- * (it then requires two more escaped sequences) or not
- * @param bool $crlf whether to treat cr/lfs as escape-worthy entities
- * (converts \n to \\n, \r to \\r)
- * @param bool $php_code whether this function is used as part of the
- * "Create PHP code" dialog
+ * @param string $a_string the string to slash
+ * @param bool $is_like whether the string will be used in a 'LIKE' clause
+ * (it then requires two more escaped sequences) or not
+ * @param bool $crlf whether to treat cr/lfs as escape-worthy entities
+ * (converts \n to \\n, \r to \\r)
+ * @param bool $php_code whether this function is used as part of the
+ * "Create PHP code" dialog
*
* @return string the slashed string
*
@@ -177,7 +178,7 @@ function PMA_sqlAddSlashes($a_string = '', $is_like = false, $crlf = false, $php
$a_string = strtr(
$a_string,
array("\n" => '\n', "\r" => '\r', "\t" => '\t')
- );
+ );
}
if ($php_code) {
@@ -210,7 +211,7 @@ function PMA_escape_mysql_wildcards($name)
* removes slashes before "_" and "%" characters
* Note: This function does not unescape backslashes!
*
- * @param string $name the string to escape
+ * @param string $name the string to escape
*
* @return string the escaped string
*
@@ -245,15 +246,17 @@ function PMA_unQuote($quoted_string, $quote = null)
foreach ($quotes as $quote) {
if (substr($quoted_string, 0, 1) === $quote
- && substr($quoted_string, -1, 1) === $quote) {
- $unquoted_string = substr($quoted_string, 1, -1);
- // replace escaped quotes
- $unquoted_string = str_replace(
+ && substr($quoted_string, -1, 1) === $quote
+ ) {
+ $unquoted_string = substr($quoted_string, 1, -1);
+ // replace escaped quotes
+ $unquoted_string = str_replace(
$quote . $quote,
$quote,
- $unquoted_string);
- return $unquoted_string;
- }
+ $unquoted_string
+ );
+ return $unquoted_string;
+ }
}
return $quoted_string;
@@ -262,7 +265,6 @@ function PMA_unQuote($quoted_string, $quote = null)
/**
* format sql strings
*
- * @todo move into PMA_Sql
* @param mixed $parsed_sql pre-parsed SQL structure
* @param string $unparsed_sql raw SQL string
*
@@ -272,7 +274,7 @@ function PMA_unQuote($quoted_string, $quote = null)
* @global boolean whether the current statement is a multiple one or not
*
* @access public
- *
+ * @todo move into PMA_Sql
*/
function PMA_formatSql($parsed_sql, $unparsed_sql = '')
{
@@ -419,7 +421,7 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju
/**
* Displays a link to the phpMyAdmin documentation
*
- * @param string $anchor anchor in documentation
+ * @param string $anchor anchor in documentation
*
* @return string the html link
*
@@ -437,7 +439,7 @@ function PMA_showDocu($anchor)
/**
* Displays a link to the PHP documentation
*
- * @param string $target anchor in documentation
+ * @param string $target anchor in documentation
*
* @return string the html link
*
@@ -457,9 +459,9 @@ function PMA_showPHPDocu($target)
/**
* returns HTML for a footnote marker and add the messsage to the footnotes
*
- * @param string $message the error message
- * @param bool $bbcode
- * @param string $type
+ * @param string $message the error message
+ * @param bool $bbcode
+ * @param string $type message types
*
* @return string html code for a footnote marker
*
@@ -500,11 +502,11 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice')
/**
* Displays a MySQL error message in the right frame.
*
- * @param string $error_message the error message
- * @param string $the_query the sql query that failed
- * @param bool $is_modify_link whether to show a "modify" link or not
- * @param string $back_url the "back" link url (full path is not required)
- * @param bool $exit EXIT the page?
+ * @param string $error_message the error message
+ * @param string $the_query the sql query that failed
+ * @param bool $is_modify_link whether to show a "modify" link or not
+ * @param string $back_url the "back" link url (full path is not required)
+ * @param bool $exit EXIT the page?
*
* @global string the curent table
* @global string the current db
@@ -512,14 +514,14 @@ function PMA_showHint($message, $bbcode = false, $type = 'notice')
* @access public
*/
function PMA_mysqlDie($error_message = '', $the_query = '',
- $is_modify_link = true, $back_url = '', $exit = true)
+$is_modify_link = true, $back_url = '', $exit = true)
{
global $table, $db;
/**
* start http output, display html headers
*/
- require_once './libraries/header.inc.php';
+ include_once './libraries/header.inc.php';
$error_msg_output = '';
@@ -641,7 +643,7 @@ function PMA_mysqlDie($error_message = '', $the_query = '',
/**
* display footer and exit
*/
- require './libraries/footer.inc.php';
+ include './libraries/footer.inc.php';
} else {
echo $error_msg_output;
}
@@ -650,10 +652,10 @@ function PMA_mysqlDie($error_message = '', $the_query = '',
/**
* returns array with tables of given db with extended information and grouped
*
- * @param string $db name of db
- * @param string $tables name of tables
- * @param integer $limit_offset list offset
- * @param int|bool $limit_count max tables to return
+ * @param string $db name of db
+ * @param string $tables name of tables
+ * @param integer $limit_offset list offset
+ * @param int|bool $limit_count max tables to return
*
* @return array (recursive) grouped table list
*/
@@ -782,10 +784,10 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count =
*
*
*
- * @param mixed $a_name the database, table or field name to "backquote"
- * or array of it
- * @param boolean $do_it a flag to bypass this function (used by dump
- * functions)
+ * @param mixed $a_name the database, table or field name to "backquote"
+ * or array of it
+ * @param boolean $do_it a flag to bypass this function (used by dump
+ * functions)
*
* @return mixed the "backquoted" database, table or field name
*
@@ -829,9 +831,8 @@ function PMA_whichCrlf()
// Win case
if (PMA_USR_OS == 'Win') {
$the_crlf = "\r\n";
- }
- // Others
- else {
+ } else {
+ // Others
$the_crlf = "\n";
}
@@ -880,10 +881,10 @@ if (typeof(window.parent) != 'undefined'
* displays the message and the query
* usually the message is the result of the query executed
*
- * @param string $message the message to display
- * @param string $sql_query the query to display
- * @param string $type the type (level) of the message
- * @param boolean $is_view is this a message after a VIEW operation?
+ * @param string $message the message to display
+ * @param string $sql_query the query to display
+ * @param string $type the type (level) of the message
+ * @param boolean $is_view is this a message after a VIEW operation?
*
* @return string
*
@@ -1005,8 +1006,9 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
// Same as below (append LIMIT), append the remembered ORDER BY
if ($GLOBALS['cfg']['RememberSorting']
- && isset($analyzed_display_query[0]['queryflags']['select_from'])
- && isset($GLOBALS['sql_order_to_append'])) {
+ && isset($analyzed_display_query[0]['queryflags']['select_from'])
+ && isset($GLOBALS['sql_order_to_append'])
+ ) {
$query_base = $analyzed_display_query[0]['section_before_limit']
. "\n" . $GLOBALS['sql_order_to_append']
. $analyzed_display_query[0]['section_after_limit'];
@@ -1158,10 +1160,10 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
) {
$validate_params = $url_params;
if (!empty($GLOBALS['validatequery'])) {
- $validate_message = __('Skip Validate SQL') ;
+ $validate_message = __('Skip Validate SQL');
} else {
$validate_params['validatequery'] = 1;
- $validate_message = __('Validate SQL') ;
+ $validate_message = __('Validate SQL');
}
$validate_link = 'import.php' . PMA_generate_common_url($validate_params);
@@ -1271,7 +1273,8 @@ function PMA_profilingSupported()
/**
* Displays a form with the Profiling checkbox
*
- * @param string $sql_query
+ * @param string $sql_query sql query
+ *
* @access public
*/
function PMA_profilingCheckbox($sql_query)
@@ -1290,9 +1293,9 @@ function PMA_profilingCheckbox($sql_query)
/**
* Formats $value to byte view
*
- * @param double $value the value to format
- * @param int $limes the sensitiveness
- * @param int $comma the number of decimals to retain
+ * @param double $value the value to format
+ * @param int $limes the sensitiveness
+ * @param int $comma the number of decimals to retain
*
* @return array the formatted value and its unit
*
@@ -1346,7 +1349,7 @@ function PMA_formatByteDown($value, $limes = 6, $comma = 0)
/**
* Changes thousands and decimal separators to locale specific values.
*
- * @param $value
+ * @param string $value the value
*
* @return string
*/
@@ -1360,7 +1363,8 @@ function PMA_localizeNumber($value)
/* l10n: Decimal separator */
__('.'),
),
- $value);
+ $value
+ );
}
/**
@@ -1376,13 +1380,14 @@ function PMA_localizeNumber($value)
* echo PMA_formatNumber(0.003, 3, 3); // 0.003
* echo PMA_formatNumber(0.00003, 3, 2); // 0.03 m
* echo PMA_formatNumber(0, 6); // 0
- *
*
- * @param double $value the value to format
- * @param integer $digits_left number of digits left of the comma
- * @param integer $digits_right number of digits right of the comma
- * @param boolean $only_down do not reformat numbers below 1
- * @param boolean $noTrailingZero removes trailing zeros right of the comma (default: true)
+ *
+ * @param double $value the value to format
+ * @param integer $digits_left number of digits left of the comma
+ * @param integer $digits_right number of digits right of the comma
+ * @param boolean $only_down do not reformat numbers below 1
+ * @param boolean $noTrailingZero removes trailing zeros right of the comma
+ * (default: true)
*
* @return string the formatted value and its unit
*
@@ -1390,7 +1395,9 @@ function PMA_localizeNumber($value)
*/
function PMA_formatNumber($value, $digits_left = 3, $digits_right = 0, $only_down = false, $noTrailingZero = true)
{
- if ($value==0) return '0';
+ if ($value==0) {
+ return '0';
+ }
$originalValue = $value;
//number_format is not multibyte safe, str_replace is safe
@@ -1449,7 +1456,9 @@ function PMA_formatNumber($value, $digits_left = 3, $digits_right = 0, $only_dow
$d-= floor(($digits_left - $cur_digits)/3);
}
- if ($d<0 && $only_down) $d=0;
+ if ($d<0 && $only_down) {
+ $d=0;
+ }
$value = round($value / (PMA_pow(1000, $d, 'pow') / $dh)) /$dh;
$unit = $units[$d];
@@ -1458,7 +1467,7 @@ function PMA_formatNumber($value, $digits_left = 3, $digits_right = 0, $only_dow
if ($noTrailingZero) {
$value = PMA_localizeNumber(
preg_replace('/(?<=\d)(?=(\d{3})+(?!\d))/', ',', $value)
- );
+ );
} else {
//number_format is not multibyte safe, str_replace is safe
$value = PMA_localizeNumber(number_format($value, $digits_right));
@@ -1474,7 +1483,7 @@ function PMA_formatNumber($value, $digits_left = 3, $digits_right = 0, $only_dow
/**
* Returns the number of bytes when a formatted size is given
*
- * @param string $formatted_size the size expression (for example 8MB)
+ * @param string $formatted_size the size expression (for example 8MB)
*
* @return integer The numerical part of the expression (for example 8)
*/
@@ -1495,8 +1504,8 @@ function PMA_extractValueFromFormattedSize($formatted_size)
/**
* Writes localised date
*
- * @param string $timestamp the current timestamp
- * @param string $format format
+ * @param string $timestamp the current timestamp
+ * @param string $format format
*
* @return string the formatted date
*
@@ -1565,8 +1574,8 @@ function PMA_localisedDate($timestamp = -1, $format = '')
* returns a tab for tabbed navigation.
* If the variables $link and $args ar left empty, an inactive tab is created
*
- * @param array $tab array with all options
- * @param array $url_params
+ * @param array $tab array with all options
+ * @param array $url_params
*
* @return string html code for one tab, a link if valid otherwise a span
*
@@ -1593,7 +1602,8 @@ function PMA_generate_html_tab($tab, $url_params = array(), $base_dir='')
// determine additionnal style-class
if (empty($tab['class'])) {
if (! empty($tab['active'])
- || PMA_isValid($GLOBALS['active_page'], 'identical', $tab['link'])) {
+ || PMA_isValid($GLOBALS['active_page'], 'identical', $tab['link'])
+ ) {
$tab['class'] = 'active';
} elseif (is_null($tab['active']) && empty($GLOBALS['active_page'])
&& basename($GLOBALS['PMA_PHP_SELF']) == $tab['link']
@@ -1630,19 +1640,21 @@ function PMA_generate_html_tab($tab, $url_params = array(), $base_dir='')
// display icon, even if iconic is disabled but the link-text is missing
if (($GLOBALS['cfg']['MainPageIconic'] || empty($tab['text']))
- && isset($tab['icon'])) {
+ && isset($tab['icon'])
+ ) {
// avoid generating an alt tag, because it only illustrates
// the text that follows and if browser does not display
// images, the text is duplicated
$image = '
%2$s';
$tab['text'] = sprintf($image, htmlentities($tab['icon']), $tab['text']);
- }
- // check to not display an empty link-text
- elseif (empty($tab['text'])) {
+ } elseif (empty($tab['text'])) {
+ // check to not display an empty link-text
$tab['text'] = '?';
- trigger_error('empty linktext in function ' . __FUNCTION__ . '()',
- E_USER_NOTICE);
+ trigger_error(
+ 'empty linktext in function ' . __FUNCTION__ . '()',
+ E_USER_NOTICE
+ );
}
//Set the id for the tab, if set in the params
@@ -1666,8 +1678,8 @@ function PMA_generate_html_tab($tab, $url_params = array(), $base_dir='')
/**
* returns html-code for a tab navigation
*
- * @param array $tabs one element per tab
- * @param string $url_params
+ * @param array $tabs one element per tab
+ * @param string $url_params
*
* @return string html-code for tab-navigation
*/
@@ -1695,14 +1707,14 @@ function PMA_generate_html_tabs($tabs, $url_params, $base_dir='')
* Displays a link, or a button if the link's URL is too large, to
* accommodate some browsers' limitations
*
- * @param string $url the URL
- * @param string $message the link message
- * @param mixed $tag_params string: js confirmation
- * array: additional tag params (f.e. style="")
- * @param boolean $new_form we set this to false when we are already in
- * a form, to avoid generating nested forms
- * @param boolean $strip_img
- * @param string $target
+ * @param string $url the URL
+ * @param string $message the link message
+ * @param mixed $tag_params string: js confirmation
+ * array: additional tag params (f.e. style="")
+ * @param boolean $new_form we set this to false when we are already in
+ * a form, to avoid generating nested forms
+ * @param boolean $strip_img whether to strip the image
+ * @param string $target target
*
* @return string the results to be echoed or saved in an array
*/
@@ -1752,9 +1764,9 @@ function PMA_linkOrButton($url, $message, $tag_params = array(),
if ($url_length <= $GLOBALS['cfg']['LinkLengthLimit']) {
if ($suhosin_get_MaxValueLength = ini_get('suhosin.get.max_value_length')) {
$query_parts = PMA_splitURLQuery($url);
- foreach($query_parts as $query_pair) {
+ foreach ($query_parts as $query_pair) {
list($eachvar, $eachval) = explode('=', $query_pair);
- if(strlen($eachval) > $suhosin_get_MaxValueLength) {
+ if (strlen($eachval) > $suhosin_get_MaxValueLength) {
$in_suhosin_limits = false;
break;
}
@@ -1822,10 +1834,12 @@ function PMA_linkOrButton($url, $message, $tag_params = array(),
/**
* Splits a URL string by parameter
*
- * @param string $url the URL
+ * @param string $url the URL
+ *
* @return array the parameter/value pairs, for example [0] db=sakila
*/
-function PMA_splitURLQuery($url) {
+function PMA_splitURLQuery($url)
+{
// decode encoded url separators
$separator = PMA_get_arg_separator();
// on most places separator is still hard coded ...
@@ -1844,7 +1858,7 @@ function PMA_splitURLQuery($url) {
/**
* Returns a given timespan value in a readable format.
*
- * @param int $seconds the timespan
+ * @param int $seconds the timespan
*
* @return string the formatted value
*/
@@ -1872,11 +1886,11 @@ function PMA_timespanFormat($seconds)
* Fulfills todo-item
* http://sf.net/tracker/?func=detail&aid=544361&group_id=23067&atid=377411
*
- * @todo add a multibyte safe function PMA_STR_split()
- * @param string $string The string
- * @param string $Separator The Separator (defaults to "
\n")
+ * @param string $string The string
+ * @param string $Separator The Separator (defaults to "
\n")
*
* @access public
+ * @todo add a multibyte safe function PMA_STR_split()
*
* @return string The flipped string
*/
@@ -1920,16 +1934,17 @@ function PMA_flipstring($string, $Separator = "
\n")
* Not sure we could use a strMissingParameter message here,
* would have to check if the error message file is always available
*
- * @todo use PMA_fatalError() if $die === true?
- * @param array $params The names of the parameters needed by the calling script.
- * @param bool $die Stop the execution?
- * (Set this manually to false in the calling script
- * until you know all needed parameters to check).
- * @param bool $request Whether to include this list in checking for special params.
+ * @param array $params The names of the parameters needed by the calling script.
+ * @param bool $die Stop the execution?
+ * (Set this manually to false in the calling script
+ * until you know all needed parameters to check).
+ * @param bool $request Whether to include this list in checking for special params.
+ *
* @global string path to current script
* @global boolean flag whether any special variable was required
*
* @access public
+ * @todo use PMA_fatalError() if $die === true?
*/
function PMA_checkParameters($params, $die = true, $request = true)
{
@@ -1961,7 +1976,7 @@ function PMA_checkParameters($params, $die = true, $request = true)
/**
* display html meta tags
*/
- require_once './libraries/header_meta_style.inc.php';
+ include_once './libraries/header_meta_style.inc.php';
echo '
' . $error_message . '