diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index ffe3c18277..964e47fb38 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -25,6 +25,7 @@ function PMA_detectPow()
}
}
+
/**
* Exponential expression / raise number into power
*
@@ -38,7 +39,7 @@ function PMA_pow($base, $exp, $use_function = false)
{
static $pow_function = null;
- if (null == $pow_function) {
+ if ($pow_function == null) {
$pow_function = PMA_detectPow();
}
@@ -46,9 +47,10 @@ function PMA_pow($base, $exp, $use_function = false)
$use_function = $pow_function;
}
- if ($exp < 0 && 'pow' != $use_function) {
+ if (($exp < 0) && ($use_function != 'pow')) {
return false;
}
+
switch ($use_function) {
case 'bcpow' :
// bcscale() needed for testing PMA_pow() with base values < 1
@@ -70,6 +72,7 @@ function PMA_pow($base, $exp, $use_function = false)
return $pow;
}
+
/**
* Returns an HTML IMG tag for a particular icon from a theme,
* which may be an actual file or an icon from a sprite.
@@ -88,7 +91,7 @@ function PMA_getIcon($icon, $alternate = '', $force_text = false)
$include_icon = ($GLOBALS['cfg']['PropertiesIconic'] !== false);
// $cfg['PropertiesIconic'] is false or both
// OR we have no $include_icon
- $include_text = ($force_text || true !== $GLOBALS['cfg']['PropertiesIconic']);
+ $include_text = ($force_text || ($GLOBALS['cfg']['PropertiesIconic'] !== true));
// Always use a span (we rely on this in js/sql.js)
$button = '';
@@ -106,6 +109,7 @@ function PMA_getIcon($icon, $alternate = '', $force_text = false)
return $button;
}
+
/**
* Returns an HTML IMG tag for a particular image from a theme,
* which may be an actual file or an icon from a sprite
@@ -135,6 +139,7 @@ function PMA_getImage($image, $alternate = '', $attributes = array())
$sprites = array();
}
}
+
// Check if we have the requested image as a sprite
// and set $url accordingly
$class = str_replace(array('.gif','.png'), '', $image);
@@ -144,6 +149,7 @@ function PMA_getImage($image, $alternate = '', $attributes = array())
} else {
$url = $GLOBALS['pmaThemeImage'] . $image;
}
+
// set class attribute
if ($is_sprite) {
if (isset($attributes['class'])) {
@@ -152,6 +158,7 @@ function PMA_getImage($image, $alternate = '', $attributes = array())
$attributes['class'] = "icon ic_$class";
}
}
+
// set all other attributes
$attr_str = '';
foreach ($attributes as $key => $value) {
@@ -159,18 +166,21 @@ function PMA_getImage($image, $alternate = '', $attributes = array())
$attr_str .= " $key=\"$value\"";
}
}
+
// override the alt attribute
if (isset($attributes['alt'])) {
$alt = $attributes['alt'];
} else {
$alt = $alternate;
}
+
// override the title attribute
if (isset($attributes['title'])) {
$title = $attributes['title'];
} else {
$title = $alternate;
}
+
// generate the IMG tag
$template = '';
$retval = sprintf($template, $url, $title, $alt, $attr_str);
@@ -178,6 +188,7 @@ function PMA_getImage($image, $alternate = '', $attributes = array())
return $retval;
}
+
/**
* Returns the formatted maximum size for an upload
*
@@ -195,6 +206,7 @@ function PMA_getFormattedMaximumUploadSize($max_upload_size)
return '(' . sprintf(__('Max: %s%s'), $max_size, $max_unit) . ')';
}
+
/**
* Generates a hidden field which should indicate to the browser
* the maximum size for upload
@@ -210,6 +222,7 @@ function PMA_generateHiddenMaxFileSize($max_size)
return '';
}
+
/**
* Add slashes before "'" and "\" characters so a value containing them can
* be used in a sql comparison.
@@ -226,9 +239,10 @@ 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 {
@@ -268,6 +282,7 @@ function PMA_escapeMysqlWildcards($name)
return strtr($name, array('_' => '\\_', '%' => '\\%'));
} // end of the 'PMA_escapeMysqlWildcards()' function
+
/**
* removes slashes before "_" and "%" characters
* Note: This function does not unescape backslashes!
@@ -283,6 +298,7 @@ function PMA_unescapeMysqlWildcards($name)
return strtr($name, array('\\_' => '_', '\\%' => '%'));
} // end of the 'PMA_unescapeMysqlWildcards()' function
+
/**
* removes quotes (',",`) from a quoted string
*
@@ -297,7 +313,7 @@ function PMA_unQuote($quoted_string, $quote = null)
{
$quotes = array();
- if (null === $quote) {
+ if ($quote === null) {
$quotes[] = '`';
$quotes[] = '"';
$quotes[] = "'";
@@ -323,6 +339,7 @@ function PMA_unQuote($quoted_string, $quote = null)
return $quoted_string;
}
+
/**
* format sql strings
*
@@ -352,7 +369,7 @@ function PMA_formatSql($parsed_sql, $unparsed_sql = '')
// We don't so just return the input directly
// This is intended to be used for when the SQL Parser is turned off
$formatted_sql = "
\n";
- if ($cfg['SQP']['fmtType'] == 'none' && $unparsed_sql != '') {
+ if (($cfg['SQP']['fmtType'] == 'none') && ($unparsed_sql != '')) {
$formatted_sql .= $unparsed_sql;
} else {
$formatted_sql .= $parsed_sql;
@@ -404,6 +421,7 @@ function PMA_showDocLink($link, $target = 'documentation')
. '';
} // end of the 'PMA_showDocLink()' function
+
/**
* Displays a link to the official MySQL documentation
*
@@ -417,12 +435,13 @@ 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'])) {
+ if (($cfg['MySQLManualType'] == 'none') || empty($cfg['MySQLManualBase'])) {
return '';
}
@@ -494,6 +513,7 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '',
} else {
return PMA_showDocLink(PMA_linkURL($url), 'mysql_doc');
}
+
} // end of the 'PMA_showMySQLDocu()' function
@@ -511,6 +531,7 @@ function PMA_showDocu($anchor)
return PMA_showDocLink('Documentation.html#' . $anchor);
} // end of the 'PMA_showDocu()' function
+
/**
* Displays a link to the PHP documentation
*
@@ -527,6 +548,7 @@ function PMA_showPHPDocu($target)
return PMA_showDocLink($url);
} // end of the 'PMA_showPHPDocu()' function
+
/**
* Returns HTML code for a tooltip
*
@@ -538,15 +560,13 @@ function PMA_showPHPDocu($target)
*/
function PMA_showHint($message)
{
- $retval = '';
- $retval .= PMA_getImage('b_help.png');
- $retval .= '';
- $retval .= $message;
- $retval .= '';
- $retval .= '';
- return $retval;
+ return ''
+ . PMA_getImage('b_help.png')
+ . '' . $message . ''
+ . '';
}
+
/**
* Displays a MySQL error message in the right frame.
*
@@ -567,6 +587,7 @@ function PMA_mysqlDie(
$error_message = '', $the_query = '',
$is_modify_link = true, $back_url = '', $exit = true
) {
+
global $table, $db;
$error_msg = '';
@@ -581,7 +602,7 @@ function PMA_mysqlDie(
// --- Added to solve bug #641765
if (! function_exists('PMA_SQP_isError') || PMA_SQP_isError()) {
$formatted_sql = htmlspecialchars($the_query);
- } elseif (empty($the_query) || trim($the_query) == '') {
+ } elseif (empty($the_query) || (trim($the_query) == '')) {
$formatted_sql = '';
} else {
if (strlen($the_query) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
@@ -708,6 +729,7 @@ function PMA_mysqlDie(
}
} // end of the 'PMA_mysqlDie()' function
+
/**
* returns array with tables of given db with extended information and grouped
*
@@ -723,7 +745,7 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0,
) {
$sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
- if (null === $tables) {
+ if ($tables === null) {
$tables = PMA_DBI_get_tables_full(
$db, false, false, null, $limit_offset, $limit_count
);
@@ -747,7 +769,7 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0,
foreach ($tables as $table_name => $table) {
// check for correct row count
- if (null === $table['Rows']) {
+ if ($table['Rows'] === null) {
// Do not check exact row count here,
// if row count is invalid possibly the table is defect
// and this would break left frame;
@@ -774,24 +796,30 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0,
if ($GLOBALS['cfg']['LeftFrameDBTree']
&& $sep && strstr($table_name, $sep)
) {
+
$parts = explode($sep, $table_name);
$group =& $table_groups;
$i = 0;
$group_name_full = '';
$parts_cnt = count($parts) - 1;
- while ($i < $parts_cnt
- && $i < $GLOBALS['cfg']['LeftFrameTableLevel']
+
+ while (($i < $parts_cnt)
+ && ($i < $GLOBALS['cfg']['LeftFrameTableLevel'])
) {
+
$group_name = $parts[$i] . $sep;
$group_name_full .= $group_name;
if (! isset($group[$group_name])) {
+
$group[$group_name] = array();
$group[$group_name]['is' . $sep . 'group'] = true;
$group[$group_name]['tab' . $sep . 'count'] = 1;
$group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
+
} elseif (! isset($group[$group_name]['is' . $sep . 'group'])) {
+
$table = $group[$group_name];
$group[$group_name] = array();
$group[$group_name][$group_name] = $table;
@@ -799,12 +827,15 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0,
$group[$group_name]['is' . $sep . 'group'] = true;
$group[$group_name]['tab' . $sep . 'count'] = 1;
$group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
+
} else {
$group[$group_name]['tab' . $sep . 'count']++;
}
+
$group =& $group[$group_name];
$i++;
}
+
} else {
if (! isset($table_groups[$table_name])) {
$table_groups[$table_name] = array();
@@ -831,6 +862,7 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0,
return $table_groups;
}
+
/* ----------------------- Set of misc functions ----------------------- */
@@ -855,6 +887,7 @@ function PMA_getTableList($db, $tables = null, $limit_offset = 0,
*/
function PMA_backquote($a_name, $do_it = true)
{
+
if (is_array($a_name)) {
foreach ($a_name as &$data) {
$data = PMA_backquote($data, $do_it);
@@ -876,8 +909,10 @@ function PMA_backquote($a_name, $do_it = true)
} else {
return $a_name;
}
+
} // end of the 'PMA_backquote()' function
+
/**
* Defines the ';
+ . htmlspecialchars(
+ preg_replace('/^.*\salt="([^"]*)".*$/si', '\1', $message)
+ )
+ . '';
}
// Suhosin: Check that each query parameter is not above maximum
@@ -1881,12 +1931,15 @@ function PMA_linkOrButton($url, $message, $tag_params = array(),
}
}
- if ($url_length <= $GLOBALS['cfg']['LinkLengthLimit'] && $in_suhosin_limits) {
+ if (($url_length <= $GLOBALS['cfg']['LinkLengthLimit']) && $in_suhosin_limits) {
+
// no whitespace within an else Safari will make it part of the link
$ret = "\n" . ''
. $message . $displayed_message . '' . "\n";
+
} else {
+
// no spaces (linebreaks) at all
// or after the hidden fields
// IE will display them all
@@ -1918,6 +1971,7 @@ function PMA_linkOrButton($url, $message, $tag_params = array(),
$subname_close = ']';
$submit_link = '#usesubform[' . $GLOBALS['subform_counter'] . ']=1';
}
+
foreach ($query_parts as $query_pair) {
list($eachvar, $eachval) = explode('=', $query_pair);
$ret .= ''
- . $message . ' ' . $displayed_message . '' . "\n";
+ . implode(' ', $tag_params_strings) . '>'
+ . $message . ' ' . $displayed_message . '' . "\n";
if ($new_form) {
$ret .= '';
@@ -1955,13 +2009,16 @@ function PMA_splitURLQuery($url)
$url = str_replace(htmlentities('&'), $separator, $url);
$url = str_replace('&', $separator, $url);
}
+
$url = str_replace(htmlentities($separator), $separator, $url);
// end decode
$url_parts = parse_url($url);
+
return explode($separator, $url_parts['query']);
}
+
/**
* Returns a given timespan value in a readable format.
*
@@ -1975,20 +2032,24 @@ function PMA_timespanFormat($seconds)
if ($days > 0) {
$seconds -= $days * 86400;
}
+
$hours = floor($seconds / 3600);
if ($days > 0 || $hours > 0) {
$seconds -= $hours * 3600;
}
+
$minutes = floor($seconds / 60);
if ($days > 0 || $hours > 0 || $minutes > 0) {
$seconds -= $minutes * 60;
}
+
return sprintf(
__('%s days, %s hours, %s minutes and %s seconds'),
(string)$days, (string)$hours, (string)$minutes, (string)$seconds
);
}
+
/**
* Takes a string and outputs each character on a line for itself. Used
* mainly for horizontalflipped display mode.
@@ -2036,6 +2097,7 @@ function PMA_flipstring($string, $Separator = "
';
@@ -1323,6 +1360,7 @@ function PMA_getMessage(
} // end of the 'PMA_getMessage()' function
+
/**
* Verifies if current MySQL server supports profiling
*
@@ -1337,7 +1375,7 @@ function PMA_profilingSupported()
// (avoid a trip to the server for MySQL before 5.0.37)
// and do not set a constant as we might be switching servers
if (defined('PMA_MYSQL_INT_VERSION')
- && PMA_MYSQL_INT_VERSION >= 50037
+ && (PMA_MYSQL_INT_VERSION >= 50037)
&& PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'")
) {
PMA_cacheSet('profiling_supported', true, true);
@@ -1349,6 +1387,7 @@ function PMA_profilingSupported()
return PMA_cacheGet('profiling_supported', true);
}
+
/**
* Returns HTML for the form with the Profiling checkbox
*
@@ -1367,9 +1406,11 @@ function PMA_getProfilingForm($sql_query)
$retval .= PMA_generate_common_hidden_inputs(
$GLOBALS['db'], $GLOBALS['table']
);
+
$retval .= '' . "\n";
- $retval .= '' . "\n";
+ . htmlspecialchars($sql_query) . '" />' . "\n"
+ . '' . "\n";
+
$retval .= PMA_getCheckbox(
'profiling', __('Profiling'), isset($_SESSION['profiling']), true
);
@@ -1379,6 +1420,7 @@ function PMA_getProfilingForm($sql_query)
return $retval;
}
+
/**
* Formats $value to byte view
*
@@ -1411,14 +1453,14 @@ function PMA_formatByteDown($value, $limes = 6, $comma = 0)
__('PiB'),
/* l10n: shortcuts for Exabyte */
__('EiB')
- );
+ );
$dh = PMA_pow(10, $comma);
$li = PMA_pow(10, $limes);
$unit = $byteUnits[0];
for ($d = 6, $ex = 15; $d >= 1; $d--, $ex-=3) {
- if (isset($byteUnits[$d]) && $value >= $li * PMA_pow(10, $ex)) {
+ if (isset($byteUnits[$d]) && ($value >= $li * PMA_pow(10, $ex))) {
// use 1024.0 to avoid integer overflow on 64-bit machines
$value = round($value / (PMA_pow(1024, $d) / $dh)) /$dh;
$unit = $byteUnits[$d];
@@ -1439,6 +1481,7 @@ function PMA_formatByteDown($value, $limes = 6, $comma = 0)
return array(trim($return_value), $unit);
} // end of the 'PMA_formatByteDown' function
+
/**
* Changes thousands and decimal separators to locale specific values.
*
@@ -1455,11 +1498,12 @@ function PMA_localizeNumber($value)
__(','),
/* l10n: Decimal separator */
__('.'),
- ),
+ ),
$value
);
}
+
/**
* Formats $value to the given length and appends SI prefixes
* with a $length of 0 no truncation occurs, number is only formated
@@ -1490,6 +1534,7 @@ function PMA_formatNumber(
$value, $digits_left = 3, $digits_right = 0,
$only_down = false, $noTrailingZero = true
) {
+
if ($value == 0) {
return '0';
}
@@ -1498,7 +1543,7 @@ function PMA_formatNumber(
//number_format is not multibyte safe, str_replace is safe
if ($digits_left === 0) {
$value = number_format($value, $digits_right);
- if ($originalValue != 0 && floatval($value) == 0) {
+ if (($originalValue != 0) && (floatval($value) == 0)) {
$value = ' <' . (1 / PMA_pow(10, $digits_right));
}
@@ -1575,6 +1620,7 @@ function PMA_formatNumber(
return $sign . $value . ' ' . $unit;
} // end of the 'PMA_formatNumber' function
+
/**
* Returns the number of bytes when a formatted size is given
*
@@ -1596,6 +1642,7 @@ function PMA_extractValueFromFormattedSize($formatted_size)
return $return_value;
}// end of the 'PMA_extractValueFromFormattedSize' function
+
/**
* Writes localised date
*
@@ -1709,7 +1756,7 @@ function PMA_generateHtmlTab($tab, $url_params = array())
) {
$tab['class'] = 'active';
} elseif (is_null($tab['active']) && empty($GLOBALS['active_page'])
- && basename($GLOBALS['PMA_PHP_SELF']) == $tab['link']
+ && (basename($GLOBALS['PMA_PHP_SELF']) == $tab['link'])
&& empty($tab['warning'])) {
$tab['class'] = 'active';
}
@@ -1777,6 +1824,7 @@ function PMA_generateHtmlTab($tab, $url_params = array())
return $out;
} // end of the 'PMA_generateHtmlTab()' function
+
/**
* returns html-code for a tab navigation
*
@@ -1820,9 +1868,11 @@ function PMA_generateHtmlTabs($tabs, $url_params, $menu_id = 'topmenu')
*
* @return string the results to be echoed or saved in an array
*/
-function PMA_linkOrButton($url, $message, $tag_params = array(),
+function PMA_linkOrButton(
+ $url, $message, $tag_params = array(),
$new_form = true, $strip_img = false, $target = ''
) {
+
$url_length = strlen($url);
// with this we should be able to catch case of image upload
// into a (MEDIUM) BLOB; not worth generating even a form for these
@@ -1856,14 +1906,14 @@ function PMA_linkOrButton($url, $message, $tag_params = array(),
$displayed_message = '';
// Add text if not already added
if (stristr($message, ''
- . htmlspecialchars(
- preg_replace('/^.*\salt="([^"]*)".*$/si', '\1', $message)
- )
- . '
\n")
return $format_string;
}
+
/**
* Function added to avoid path disclosures.
* Called by each script that needs parameters, it displays
@@ -2067,7 +2129,7 @@ function PMA_checkParameters($params, $request = true)
$error_message = '';
foreach ($params as $param) {
- if ($request && $param != 'db' && $param != 'table') {
+ if ($request && ($param != 'db') && ($param != 'table')) {
$checked_special = true;
}
@@ -2085,6 +2147,7 @@ function PMA_checkParameters($params, $request = true)
}
} // end function
+
/**
* Function to generate unique condition for specified row.
*
@@ -2101,6 +2164,7 @@ function PMA_checkParameters($params, $request = true)
function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row,
$force_unique = false
) {
+
$primary_key = '';
$unique_key = '';
$nonprimary_condition = '';
@@ -2111,6 +2175,7 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row,
$condition_array = array();
for ($i = 0; $i < $fields_cnt; ++$i) {
+
$condition = '';
$con_key = '';
$con_val = '';
@@ -2149,7 +2214,7 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row,
// (The isView() verification should not be costly in most cases
// because there is some caching in the function).
if (isset($meta->orgtable)
- && $meta->table != $meta->orgtable
+ && ($meta->table != $meta->orgtable)
&& ! PMA_Table::isView($GLOBALS['db'], $meta->table)
) {
$meta->table = $meta->orgtable;
@@ -2172,17 +2237,22 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row,
if (! isset($row[$i]) || is_null($row[$i])) {
$con_val = 'IS NULL';
} else {
+
// timestamp is numeric on some MySQL 4.1
// for real we use CONCAT above and it should compare to string
if ($meta->numeric
- && $meta->type != 'timestamp'
- && $meta->type != 'real'
+ && ($meta->type != 'timestamp')
+ && ($meta->type != 'real')
) {
+
$con_val = '= ' . $row[$i];
- } elseif (($meta->type == 'blob' || $meta->type == 'string')
+
+ } elseif ((($meta->type == 'blob') || ($meta->type == 'string'))
// hexify only if this is a true not empty BLOB or a BINARY
&& stristr($field_flags, 'BINARY')
- && ! empty($row[$i])) {
+ && ! empty($row[$i])
+ ) {
+
// do not waste memory building a too big condition
if (strlen($row[$i]) < 1000) {
// use a CAST if possible, to avoid problems
@@ -2192,31 +2262,40 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row,
// this blob won't be part of the final condition
$con_val = null;
}
+
} elseif (in_array($meta->type, PMA_getGISDatatypes())
&& ! empty($row[$i])
) {
+
// do not build a too big condition
if (strlen($row[$i]) < 5000) {
$condition .= '=0x' . bin2hex($row[$i]) . ' AND';
} else {
$condition = '';
}
+
} elseif ($meta->type == 'bit') {
+
$con_val = "= b'"
. PMA_printableBitValue($row[$i], $meta->length) . "'";
+
} else {
$con_val = '= \'' . PMA_sqlAddSlashes($row[$i], false, true) . '\'';
- }
+ }
}
+
if ($con_val != null) {
+
$condition .= $con_val . ' AND';
- if ($meta->primary_key > 0) {
+
+ if ($meta->primary_key > 0) {
$primary_key .= $condition;
- $primary_key_array[$con_key] = $con_val;
- } elseif ($meta->unique_key > 0) {
+ $primary_key_array[$con_key] = $con_val;
+ } elseif ($meta->unique_key > 0) {
$unique_key .= $condition;
- $unique_key_array[$con_key] = $con_val;
+ $unique_key_array[$con_key] = $con_val;
}
+
$nonprimary_condition .= $condition;
$nonprimary_condition_array[$con_key] = $con_val;
}
@@ -2226,22 +2305,26 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row,
// prefer primary or unique keys for condition,
// but use conjunction of all values if no primary key
$clause_is_unique = true;
- if ($primary_key) {
+
+ if ($primary_key) {
$preferred_condition = $primary_key;
$condition_array = $primary_key_array;
- } elseif ($unique_key) {
+
+ } elseif ($unique_key) {
$preferred_condition = $unique_key;
$condition_array = $unique_key_array;
- } elseif (! $force_unique) {
+
+ } elseif (! $force_unique) {
$preferred_condition = $nonprimary_condition;
$condition_array = $nonprimary_condition_array;
- $clause_is_unique = false;
+ $clause_is_unique = false;
}
$where_clause = trim(preg_replace('|\s?AND$|', '', $preferred_condition));
return(array($where_clause, $clause_is_unique, $condition_array));
} // end function
+
/**
* Generate a button or image tag
*
@@ -2256,13 +2339,15 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row,
*
* @access public
*/
-function PMA_getButtonOrImage($button_name, $button_class, $image_name, $text,
- $image, $value = ''
+function PMA_getButtonOrImage(
+ $button_name, $button_class, $image_name, $text, $image, $value = ''
) {
+
if ($value == '') {
$value = $text;
}
- if (false === $GLOBALS['cfg']['PropertiesIconic']) {
+
+ if ($GLOBALS['cfg']['PropertiesIconic'] === false) {
return ' ' . "\n";
@@ -2287,6 +2372,7 @@ function PMA_getButtonOrImage($button_name, $button_class, $image_name, $text,
}
} // end function
+
/**
* Generate a pagination selector for browsing resultsets
*
@@ -2307,10 +2393,11 @@ function PMA_getButtonOrImage($button_name, $button_class, $image_name, $text,
*
* @access public
*/
-function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1,
- $showAll = 200, $sliceStart = 5, $sliceEnd = 5, $percent = 20,
- $range = 10, $prompt = ''
+function PMA_pageselector(
+ $rows, $pageNow = 1, $nbTotalPage = 1, $showAll = 200, $sliceStart = 5,
+ $sliceEnd = 5, $percent = 20, $range = 10, $prompt = ''
) {
+
$increment = floor($nbTotalPage / $percent);
$pageNowMinusRange = ($pageNow - $range);
$pageNowPlusRange = ($pageNow + $range);
@@ -2319,10 +2406,13 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1,
if ($GLOBALS['cfg']['AjaxEnable']) {
$gotopage .= ' class="ajax"';
}
+
$gotopage .= ' name="pos" >' . "\n";
if ($nbTotalPage < $showAll) {
$pages = range(1, $nbTotalPage);
+
} else {
+
$pages = array();
// Always show first X pages
@@ -2344,6 +2434,7 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1,
$i = $sliceStart;
$x = $nbTotalPage - $sliceEnd;
$met_boundary = false;
+
while ($i <= $x) {
if ($i >= $pageNowMinusRange && $i <= $pageNowPlusRange) {
// If our pageselector comes near the current page, we use 1
@@ -2439,8 +2530,9 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1,
*
* @todo use $pos from $_url_params
*/
-function PMA_getListNavigator($count, $pos, $_url_params, $script, $frame, $max_count)
-{
+function PMA_getListNavigator(
+ $count, $pos, $_url_params, $script, $frame, $max_count
+) {
$list_navigator_html = '';
@@ -2532,6 +2624,7 @@ function PMA_getListNavigator($count, $pos, $_url_params, $script, $frame, $max_
}
+
/**
* replaces %u in given path with current user name
*
@@ -2555,6 +2648,7 @@ function PMA_userDir($dir)
return str_replace('%u', $GLOBALS['cfg']['Server']['user'], $dir);
}
+
/**
* returns html code for db link to default db page
*
@@ -2582,6 +2676,7 @@ function PMA_getDbLink($database = null)
. '">' . htmlspecialchars($database) . '';
}
+
/**
* Prepare a lightbulb hint explaining a known external bug
* that affects a functionality
@@ -2596,7 +2691,7 @@ function PMA_getDbLink($database = null)
function PMA_getExternalBug($functionality, $component, $minimum_version, $bugref)
{
$ext_but_html = '';
- if ($component == 'mysql' && PMA_MYSQL_INT_VERSION < $minimum_version) {
+ if (($component == 'mysql') && (PMA_MYSQL_INT_VERSION < $minimum_version)) {
$ext_but_html .= PMA_showHint(
sprintf(
__('The %s functionality is affected by a known bug, see %s'),
@@ -2608,6 +2703,7 @@ function PMA_getExternalBug($functionality, $component, $minimum_version, $bugre
return $ext_but_html;
}
+
/**
* Returns a HTML checkbox
*
@@ -2620,14 +2716,13 @@ function PMA_getExternalBug($functionality, $component, $minimum_version, $bugre
*/
function PMA_getCheckbox($html_field_name, $label, $checked, $onclick)
{
-
return '';
-
}
+
/**
* Generates a set of radio HTML fields
*
@@ -2647,25 +2742,31 @@ function PMA_getRadioFields($html_field_name, $choices, $checked_choice = '',
$radio_html = '';
foreach ($choices as $choice_value => $choice_label) {
+
if (! empty($class)) {
$radio_html .= '