Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-01-05 12:57:18 +01:00
commit 131a93c4b2
17 changed files with 376 additions and 396 deletions

View File

@ -607,7 +607,7 @@ if (file_exists('libraries/language_stats.inc.php')) {
* prints list item for main page
*
* @param string $name displayed text
* @param string $id id, used for css styles
* @param string $listId id, used for css styles
* @param string $url make item as link with $url as target
* @param string $mysql_help_page display a link to MySQL's manual
* @param string $target special target for $url
@ -618,11 +618,11 @@ if (file_exists('libraries/language_stats.inc.php')) {
*
* @return void
*/
function PMA_printListItem($name, $id = null, $url = null,
function PMA_printListItem($name, $listId = null, $url = null,
$mysql_help_page = null, $target = null, $a_id = null, $class = null,
$a_class = null
) {
echo '<li id="' . $id . '"';
echo '<li id="' . $listId . '"';
if (null !== $class) {
echo ' class="' . $class . '"';
}

View File

@ -794,9 +794,6 @@ class PMA_DatabaseInterface
$limit_count = $GLOBALS['cfg']['MaxDbList'];
}
// initialize to avoid errors when there are no databases
$databases = array();
$apply_limit_and_order_manual = true;
/**
@ -1238,9 +1235,9 @@ class PMA_DatabaseInterface
AND i.table_name = '" . PMA_Util::sqlAddSlashes($table) . "'
AND i.is_unique
AND NOT i.is_nullable";
$fs = $this->fetchResult($sql, 'index_name', null, $link);
$fs = $fs ? array_shift($fs) : array();
foreach ($fs as $f) {
$result = $this->fetchResult($sql, 'index_name', null, $link);
$result = $result ? array_shift($result) : array();
foreach ($result as $f) {
$fields[$f]['Key'] = 'PRI';
}
}
@ -1506,11 +1503,10 @@ class PMA_DatabaseInterface
5
);
}
$set_collation_con_query = "SET collation_connection = '"
. PMA_Util::sqlAddSlashes($GLOBALS['collation_connection'])
. "';";
$this->query(
$set_collation_con_query,
"SET collation_connection = '"
. PMA_Util::sqlAddSlashes($GLOBALS['collation_connection'])
. "';",
$link,
self::QUERY_STORE
);
@ -2052,18 +2048,18 @@ class PMA_DatabaseInterface
* Checks whether given schema is a system schema: information_schema
* (MySQL and Drizzle) or data_dictionary (Drizzle)
*
* @param string $schema_name Name of schema (database) to test
* @param bool $test_for_mysql_schema Whether 'mysql' schema should
* be treated the same as IS and DD
* @param string $schema_name Name of schema (database) to test
* @param bool $testForMysqlSchema Whether 'mysql' schema should
* be treated the same as IS and DD
*
* @return bool
*/
public function isSystemSchema($schema_name, $test_for_mysql_schema = false)
public function isSystemSchema($schema_name, $testForMysqlSchema = false)
{
return strtolower($schema_name) == 'information_schema'
|| (!PMA_DRIZZLE && strtolower($schema_name) == 'performance_schema')
|| (PMA_DRIZZLE && strtolower($schema_name) == 'data_dictionary')
|| ($test_for_mysql_schema && !PMA_DRIZZLE && $schema_name == 'mysql');
|| ($testForMysqlSchema && !PMA_DRIZZLE && $schema_name == 'mysql');
}
/**

View File

@ -105,8 +105,8 @@ class PMA_PDF extends TCPDF
function _putpages()
{
if (count($this->Alias) > 0) {
$nb = count($this->pages);
for ($n = 1;$n <= $nb;$n++) {
$nbPages = count($this->pages);
for ($n = 1; $n <= $nbPages; $n++) {
$this->pages[$n] = strtr($this->pages[$n], $this->Alias);
}
}

View File

@ -549,7 +549,6 @@ EOT;
$backquoted_name = PMA_Util::backquote($names);
$where = '';
if ($unaryFlag) {
$criteriaValues = '';
$where = $backquoted_name . ' ' . $func_type;
} elseif (strncasecmp($types, 'enum', 4) == 0 && ! empty($criteriaValues)) {
@ -579,54 +578,11 @@ EOT;
$criteriaValues = '^' . $criteriaValues . '$';
}
if ('IN (...)' == $func_type
|| 'NOT IN (...)' == $func_type
|| 'BETWEEN' == $func_type
|| 'NOT BETWEEN' == $func_type
if ('IN (...)' != $func_type
&& 'NOT IN (...)' != $func_type
&& 'BETWEEN' != $func_type
&& 'NOT BETWEEN' != $func_type
) {
$func_type = str_replace(' (...)', '', $func_type);
//Don't explode if this is already an array
//(Case for (NOT) IN/BETWEEN.)
if (is_array($criteriaValues)) {
$values = $criteriaValues;
} else {
$values = explode(',', $criteriaValues);
}
// quote values one by one
$emptyKey = false;
foreach ($values as $key => &$value) {
if ('' === $value) {
$emptyKey = $key;
$value = 'NULL';
continue;
}
$value = $quot . PMA_Util::sqlAddSlashes(trim($value))
. $quot;
}
if ('BETWEEN' == $func_type || 'NOT BETWEEN' == $func_type) {
$where = $backquoted_name . ' ' . $func_type . ' '
. (isset($values[0]) ? $values[0] : '')
. ' AND ' . (isset($values[1]) ? $values[1] : '');
} else { //[NOT] IN
if (false !== $emptyKey) {
unset($values[$emptyKey]);
}
$wheres = array();
if (!empty($values)) {
$wheres[] = $backquoted_name . ' ' . $func_type
. ' (' . implode(',', $values) . ')';
}
if (false !== $emptyKey) {
$wheres[] = $backquoted_name . ' IS NULL';
}
$where = implode(' OR ', $wheres);
if (1 < count($wheres)) {
$where = '(' . $where . ')';
}
}
} else {
if ($func_type == 'LIKE %...%' || $func_type == 'LIKE') {
$where = $backquoted_name . ' ' . $func_type . ' ' . $quot
. PMA_Util::sqlAddSlashes($criteriaValues, true) . $quot;
@ -634,6 +590,49 @@ EOT;
$where = $backquoted_name . ' ' . $func_type . ' ' . $quot
. PMA_Util::sqlAddSlashes($criteriaValues) . $quot;
}
return $where;
}
$func_type = str_replace(' (...)', '', $func_type);
//Don't explode if this is already an array
//(Case for (NOT) IN/BETWEEN.)
if (is_array($criteriaValues)) {
$values = $criteriaValues;
} else {
$values = explode(',', $criteriaValues);
}
// quote values one by one
$emptyKey = false;
foreach ($values as $key => &$value) {
if ('' === $value) {
$emptyKey = $key;
$value = 'NULL';
continue;
}
$value = $quot . PMA_Util::sqlAddSlashes(trim($value))
. $quot;
}
if ('BETWEEN' == $func_type || 'NOT BETWEEN' == $func_type) {
$where = $backquoted_name . ' ' . $func_type . ' '
. (isset($values[0]) ? $values[0] : '')
. ' AND ' . (isset($values[1]) ? $values[1] : '');
} else { //[NOT] IN
if (false !== $emptyKey) {
unset($values[$emptyKey]);
}
$wheres = array();
if (!empty($values)) {
$wheres[] = $backquoted_name . ' ' . $func_type
. ' (' . implode(',', $values) . ')';
}
if (false !== $emptyKey) {
$wheres[] = $backquoted_name . ' IS NULL';
}
$where = implode(' OR ', $wheres);
if (1 < count($wheres)) {
$where = '(' . $where . ')';
}
}
} // end if
@ -1384,7 +1383,7 @@ EOT;
$sql_query .= " GROUP BY " . PMA_Util::backquote($column)
. " ORDER BY " . PMA_Util::backquote($column) . " ASC";
$rs = $GLOBALS['dbi']->query(
$resultSet = $GLOBALS['dbi']->query(
$sql_query, null, PMA_DatabaseInterface::QUERY_STORE
);
@ -1411,7 +1410,7 @@ EOT;
$htmlOutput .= '<tbody>';
$odd = true;
while ($row = $GLOBALS['dbi']->fetchRow($rs)) {
while ($row = $GLOBALS['dbi']->fetchRow($resultSet)) {
$val = $row[0];
$replaced = $row[1];
$count = $row[2];

View File

@ -332,10 +332,10 @@ function PMA_getSqlQueryAndCreateDbBeforeCopy()
{
// lower_case_table_names=1 `DB` becomes `db`
if (! PMA_DRIZZLE) {
$lower_case_table_names = $GLOBALS['dbi']->fetchValue(
$lowerCaseTableNames = $GLOBALS['dbi']->fetchValue(
'SHOW VARIABLES LIKE "lower_case_table_names"', 0, 1
);
if ($lower_case_table_names === '1') {
if ($lowerCaseTableNames === '1') {
$_REQUEST['newname'] = $GLOBALS['PMA_String']->strtolower(
$_REQUEST['newname']
);
@ -969,15 +969,15 @@ function PMA_getPossibleRowFormat()
)
);
$innodb_engine_plugin = PMA_StorageEngine::getEngine('innodb');
$innodb_plugin_version = $innodb_engine_plugin->getInnodbPluginVersion();
if (!empty($innodb_plugin_version)) {
$innodb_file_format = $innodb_engine_plugin->getInnodbFileFormat();
$innodbEnginePlugin = PMA_StorageEngine::getEngine('innodb');
$innodbPluginVersion = $innodbEnginePlugin->getInnodbPluginVersion();
if (!empty($innodbPluginVersion)) {
$innodb_file_format = $innodbEnginePlugin->getInnodbFileFormat();
} else {
$innodb_file_format = '';
}
if ('Barracuda' == $innodb_file_format
&& $innodb_engine_plugin->supportsFilePerTable()
&& $innodbEnginePlugin->supportsFilePerTable()
) {
$possible_row_formats['INNODB']['DYNAMIC'] = 'DYNAMIC';
$possible_row_formats['INNODB']['COMPRESSED'] = 'COMPRESSED';
@ -1233,13 +1233,13 @@ function PMA_getMaintainActionlink($action, $params, $url_params, $link)
* Get HTML for Delete data or table (truncate table, drop table)
*
* @param array $truncate_table_url_params url parameter array for truncate table
* @param array $drop_table_url_params url parameter array for drop table
* @param array $dropTableUrlParams url parameter array for drop table
*
* @return string $html_output
*/
function PMA_getHtmlForDeleteDataOrTable(
$truncate_table_url_params,
$drop_table_url_params
$dropTableUrlParams
) {
$html_output = '<div class="operations_half_width">'
. '<fieldset class="caution">'
@ -1255,9 +1255,9 @@ function PMA_getHtmlForDeleteDataOrTable(
'truncate_tbl_anchor'
);
}
if (!empty ($drop_table_url_params)) {
if (!empty ($dropTableUrlParams)) {
$html_output .= PMA_getDeleteDataOrTablelink(
$drop_table_url_params,
$dropTableUrlParams,
'DROP_TABLE',
__('Delete the table (DROP)'),
'drop_tbl_anchor'
@ -1274,15 +1274,15 @@ function PMA_getHtmlForDeleteDataOrTable(
* @param array $url_params url parameter array for delete data or table
* @param string $syntax TRUNCATE_TABLE or DROP_TABLE or DROP_DATABASE
* @param string $link link to be shown
* @param string $id id of the link
* @param string $htmlId id of the link
*
* @return String html output
*/
function PMA_getDeleteDataOrTablelink($url_params, $syntax, $link, $id)
function PMA_getDeleteDataOrTablelink($url_params, $syntax, $link, $htmlId)
{
return '<li><a '
. 'href="sql.php' . PMA_URL_getCommon($url_params) . '"'
. ' id="' . $id . '" class="ajax">'
. ' id="' . $htmlId . '" class="ajax">'
. $link . '</a>'
. PMA_Util::showMySQLDocu($syntax)
. '</li>';
@ -1439,25 +1439,25 @@ function PMA_getQueryAndResultForReorderingTable()
/**
* Get table alters array
*
* @param boolean $is_myisam_or_aria whether MYISAM | ARIA or not
* @param boolean $is_isam whether ISAM or not
* @param string $pack_keys pack keys
* @param string $checksum value of checksum
* @param boolean $is_aria whether ARIA or not
* @param string $page_checksum value of page checksum
* @param string $delay_key_write delay key write
* @param boolean $is_innodb whether INNODB or not
* @param boolean $is_pbxt whether PBXT or not
* @param string $row_format row format
* @param string $new_tbl_storage_engine table storage engine
* @param string $transactional value of transactional
* @param string $tbl_collation collation of the table
* @param boolean $is_myisam_or_aria whether MYISAM | ARIA or not
* @param boolean $is_isam whether ISAM or not
* @param string $pack_keys pack keys
* @param string $checksum value of checksum
* @param boolean $is_aria whether ARIA or not
* @param string $page_checksum value of page checksum
* @param string $delay_key_write delay key write
* @param boolean $is_innodb whether INNODB or not
* @param boolean $is_pbxt whether PBXT or not
* @param string $row_format row format
* @param string $newTblStorageEngine table storage engine
* @param string $transactional value of transactional
* @param string $tbl_collation collation of the table
*
* @return array $table_alters
*/
function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys,
$checksum, $is_aria, $page_checksum, $delay_key_write, $is_innodb,
$is_pbxt, $row_format, $new_tbl_storage_engine, $transactional, $tbl_collation
$is_pbxt, $row_format, $newTblStorageEngine, $transactional, $tbl_collation
) {
global $auto_increment;
@ -1469,10 +1469,10 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys,
$table_alters[] = 'COMMENT = \''
. PMA_Util::sqlAddSlashes($_REQUEST['comment']) . '\'';
}
if (! empty($new_tbl_storage_engine)
&& strtolower($new_tbl_storage_engine) !== strtolower($GLOBALS['tbl_storage_engine'])
if (! empty($newTblStorageEngine)
&& strtolower($newTblStorageEngine) !== strtolower($GLOBALS['tbl_storage_engine'])
) {
$table_alters[] = 'ENGINE = ' . $new_tbl_storage_engine;
$table_alters[] = 'ENGINE = ' . $newTblStorageEngine;
}
if (! empty($_REQUEST['tbl_collation'])
&& $_REQUEST['tbl_collation'] !== $tbl_collation
@ -1550,21 +1550,19 @@ function PMA_getTableAltersArray($is_myisam_or_aria, $is_isam, $pack_keys,
*/
function PMA_setGlobalVariablesForEngine($tbl_storage_engine)
{
$is_myisam_or_aria = $is_isam = $is_innodb = $is_berkeleydb
= $is_aria = $is_pbxt = false;
$upper_tbl_storage_engine = strtoupper($tbl_storage_engine);
$upperTblStorEngine = strtoupper($tbl_storage_engine);
//Options that apply to MYISAM usually apply to ARIA
$is_myisam_or_aria = ($upper_tbl_storage_engine == 'MYISAM'
|| $upper_tbl_storage_engine == 'ARIA'
|| $upper_tbl_storage_engine == 'MARIA'
$is_myisam_or_aria = ($upperTblStorEngine == 'MYISAM'
|| $upperTblStorEngine == 'ARIA'
|| $upperTblStorEngine == 'MARIA'
);
$is_aria = ($upper_tbl_storage_engine == 'ARIA');
$is_aria = ($upperTblStorEngine == 'ARIA');
$is_isam = ($upper_tbl_storage_engine == 'ISAM');
$is_innodb = ($upper_tbl_storage_engine == 'INNODB');
$is_berkeleydb = ($upper_tbl_storage_engine == 'BERKELEYDB');
$is_pbxt = ($upper_tbl_storage_engine == 'PBXT');
$is_isam = ($upperTblStorEngine == 'ISAM');
$is_innodb = ($upperTblStorEngine == 'INNODB');
$is_berkeleydb = ($upperTblStorEngine == 'BERKELEYDB');
$is_pbxt = ($upperTblStorEngine == 'PBXT');
return array(
$is_myisam_or_aria, $is_innodb, $is_isam,

View File

@ -343,25 +343,25 @@ function PMA_getDiagMessageForFeature($feature_name,
/**
* prints out one diagnostic message for a configuration parameter
*
* @param string $parameter config parameter name to display
* @param boolean $relation_parameter_set whether this parameter is set
* @param array $messages utility messages
* @param string $doc_anchor anchor in documentation
* @param string $parameter config parameter name to display
* @param boolean $relationParameterSet whether this parameter is set
* @param array $messages utility messages
* @param string $docAnchor anchor in documentation
*
* @return string
*/
function PMA_getDiagMessageForParameter($parameter,
$relation_parameter_set, $messages, $doc_anchor
$relationParameterSet, $messages, $docAnchor
) {
$retval = '<tr><th class="left">';
$retval .= '$cfg[\'Servers\'][$i][\'' . $parameter . '\'] ... ';
$retval .= '</th><td class="right">';
if ($relation_parameter_set) {
if ($relationParameterSet) {
$retval .= $messages['ok'];
} else {
$retval .= sprintf(
$messages['error'],
PMA_Util::getDocuLink('config', 'cfg_Servers_' . $doc_anchor)
PMA_Util::getDocuLink('config', 'cfg_Servers_' . $docAnchor)
);
}
$retval .= '</td></tr>' . "\n";
@ -574,10 +574,10 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both')
if (($source == 'both' || $source == 'foreign') && strlen($table)) {
$show_create_table_query = 'SHOW CREATE TABLE '
$showCreateTableQuery = 'SHOW CREATE TABLE '
. PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table);
$show_create_table = $GLOBALS['dbi']->fetchValue(
$show_create_table_query, 0, 1
$showCreateTableQuery, 0, 1
);
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
@ -625,12 +625,12 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both')
/**
* Emulating relations for some information_schema and data_dictionary tables
*/
$is_information_schema = strtolower($db) == 'information_schema';
$isInformationSchema = strtolower($db) == 'information_schema';
$is_data_dictionary = PMA_DRIZZLE && strtolower($db) == 'data_dictionary';
if (($is_information_schema || $is_data_dictionary)
if (($isInformationSchema || $is_data_dictionary)
&& ($source == 'internal' || $source == 'both')
) {
if ($is_information_schema) {
if ($isInformationSchema) {
$relations_key = 'information_schema_relations';
include_once './libraries/information_schema_relations.lib.php';
} else {

View File

@ -89,9 +89,9 @@ function PMA_RTE_getList($type, $items)
}
$retval .= " </tr>\n";
$retval .= " <!-- TABLE DATA -->\n";
$ct = 0;
$count = 0;
foreach ($items as $item) {
$rowclass = ($ct % 2 == 0) ? 'odd' : 'even';
$rowclass = ($count % 2 == 0) ? 'odd' : 'even';
if ($GLOBALS['is_ajax_request'] && empty($_REQUEST['ajax_page_request'])) {
$rowclass .= ' ajaxInsert hide';
}
@ -109,7 +109,7 @@ function PMA_RTE_getList($type, $items)
default:
break;
}
$ct++;
$count++;
}
$retval .= " </table>\n";
$retval .= "</fieldset>\n";

View File

@ -910,9 +910,9 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine)
unset($routine['item_param_opts_text'][$routine['item_num_params']-1]);
$routine['item_num_params']--;
}
$disable_remove_parameter = '';
$disableRemoveParam = '';
if (! $routine['item_num_params']) {
$disable_remove_parameter = " color: gray;' disabled='disabled";
$disableRemoveParam = " color: gray;' disabled='disabled";
}
$original_routine = '';
if ($mode == 'edit') {
@ -988,46 +988,45 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine)
for ($i=0; $i<$routine['item_num_params']; $i++) { // each parameter
$retval .= PMA_RTN_getParameterRow($routine, $i, $isprocedure_class);
}
$retval .= " </table>\n";
$retval .= " </td>\n";
$retval .= "</tr>\n";
$retval .= "<tr>\n";
$retval .= " <td>&nbsp;</td>\n";
$retval .= " <td>\n";
$retval .= " <input style='width: 49%;' type='button' \n";
$retval .= " name='routine_addparameter'\n";
$retval .= " value='" . __('Add parameter') . "' />\n";
$retval .= " <input style='width: 49%;$disable_remove_parameter'\n";
$retval .= " type='submit' \n";
$retval .= " name='routine_removeparameter'\n";
$retval .= " value='" . __('Remove last parameter') . "' />\n";
$retval .= " </td>\n";
$retval .= "</tr>\n";
$retval .= " </table>";
$retval .= " </td>";
$retval .= "</tr>";
$retval .= "<tr>";
$retval .= " <td>&nbsp;</td>";
$retval .= " <td>";
$retval .= " <input style='width: 49%;' type='button'";
$retval .= " name='routine_addparameter'";
$retval .= " value='" . __('Add parameter') . "' />";
$retval .= " <input style='width: 49%;".$disableRemoveParam."'";
$retval .= " type='submit' ";
$retval .= " name='routine_removeparameter'";
$retval .= " value='" . __('Remove last parameter') . "' />";
$retval .= " </td>";
$retval .= "</tr>";
// parameter handling end
$retval .= "<tr class='routine_return_row$isfunction_class'>\n";
$retval .= " <td>" . __('Return type') . "</td>\n";
$retval .= " <td><select name='item_returntype'>\n";
$retval .= PMA_Util::getSupportedDatatypes(true, $routine['item_returntype'])
. "\n";
$retval .= " </select></td>\n";
$retval .= "</tr>\n";
$retval .= "<tr class='routine_return_row$isfunction_class'>\n";
$retval .= " <td>" . __('Return length/values') . "</td>\n";
$retval .= " <td><input type='text' name='item_returnlength'\n";
$retval .= " value='{$routine['item_returnlength']}' /></td>\n";
$retval .= " <td class='hide no_len'>---</td>\n";
$retval .= "</tr>\n";
$retval .= "<tr class='routine_return_row$isfunction_class'>\n";
$retval .= " <td>" . __('Return options') . "</td>\n";
$retval .= " <td><div>\n";
$retval .= "<tr class='routine_return_row".$isfunction_class."'>";
$retval .= " <td>" . __('Return type') . "</td>";
$retval .= " <td><select name='item_returntype'>";
$retval .= PMA_Util::getSupportedDatatypes(true, $routine['item_returntype']);
$retval .= " </select></td>";
$retval .= "</tr>";
$retval .= "<tr class='routine_return_row".$isfunction_class."'>";
$retval .= " <td>" . __('Return length/values') . "</td>";
$retval .= " <td><input type='text' name='item_returnlength'";
$retval .= " value='".$routine['item_returnlength']."' /></td>";
$retval .= " <td class='hide no_len'>---</td>";
$retval .= "</tr>";
$retval .= "<tr class='routine_return_row".$isfunction_class."'>";
$retval .= " <td>" . __('Return options') . "</td>";
$retval .= " <td><div>";
$retval .= PMA_generateCharsetDropdownBox(
PMA_CSDROPDOWN_CHARSET,
"item_returnopts_text",
null,
$routine['item_returnopts_text']
);
$retval .= "\n </div>\n";
$retval .= " <div><select name='item_returnopts_num'>\n";
$retval .= " </div>";
$retval .= " <div><select name='item_returnopts_num'>";
$retval .= " <option value=''></option>";
foreach ($param_opts_num as $key => $value) {
$selected = "";
@ -1036,68 +1035,68 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine)
) {
$selected = " selected='selected'";
}
$retval .= "<option$selected>$value</option>";
$retval .= "<option".$selected.">".$value."</option>";
}
$retval .= "\n </select></div>\n";
$retval .= " <div class='hide no_opts'>---</div>\n";
$retval .= "</td>\n";
$retval .= "</tr>\n";
$retval .= "<tr>\n";
$retval .= " <td>" . __('Definition') . "</td>\n";
$retval .= " </select></div>";
$retval .= " <div class='hide no_opts'>---</div>";
$retval .= "</td>";
$retval .= "</tr>";
$retval .= "<tr>";
$retval .= " <td>" . __('Definition') . "</td>";
$retval .= " <td><textarea name='item_definition' rows='15' cols='40'>";
$retval .= $routine['item_definition'];
$retval .= "</textarea></td>\n";
$retval .= "</tr>\n";
$retval .= "<tr>\n";
$retval .= " <td>" . __('Is deterministic') . "</td>\n";
$retval .= "</textarea></td>";
$retval .= "</tr>";
$retval .= "<tr>";
$retval .= " <td>" . __('Is deterministic') . "</td>";
$retval .= " <td><input type='checkbox' name='item_isdeterministic'"
. $routine['item_isdeterministic'] . " /></td>\n";
$retval .= "</tr>\n";
$retval .= "<tr>\n";
$retval .= " <td>" . __('Definer') . "</td>\n";
$retval .= " <td><input type='text' name='item_definer'\n";
$retval .= " value='{$routine['item_definer']}' /></td>\n";
$retval .= "</tr>\n";
$retval .= "<tr>\n";
$retval .= " <td>" . __('Security type') . "</td>\n";
$retval .= " <td><select name='item_securitytype'>\n";
. $routine['item_isdeterministic'] . " /></td>";
$retval .= "</tr>";
$retval .= "<tr>";
$retval .= " <td>" . __('Definer') . "</td>";
$retval .= " <td><input type='text' name='item_definer'";
$retval .= " value='".$routine['item_definer']."' /></td>";
$retval .= "</tr>";
$retval .= "<tr>";
$retval .= " <td>" . __('Security type') . "</td>";
$retval .= " <td><select name='item_securitytype'>";
$retval .= " <option value='DEFINER'"
. $routine['item_securitytype_definer'] . ">DEFINER</option>\n";
. $routine['item_securitytype_definer'] . ">DEFINER</option>";
$retval .= " <option value='INVOKER'"
. $routine['item_securitytype_invoker'] . ">INVOKER</option>\n";
$retval .= " </select></td>\n";
$retval .= "</tr>\n";
$retval .= "<tr>\n";
$retval .= " <td>" . __('SQL data access') . "</td>\n";
$retval .= " <td><select name='item_sqldataaccess'>\n";
. $routine['item_securitytype_invoker'] . ">INVOKER</option>";
$retval .= " </select></td>";
$retval .= "</tr>";
$retval .= "<tr>";
$retval .= " <td>" . __('SQL data access') . "</td>";
$retval .= " <td><select name='item_sqldataaccess'>";
foreach ($param_sqldataaccess as $key => $value) {
$selected = "";
if ($routine['item_sqldataaccess'] == $value) {
$selected = " selected='selected'";
}
$retval .= " <option$selected>$value</option>\n";
$retval .= " <option".$selected.">".$value."</option>";
}
$retval .= " </select></td>\n";
$retval .= "</tr>\n";
$retval .= "<tr>\n";
$retval .= " <td>" . __('Comment') . "</td>\n";
$retval .= " <td><input type='text' name='item_comment' maxlength='64'\n";
$retval .= " value='{$routine['item_comment']}' /></td>\n";
$retval .= "</tr>\n";
$retval .= "</table>\n";
$retval .= "</fieldset>\n";
$retval .= " </select></td>";
$retval .= "</tr>";
$retval .= "<tr>";
$retval .= " <td>" . __('Comment') . "</td>";
$retval .= " <td><input type='text' name='item_comment' maxlength='64'";
$retval .= " value='".$routine['item_comment']."' /></td>";
$retval .= "</tr>";
$retval .= "</table>";
$retval .= "</fieldset>";
if ($GLOBALS['is_ajax_request']) {
$retval .= "<input type='hidden' name='editor_process_{$mode}'\n";
$retval .= " value='true' />\n";
$retval .= "<input type='hidden' name='ajax_request' value='true' />\n";
$retval .= "<input type='hidden' name='editor_process_".$mode."'";
$retval .= " value='true' />";
$retval .= "<input type='hidden' name='ajax_request' value='true' />";
} else {
$retval .= "<fieldset class='tblFooters'>\n";
$retval .= " <input type='submit' name='editor_process_{$mode}'\n";
$retval .= " value='" . __('Go') . "' />\n";
$retval .= "</fieldset>\n";
$retval .= "<fieldset class='tblFooters'>";
$retval .= " <input type='submit' name='editor_process_".$mode."'";
$retval .= " value='" . __('Go') . "' />";
$retval .= "</fieldset>";
}
$retval .= "</form>\n\n";
$retval .= "<!-- END " . strtoupper($mode) . " ROUTINE FORM -->\n\n";
$retval .= "</form>";
$retval .= "<!-- END " . strtoupper($mode) . " ROUTINE FORM -->";
return $retval;
} // end PMA_RTN_getEditorForm()
@ -1412,7 +1411,7 @@ function PMA_RTN_handleExecute()
);
$output .= "</legend>";
$num_of_rusults_set_to_display = 0;
$nbResultsetToDisplay = 0;
do {
@ -1448,7 +1447,7 @@ function PMA_RTN_handleExecute()
}
$output .= "</table>";
$num_of_rusults_set_to_display++;
$nbResultsetToDisplay++;
$affected = $num_rows;
}
@ -1483,7 +1482,7 @@ function PMA_RTN_handleExecute()
}
$message = PMA_message::success($message);
if ($num_of_rusults_set_to_display == 0) {
if ($nbResultsetToDisplay == 0) {
$notice = __(
'MySQL returned an empty result set (i.e. zero rows).'
);

View File

@ -15,17 +15,17 @@ if (! defined('PHPMYADMIN')) {
/**
* Returns the html for server Character Sets and Collations.
*
* @param Array $mysql_charsets Mysql Charsets list
* @param Array $mysql_collations Mysql Collations list
* @param Array $mysql_charsets_descriptions Charsets descriptions
* @param Array $mysql_default_collations Default Collations list
* @param Array $mysql_collations_available Available Collations list
* @param Array $mysqlCharsets Mysql Charsets list
* @param Array $mysqlCollations Mysql Collations list
* @param Array $mysqlCharsetsDesc Charsets descriptions
* @param Array $mysqlDftCollations Default Collations list
* @param Array $mysqlCollAvailable Available Collations list
*
* @return string
*/
function PMA_getHtmlForCharsets($mysql_charsets, $mysql_collations,
$mysql_charsets_descriptions, $mysql_default_collations,
$mysql_collations_available
function PMA_getHtmlForCharsets($mysqlCharsets, $mysqlCollations,
$mysqlCharsetsDesc, $mysqlDftCollations,
$mysqlCollAvailable
) {
/**
* Outputs the result
@ -36,27 +36,27 @@ function PMA_getHtmlForCharsets($mysql_charsets, $mysql_collations,
. ' <th>' . __('Description') . '</th>' . "\n"
. '</tr>' . "\n";
$table_row_count = count($mysql_charsets) + count($mysql_collations);
$table_row_count = count($mysqlCharsets) + count($mysqlCollations);
foreach ($mysqlCharsets as $current_charset) {
foreach ($mysql_charsets as $current_charset) {
$html .= '<tr><th colspan="2" class="right">' . "\n"
. ' ' . htmlspecialchars($current_charset) . "\n"
. (empty($mysql_charsets_descriptions[$current_charset])
. (empty($mysqlCharsetsDesc[$current_charset])
? ''
: ' (<i>' . htmlspecialchars(
$mysql_charsets_descriptions[$current_charset]
$mysqlCharsetsDesc[$current_charset]
) . '</i>)' . "\n")
. ' </th>' . "\n"
. '</tr>' . "\n";
$html .= PMA_getHtmlForCollationCurrentCharset(
$current_charset,
$mysql_collations,
$mysql_default_collations,
$mysql_collations_available
$mysqlCollations,
$mysqlDftCollations,
$mysqlCollAvailable
);
}
unset($table_row_count);
$html .= '</table>' . "\n"
@ -68,27 +68,27 @@ function PMA_getHtmlForCharsets($mysql_charsets, $mysql_collations,
/**
* Returns the html for Collations of Current Charset.
*
* @param String $current_charset Current Charset
* @param Array $mysql_collations Collations list
* @param Array $mysql_default_collations Default Collations list
* @param Array $mysql_collations_available Available Collations list
* @param String $currCharset Current Charset
* @param Array $mysqlColl Collations list
* @param Array $mysqlDefaultColl Default Collations list
* @param Array $mysqlCollAvailable Available Collations list
*
* @return string
*/
function PMA_getHtmlForCollationCurrentCharset(
$current_charset, $mysql_collations,
$mysql_default_collations, $mysql_collations_available
$currCharset, $mysqlColl,
$mysqlDefaultColl, $mysqlCollAvailable
) {
$odd_row = true;
$html = '';
foreach ($mysql_collations[$current_charset] as $current_collation) {
foreach ($mysqlColl[$currCharset] as $current_collation) {
$html .= '<tr class="'
. ($odd_row ? 'odd' : 'even')
. ($mysql_default_collations[$current_charset] == $current_collation
. ($mysqlDefaultColl[$currCharset] == $current_collation
? ' marked'
: '')
. ($mysql_collations_available[$current_collation] ? '' : ' disabled')
. ($mysqlCollAvailable[$current_collation] ? '' : ' disabled')
. '">' . "\n"
. ' <td>' . htmlspecialchars($current_collation) . '</td>' . "\n"
. ' <td>' . PMA_getCollationDescr($current_collation) . '</td>' . "\n"

View File

@ -109,10 +109,7 @@ function PMA_getHtmlForDatabase(
$html .= PMA_getHtmlForTableFooterButtons(
$cfg['AllowUserDropDatabase'],
$is_superuser,
$sort_by,
$sort_order,
$dbstats
$is_superuser
);
if (empty($dbstats)) {
@ -128,56 +125,53 @@ function PMA_getHtmlForDatabase(
/**
* Returns the html for Table footer buttons
*
* @param bool $is_allowUserDropDatabase Allow user drop database
* @param bool $is_superuser User status
* @param string $sort_by sort by string
* @param string $sort_order sort order string
* @param Array $dbstats database status
* @param bool $is_allowUserDropDb Allow user drop database
* @param bool $is_superuser User status
*
* @return string
*/
function PMA_getHtmlForTableFooterButtons(
$is_allowUserDropDatabase, $is_superuser,
$sort_by, $sort_order, $dbstats
) {
$html = "";
if ($is_superuser || $is_allowUserDropDatabase) {
$html .= '<img class="selectallarrow" src="'
. $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png"'
. ' width="38" height="22" alt="' . __('With selected:') . '" />' . "\n"
. '<input type="checkbox" id="dbStatsForm_checkall" '
. 'class="checkall_box" title="' . __('Check All') . '" /> '
. '<label for="dbStatsForm_checkall">' . __('Check All') . '</label> '
. '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
$html .= PMA_Util::getButtonOrImage(
'',
'mult_submit' . ' ajax',
'drop_selected_dbs',
__('Drop'), 'b_deltbl.png'
);
function PMA_getHtmlForTableFooterButtons($is_allowUserDropDb, $is_superuser)
{
if (!$is_superuser && !$is_allowUserDropDb) {
return '';
}
$html = '<img class="selectallarrow" src="'
. $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png"'
. ' width="38" height="22" alt="' . __('With selected:') . '" />' . "\n"
. '<input type="checkbox" id="dbStatsForm_checkall" '
. 'class="checkall_box" title="' . __('Check All') . '" /> '
. '<label for="dbStatsForm_checkall">' . __('Check All') . '</label> '
. '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
$html .= PMA_Util::getButtonOrImage(
'',
'mult_submit' . ' ajax',
'drop_selected_dbs',
__('Drop'), 'b_deltbl.png'
);
return $html;
}
/**
* Returns the html for Table footer
*
* @param bool $is_allowUserDropDatabase Allow user drop database
* @param bool $is_superuser User status
* @param Array $databases_count Database count
* @param string $column_order column order
* @param array $replication_types replication types
* @param string $first_database First database
* @param bool $is_allowUserDropDb Allow user drop database
* @param bool $is_superuser User status
* @param Array $databases_count Database count
* @param string $column_order column order
* @param array $replication_types replication types
* @param string $first_database First database
*
* @return string
*/
function PMA_getHtmlForTableFooter(
$is_allowUserDropDatabase, $is_superuser,
$is_allowUserDropDb, $is_superuser,
$databases_count, $column_order,
$replication_types, $first_database
) {
$html = '<tfoot><tr>' . "\n";
if ($is_superuser || $is_allowUserDropDatabase) {
if ($is_superuser || $is_allowUserDropDb) {
$html .= ' <th></th>' . "\n";
}
$html .= ' <th>' . __('Total') . ': <span id="databases_count">'
@ -288,22 +282,22 @@ function PMA_getHtmlForColumnOrder($column_order, $first_database)
/**
* Returns the html for Column Order with Sort
*
* @param bool $is_superuser User status
* @param bool $is_allowUserDropDatabase Allow user drop database
* @param Array $_url_params Url params
* @param string $sort_by sort colume name
* @param string $sort_order order
* @param array $column_order column order
* @param array $first_database database to show
* @param bool $is_superuser User status
* @param bool $is_allowUserDropDb Allow user drop database
* @param Array $_url_params Url params
* @param string $sort_by sort colume name
* @param string $sort_order order
* @param array $column_order column order
* @param array $first_database database to show
*
* @return string
*/
function PMA_getHtmlForColumnOrderWithSort(
$is_superuser, $is_allowUserDropDatabase,
$is_superuser, $is_allowUserDropDb,
$_url_params, $sort_by, $sort_order,
$column_order, $first_database
) {
$html = ($is_superuser || $is_allowUserDropDatabase
$html = ($is_superuser || $is_allowUserDropDb
? ' <th></th>' . "\n"
: '')
. ' <th><a href="server_databases.php'
@ -319,30 +313,32 @@ function PMA_getHtmlForColumnOrderWithSort(
. ' </a></th>' . "\n";
$table_columns = 3;
foreach ($column_order as $stat_name => $stat) {
if (array_key_exists($stat_name, $first_database)) {
if ($stat['format'] === 'byte') {
$table_columns += 2;
$colspan = ' colspan="2"';
} else {
$table_columns++;
$colspan = '';
}
$_url_params['sort_by'] = $stat_name;
$_url_params['sort_order']
= ($sort_by == $stat_name && $sort_order == 'desc') ? 'asc' : 'desc';
$html .= ' <th' . $colspan . '>'
. '<a href="server_databases.php'
. PMA_URL_getCommon($_url_params) . '">' . "\n"
. ' ' . $stat['disp_name'] . "\n"
. ($sort_by == $stat_name
? ' ' . PMA_Util::getImage(
's_' . $sort_order . '.png',
($sort_order == 'asc' ? __('Ascending') : __('Descending'))
) . "\n"
: ''
)
. ' </a></th>' . "\n";
if (!array_key_exists($stat_name, $first_database)) {
continue;
}
if ($stat['format'] === 'byte') {
$table_columns += 2;
$colspan = ' colspan="2"';
} else {
$table_columns++;
$colspan = '';
}
$_url_params['sort_by'] = $stat_name;
$_url_params['sort_order']
= ($sort_by == $stat_name && $sort_order == 'desc') ? 'asc' : 'desc';
$html .= ' <th' . $colspan . '>'
. '<a href="server_databases.php'
. PMA_URL_getCommon($_url_params) . '">' . "\n"
. ' ' . $stat['disp_name'] . "\n"
. ($sort_by == $stat_name
? ' ' . PMA_Util::getImage(
's_' . $sort_order . '.png',
($sort_order == 'asc' ? __('Ascending') : __('Descending'))
) . "\n"
: ''
)
. ' </a></th>' . "\n";
}
return $html;
}

View File

@ -422,16 +422,16 @@ function PMA_getHtmlForColumnPrivileges($columns, $row, $name_for_select,
. '<select id="select_' . $name . '_priv" name="'
. $name_for_select . '[]" multiple="multiple" size="8">' . "\n";
foreach ($columns as $current_column => $current_column_privileges) {
foreach ($columns as $currCol => $currColPrivs) {
$html_output .= '<option '
. 'value="' . htmlspecialchars($current_column) . '"';
. 'value="' . htmlspecialchars($currCol) . '"';
if ($row[$name_for_select] == 'Y'
|| $current_column_privileges[$name_for_current]
|| $currColPrivs[$name_for_current]
) {
$html_output .= ' selected="selected"';
}
$html_output .= '>'
. htmlspecialchars($current_column) . '</option>' . "\n";
. htmlspecialchars($currCol) . '</option>' . "\n";
}
$html_output .= '</select>' . "\n"
@ -1134,7 +1134,7 @@ function PMA_getStructurePrivilegeTable($table, $row)
*/
function PMA_getAdministrationPrivilegeTable($db)
{
$administration_privTable = array(
$adminPrivTable = array(
array('Grant',
'GRANT',
__(
@ -1144,7 +1144,7 @@ function PMA_getAdministrationPrivilegeTable($db)
),
);
if ($db == '*') {
$administration_privTable[] = array('Super',
$adminPrivTable[] = array('Super',
'SUPER',
__(
'Allows connecting, even if maximum number '
@ -1153,46 +1153,46 @@ function PMA_getAdministrationPrivilegeTable($db)
. 'setting global variables or killing threads of other users.'
)
);
$administration_privTable[] = array('Process',
$adminPrivTable[] = array('Process',
'PROCESS',
__('Allows viewing processes of all users')
);
$administration_privTable[] = array('Reload',
$adminPrivTable[] = array('Reload',
'RELOAD',
__('Allows reloading server settings and flushing the server\'s caches.')
);
$administration_privTable[] = array('Shutdown',
$adminPrivTable[] = array('Shutdown',
'SHUTDOWN',
__('Allows shutting down the server.')
);
$administration_privTable[] = array('Show_db',
$adminPrivTable[] = array('Show_db',
'SHOW DATABASES',
__('Gives access to the complete list of databases.')
);
}
$administration_privTable[] = array('Lock_tables',
$adminPrivTable[] = array('Lock_tables',
'LOCK TABLES',
__('Allows locking tables for the current thread.')
);
$administration_privTable[] = array('References',
$adminPrivTable[] = array('References',
'REFERENCES',
__('Has no effect in this MySQL version.')
);
if ($db == '*') {
$administration_privTable[] = array('Repl_client',
$adminPrivTable[] = array('Repl_client',
'REPLICATION CLIENT',
__('Allows the user to ask where the slaves / masters are.')
);
$administration_privTable[] = array('Repl_slave',
$adminPrivTable[] = array('Repl_slave',
'REPLICATION SLAVE',
__('Needed for the replication slaves.')
);
$administration_privTable[] = array('Create_user',
$adminPrivTable[] = array('Create_user',
'CREATE USER',
__('Allows creating, dropping and renaming user accounts.')
);
}
return $administration_privTable;
return $adminPrivTable;
}
/**
@ -1755,7 +1755,7 @@ function PMA_getListOfPrivilegesAndComparedPrivileges()
. '`Alter_routine_priv`, '
. '`Execute_priv`';
$list_of_compared_privileges
$listOfComparedPrivs
= '`Select_priv` = \'N\''
. ' AND `Insert_priv` = \'N\''
. ' AND `Update_priv` = \'N\''
@ -1776,11 +1776,11 @@ function PMA_getListOfPrivilegesAndComparedPrivileges()
$list_of_privileges .=
', `Event_priv`, '
. '`Trigger_priv`';
$list_of_compared_privileges .=
$listOfComparedPrivs .=
' AND `Event_priv` = \'N\''
. ' AND `Trigger_priv` = \'N\'';
}
return array($list_of_privileges, $list_of_compared_privileges);
return array($list_of_privileges, $listOfComparedPrivs);
}
/**
@ -1819,19 +1819,19 @@ function PMA_getHtmlForSpecificDbPrivileges($db)
. '</tr>' . "\n"
. '</thead>' . "\n";
// now, we build the table...
list($list_of_privileges, $list_of_compared_privileges)
list($listOfPrivs, $listOfComparedPrivs)
= PMA_getListOfPrivilegesAndComparedPrivileges();
$sql_query = '(SELECT ' . $list_of_privileges . ', `Db`, \'d\' AS `Type`'
$sql_query = '(SELECT ' . $listOfPrivs . ', `Db`, \'d\' AS `Type`'
.' FROM `mysql`.`db`'
.' WHERE \'' . PMA_Util::sqlAddSlashes($db)
. "'"
.' LIKE `Db`'
.' AND NOT (' . $list_of_compared_privileges. ')) '
.' AND NOT (' . $listOfComparedPrivs. ')) '
.'UNION '
.'(SELECT ' . $list_of_privileges . ', \'*\' AS `Db`, \'g\' AS `Type`'
.'(SELECT ' . $listOfPrivs . ', \'*\' AS `Db`, \'g\' AS `Type`'
.' FROM `mysql`.`user` '
.' WHERE NOT (' . $list_of_compared_privileges . ')) '
.' WHERE NOT (' . $listOfComparedPrivs . ')) '
.' ORDER BY `User` ASC,'
.' `Host` ASC,'
.' `Db` ASC;';
@ -1926,20 +1926,20 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table)
. '</tr>'
. '</thead>';
list($list_of_privileges, $list_of_compared_privileges)
list($listOfPrivs, $listOfComparedPrivs)
= PMA_getListOfPrivilegesAndComparedPrivileges();
$sql_query
= "("
. " SELECT " . $list_of_privileges . ", '*' AS `Db`, 'g' AS `Type`"
. " SELECT " . $listOfPrivs . ", '*' AS `Db`, 'g' AS `Type`"
. " FROM `mysql`.`user`"
. " WHERE NOT (" . $list_of_compared_privileges . ")"
. " WHERE NOT (" . $listOfComparedPrivs . ")"
. ")"
. " UNION "
. "("
. " SELECT " . $list_of_privileges . ", `Db`, 'd' AS `Type`"
. " SELECT " . $listOfPrivs . ", `Db`, 'd' AS `Type`"
. " FROM `mysql`.`db`"
. " WHERE '" . PMA_Util::sqlAddSlashes($db) . "' LIKE `Db`"
. " AND NOT (" . $list_of_compared_privileges. ")"
. " AND NOT (" . $listOfComparedPrivs. ")"
. ")"
. " ORDER BY `User` ASC, `Host` ASC, `Db` ASC;";
$res = $GLOBALS['dbi']->query($sql_query);
@ -1978,9 +1978,7 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table)
$privMap[$user][$host][] = $row;
}
$html_output .= PMA_getHtmlTableBodyForSpecificDbOrTablePrivs(
$privMap, $db, $table
);
$html_output .= PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db);
$html_output .= '</table>';
$html_output .= '</fieldset>';
$html_output .= '</form>';
@ -2011,11 +2009,10 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table)
*
* @param array $privMap priviledge map
* @param boolean $db database
* @param boolean $table table
*
* @return string $html_output
*/
function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = null)
function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db)
{
$html_output = '<tbody>';
$odd_row = true;
@ -2402,11 +2399,11 @@ function PMA_getExtraDataForAjaxBehavior(
* pagination
*/
$new_user_initial = strtoupper(substr($username, 0, 1));
$new_user_initial_string = '<a href="server_privileges.php'
$newUserInitialString = '<a href="server_privileges.php'
. PMA_URL_getCommon(array('initial' => $new_user_initial)) .'">'
. $new_user_initial . '</a>';
$extra_data['new_user_initial'] = $new_user_initial;
$extra_data['new_user_initial_string'] = $new_user_initial_string;
$extra_data['new_user_initial_string'] = $newUserInitialString;
}
if (isset($_POST['update_privs'])) {
@ -3207,12 +3204,12 @@ function PMA_getDbRightsForUserOverview()
// we also want users not in table `user` but in other table
$tables = $GLOBALS['dbi']->fetchResult('SHOW TABLES FROM `mysql`;');
$tables_to_search_for_users = array(
$tablesSearchForUsers = array(
'user', 'db', 'tables_priv', 'columns_priv', 'procs_priv',
);
$db_rights_sqls = array();
foreach ($tables_to_search_for_users as $table_search_in) {
foreach ($tablesSearchForUsers as $table_search_in) {
if (in_array($table_search_in, $tables)) {
$db_rights_sqls[] = 'SELECT DISTINCT `User`, `Host` FROM `mysql`.`'
. $table_search_in . '` '

View File

@ -312,11 +312,9 @@ function PMA_getHtmlForServerStateConnections($ServerStatusData)
/**
* Prints Server Process list
*
* @param PMA_ServerStatusData $ServerStatusData Server status data
*
* @return string
*/
function PMA_getHtmlForServerProcesslist($ServerStatusData)
function PMA_getHtmlForServerProcesslist()
{
$url_params = array();
@ -368,7 +366,7 @@ function PMA_getHtmlForServerProcesslist($ServerStatusData)
'order_by_field' => 'Info'
)
);
$sortable_columns_count = count($sortable_columns);
$sortableColCount = count($sortable_columns);
if (PMA_DRIZZLE) {
$left_str = 'left(p.info, '
@ -455,7 +453,7 @@ function PMA_getHtmlForServerProcesslist($ServerStatusData)
$retval .= '</a>';
if (! PMA_DRIZZLE && (0 === --$sortable_columns_count)) {
if (! PMA_DRIZZLE && (0 === --$sortableColCount)) {
$retval .= '<a href="' . $full_text_link . '">';
if ($show_full_sql) {
$retval .= PMA_Util::getImage(

View File

@ -552,20 +552,19 @@ function PMA_getJsonForChartingData()
*/
function PMA_getJsonForLogDataTypeSlow($start, $end)
{
$q = 'SELECT start_time, user_host, ';
$q .= 'Sec_to_Time(Sum(Time_to_Sec(query_time))) as query_time, ';
$q .= 'Sec_to_Time(Sum(Time_to_Sec(lock_time))) as lock_time, ';
$q .= 'SUM(rows_sent) AS rows_sent, ';
$q .= 'SUM(rows_examined) AS rows_examined, db, sql_text, ';
$q .= 'COUNT(sql_text) AS \'#\' ';
$q .= 'FROM `mysql`.`slow_log` ';
$q .= 'WHERE start_time > FROM_UNIXTIME(' . $start . ') ';
$q .= 'AND start_time < FROM_UNIXTIME(' . $end . ') GROUP BY sql_text';
$query = 'SELECT start_time, user_host, ';
$query .= 'Sec_to_Time(Sum(Time_to_Sec(query_time))) as query_time, ';
$query .= 'Sec_to_Time(Sum(Time_to_Sec(lock_time))) as lock_time, ';
$query .= 'SUM(rows_sent) AS rows_sent, ';
$query .= 'SUM(rows_examined) AS rows_examined, db, sql_text, ';
$query .= 'COUNT(sql_text) AS \'#\' ';
$query .= 'FROM `mysql`.`slow_log` ';
$query .= 'WHERE start_time > FROM_UNIXTIME(' . $start . ') ';
$query .= 'AND start_time < FROM_UNIXTIME(' . $end . ') GROUP BY sql_text';
$result = $GLOBALS['dbi']->tryQuery($q);
$result = $GLOBALS['dbi']->tryQuery($query);
$return = array('rows' => array(), 'sum' => array());
$type = '';
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
$type = strtolower(
@ -621,18 +620,17 @@ function PMA_getJsonForLogDataTypeGeneral($start, $end)
= 'AND argument REGEXP \'^(INSERT|SELECT|UPDATE|DELETE)\' ';
}
$q = 'SELECT TIME(event_time) as event_time, user_host, thread_id, ';
$q .= 'server_id, argument, count(argument) as \'#\' ';
$q .= 'FROM `mysql`.`general_log` ';
$q .= 'WHERE command_type=\'Query\' ';
$q .= 'AND event_time > FROM_UNIXTIME(' . $start . ') ';
$q .= 'AND event_time < FROM_UNIXTIME(' . $end . ') ';
$q .= $limitTypes . 'GROUP by argument'; // HAVING count > 1';
$query = 'SELECT TIME(event_time) as event_time, user_host, thread_id, ';
$query .= 'server_id, argument, count(argument) as \'#\' ';
$query .= 'FROM `mysql`.`general_log` ';
$query .= 'WHERE command_type=\'Query\' ';
$query .= 'AND event_time > FROM_UNIXTIME(' . $start . ') ';
$query .= 'AND event_time < FROM_UNIXTIME(' . $end . ') ';
$query .= $limitTypes . 'GROUP by argument'; // HAVING count > 1';
$result = $GLOBALS['dbi']->tryQuery($q);
$result = $GLOBALS['dbi']->tryQuery($query);
$return = array('rows' => array(), 'sum' => array());
$type = '';
$insertTables = array();
$insertTablesFirst = -1;
$i = 0;

View File

@ -232,21 +232,21 @@ function PMA_getMIME($db, $table, $strict = false)
/**
* Set a single mimetype to a certain value.
*
* @param string $db the name of the db
* @param string $table the name of the table
* @param string $key the name of the column
* @param string $mimetype the mimetype of the column
* @param string $transformation the transformation of the column
* @param string $transformation_options the transformation options of the column
* @param boolean $forcedelete force delete, will erase any existing
* comments for this column
* @param string $db the name of the db
* @param string $table the name of the table
* @param string $key the name of the column
* @param string $mimetype the mimetype of the column
* @param string $transformation the transformation of the column
* @param string $transformationOpt the transformation options of the column
* @param boolean $forcedelete force delete, will erase any existing
* comments for this column
*
* @access public
*
* @return boolean true, if comment-query was made.
*/
function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
$transformation_options, $forcedelete = false
$transformationOpt, $forcedelete = false
) {
$cfgRelation = PMA_getRelationsParam();
@ -287,7 +287,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
if (! $forcedelete
&& (strlen($mimetype) || strlen($transformation)
|| strlen($transformation_options) || strlen($row['comment']))
|| strlen($transformationOpt) || strlen($row['comment']))
) {
$upd_query = 'UPDATE ' . PMA_Util::backquote($cfgRelation['db']) . '.'
. PMA_Util::backquote($cfgRelation['column_info'])
@ -297,7 +297,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
. '`transformation` = \''
. PMA_Util::sqlAddSlashes($transformation) . '\', '
. '`transformation_options` = \''
. PMA_Util::sqlAddSlashes($transformation_options) . '\'';
. PMA_Util::sqlAddSlashes($transformationOpt) . '\'';
} else {
$upd_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db'])
. '.' . PMA_Util::backquote($cfgRelation['column_info']);
@ -308,7 +308,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
AND `column_name` = \'' . PMA_Util::sqlAddSlashes($key) . '\'';
} elseif (strlen($mimetype)
|| strlen($transformation)
|| strlen($transformation_options)
|| strlen($transformationOpt)
) {
$upd_query = 'INSERT INTO ' . PMA_Util::backquote($cfgRelation['db'])
@ -321,7 +321,7 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
. '\'' . PMA_Util::sqlAddSlashes($key) . '\','
. '\'' . PMA_Util::sqlAddSlashes($mimetype) . '\','
. '\'' . PMA_Util::sqlAddSlashes($transformation) . '\','
. '\'' . PMA_Util::sqlAddSlashes($transformation_options) . '\')';
. '\'' . PMA_Util::sqlAddSlashes($transformationOpt) . '\')';
}
if (isset($upd_query)) {

View File

@ -38,17 +38,17 @@ function PMA_process_formset(FormDisplay $form_display)
$page = filter_input(INPUT_GET, 'page');
$formset = filter_input(INPUT_GET, 'formset');
$formset = $formset ? "{$separator}formset=$formset" : '';
$id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
if ($id === null && $page == 'servers') {
$formId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
if ($formId === null && $page == 'servers') {
// we've just added a new server, get its id
$id = $form_display->getConfigFile()->getServerCount();
$formId = $form_display->getConfigFile()->getServerCount();
}
$id = $id ? "{$separator}id=$id" : '';
$formId = $formId ? "{$separator}id=$formId" : '';
?>
<div class="error">
<h4><?php echo __('Warning') ?></h4>
<?php echo __('Submitted form contains errors') ?><br />
<a href="?page=<?php echo $page . $formset . $id . $separator ?>mode=revert">
<a href="?page=<?php echo $page . $formset . $formId . $separator ?>mode=revert">
<?php echo __('Try to revert erroneous fields to their default values')
?>
</a>
@ -56,7 +56,7 @@ function PMA_process_formset(FormDisplay $form_display)
<?php $form_display->displayErrors() ?>
<a class="btn" href="index.php"><?php echo __('Ignore errors') ?></a>
&nbsp;
<a class="btn" href="?page=<?php echo $page . $formset . $id
<a class="btn" href="?page=<?php echo $page . $formset . $formId
. $separator ?>mode=edit"><?php echo __('Show form') ?></a>
<?php
}

View File

@ -34,16 +34,16 @@ function PMA_messagesBegin()
* Adds a new message to message list
*
* @param string $type one of: notice, error
* @param string $id unique message identifier
* @param string $msgId unique message identifier
* @param string $title language string id (in $str array)
* @param string $message message text
*
* @return void
*/
function PMA_messagesSet($type, $id, $title, $message)
function PMA_messagesSet($type, $msgId, $title, $message)
{
$fresh = ! isset($_SESSION['messages'][$type][$id]);
$_SESSION['messages'][$type][$id] = array(
$fresh = ! isset($_SESSION['messages'][$type][$msgId]);
$_SESSION['messages'][$type][$msgId] = array(
'fresh' => $fresh,
'active' => true,
'title' => $title,

View File

@ -1411,10 +1411,9 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
{
$privMap = null;
$db = "pma_dbname";
$table = "pma_table";
//$privMap = null
$html = PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table);
$html = PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db);
$this->assertContains(
__('No user found.'),
$html
@ -1431,7 +1430,7 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
)
);
$html = PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table);
$html = PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db);
//validate 1: $current_privileges
$current_privileges = $privMap["user1"]["hostname1"];