Merge branch 'master' of https://github.com/phpmyadmin/phpmyadmin into tbl_UTs

This commit is contained in:
adamgsoc2013 2013-09-10 16:32:45 +08:00
commit ea4f59f5ca
59 changed files with 3064 additions and 1450 deletions

View File

@ -37,12 +37,14 @@ phpMyAdmin - ChangeLog
+ [setup] rfe #1452 Use type="password" for server passwords
+ rfe #1451 HTML5 input tag enhancements
- bug #1193 Text field too small when editing a row longer than $cfg['LimitChars']
+ Privileges tab for table level
4.0.7.0 (not yet released)
- bug #3993 Sorting in database overview with statistics doesn't work
- bug Handle the situation where PHP_SELF is not set
- bug #4080 Overwrite existing file not obeyed
4.0.6.0 (not yet released)
4.0.6.0 (2013-09-05)
- bug #4036 Call to undefined function mb_detect_encoding (clarify the doc)
- bug Missing hints when changing a column's structure
- bug #4048 Cannot select foreign value in Search

View File

@ -8,6 +8,7 @@
require_once 'libraries/common.inc.php';
require_once 'libraries/transformations.lib.php';
require_once 'libraries/browse_foreigners.lib.php';
/**
* Sets globals from $_REQUEST
@ -36,311 +37,29 @@ $header->setBodyId('body_browse_foreigners');
$cfgRelation = PMA_getRelationsParam();
$foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : false);
$override_total = true;
if (! isset($_REQUEST['pos'])) {
$pos = 0;
} else {
$pos = $_REQUEST['pos'];
}
$foreign_limit = 'LIMIT ' . $pos . ', ' . $GLOBALS['cfg']['MaxRows'] . ' ';
if (isset($foreign_navig) && $foreign_navig == __('Show all')) {
unset($foreign_limit);
}
$foreign_limit = PMA_getForeignLimit(
isset($foreign_navig) ? $foreign_navig : null
);
$foreignData = PMA_getForeignData(
$foreigners, $field, $override_total,
$foreigners, $_REQUEST['field'], true,
isset($_REQUEST['foreign_filter'])
? $_REQUEST['foreign_filter']
: '', $foreign_limit
);
$gotopage = '';
$showall = '';
if (is_array($foreignData['disp_row'])) {
if ($cfg['ShowAll']
&& ($foreignData['the_total'] > $GLOBALS['cfg']['MaxRows'])
) {
$showall = '<input type="submit" name="foreign_navig" value="'
. __('Show all') . '" />';
}
$session_max_rows = $GLOBALS['cfg']['MaxRows'];
$pageNow = @floor($pos / $session_max_rows) + 1;
$nbTotalPage = @ceil($foreignData['the_total'] / $session_max_rows);
if ($foreignData['the_total'] > $GLOBALS['cfg']['MaxRows']) {
$gotopage = PMA_Util::pageselector(
'pos',
$session_max_rows,
$pageNow,
$nbTotalPage,
200,
5,
5,
20,
10,
__('Page number:')
);
}
}
// When coming from Table/Zoom search
if (isset($_REQUEST['fromsearch'])) {
// In table or zoom search, input fields are named "criteriaValues"
$element_name = " var field = 'criteriaValues';\n";
} else {
// In insert/edit, input fields are named "fields"
$element_name = " var field = 'fields';\n";
}
if (isset($_REQUEST['rownumber'])) {
$element_name .= " var element_name = field + '[multi_edit]["
. htmlspecialchars($_REQUEST['rownumber']) . "][' + fieldmd5 + ']';\n"
. " var null_name = field_null + '[multi_edit]["
. htmlspecialchars($_REQUEST['rownumber']) . "][' + fieldmd5 + ']';\n";
} else {
$element_name .= "var element_name = field + '[]'";
}
$error = PMA_jsFormat(
__(
'The target browser window could not be updated. '
. 'Maybe you have closed the parent window, or '
. 'your browser\'s security settings are '
. 'configured to block cross-window updates.'
)
: '',
isset($foreign_limit) ? $foreign_limit : null
);
if (! isset($_REQUEST['fieldkey']) || ! is_numeric($_REQUEST['fieldkey'])) {
$fieldkey = 0;
} else {
$fieldkey = $_REQUEST['fieldkey'];
}
$code = <<<EOC
self.focus();
function formupdate(fieldmd5, key) {
var \$inline = window.opener.jQuery('.browse_foreign_clicked');
if (\$inline.length != 0) {
\$inline.removeClass('browse_foreign_clicked')
// for grid editing,
// puts new value in the previous element which is
// a span with class curr_value, and trigger .change()
.prev('.curr_value').text(key).change();
// for zoom-search editing, puts new value in the previous
// element which is an input field
\$inline.prev('input[type=text]').val(key);
self.close();
return false;
}
if (opener && opener.document && opener.document.insertForm) {
var field = 'fields';
var field_null = 'fields_null';
$element_name
var element_name_alt = field + '[$fieldkey]';
if (opener.document.insertForm.elements[element_name]) {
// Edit/Insert form
opener.document.insertForm.elements[element_name].value = key;
if (opener.document.insertForm.elements[null_name]) {
opener.document.insertForm.elements[null_name].checked = false;
}
self.close();
return false;
} else if (opener.document.insertForm.elements[element_name_alt]) {
// Search form
opener.document.insertForm.elements[element_name_alt].value = key;
self.close();
return false;
}
}
alert('$error');
}
EOC;
$code = PMA_getJsScriptToHandleSelectRelationalFields();
$header->getScripts()->addCode($code);
// HTML output
$output = '<form action="browse_foreigners.php" method="post">'
. '<fieldset>'
. PMA_URL_getHiddenInputs($db, $table)
. '<input type="hidden" name="field" value="' . htmlspecialchars($field) . '" />'
. '<input type="hidden" name="fieldkey" value="'
. (isset($fieldkey) ? htmlspecialchars($fieldkey) : '') . '" />';
$html = PMA_getHtmlForRelationalFieldSelection(
$db, $table, $_REQUEST['field'], $foreignData,
isset($fieldkey) ? $fieldkey : null,
isset($data) ? $data : null
);
if (isset($_REQUEST['rownumber'])) {
$output .= '<input type="hidden" name="rownumber" value="'
. htmlspecialchars($_REQUEST['rownumber']) . '" />';
}
$output .= '<span class="formelement">'
. '<label for="input_foreign_filter">' . __('Search:') . '</label>'
. '<input type="text" name="foreign_filter" id="input_foreign_filter" value="'
. (isset($_REQUEST['foreign_filter'])
? htmlspecialchars($_REQUEST['foreign_filter'])
: '')
. '" />'
. '<input type="submit" name="submit_foreign_filter" value="'
. __('Go') . '" />'
. '</span>'
. '<span class="formelement">' . $gotopage . '</span>'
. '<span class="formelement">' . $showall . '</span>'
. '</fieldset>'
. '</form>';
$output .= '<table width="100%">';
if (is_array($foreignData['disp_row'])) {
$header = '<tr>
<th>' . __('Keyname') . '</th>
<th>' . __('Description') . '</th>
<td width="20%"></td>
<th>' . __('Description') . '</th>
<th>' . __('Keyname') . '</th>
</tr>';
$output .= '<thead>' . $header . '</thead>' . "\n"
. '<tfoot>' . $header . '</tfoot>' . "\n"
. '<tbody>' . "\n";
$values = array();
$keys = array();
foreach ($foreignData['disp_row'] as $relrow) {
if ($foreignData['foreign_display'] != false) {
$values[] = $relrow[$foreignData['foreign_display']];
} else {
$values[] = '';
}
$keys[] = $relrow[$foreignData['foreign_field']];
}
asort($keys);
$hcount = 0;
$odd_row = true;
$val_ordered_current_row = 0;
$val_ordered_current_equals_data = false;
$key_ordered_current_equals_data = false;
foreach ($keys as $key_ordered_current_row => $value) {
$hcount++;
if ($cfg['RepeatCells'] > 0 && $hcount > $cfg['RepeatCells']) {
$output .= $header;
$hcount = 0;
$odd_row = true;
}
$key_ordered_current_key = $keys[$key_ordered_current_row];
$key_ordered_current_val = $values[$key_ordered_current_row];
$val_ordered_current_key = $keys[$val_ordered_current_row];
$val_ordered_current_val = $values[$val_ordered_current_row];
$val_ordered_current_row++;
if ($GLOBALS['PMA_String']->strlen($val_ordered_current_val) <= $cfg['LimitChars']) {
$val_ordered_current_val = htmlspecialchars(
$val_ordered_current_val
);
$val_ordered_current_val_title = '';
} else {
$val_ordered_current_val_title = htmlspecialchars(
$val_ordered_current_val
);
$val_ordered_current_val = htmlspecialchars(
$GLOBALS['PMA_String']->substr($val_ordered_current_val, 0, $cfg['LimitChars'])
. '...'
);
}
if ($GLOBALS['PMA_String']->strlen($key_ordered_current_val) <= $cfg['LimitChars']) {
$key_ordered_current_val = htmlspecialchars(
$key_ordered_current_val
);
$key_ordered_current_val_title = '';
} else {
$key_ordered_current_val_title = htmlspecialchars(
$key_ordered_current_val
);
$key_ordered_current_val = htmlspecialchars(
$GLOBALS['PMA_String']->substr(
$key_ordered_current_val, 0, $cfg['LimitChars']
) . '...'
);
}
if (! empty($data)) {
$val_ordered_current_equals_data = $val_ordered_current_key == $data;
$key_ordered_current_equals_data = $key_ordered_current_key == $data;
}
$output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$odd_row = ! $odd_row;
$output .= '<td class="nowrap">'
. ($key_ordered_current_equals_data ? '<strong>' : '')
. '<a href="#" title="' . __('Use this value')
. ($key_ordered_current_val_title != ''
? ': ' . $key_ordered_current_val_title
: '') . '"'
. ' onclick="formupdate(\'' . md5($field) . '\', \''
. PMA_jsFormat($key_ordered_current_key, false) . '\'); return false;">'
. htmlspecialchars($key_ordered_current_key)
. '</a>' . ($key_ordered_current_equals_data ? '</strong>' : '')
. '</td>';
$output .= '<td>'
. ($key_ordered_current_equals_data ? '<strong>' : '')
. '<a href="#" title="' . __('Use this value')
. ($key_ordered_current_val_title != '' ? ': '
. $key_ordered_current_val_title : '') . '" onclick="formupdate(\''
. md5($field) . '\', \''
. PMA_jsFormat($key_ordered_current_key, false)
. '\'); return false;">'
. $key_ordered_current_val . '</a>'
. ($key_ordered_current_equals_data ? '</strong>' : '')
. '</td>';
$output .= '<td width="20%">'
. '<img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png" alt=""'
. ' width="1" height="1" /></td>';
$output .= '<td>'
. ($val_ordered_current_equals_data ? '<strong>' : '')
. '<a href="#" title="' . __('Use this value')
. ($val_ordered_current_val_title != '' ? ': '
. $val_ordered_current_val_title : '') . '" onclick="formupdate(\''
. md5($field) . '\', \''
. PMA_jsFormat($val_ordered_current_key, false)
. '\'); return false;">'
. $val_ordered_current_val . '</a>'
. ($val_ordered_current_equals_data ? '</strong>' : '')
. '</td>';
$output .= '<td class="nowrap">'
. ($val_ordered_current_equals_data ? '<strong>' : '')
. '<a href="#" title="' . __('Use this value')
. ($val_ordered_current_val_title != ''
? ': ' . $val_ordered_current_val_title : '')
. '" onclick="formupdate(\'' . md5($field) . '\', \''
. PMA_jsFormat($val_ordered_current_key, false) . '\'); return false;">'
. htmlspecialchars($val_ordered_current_key)
. '</a>' . ($val_ordered_current_equals_data ? '</strong>' : '')
. '</td>';
$output .= '</tr>';
} // end while
}
$output .= '</tbody>'
. '</table>';
$response->addHtml($output);
$response->addHtml($html);
?>

View File

@ -207,10 +207,11 @@ foreach ($tables as $table) {
}
$column_name = $row['Field'];
$tmp_column = $analyzed_sql[0]['create_table_fields'][$column_name];
if (PMA_MYSQL_INT_VERSION < 50025
&& ! empty($analyzed_sql[0]['create_table_fields'][$column_name]['type'])
&& $analyzed_sql[0]['create_table_fields'][$column_name]['type'] == 'TIMESTAMP'
&& $analyzed_sql[0]['create_table_fields'][$column_name]['timestamp_not_null']
&& ! empty($tmp_column['type'])
&& $tmp_column['type'] == 'TIMESTAMP'
&& $tmp_column['timestamp_not_null']
) {
// here, we have a TIMESTAMP that SHOW FULL COLUMNS reports as
// having the NULL attribute, but SHOW CREATE TABLE says the

View File

@ -1198,6 +1198,12 @@ Generic settings
:default: false
Whether to force using https while accessing phpMyAdmin.
.. note::
In some setups (like separate SSL proxy or loadballancer) you might
have to set :config:option:`$cfg['PmaAbsoluteUri']` for correct
redirection.
.. config:option:: $cfg['ExecTimeLimit']

View File

@ -262,43 +262,9 @@ CREATE TABLE IF NOT EXISTS `pma__users` (
CREATE TABLE IF NOT EXISTS `pma__usergroups` (
`usergroup` varchar(64) NOT NULL,
`server_databases` enum('Y','N') NOT NULL DEFAULT 'N',
`server_sql` enum('Y','N') NOT NULL DEFAULT 'N',
`server_status` enum('Y','N') NOT NULL DEFAULT 'N',
`server_rights` enum('Y','N') NOT NULL DEFAULT 'N',
`server_export` enum('Y','N') NOT NULL DEFAULT 'N',
`server_import` enum('Y','N') NOT NULL DEFAULT 'N',
`server_settings` enum('Y','N') NOT NULL DEFAULT 'N',
`server_binlog` enum('Y','N') NOT NULL DEFAULT 'N',
`server_replication` enum('Y','N') NOT NULL DEFAULT 'N',
`server_vars` enum('Y','N') NOT NULL DEFAULT 'N',
`server_charset` enum('Y','N') NOT NULL DEFAULT 'N',
`server_plugins` enum('Y','N') NOT NULL DEFAULT 'N',
`server_engine` enum('Y','N') NOT NULL DEFAULT 'N',
`db_structure` enum('Y','N') NOT NULL DEFAULT 'N',
`db_sql` enum('Y','N') NOT NULL DEFAULT 'N',
`db_search` enum('Y','N') NOT NULL DEFAULT 'N',
`db_qbe` enum('Y','N') NOT NULL DEFAULT 'N',
`db_export` enum('Y','N') NOT NULL DEFAULT 'N',
`db_import` enum('Y','N') NOT NULL DEFAULT 'N',
`db_operation` enum('Y','N') NOT NULL DEFAULT 'N',
`db_privileges` enum('Y','N') NOT NULL DEFAULT 'N',
`db_routines` enum('Y','N') NOT NULL DEFAULT 'N',
`db_events` enum('Y','N') NOT NULL DEFAULT 'N',
`db_triggers` enum('Y','N') NOT NULL DEFAULT 'N',
`db_tracking` enum('Y','N') NOT NULL DEFAULT 'N',
`db_designer` enum('Y','N') NOT NULL DEFAULT 'N',
`table_browse` enum('Y','N') NOT NULL DEFAULT 'N',
`table_structure` enum('Y','N') NOT NULL DEFAULT 'N',
`table_sql` enum('Y','N') NOT NULL DEFAULT 'N',
`table_search` enum('Y','N') NOT NULL DEFAULT 'N',
`table_insert` enum('Y','N') NOT NULL DEFAULT 'N',
`table_export` enum('Y','N') NOT NULL DEFAULT 'N',
`table_import` enum('Y','N') NOT NULL DEFAULT 'N',
`table_operation` enum('Y','N') NOT NULL DEFAULT 'N',
`table_tracking` enum('Y','N') NOT NULL DEFAULT 'N',
`table_triggers` enum('Y','N') NOT NULL DEFAULT 'N',
PRIMARY KEY (`usergroup`)
`tab` varchar(64) NOT NULL,
`allowed` enum('Y','N') NOT NULL DEFAULT 'N',
PRIMARY KEY (`usergroup`,`tab`,`allowed`)
)
COMMENT='User groups with configured menu items'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;

View File

@ -248,43 +248,9 @@ CREATE TABLE IF NOT EXISTS `pma__users` (
CREATE TABLE IF NOT EXISTS `pma__usergroups` (
`usergroup` varchar(64) NOT NULL,
`server_databases` enum('Y','N') NOT NULL DEFAULT 'N',
`server_sql` enum('Y','N') NOT NULL DEFAULT 'N',
`server_status` enum('Y','N') NOT NULL DEFAULT 'N',
`server_rights` enum('Y','N') NOT NULL DEFAULT 'N',
`server_export` enum('Y','N') NOT NULL DEFAULT 'N',
`server_import` enum('Y','N') NOT NULL DEFAULT 'N',
`server_settings` enum('Y','N') NOT NULL DEFAULT 'N',
`server_binlog` enum('Y','N') NOT NULL DEFAULT 'N',
`server_replication` enum('Y','N') NOT NULL DEFAULT 'N',
`server_vars` enum('Y','N') NOT NULL DEFAULT 'N',
`server_charset` enum('Y','N') NOT NULL DEFAULT 'N',
`server_plugins` enum('Y','N') NOT NULL DEFAULT 'N',
`server_engine` enum('Y','N') NOT NULL DEFAULT 'N',
`db_structure` enum('Y','N') NOT NULL DEFAULT 'N',
`db_sql` enum('Y','N') NOT NULL DEFAULT 'N',
`db_search` enum('Y','N') NOT NULL DEFAULT 'N',
`db_qbe` enum('Y','N') NOT NULL DEFAULT 'N',
`db_export` enum('Y','N') NOT NULL DEFAULT 'N',
`db_import` enum('Y','N') NOT NULL DEFAULT 'N',
`db_operation` enum('Y','N') NOT NULL DEFAULT 'N',
`db_privileges` enum('Y','N') NOT NULL DEFAULT 'N',
`db_routines` enum('Y','N') NOT NULL DEFAULT 'N',
`db_events` enum('Y','N') NOT NULL DEFAULT 'N',
`db_triggers` enum('Y','N') NOT NULL DEFAULT 'N',
`db_tracking` enum('Y','N') NOT NULL DEFAULT 'N',
`db_designer` enum('Y','N') NOT NULL DEFAULT 'N',
`table_browse` enum('Y','N') NOT NULL DEFAULT 'N',
`table_structure` enum('Y','N') NOT NULL DEFAULT 'N',
`table_sql` enum('Y','N') NOT NULL DEFAULT 'N',
`table_search` enum('Y','N') NOT NULL DEFAULT 'N',
`table_insert` enum('Y','N') NOT NULL DEFAULT 'N',
`table_export` enum('Y','N') NOT NULL DEFAULT 'N',
`table_import` enum('Y','N') NOT NULL DEFAULT 'N',
`table_operation` enum('Y','N') NOT NULL DEFAULT 'N',
`table_tracking` enum('Y','N') NOT NULL DEFAULT 'N',
`table_triggers` enum('Y','N') NOT NULL DEFAULT 'N',
PRIMARY KEY (`usergroup`)
`tab` varchar(64) NOT NULL,
`allowed` enum('Y','N') NOT NULL DEFAULT 'N',
PRIMARY KEY (`usergroup`,`tab`,`allowed`)
)
COMMENT='User groups with configured menu items'
COLLATE utf8_bin;

View File

@ -6,18 +6,17 @@
* @package PhpMyAdmin
*/
/**
* If we are sending the export file (as opposed to just displaying it
* as text), we have to bypass the usual PMA_Response mechanism
*/
if ($_POST['output_format'] == 'sendit') {
define('PMA_BYPASS_GET_INSTANCE', 1);
}
/**
* Get the variables sent or posted to this script and a core script
*/
if (!defined('TESTSUITE')) {
/**
* If we are sending the export file (as opposed to just displaying it
* as text), we have to bypass the usual PMA_Response mechanism
*/
if ($_POST['output_format'] == 'sendit') {
define('PMA_BYPASS_GET_INSTANCE', 1);
}
require_once 'libraries/common.inc.php';
require_once 'libraries/zip.lib.php';
require_once 'libraries/plugin_interface.lib.php';
@ -504,7 +503,7 @@ if (!defined('TESTSUITE')) {
. preg_replace('@[/\\\\]@', '_', $filename);
unset($message);
if (file_exists($save_filename)
&& ((! $quick_export && empty($onserverover))
&& ((! $quick_export && empty($_REQUEST['onserverover']))
|| ($quick_export
&& $_REQUEST['quick_export_onserverover'] != 'saveitover'))
) {

View File

@ -134,10 +134,8 @@ if ($server > 0 || count($cfg['Servers']) > 1
*/
if ($cfg['ServerDefault'] == 0
|| (! $cfg['NavigationDisplayServers']
&& (count($cfg['Servers']) > 1
|| ($server == 0 && count($cfg['Servers']) == 1)
)
)
&& (count($cfg['Servers']) > 1
|| ($server == 0 && count($cfg['Servers']) == 1)))
) {
echo '<li id="li_select_server" class="no_bullets" >';
include_once 'libraries/select_server.lib.php';
@ -257,7 +255,9 @@ if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
'li_server_type'
);
PMA_printListItem(
__('Server version:') . ' ' . PMA_MYSQL_STR_VERSION . ' - ' . PMA_MYSQL_VERSION_COMMENT,
__('Server version:')
. ' '
. PMA_MYSQL_STR_VERSION . ' - ' . PMA_MYSQL_VERSION_COMMENT,
'li_server_version'
);
PMA_printListItem(
@ -272,12 +272,12 @@ if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
echo ' <li id="li_select_mysql_charset">';
echo ' ' . __('Server charset:') . ' '
. ' <span lang="en" dir="ltr">'
. ' ' . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']] . "\n"
. ' (' . $mysql_charset_map['utf-8'] . ')' . "\n"
. ' </span>' . "\n"
. ' </li>' . "\n";
echo ' </ul>';
echo ' </div>';
. ' ' . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']]
. ' (' . $mysql_charset_map['utf-8'] . ')'
. ' </span>'
. ' </li>'
. ' </ul>'
. ' </div>';
}
if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
@ -290,7 +290,10 @@ if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
if ($server > 0) {
$client_version_str = $GLOBALS['dbi']->getClientInfo();
if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)
&& in_array($GLOBALS['cfg']['Server']['extension'], array('mysql', 'mysqli'))
&& in_array(
$GLOBALS['cfg']['Server']['extension'],
array('mysql', 'mysqli')
)
) {
$client_version_str = 'libmysql - ' . $client_version_str;
}
@ -500,7 +503,8 @@ if ($server > 0) {
) {
$msg = PMA_Message::notice(__('The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. To find out why click %shere%s.'));
$msg->addParam(
'<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?' . $common_url_query . '">',
'<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?'
. $common_url_query . '">',
false
);
$msg->addParam('</a>', false);
@ -587,7 +591,9 @@ if (file_exists('libraries/language_stats.inc.php')) {
&& $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold']
) {
trigger_error(
'You are using an incomplete translation, please help to make it better by [a@http://www.phpmyadmin.net/home_page/improve.php#translate@_blank]contributing[/a].',
'You are using an incomplete translation, please help to make it '
. 'better by [a@http://www.phpmyadmin.net/home_page/improve.php'
. '#translate@_blank]contributing[/a].',
E_USER_NOTICE
);
}

View File

@ -376,17 +376,19 @@ function PMA_showCurrentNavigation()
var $dbItem = highlightLoadedItem(
$('#pma_navigation_tree > div'), db, 'database', false, false
);
// open the table in the tree and select it
var $expander = $dbItem.children('div:first').children('a.expander');
// if not loaded or loaded but collapsed
if (! $expander.hasClass('loaded')
|| $expander.find('img').is('.ic_b_plus')
) {
expandTreeNode($expander, function() {
if ($dbItem) {
// open the table in the tree and select it
var $expander = $dbItem.children('div:first').children('a.expander');
// if not loaded or loaded but collapsed
if (! $expander.hasClass('loaded')
|| $expander.find('img').is('.ic_b_plus')
) {
expandTreeNode($expander, function() {
loadAndHighlightTableOrView($dbItem, table);
});
} else {
loadAndHighlightTableOrView($dbItem, table);
});
} else {
loadAndHighlightTableOrView($dbItem, table);
}
}
} else if (db) { // if we are at the database level
// open in the tree and select the database

View File

@ -143,7 +143,8 @@ RTE.COMMON = {
lineNumbers: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/x-mysql"
mode: "text/x-mysql",
lineWrapping: true
};
CodeMirror.fromTextArea($elm[0], opts);
} else {
@ -331,7 +332,8 @@ RTE.COMMON = {
lineNumbers: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/x-mysql"
mode: "text/x-mysql",
lineWrapping: true
};
if (typeof CodeMirror != 'undefined') {
that.syntaxHiglighter = CodeMirror.fromTextArea($elm[0], opts);

View File

@ -575,7 +575,8 @@ AJAX.registerOnload('server_privileges.js', function () {
lineNumbers: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/x-mysql"
mode: "text/x-mysql",
lineWrapping: true
}
);
}
@ -593,7 +594,8 @@ AJAX.registerOnload('server_privileges.js', function () {
lineNumbers: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/x-mysql"
mode: "text/x-mysql",
lineWrapping: true
}
);
}
@ -629,7 +631,8 @@ AJAX.registerOnload('server_privileges.js', function () {
lineNumbers: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/x-mysql"
mode: "text/x-mysql",
lineWrapping: true
}
);
}

View File

@ -94,7 +94,8 @@ AJAX.registerOnload('server_status_monitor.js', function () {
lineNumbers: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/x-mysql"
mode: "text/x-mysql",
lineWrapping: true
}
);
}

View File

@ -140,19 +140,16 @@ class PMA_Menu
$userTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
$sql_query = "SELECT * FROM " . $groupTable
. " WHERE `usergroup` = (SELECT usergroup FROM "
$sql_query = "SELECT `tab` FROM " . $groupTable
. " WHERE `allowed` = 'N' AND `usergroup` = (SELECT usergroup FROM "
. $userTable . " WHERE `username` = '"
. PMA_Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) . "')";
$result = PMA_queryAsControlUser($sql_query, false);
if ($result) {
$row = $GLOBALS['dbi']->fetchAssoc($result);
foreach ($allowedTabs as $key => $tab) {
$colName = $level . '_' . $key;
if (isset($row[$colName]) && $row[$colName] == 'N') {
unset($allowedTabs[$key]);
}
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
$tabName = substr($row['tab'], strpos($row['tab'], '_') + 1);
unset($allowedTabs[$tabName]);
}
}
}
@ -292,6 +289,7 @@ class PMA_Menu
{
$db_is_information_schema = $GLOBALS['dbi']->isSystemSchema($this->_db);
$tbl_is_view = PMA_Table::isView($this->_db, $this->_table);
$is_superuser = $GLOBALS['dbi']->isSuperuser();
$tabs = array();
@ -328,14 +326,26 @@ class PMA_Menu
$tabs['export']['text'] = __('Export');
/**
* Don't display "Import" and "Operations"
* for views and information_schema
* Don't display "Import" for views and information_schema
*/
if (! $tbl_is_view && ! $db_is_information_schema) {
$tabs['import']['icon'] = 'b_tblimport.png';
$tabs['import']['link'] = 'tbl_import.php';
$tabs['import']['text'] = __('Import');
}
if ($is_superuser && ! PMA_DRIZZLE && ! $db_is_information_schema) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivsdb'] = $this->_db;
$tabs['privileges']['args']['checkprivstable'] = $this->_table;
// stay on table view
$tabs['privileges']['args']['viewing_mode'] = 'table';
$tabs['privileges']['text'] = __('Privileges');
$tabs['privileges']['icon'] = 's_rights.png';
}
/**
* Don't display "Operations" for views and information_schema
*/
if (! $tbl_is_view && ! $db_is_information_schema) {
$tabs['operation']['icon'] = 'b_tblops.png';
$tabs['operation']['link'] = 'tbl_operations.php';
$tabs['operation']['text'] = __('Operations');
@ -425,7 +435,7 @@ class PMA_Menu
if ($is_superuser && ! PMA_DRIZZLE) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivs'] = $this->_db;
$tabs['privileges']['args']['checkprivsdb'] = $this->_db;
// stay on database view
$tabs['privileges']['args']['viewing_mode'] = 'db';
$tabs['privileges']['text'] = __('Privileges');
@ -521,6 +531,7 @@ class PMA_Menu
basename($GLOBALS['PMA_PHP_SELF']),
array('server_privileges.php', 'server_user_groups.php')
);
$tabs['rights']['args']['viewing_mode'] = 'server';
}
$tabs['export']['icon'] = 'b_export.png';

View File

@ -4114,6 +4114,7 @@ class PMA_Util
'insert' => __('Insert'),
'export' => __('Export'),
'import' => __('Import'),
'privileges' => __('Privileges'),
'operation' => __('Operations'),
'tracking' => __('Tracking'),
'triggers' => __('Triggers'),

View File

@ -0,0 +1,415 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Contains functions used by browse_foreigners.php
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Function to get html for relational field selection
*
* @param string $db current database
* @param string $table current table
* @param string $field field
* @param array $foreignData foreign column data
* @param string $fieldkey field key
* @param array $data data
*
* @return string
*/
function PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignData,
$fieldkey, $data
) {
$gotopage = PMA_getHtmlForGotoPage($foreignData);
$showall = PMA_getHtmlForShowAll($foreignData);
$output = '<form action="browse_foreigners.php" method="post">'
. '<fieldset>'
. PMA_URL_getHiddenInputs($db, $table)
. '<input type="hidden" name="field" value="' . htmlspecialchars($field)
. '" />'
. '<input type="hidden" name="fieldkey" value="'
. (isset($fieldkey) ? htmlspecialchars($fieldkey) : '') . '" />';
if (isset($_REQUEST['rownumber'])) {
$output .= '<input type="hidden" name="rownumber" value="'
. htmlspecialchars($_REQUEST['rownumber']) . '" />';
}
$output .= '<span class="formelement">'
. '<label for="input_foreign_filter">' . __('Search:') . '</label>'
. '<input type="text" name="foreign_filter" '
. 'id="input_foreign_filter" value="'
. (isset($_REQUEST['foreign_filter'])
? htmlspecialchars($_REQUEST['foreign_filter'])
: '')
. '" />'
. '<input type="submit" name="submit_foreign_filter" value="'
. __('Go') . '" />'
. '</span>'
. '<span class="formelement">' . $gotopage . '</span>'
. '<span class="formelement">' . $showall . '</span>'
. '</fieldset>'
. '</form>';
$output .= '<table width="100%">';
if (is_array($foreignData['disp_row'])) {
$header = '<tr>
<th>' . __('Keyname') . '</th>
<th>' . __('Description') . '</th>
<td width="20%"></td>
<th>' . __('Description') . '</th>
<th>' . __('Keyname') . '</th>
</tr>';
$output .= '<thead>' . $header . '</thead>' . "\n"
. '<tfoot>' . $header . '</tfoot>' . "\n"
. '<tbody>' . "\n";
$values = array();
$keys = array();
foreach ($foreignData['disp_row'] as $relrow) {
if ($foreignData['foreign_display'] != false) {
$values[] = $relrow[$foreignData['foreign_display']];
} else {
$values[] = '';
}
$keys[] = $relrow[$foreignData['foreign_field']];
}
asort($keys);
$hcount = 0;
$odd_row = true;
$val_ordered_current_row = 0;
$val_ordered_current_equals_data = false;
$key_ordered_current_equals_data = false;
foreach ($keys as $key_ordered_current_row => $value) {
$hcount++;
if ($GLOBALS['cfg']['RepeatCells'] > 0
&& $hcount > $GLOBALS['cfg']['RepeatCells']
) {
$output .= $header;
$hcount = 0;
$odd_row = true;
}
$key_ordered_current_key = $keys[$key_ordered_current_row];
$key_ordered_current_val = $values[$key_ordered_current_row];
$val_ordered_current_key = $keys[$val_ordered_current_row];
$val_ordered_current_val = $values[$val_ordered_current_row];
$val_ordered_current_row++;
$pmaString = $GLOBALS['PMA_String'];
$limitChars = $GLOBALS['cfg']['LimitChars'];
if ($pmaString->strlen($val_ordered_current_val) <= $limitChars) {
$val_ordered_current_val = htmlspecialchars(
$val_ordered_current_val
);
$val_ordered_current_val_title = '';
} else {
$val_ordered_current_val_title = htmlspecialchars(
$val_ordered_current_val
);
$val_ordered_current_val = htmlspecialchars(
$pmaString->substr(
$val_ordered_current_val, 0, $limitChars
)
. '...'
);
}
if ($pmaString->strlen($key_ordered_current_val) <= $limitChars) {
$key_ordered_current_val = htmlspecialchars(
$key_ordered_current_val
);
$key_ordered_current_val_title = '';
} else {
$key_ordered_current_val_title = htmlspecialchars(
$key_ordered_current_val
);
$key_ordered_current_val = htmlspecialchars(
$pmaString->substr(
$key_ordered_current_val, 0, $limitChars
) . '...'
);
}
if (! empty($data)) {
$val_ordered_current_equals_data
= $val_ordered_current_key == $data;
$key_ordered_current_equals_data
= $key_ordered_current_key == $data;
}
$output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$odd_row = ! $odd_row;
$output .= PMA_getHtmlForColumnElement(
'class="nowrap"', $key_ordered_current_equals_data,
$key_ordered_current_key, $key_ordered_current_val,
$key_ordered_current_val_title, $field
);
$output .= PMA_getHtmlForColumnElement(
'', $key_ordered_current_equals_data, $key_ordered_current_key,
$key_ordered_current_val, $key_ordered_current_val_title, $field
);
$output .= '<td width="20%">'
. '<img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png" alt=""'
. ' width="1" height="1" /></td>';
$output .= PMA_getHtmlForColumnElement(
'', $val_ordered_current_equals_data, $key_ordered_current_key,
$val_ordered_current_val, $val_ordered_current_val_title, $field
);
$output .= PMA_getHtmlForColumnElement(
'class="nowrap"', $val_ordered_current_equals_data,
$key_ordered_current_key, $val_ordered_current_val,
$val_ordered_current_val_title, $field
);
$output .= '</tr>';
} // end while
}
$output .= '</tbody>'
. '</table>';
return $output;
}
/**
* Function to get html for each column element
*
* @param string $cssClass class="nowrap" or ''
* @param bool $currentEqualsData whether current equals data
* @param string $currentKey current key
* @param string $currentVal current value
* @param string $currentTitle current title
* @param string $field field
*
* @return string
*/
function PMA_getHtmlForColumnElement($cssClass, $currentEqualsData, $currentKey,
$currentVal, $currentTitle, $field
) {
$output = '<td ' . $cssClass . '>'
. ($currentEqualsData ? '<strong>' : '')
. '<a href="#" title="' . __('Use this value')
. ($currentTitle != ''
? ': ' . $currentTitle
: '')
. '" onclick="formupdate(\'' . md5($field) . '\', \''
. PMA_jsFormat($currentKey, false)
. '\'); return false;">';
if ($cssClass !== '') {
$output .= htmlspecialchars($currentKey);
} else {
$output .= $currentVal;
}
$output .= '</a>' . ($currentEqualsData ? '</strong>' : '') . '</td>';
return $output;
}
/**
* Function to get javascript code to handle display selection for relational
* field values
*
* @return string
*/
function PMA_getJsScriptToHandleSelectRelationalFields()
{
$element_name = PMA_getElementName();
$fieldkey = PMA_getFieldKey();
$error = PMA_getJsError();
$code = <<<EOC
self.focus();
function formupdate(fieldmd5, key) {
var \$inline = window.opener.jQuery('.browse_foreign_clicked');
if (\$inline.length != 0) {
\$inline.removeClass('browse_foreign_clicked')
// for grid editing,
// puts new value in the previous element which is
// a span with class curr_value, and trigger .change()
.prev('.curr_value').text(key).change();
// for zoom-search editing, puts new value in the previous
// element which is an input field
\$inline.prev('input[type=text]').val(key);
self.close();
return false;
}
if (opener && opener.document && opener.document.insertForm) {
var field = 'fields';
var field_null = 'fields_null';
$element_name
var element_name_alt = field + '[$fieldkey]';
if (opener.document.insertForm.elements[element_name]) {
// Edit/Insert form
opener.document.insertForm.elements[element_name].value = key;
if (opener.document.insertForm.elements[null_name]) {
opener.document.insertForm.elements[null_name].checked = false;
}
self.close();
return false;
} else if (opener.document.insertForm.elements[element_name_alt]) {
// Search form
opener.document.insertForm.elements[element_name_alt].value = key;
self.close();
return false;
}
}
alert('$error');
}
EOC;
return $code;
}
/**
* Function to get formatted error message for javascript
*
* @return string
*/
function PMA_getJsError()
{
return PMA_jsFormat(
__(
'The target browser window could not be updated. '
. 'Maybe you have closed the parent window, or '
. 'your browser\'s security settings are '
. 'configured to block cross-window updates.'
)
);
}
/**
* Function to get the field key
*
* @return string
*/
function PMA_getFieldKey()
{
if (! isset($_REQUEST['fieldkey']) || ! is_numeric($_REQUEST['fieldkey'])) {
$fieldkey = 0;
} else {
$fieldkey = $_REQUEST['fieldkey'];
}
return $fieldkey;
}
/**
* Function to get the element name
*
* @return string
*/
function PMA_getElementName()
{
// When coming from Table/Zoom search
if (isset($_REQUEST['fromsearch'])) {
// In table or zoom search, input fields are named "criteriaValues"
$element_name = " var field = 'criteriaValues';\n";
} else {
// In insert/edit, input fields are named "fields"
$element_name = " var field = 'fields';\n";
}
if (isset($_REQUEST['rownumber'])) {
$element_name .= " var element_name = field + '[multi_edit]["
. htmlspecialchars($_REQUEST['rownumber']) . "][' + fieldmd5 + ']';\n"
. " var null_name = field_null + '[multi_edit]["
. htmlspecialchars($_REQUEST['rownumber']) . "][' + fieldmd5 + ']';\n";
} else {
$element_name .= "var element_name = field + '[]'";
}
return $element_name;
}
/**
* Function to get html for show all case
*
* @param array $foreignData foreign data
*
* @return string
*/
function PMA_getHtmlForShowAll($foreignData)
{
$showall = '';
if (is_array($foreignData['disp_row'])) {
if ($GLOBALS['cfg']['ShowAll']
&& ($foreignData['the_total'] > $GLOBALS['cfg']['MaxRows'])
) {
$showall = '<input type="submit" name="foreign_navig" value="'
. __('Show all') . '" />';
}
}
return $showall;
}
/**
* Function to get html for the goto page option
*
* @param array $foreignData foreign data
*
* @return string
*/
function PMA_getHtmlForGotoPage($foreignData)
{
$gotopage = '';
isset($_REQUEST['pos']) ? $pos = $_REQUEST['pos'] : $pos = 0;
if (is_array($foreignData['disp_row'])) {
$session_max_rows = $GLOBALS['cfg']['MaxRows'];
$pageNow = @floor($pos / $session_max_rows) + 1;
$nbTotalPage = @ceil($foreignData['the_total'] / $session_max_rows);
if ($foreignData['the_total'] > $GLOBALS['cfg']['MaxRows']) {
$gotopage = PMA_Util::pageselector(
'pos',
$session_max_rows,
$pageNow,
$nbTotalPage,
200,
5,
5,
20,
10,
__('Page number:')
);
}
}
return $gotopage;
}
/**
* Function to get foreign limit
*
* @param string $foreign_navig foreign navigation
*
* @return string
*/
function PMA_getForeignLimit($foreign_navig)
{
if (isset($foreign_navig) && $foreign_navig == __('Show all')) {
return null;
}
isset($_REQUEST['pos']) ? $pos = $_REQUEST['pos'] : $pos = 0;
return 'LIMIT ' . $pos . ', ' . $GLOBALS['cfg']['MaxRows'] . ' ';
}
?>

View File

@ -165,7 +165,7 @@ function PMA_buildHtmlForDb(
. 'PMA_commonActions.setDb(\''
. PMA_jsFormat($current['SCHEMA_NAME']) . '\');'
. '" href="server_privileges.php?' . $url_query
. '&amp;checkprivs=' . urlencode($current['SCHEMA_NAME'])
. '&amp;checkprivsdb=' . urlencode($current['SCHEMA_NAME'])
. '" title="'
. sprintf(
__('Check privileges for database &quot;%s&quot;.'),

View File

@ -150,35 +150,35 @@ $cfg['Servers'][$i]['ssl'] = false;
*
* @global string $cfg['Servers'][$i]['ssl_key']
*/
$cfg['Servers'][$i]['ssl_key'] = NULL;
$cfg['Servers'][$i]['ssl_key'] = null;
/**
* Path to the cert file when using SSL for connecting to the MySQL server
*
* @global string $cfg['Servers'][$i]['ssl_cert']
*/
$cfg['Servers'][$i]['ssl_cert'] = NULL;
$cfg['Servers'][$i]['ssl_cert'] = null;
/**
* Path to the CA file when using SSL for connecting to the MySQL server
*
* @global string $cfg['Servers'][$i]['ssl_ca']
*/
$cfg['Servers'][$i]['ssl_ca'] = NULL;
$cfg['Servers'][$i]['ssl_ca'] = null;
/**
* Directory containing trusted SSL CA certificates in PEM format
*
* @global string $cfg['Servers'][$i]['ssl_ca_path']
*/
$cfg['Servers'][$i]['ssl_ca_path'] = NULL;
$cfg['Servers'][$i]['ssl_ca_path'] = null;
/**
* List of allowable ciphers for SSL connections to the MySQL server
*
* @global string $cfg['Servers'][$i]['ssl_ciphers']
*/
$cfg['Servers'][$i]['ssl_ciphers'] = NULL;
$cfg['Servers'][$i]['ssl_ciphers'] = null;
/**
* How to connect to MySQL server ('tcp' or 'socket')

View File

@ -128,7 +128,7 @@ class ConfigFile
* Sets names of config options which will be placed in config file even if
* they are set to their default values (use only full paths)
*
* @param array $keys
* @param array $keys the names of the config options
*
* @return void
*/
@ -173,7 +173,8 @@ class ConfigFile
* {@link updateWithGlobalConfig()} or reading
* by {@link getConfig()} or {@link getConfigArray()}
*
* @param array $mapping
* @param array $mapping Contains the mapping of "Server/config options"
* to "Server/1/config options"
*
* @return void
*/
@ -195,7 +196,7 @@ class ConfigFile
/**
* Sets configuration data (overrides old data)
*
* @param array $cfg
* @param array $cfg Configuration options
*
* @return void
*/

View File

@ -51,13 +51,13 @@ function PMA_getIndexedColumns()
* Initiate the column creation statement according to the table creation or
* add columns to a existing table
*
* @param int $field_cnt number of columns
* @param int $field_primary primary index field
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
* @param int $field_cnt number of columns
* @param int &$field_primary primary index field
* @param boolean $is_create_tbl true if requirement is to get the statement
* for table creation
*
* @return array $definitions An array of initial sql statements
* according to the request
* @return array $definitions An array of initial sql statements
* according to the request
*/
function PMA_buildColumnCreationStatement(
$field_cnt, &$field_primary, $is_create_tbl = true

View File

@ -2181,6 +2181,7 @@ function PMA_transformEditedValues($db, $table,
* @param array $multi_edit_colummns multiple edit column array
* @param array $multi_edit_columns_name multiple edit columns name array
* @param array $multi_edit_funcs multiple edit functions array
* @param array $multi_edit_salt multiple edit array with encryption salt
* @param array $gis_from_text_functions array that contains gis from text functions
* @param string $current_value current value in the column
* @param array $gis_from_wkb_functions initialy $val is $multi_edit_colummns[$key]

View File

@ -85,7 +85,8 @@ class PMA_NavigationHeader
// prevent XSS, see PMASA-2013-9
// if link has protocol, allow only http and https
if (preg_match('/^[a-z]+:/i', $logo_link)
&& ! preg_match('/^https?:/i', $logo_link)) {
&& ! preg_match('/^https?:/i', $logo_link)
) {
$logo_link = 'index.php';
}
$retval .= ' <a href="' . $logo_link;

View File

@ -94,14 +94,19 @@ function PMA_rangeOfUsers($initial = '')
*
* @param array $row the row
* @param boolean $enableHTML add <dfn> tag with tooltips
* @param boolean $tablePrivs whether row contains table privileges
*
* @global resource $user_link the database connection
*
* @return array
*/
function PMA_extractPrivInfo($row = '', $enableHTML = false)
function PMA_extractPrivInfo($row = '', $enableHTML = false, $tablePrivs = false)
{
$grants = PMA_getGrantsArray();
if ($tablePrivs) {
$grants = PMA_getTableGrantsArray();
} else {
$grants = PMA_getGrantsArray();
}
if (! empty($row) && isset($row['Table_priv'])) {
$row1 = $GLOBALS['dbi']->fetchSingleRow(
@ -178,6 +183,57 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false)
return $privs;
} // end of the 'PMA_extractPrivInfo()' function
/**
* Returns an array of table grants and their descriptions
*
* @return array array of table grants
*/
function PMA_getTableGrantsArray()
{
return array(
array(
'Delete',
'DELETE',
$GLOBALS['strPrivDescDelete']
),
array(
'Create',
'CREATE',
$GLOBALS['strPrivDescCreateTbl']
),
array(
'Drop',
'DROP',
$GLOBALS['strPrivDescDropTbl']
),
array(
'Index',
'INDEX',
$GLOBALS['strPrivDescIndex']
),
array(
'Alter',
'ALTER',
$GLOBALS['strPrivDescAlter']
),
array(
'Create View',
'CREATE_VIEW',
$GLOBALS['strPrivDescCreateView']
),
array(
'Show view',
'SHOW_VIEW',
$GLOBALS['strPrivDescShowView']
),
array(
'Trigger',
'TRIGGER',
$GLOBALS['strPrivDescTrigger']
),
);
}
/**
* Get the grants array which contains all the privilege types
* and relevent grant messages
@ -444,7 +500,7 @@ function PMA_getHtmlToChooseUserGroup($username)
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
$userGroups = array();
$sql_query = "SELECT `usergroup` FROM " . $groupTable;
$sql_query = "SELECT DISTINCT `usergroup` FROM " . $groupTable;
$result = PMA_queryAsControlUser($sql_query, false);
if ($result) {
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
@ -1730,9 +1786,11 @@ function PMA_getListOfPrivilegesAndComparedPrivileges()
/**
* Get the HTML for user form and check the privileges for a particular database.
*
* @param string $db database name
*
* @return string $html_output
*/
function PMA_getHtmlForSpecificDbPrivileges()
function PMA_getHtmlForSpecificDbPrivileges($db)
{
// check the privileges for a particular database.
$html_output = '<form id="usersForm" action="server_privileges.php">'
@ -1743,8 +1801,8 @@ function PMA_getHtmlForSpecificDbPrivileges()
. sprintf(
__('Users having access to &quot;%s&quot;'),
'<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?'
. PMA_URL_getCommon($_REQUEST['checkprivs']) . '">'
. htmlspecialchars($_REQUEST['checkprivs'])
. PMA_URL_getCommon($db) . '">'
. htmlspecialchars($db)
. '</a>'
)
. "\n"
@ -1765,27 +1823,35 @@ function PMA_getHtmlForSpecificDbPrivileges()
list($list_of_privileges, $list_of_compared_privileges)
= PMA_getListOfPrivilegesAndComparedPrivileges();
$sql_query = '(SELECT ' . $list_of_privileges . ', `Db`'
$sql_query = '(SELECT ' . $list_of_privileges . ', `Db`, \'d\' AS `Type`'
.' FROM `mysql`.`db`'
.' WHERE \'' . PMA_Util::sqlAddSlashes($_REQUEST['checkprivs'])
.' WHERE \'' . PMA_Util::sqlAddSlashes($db)
. "'"
.' LIKE `Db`'
.' AND NOT (' . $list_of_compared_privileges. ')) '
.'UNION '
.'(SELECT ' . $list_of_privileges . ', \'*\' AS `Db`'
.'(SELECT ' . $list_of_privileges . ', \'*\' AS `Db`, \'g\' AS `Type`'
.' FROM `mysql`.`user` '
.' WHERE NOT (' . $list_of_compared_privileges . ')) '
.' ORDER BY `User` ASC,'
.' `Host` ASC,'
.' `Db` ASC;';
$res = $GLOBALS['dbi']->query($sql_query);
$row = $GLOBALS['dbi']->fetchAssoc($res);
if ($row) {
$found = true;
$privMap = array();
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
$user = $row['User'];
$host = $row['Host'];
if (! isset($privMap[$user])) {
$privMap[$user] = array();
}
if (! isset($privMap[$user][$host])) {
$privMap[$user][$host] = array();
}
$privMap[$user][$host][] = $row;
}
$html_output .= PMA_getHtmlTableBodyForSpecificDbPrivs(
$found, $row, $odd_row, $res
);
$html_output .= PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db);
$html_output .= '</table>'
. '</fieldset>'
. '</form>' . "\n";
@ -1807,11 +1873,11 @@ function PMA_getHtmlForSpecificDbPrivileges()
. PMA_URL_getCommon(
array(
'adduser' => 1,
'dbname' => $_REQUEST['checkprivs'],
'dbname' => $db,
)
)
.'" rel="'
. PMA_URL_getCommon(array('checkprivs' => $_REQUEST['checkprivs']))
. PMA_URL_getCommon(array('checkprivsdb' => $db))
. '" class="ajax" name="db_specific">' . "\n"
. PMA_Util::getIcon('b_usradd.png')
. ' ' . __('Add user') . '</a>' . "\n";
@ -1822,113 +1888,266 @@ function PMA_getHtmlForSpecificDbPrivileges()
}
/**
* Get HTML snippet for table body of specific database privileges
* Get the HTML for user form and check the privileges for a particular table.
*
* @param boolean $found whether user found or not
* @param array $row array of rows from mysql,
* db table with list of privileges
* @param boolean $odd_row whether odd or not
* @param string $res ran sql query
* @param string $db database name
* @param string $table table name
*
* @return string $html_output
*/
function PMA_getHtmlTableBodyForSpecificDbPrivs($found, $row, $odd_row,
$res
) {
$html_output = '<tbody>' . "\n";
if ($found) {
while (true) {
// prepare the current user
$current_privileges = array();
$current_user = $row['User'];
$current_host = $row['Host'];
while ($row
&& $current_user == $row['User']
&& $current_host == $row['Host']
) {
$current_privileges[] = $row;
$row = $GLOBALS['dbi']->fetchAssoc($res);
}
$html_output .= '<tr '
. 'class="noclick ' . ($odd_row ? 'odd' : 'even')
. '">' . "\n"
. '<td';
if (count($current_privileges) > 1) {
$html_output .= ' rowspan="' . count($current_privileges) . '"';
}
$html_output .= '>'
. (empty($current_user)
? '<span style="color: #FF0000">' . __('Any') . '</span>'
: htmlspecialchars($current_user)) . "\n"
. '</td>' . "\n";
function PMA_getHtmlForSpecificTablePrivileges($db, $table)
{
// check the privileges for a particular table.
$html_output = '<form id="usersForm" action="server_privileges.php">';
$html_output .= '<fieldset>';
$html_output .= '<legend>'
. PMA_Util::getIcon('b_usrcheck.png')
. sprintf(
__('Users having access to &quot;%s&quot;'),
'<a href="' . $GLOBALS['cfg']['DefaultTabTable']
. PMA_URL_getCommon(
array(
'db' => $db,
'table' => $table,
)
) . '">'
. htmlspecialchars($db) . '.' . htmlspecialchars($table)
. '</a>'
)
. '</legend>';
$html_output .= '<td';
if (count($current_privileges) > 1) {
$html_output .= ' rowspan="' . count($current_privileges) . '"';
}
$html_output .= '>'
. htmlspecialchars($current_host) . '</td>' . "\n";
for ($i = 0; $i < count($current_privileges); $i++) {
$current = $current_privileges[$i];
$html_output .= '<td>' . "\n"
. ' ';
if (! isset($current['Db']) || $current['Db'] == '*') {
$html_output .= __('global');
} elseif (
$current['Db'] == PMA_Util::escapeMysqlWildcards(
$_REQUEST['checkprivs']
)
) {
$html_output .= __('database-specific');
$html_output .= '<table id="tablespecificuserrights" class="data">';
$html_output .= '<thead>'
. '<tr><th>' . __('User') . '</th>'
. '<th>' . __('Host') . '</th>'
. '<th>' . __('Type') . '</th>'
. '<th>' . __('Privileges') . '</th>'
. '<th>' . __('Grant') . '</th>'
. '<th>' . __('Action') . '</th>'
. '</tr>'
. '</thead>';
list($list_of_privileges, $list_of_compared_privileges)
= PMA_getListOfPrivilegesAndComparedPrivileges();
$sql_query
= "("
. " SELECT " . $list_of_privileges . ", '*' AS `Db`, 'g' AS `Type`"
. " FROM `mysql`.`user`"
. " WHERE NOT (" . $list_of_compared_privileges . ")"
. ")"
. " UNION "
. "("
. " SELECT " . $list_of_privileges . ", `Db`, 'd' AS `Type`"
. " FROM `mysql`.`db`"
. " WHERE '" . PMA_Util::sqlAddSlashes($db) . "' LIKE `Db`"
. " AND NOT (" . $list_of_compared_privileges. ")"
. ")"
. " ORDER BY `User` ASC, `Host` ASC, `Db` ASC;";
$res = $GLOBALS['dbi']->query($sql_query);
$privMap = array();
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
$user = $row['User'];
$host = $row['Host'];
if (! isset($privMap[$user])) {
$privMap[$user] = array();
}
if (! isset($privMap[$user][$host])) {
$privMap[$user][$host] = array();
}
$privMap[$user][$host][] = $row;
}
$sql_query = "SELECT `User`, `Host`, `Db`,"
. " 't' AS `Type`, `Table_name`, `Table_priv`"
. " FROM `mysql`.`tables_priv`"
. " WHERE '" . PMA_Util::sqlAddSlashes($db) . "' LIKE `Db`"
. " AND '" . PMA_Util::sqlAddSlashes($table) . "' LIKE `Table_name`"
. " AND NOT (`Table_priv` = '' AND Column_priv = '')"
. " ORDER BY `User` ASC, `Host` ASC, `Db` ASC, `Table_priv` ASC;";
$res = $GLOBALS['dbi']->query($sql_query);
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
$user = $row['User'];
$host = $row['Host'];
if (! isset($privMap[$user])) {
$privMap[$user] = array();
}
if (! isset($privMap[$user][$host])) {
$privMap[$user][$host] = array();
}
$privMap[$user][$host][] = $row;
}
$html_output .= PMA_getHtmlTableBodyForSpecificDbOrTablePrivs(
$privMap, $db, $table
);
$html_output .= '</table>';
$html_output .= '</fieldset>';
$html_output .= '</form>';
// Offer to create a new user for the current database
$html_output .= '<fieldset id="fieldset_add_user">'
. '<legend>' . _pgettext('Create new user', 'New') . '</legend>';
$html_output .= '<a href="server_privileges.php'
. PMA_URL_getCommon(
array(
'adduser' => 1,
'dbname' => $db,
'tablename' => $table
)
)
. '" rel="' . PMA_URL_getCommon(
array('checkprivsdb' => $db, 'checkprivstable' => $table)
)
. '" class="ajax" name="table_specific">'
. PMA_Util::getIcon('b_usradd.png') . __('Add user') . '</a>';
$html_output .= '</fieldset>';
return $html_output;
}
/**
* Get HTML snippet for table body of specific database or table privileges
*
* @param boolean $privMap priviledge map
* @param boolean $db database
* @param boolean $table table
*
* @return string $html_output
*/
function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = null)
{
$html_output = '<tbody>';
$odd_row = true;
if (! empty($privMap)) {
foreach ($privMap as $current_user => $val) {
foreach ($val as $current_host => $current_privileges) {
$html_output .= '<tr class="noclick '
. ($odd_row ? 'odd' : 'even') . '">';
// user
$html_output .= '<td';
if (count($current_privileges) > 1) {
$html_output .= ' rowspan="' . count($current_privileges) . '"';
}
$html_output .= '>';
if (empty($current_user)) {
$html_output .= '<span style="color: #FF0000">'
. __('Any') . '</span>';
} else {
$html_output .= __('wildcard'). ': '
. '<code>' . htmlspecialchars($current['Db']) . '</code>';
$html_output .= htmlspecialchars($current_user);
}
$html_output .= "\n"
. '</td>' . "\n";
$html_output .= '</td>';
$html_output .='<td>' . "\n"
. '<code>' . "\n"
. ''
. join(
',' . "\n" . ' ',
PMA_extractPrivInfo($current, true)
)
. "\n"
. '</code>' . "\n"
. '</td>' . "\n";
$html_output .= '<td>' . "\n"
. '' . ($current['Grant_priv'] == 'Y' ? __('Yes') : __('No'))
. "\n"
. '</td>' . "\n"
. '<td>' . "\n";
$html_output .= PMA_getUserEditLink(
$current_user, $current_host,
(isset($current['Db']) && $current['Db'] != '*')
? $current['Db'] : ''
);
$html_output .= '</td>' . "\n"
. ' </tr>' . "\n";
if (($i + 1) < count($current_privileges)) {
$html_output .= '<tr '
. 'class="noclick ' . ($odd_row ? 'odd' : 'even') . '">'
. "\n";
// host
$html_output .= '<td';
if (count($current_privileges) > 1) {
$html_output .= ' rowspan="' . count($current_privileges) . '"';
}
$html_output .= '>';
$html_output .= htmlspecialchars($current_host);
$html_output .= '</td>';
for ($i = 0; $i < count($current_privileges); $i++) {
$current = $current_privileges[$i];
// type
$html_output .= '<td>';
if ($current['Type'] == 'g') {
$html_output .= __('global');
} elseif ($current['Type'] == 'd') {
if ($current['Db'] == PMA_Util::escapeMysqlWildcards($db)) {
$html_output .= __('database-specific');
} else {
$html_output .= __('wildcard'). ': '
. '<code>'
. htmlspecialchars($current['Db'])
. '</code>';
}
} elseif ($current['Type'] == 't') {
$html_output .= __('table-specific');
}
$html_output .= '</td>';
// privileges
$html_output .= '<td>';
if (isset($current['Table_name'])) {
$privList = explode(',', $current['Table_priv']);
$privs = array();
$grantsArr = PMA_getTableGrantsArray();
foreach ($grantsArr as $grant) {
$privs[$grant[0]] = 'N';
foreach ($privList as $priv) {
if ($grant[0] == $priv) {
$privs[$grant[0]] = 'Y';
}
}
}
$html_output .= '<code>'
. join(
',',
PMA_extractPrivInfo($privs, true, true)
)
. '</code>';
} else {
$html_output .= '<code>'
. join(
',',
PMA_extractPrivInfo($current, true, false)
)
. '</code>';
}
$html_output .= '</td>';
// grant
$html_output .= '<td>';
$containsGrant = false;
if (isset($current['Table_name'])) {
$privList = explode(',', $current['Table_priv']);
foreach ($privList as $priv) {
if ($priv == 'Grant') {
$containsGrant = true;
}
}
} else {
$containsGrant = $current['Grant_priv'] == 'Y';
}
$html_output .= ($containsGrant ? __('Yes') : __('No'));
$html_output .= '</td>';
// action
$html_output .= '<td>';
$specific_db = (isset($current['Db']) && $current['Db'] != '*')
? $current['Db'] : '';
$specific_table = (isset($current['Table_name'])
&& $current['Table_name'] != '*')
? $current['Table_name'] : '';
$html_output .= PMA_getUserEditLink(
$current_user,
$current_host,
$specific_db,
$specific_table
);
$html_output .= '</td>';
$html_output .= '</tr>';
if (($i + 1) < count($current_privileges)) {
$html_output .= '<tr class="noclick '
. ($odd_row ? 'odd' : 'even') . '">';
}
}
$odd_row = ! $odd_row;
}
if (empty($row)) {
break;
}
$odd_row = ! $odd_row;
}
} else {
$html_output .= '<tr class="odd">' . "\n"
. '<td colspan="6">' . "\n"
. ' ' . __('No user found.') . "\n"
. '</td>' . "\n"
. '</tr>' . "\n";
$html_output .= '<tr class="odd">'
. '<td colspan="6">'
. __('No user found.')
. '</td>'
. '</tr>';
}
$html_output .= '</tbody>' . "\n";
$html_output .= '</tbody>';
return $html_output;
}
@ -3033,11 +3252,11 @@ function PMA_updatePrivileges($username, $hostname, $tablename, $dbname)
// See https://sourceforge.net/p/phpmyadmin/bugs/3270/
$sql_query0 = '';
}
if (isset($sql_query1) && ! $GLOBALS['dbi']->tryQuery($sql_query1)) {
if (! empty($sql_query1) && ! $GLOBALS['dbi']->tryQuery($sql_query1)) {
// this one may fail, too...
$sql_query1 = '';
}
if (isset($sql_query2)) {
if (! empty($sql_query2)) {
$GLOBALS['dbi']->query($sql_query2);
} else {
$sql_query2 = '';
@ -3426,7 +3645,7 @@ function PMA_getHtmlHeaderForDisplayUserProperties(
. __('Edit Privileges:') . ' '
. __('User');
if (isset($dbname)) {
if (! empty($dbname)) {
$html_output .= ' <i><a href="server_privileges.php'
. PMA_URL_getCommon(
array(
@ -3442,7 +3661,7 @@ function PMA_getHtmlHeaderForDisplayUserProperties(
$html_output .= ' - ';
$html_output .= $dbname_is_wildcard ? __('Databases') : __('Database');
if (isset($_REQUEST['tablename'])) {
if (! empty($_REQUEST['tablename'])) {
$html_output .= ' <i><a href="server_privileges.php'
. PMA_URL_getCommon(
array(
@ -3582,342 +3801,6 @@ function PMA_getHtmlForDisplayUserOverviewPage($pmaThemeImage, $text_dir)
return $html_output;
}
/**
* Return HTML to list the users belonging to a given user group
*
* @param string $userGroup user group name
*
* @return HTML to list the users belonging to a given user group
*/
function PMA_getHtmlForListingUsersofAGroup($userGroup)
{
$html_output = '<h2>'
. sprintf(__('Users of \'%s\' user group'), htmlspecialchars($userGroup))
. '</h2>';
$usersTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
$sql_query = "SELECT `username` FROM " . $usersTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
$result = PMA_queryAsControlUser($sql_query, false);
if ($result) {
if ($GLOBALS['dbi']->numRows($result) == 0) {
$html_output .= '<p>'
. __('No users were found belonging to this user group.')
. '</p>';
} else {
$html_output .= '<table>'
. '<thead><tr><th>#</th><th>' . __('User') . '</th></tr></thead>'
. '<tbody>';
$i = 0;
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
$i++;
$html_output .= '<tr>'
. '<td>' . $i . ' </td>'
. '<td>' . htmlspecialchars($row[0]) . '</td>'
. '</tr>';
}
$html_output .= '</tbody>'
. '</table>';
}
}
$GLOBALS['dbi']->freeResult($result);
return $html_output;
}
/**
* Returns HTML for the 'user groups' table
*
* @return string HTML for the 'user groups' table
*/
function PMA_getHtmlForUserGroupsTable()
{
$tabs = PMA_Util::getMenuTabList();
$html_output = '<h2>' . __('User groups') . '</h2>';
$groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
$sql_query = "SELECT * FROM " . $groupTable . " ORDER BY `usergroup` ASC";
$result = PMA_queryAsControlUser($sql_query, false);
if ($result && $GLOBALS['dbi']->numRows($result)) {
$html_output .= '<form name="userGroupsForm" id="userGroupsForm"'
. ' action="server_privileges.php" method="post">';
$html_output .= PMA_URL_getHiddenInputs();
$html_output .= '<table id="userGroupsTable">';
$html_output .= '<thead><tr>';
$html_output .= '<th style="white-space: nowrap">'
. __('User group') . '</th>';
$html_output .= '<th>' . __('Server level tabs') . '</th>';
$html_output .= '<th>' . __('Database level tabs') . '</th>';
$html_output .= '<th>' . __('Table level tabs') . '</th>';
$html_output .= '<th>' . __('Action') . '</th>';
$html_output .= '</tr></thead>';
$html_output .= '<tbody>';
$odd = true;
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
$html_output .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
$html_output .= '<td>' . htmlspecialchars($row['usergroup']) . '</td>';
$html_output .= '<td>' . _getAllowedTabNames($row, 'server') . '</td>';
$html_output .= '<td>' . _getAllowedTabNames($row, 'db') . '</td>';
$html_output .= '<td>' . _getAllowedTabNames($row, 'table') . '</td>';
$html_output .= '<td>';
$html_output .= '<a class="" href="server_user_groups.php'
. PMA_URL_getCommon(
array(
'viewUsers' => 1, 'userGroup' => $row['usergroup']
)
)
. '">'
. PMA_Util::getIcon('b_usrlist.png', __('View users')) . '</a>';
$html_output .= '&nbsp;&nbsp;';
$html_output .= '<a class="" href="server_user_groups.php'
. PMA_URL_getCommon(
array(
'editUserGroup' => 1, 'userGroup' => $row['usergroup']
)
)
. '">'
. PMA_Util::getIcon('b_edit.png', __('Edit')) . '</a>';
$html_output .= '&nbsp;&nbsp;';
$html_output .= '<a class="deleteUserGroup ajax"'
. ' href="server_user_groups.php'
. PMA_URL_getCommon(
array(
'deleteUserGroup' => 1, 'userGroup' => $row['usergroup']
)
)
. '">'
. PMA_Util::getIcon('b_drop.png', __('Delete')) . '</a>';
$html_output .= '</td>';
$html_output .= '</tr>';
$odd = ! $odd;
}
$html_output .= '</tbody>';
$html_output .= '</table>';
$html_output .= '</form>';
}
$GLOBALS['dbi']->freeResult($result);
$html_output .= '<fieldset id="fieldset_add_user_group">';
$html_output .= '<a href="server_user_groups.php'
. PMA_URL_getCommon(array('addUserGroup' => 1)) . '">'
. PMA_Util::getIcon('b_usradd.png')
. __('Add user group') . '</a>';
$html_output .= '</fieldset>';
return $html_output;
}
/**
* Returns the list of allowed menu tab names
* based on a data row from usergroup table.
*
* @param array $row row of usergroup table
* @param string $level 'server', 'db' or 'table'
*
* @return string comma seperated list of allowed menu tab names
*/
function _getAllowedTabNames($row, $level)
{
$tabNames = array();
$tabs = PMA_Util::getMenuTabList($level);
foreach ($tabs as $tab => $tabName) {
if (! isset($row[$level . '_' . $tab])
|| $row[$level . '_' . $tab] == 'Y'
) {
$tabNames[] = $tabName;
}
}
return implode(', ', $tabNames);
}
/**
* Deletes a user group
*
* @param string $userGroup user group name
*
* @return void
*/
function PMA_deleteUserGroup($userGroup)
{
$userTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
$groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
$sql_query = "DELETE FROM " . $userTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
PMA_queryAsControlUser($sql_query, true);
$sql_query = "DELETE FROM " . $groupTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
PMA_queryAsControlUser($sql_query, true);
}
/**
* Returns HTML for add/edit user group dialog
*
* @param string $userGroup name of the user group in case of editing
*
* @return string HTML for add/edit user group dialog
*/
function PMA_getHtmlToEditUserGroup($userGroup = null)
{
$html_output = '';
if ($userGroup == null) {
$html_output .= '<h2>' . __('Add user group') . '</h2>';
} else {
$html_output .= '<h2>'
. sprintf(__('Edit user group: \'%s\''), htmlspecialchars($userGroup))
. '</h2>';
}
$html_output .= '<form name="userGroupForm" id="userGroupForm"'
. ' action="server_user_groups.php" method="post">';
$urlParams = array();
if ($userGroup != null) {
$urlParams['userGroup'] = $userGroup;
$urlParams['editUserGroupSubmit'] = '1';
} else {
$urlParams['addUserGroupSubmit'] = '1';
}
$html_output .= PMA_URL_getHiddenInputs($urlParams);
$html_output .= '<fieldset id="fieldset_user_group_rights">';
$html_output .= '<legend>' . __('User group menu assignments')
. '&nbsp;&nbsp;&nbsp;'
. '<input type="checkbox" class="checkall_box" title="Check All">'
. '<label for="addUsersForm_checkall">' . __('Check All') .'</label>'
. '</legend>';
if ($userGroup == null) {
$html_output .= '<label for="userGroup">' . __('Group name:') . '</label>';
$html_output .= '<input type="text" name="userGroup" '
. 'autocomplete="off" required="required" />';
$html_output .= '<div class="clearfloat"></div>';
}
$allowedTabs = array(
'server' => array(),
'db' => array(),
'table' => array()
);
if ($userGroup != null) {
$groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
$sql_query = "SELECT * FROM " . $groupTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
$result = PMA_queryAsControlUser($sql_query, false);
if ($result) {
$row = $GLOBALS['dbi']->fetchAssoc($result);
foreach ($row as $key => $value) {
if (substr($key, 0, 7) == 'server_' && $value == 'Y') {
$allowedTabs['server'][] = substr($key, 7);
} elseif (substr($key, 0, 3) == 'db_' && $value == 'Y') {
$allowedTabs['db'][] = substr($key, 3);
} elseif (substr($key, 0, 6) == 'table_' && $value == 'Y') {
$allowedTabs['table'][] = substr($key, 6);
}
}
}
$GLOBALS['dbi']->freeResult($result);
}
$html_output .= _getTabList(
__('Server-level tabs'), 'server', $allowedTabs['server']
);
$html_output .= _getTabList(
__('Database-level tabs'), 'db', $allowedTabs['db']
);
$html_output .= _getTabList(
__('Table-level tabs'), 'table', $allowedTabs['table']
);
$html_output .= '</fieldset>';
$html_output .= '<fieldset id="fieldset_user_group_rights_footer"'
. ' class="tblFooters">';
$html_output .= '<input type="submit" name="update_privs" value="Go">';
$html_output .= '</fieldset>';
return $html_output;
}
/**
* Returns HTML for checkbox groups to choose
* tabs of 'server', 'db' or 'table' levels.
*
* @param string $title title of the checkbox group
* @param string $level 'server', 'db' or 'table'
* @param array $selected array of selected allowed tabs
*
* @return string HTML for checkbox groups
*/
function _getTabList($title, $level, $selected)
{
$tabs = PMA_Util::getMenuTabList($level);
$html_output = '<fieldset>';
$html_output .= '<legend>' . $title . '</legend>';
foreach ($tabs as $tab => $tabName) {
$html_output .= '<div class="item">';
$html_output .= '<input type="checkbox" class="checkall"'
. (in_array($tab, $selected) ? ' checked="checked"' : '')
. ' name="' . $level . '_' . $tab . '" value="Y" />';
$html_output .= '<label for="' . $level . '_' . $tab . '">'
. '<code>' . $tabName . '</code>'
. '</label>';
$html_output .= '</div>';
}
$html_output .= '</fieldset>';
return $html_output;
}
/**
* Add/update a user group with allowed menu tabs.
*
* @param string $userGroup user group name
* @param boolean $new whether this is a new user group
*
* @return void
*/
function PMA_editUserGroup($userGroup, $new = false)
{
$tabs = PMA_Util::getMenuTabList();
$groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
$cols = "";
$vals = "";
$colsNvals = "";
foreach ($tabs as $tabGroupName => $tabGroup) {
foreach ($tabs[$tabGroupName] as $tab => $tabName) {
$colName = $tabGroupName . '_' . $tab;
$cols .= "," . PMA_Util::backquote($colName);
if (isset($_REQUEST[$colName])&& $_REQUEST[$colName] == 'Y') {
$vals .= ",'Y'";
$colsNvals .= "," . PMA_Util::backquote($colName) . "='Y'";
} else {
$vals .= ",'N'";
$colsNvals .= "," . PMA_Util::backquote($colName) . "='N'";
}
}
}
if ($new) {
$sql_query = "INSERT INTO " . $groupTable
. "(`usergroup`" . $cols . ")"
. " VALUES"
. " ('" . PMA_Util::sqlAddSlashes($userGroup) . "'" . $vals . ")";
} else {
$sql_query = "UPDATE " . $groupTable . " SET " . substr($colsNvals, 1)
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
}
PMA_queryAsControlUser($sql_query, true);
}
/**
* Get HTML snippet for display user properties
*
@ -4294,44 +4177,4 @@ function PMA_getSqlQueriesForDisplayAndAddUser($username, $hostname, $password)
$sql_query
);
}
/**
* Get HTML for secondary level menu tabs on 'Users' page
*
* @param string $selfUrl Url of the file
*
* @return string HTML for secondary level menu tabs on 'Users' page
*/
function PMA_getHtmlForSubMenusOnUsersPage($selfUrl)
{
$url_params = PMA_URL_getCommon();
$items = array(
array(
'name' => __('Users overview'),
'url' => 'server_privileges.php'
),
array(
'name' => __('User groups'),
'url' => 'server_user_groups.php'
)
);
$retval = '<ul id="topmenu2">';
foreach ($items as $item) {
$class = '';
if ($item['url'] === $selfUrl) {
$class = ' class="tabactive"';
}
$retval .= '<li>';
$retval .= '<a' . $class;
$retval .= ' href="' . $item['url'] . '?' . $url_params . '">';
$retval .= $item['name'];
$retval .= '</a>';
$retval .= '</li>';
}
$retval .= '</ul>';
$retval .= '<div class="clearfloat"></div>';
return $retval;
}
?>

View File

@ -0,0 +1,355 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* set of functions for user group handling
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Return HTML to list the users belonging to a given user group
*
* @param string $userGroup user group name
*
* @return HTML to list the users belonging to a given user group
*/
function PMA_getHtmlForListingUsersofAGroup($userGroup)
{
$html_output = '<h2>'
. sprintf(__('Users of \'%s\' user group'), htmlspecialchars($userGroup))
. '</h2>';
$usersTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
$sql_query = "SELECT `username` FROM " . $usersTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
$result = PMA_queryAsControlUser($sql_query, false);
if ($result) {
if ($GLOBALS['dbi']->numRows($result) == 0) {
$html_output .= '<p>'
. __('No users were found belonging to this user group.')
. '</p>';
} else {
$html_output .= '<table>'
. '<thead><tr><th>#</th><th>' . __('User') . '</th></tr></thead>'
. '<tbody>';
$i = 0;
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
$i++;
$html_output .= '<tr>'
. '<td>' . $i . ' </td>'
. '<td>' . htmlspecialchars($row[0]) . '</td>'
. '</tr>';
}
$html_output .= '</tbody>'
. '</table>';
}
}
$GLOBALS['dbi']->freeResult($result);
return $html_output;
}
/**
* Returns HTML for the 'user groups' table
*
* @return string HTML for the 'user groups' table
*/
function PMA_getHtmlForUserGroupsTable()
{
$tabs = PMA_Util::getMenuTabList();
$html_output = '<h2>' . __('User groups') . '</h2>';
$groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
$sql_query = "SELECT * FROM " . $groupTable . " ORDER BY `usergroup` ASC";
$result = PMA_queryAsControlUser($sql_query, false);
if ($result && $GLOBALS['dbi']->numRows($result)) {
$html_output .= '<form name="userGroupsForm" id="userGroupsForm"'
. ' action="server_privileges.php" method="post">';
$html_output .= PMA_URL_getHiddenInputs();
$html_output .= '<table id="userGroupsTable">';
$html_output .= '<thead><tr>';
$html_output .= '<th style="white-space: nowrap">'
. __('User group') . '</th>';
$html_output .= '<th>' . __('Server level tabs') . '</th>';
$html_output .= '<th>' . __('Database level tabs') . '</th>';
$html_output .= '<th>' . __('Table level tabs') . '</th>';
$html_output .= '<th>' . __('Action') . '</th>';
$html_output .= '</tr></thead>';
$html_output .= '<tbody>';
$odd = true;
$userGroups = array();
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
$groupName = $row['usergroup'];
if (! isset($userGroups[$groupName])) {
$userGroups[$groupName] = array();
}
$userGroups[$groupName][$row['tab']] = $row['allowed'];
}
foreach ($userGroups as $groupName => $tabs) {
$html_output .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
$html_output .= '<td>' . htmlspecialchars($groupName) . '</td>';
$html_output .= '<td>' . _getAllowedTabNames($tabs, 'server') . '</td>';
$html_output .= '<td>' . _getAllowedTabNames($tabs, 'db') . '</td>';
$html_output .= '<td>' . _getAllowedTabNames($tabs, 'table') . '</td>';
$html_output .= '<td>';
$html_output .= '<a class="" href="server_user_groups.php'
. PMA_URL_getCommon(
array(
'viewUsers' => 1, 'userGroup' => $groupName
)
)
. '">'
. PMA_Util::getIcon('b_usrlist.png', __('View users')) . '</a>';
$html_output .= '&nbsp;&nbsp;';
$html_output .= '<a class="" href="server_user_groups.php'
. PMA_URL_getCommon(
array(
'editUserGroup' => 1, 'userGroup' => $groupName
)
)
. '">'
. PMA_Util::getIcon('b_edit.png', __('Edit')) . '</a>';
$html_output .= '&nbsp;&nbsp;';
$html_output .= '<a class="deleteUserGroup ajax"'
. ' href="server_user_groups.php'
. PMA_URL_getCommon(
array(
'deleteUserGroup' => 1, 'userGroup' => $groupName
)
)
. '">'
. PMA_Util::getIcon('b_drop.png', __('Delete')) . '</a>';
$html_output .= '</td>';
$html_output .= '</tr>';
$odd = ! $odd;
}
$html_output .= '</tbody>';
$html_output .= '</table>';
$html_output .= '</form>';
}
$GLOBALS['dbi']->freeResult($result);
$html_output .= '<fieldset id="fieldset_add_user_group">';
$html_output .= '<a href="server_user_groups.php'
. PMA_URL_getCommon(array('addUserGroup' => 1)) . '">'
. PMA_Util::getIcon('b_usradd.png')
. __('Add user group') . '</a>';
$html_output .= '</fieldset>';
return $html_output;
}
/**
* Returns the list of allowed menu tab names
* based on a data row from usergroup table.
*
* @param array $row row of usergroup table
* @param string $level 'server', 'db' or 'table'
*
* @return string comma seperated list of allowed menu tab names
*/
function _getAllowedTabNames($row, $level)
{
$tabNames = array();
$tabs = PMA_Util::getMenuTabList($level);
foreach ($tabs as $tab => $tabName) {
if (! isset($row[$level . '_' . $tab])
|| $row[$level . '_' . $tab] == 'Y'
) {
$tabNames[] = $tabName;
}
}
return implode(', ', $tabNames);
}
/**
* Deletes a user group
*
* @param string $userGroup user group name
*
* @return void
*/
function PMA_deleteUserGroup($userGroup)
{
$userTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
$groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
$sql_query = "DELETE FROM " . $userTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
PMA_queryAsControlUser($sql_query, true);
$sql_query = "DELETE FROM " . $groupTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
PMA_queryAsControlUser($sql_query, true);
}
/**
* Returns HTML for add/edit user group dialog
*
* @param string $userGroup name of the user group in case of editing
*
* @return string HTML for add/edit user group dialog
*/
function PMA_getHtmlToEditUserGroup($userGroup = null)
{
$html_output = '';
if ($userGroup == null) {
$html_output .= '<h2>' . __('Add user group') . '</h2>';
} else {
$html_output .= '<h2>'
. sprintf(__('Edit user group: \'%s\''), htmlspecialchars($userGroup))
. '</h2>';
}
$html_output .= '<form name="userGroupForm" id="userGroupForm"'
. ' action="server_user_groups.php" method="post">';
$urlParams = array();
if ($userGroup != null) {
$urlParams['userGroup'] = $userGroup;
$urlParams['editUserGroupSubmit'] = '1';
} else {
$urlParams['addUserGroupSubmit'] = '1';
}
$html_output .= PMA_URL_getHiddenInputs($urlParams);
$html_output .= '<fieldset id="fieldset_user_group_rights">';
$html_output .= '<legend>' . __('User group menu assignments')
. '&nbsp;&nbsp;&nbsp;'
. '<input type="checkbox" class="checkall_box" title="Check All">'
. '<label for="addUsersForm_checkall">' . __('Check All') .'</label>'
. '</legend>';
if ($userGroup == null) {
$html_output .= '<label for="userGroup">' . __('Group name:') . '</label>';
$html_output .= '<input type="text" name="userGroup" '
. 'autocomplete="off" required="required" />';
$html_output .= '<div class="clearfloat"></div>';
}
$allowedTabs = array(
'server' => array(),
'db' => array(),
'table' => array()
);
if ($userGroup != null) {
$groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
$sql_query = "SELECT * FROM " . $groupTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
$result = PMA_queryAsControlUser($sql_query, false);
if ($result) {
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
$key = $row['tab'];
$value = $row['allowed'];
if (substr($key, 0, 7) == 'server_' && $value == 'Y') {
$allowedTabs['server'][] = substr($key, 7);
} elseif (substr($key, 0, 3) == 'db_' && $value == 'Y') {
$allowedTabs['db'][] = substr($key, 3);
} elseif (substr($key, 0, 6) == 'table_' && $value == 'Y') {
$allowedTabs['table'][] = substr($key, 6);
}
}
}
$GLOBALS['dbi']->freeResult($result);
}
$html_output .= _getTabList(
__('Server-level tabs'), 'server', $allowedTabs['server']
);
$html_output .= _getTabList(
__('Database-level tabs'), 'db', $allowedTabs['db']
);
$html_output .= _getTabList(
__('Table-level tabs'), 'table', $allowedTabs['table']
);
$html_output .= '</fieldset>';
$html_output .= '<fieldset id="fieldset_user_group_rights_footer"'
. ' class="tblFooters">';
$html_output .= '<input type="submit" name="update_privs" value="Go">';
$html_output .= '</fieldset>';
return $html_output;
}
/**
* Returns HTML for checkbox groups to choose
* tabs of 'server', 'db' or 'table' levels.
*
* @param string $title title of the checkbox group
* @param string $level 'server', 'db' or 'table'
* @param array $selected array of selected allowed tabs
*
* @return string HTML for checkbox groups
*/
function _getTabList($title, $level, $selected)
{
$tabs = PMA_Util::getMenuTabList($level);
$html_output = '<fieldset>';
$html_output .= '<legend>' . $title . '</legend>';
foreach ($tabs as $tab => $tabName) {
$html_output .= '<div class="item">';
$html_output .= '<input type="checkbox" class="checkall"'
. (in_array($tab, $selected) ? ' checked="checked"' : '')
. ' name="' . $level . '_' . $tab . '" value="Y" />';
$html_output .= '<label for="' . $level . '_' . $tab . '">'
. '<code>' . $tabName . '</code>'
. '</label>';
$html_output .= '</div>';
}
$html_output .= '</fieldset>';
return $html_output;
}
/**
* Add/update a user group with allowed menu tabs.
*
* @param string $userGroup user group name
* @param boolean $new whether this is a new user group
*
* @return void
*/
function PMA_editUserGroup($userGroup, $new = false)
{
$tabs = PMA_Util::getMenuTabList();
$groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
if (! $new) {
$sql_query = "DELETE FROM " . $groupTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "';";
PMA_queryAsControlUser($sql_query, true);
}
$sql_query = "INSERT INTO " . $groupTable
. "(`usergroup`, `tab`, `allowed`)"
. " VALUES ";
$first = true;
foreach ($tabs as $tabGroupName => $tabGroup) {
foreach ($tabs[$tabGroupName] as $tab => $tabName) {
if (! $first) {
$sql_query .= ", ";
}
$tabName = $tabGroupName . '_' . $tab;
$allowed = isset($_REQUEST[$tabName]) && $_REQUEST[$tabName] == 'Y';
$sql_query .= "('" . $userGroup . "', '" . $tabName . "', '"
. ($allowed ? "Y" : "N") . "')";
$first = false;
}
}
$sql_query .= ";";
PMA_queryAsControlUser($sql_query, true);
}
?>

View File

@ -0,0 +1,55 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* set of common functions for sub tabs in server level `Users` page
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Get HTML for secondary level menu tabs on 'Users' page
*
* @param string $selfUrl Url of the file
*
* @return string HTML for secondary level menu tabs on 'Users' page
*/
function PMA_getHtmlForSubMenusOnUsersPage($selfUrl)
{
$url_params = PMA_URL_getCommon();
$items = array(
array(
'name' => __('Users overview'),
'url' => 'server_privileges.php',
'specific_params' => '&viewing_mode=server'
),
array(
'name' => __('User groups'),
'url' => 'server_user_groups.php',
'specific_params' => ''
)
);
$retval = '<ul id="topmenu2">';
foreach ($items as $item) {
$class = '';
if ($item['url'] === $selfUrl) {
$class = ' class="tabactive"';
}
$retval .= '<li>';
$retval .= '<a' . $class;
$retval .= ' href="' . $item['url']
. '?' . $url_params . $item['specific_params'] . '">';
$retval .= $item['name'];
$retval .= '</a>';
$retval .= '</li>';
}
$retval .= '</ul>';
$retval .= '<div class="clearfloat"></div>';
return $retval;
}
?>

View File

@ -2284,7 +2284,7 @@ function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results,
$sql_limit_to_append = '';
}
$reload = PMA_hasCurrentDbChanged($db);
$GLOBALS['reload'] = PMA_hasCurrentDbChanged($db);
// Execute the query
list($result, $num_rows, $unlim_num_rows, $profiling_results,

View File

@ -391,18 +391,18 @@ function PMA_getRowDataForRegeneration($columnNumber, $submit_fulltext)
$parts = explode($_REQUEST['field_key'][$columnNumber], '_', 2);
if (count($parts) == 2 && $parts[1] == $columnNumber) {
switch ($parts[0]) {
case 'primary':
$columnMeta['Key'] = 'PRI';
break;
case 'index':
$columnMeta['Key'] = 'MUL';
break;
case 'unique':
$columnMeta['Key'] = 'UNI';
break;
case 'fulltext':
$columnMeta['Key'] = 'FULLTEXT';
break;
case 'primary':
$columnMeta['Key'] = 'PRI';
break;
case 'index':
$columnMeta['Key'] = 'MUL';
break;
case 'unique':
$columnMeta['Key'] = 'UNI';
break;
case 'fulltext':
$columnMeta['Key'] = 'FULLTEXT';
break;
}
}
}

View File

@ -199,9 +199,9 @@ function PMA_getHtmlForOptionsList($options, $select)
$html = '';
foreach ($options as $option) {
$html .= '<option value="' . htmlspecialchars($option) . '"';
if ($option == $select) {
$html .= ' selected="selected"';
}
if ($option == $select) {
$html .= ' selected="selected"';
}
$html .= '>' . htmlspecialchars($option) . '</option>';
}
@ -274,7 +274,7 @@ function PMA_getHtmlForUseOpenStreetMaps($isSelected)
* @param array $visualizationSettings visualization settings
* @param String $sql_query the sql query
* @param String $visualization html and js code for the visualization
* @param boolean svg_support whether svg download format is supported
* @param boolean $svg_support whether svg download format is supported
* @param array $data array of visualizing data
*
* @return string $html html code for the GIS visualization

View File

@ -193,8 +193,8 @@ function PMA_getHtmlForCommonForm($db, $table, $columns, $cfgRelation,
* @param array $columns columns
* @param array $cfgRelation configuration relation
* @param string $tbl_storage_engine table storage engine
* @param array $existrel db, table, column
* @param array $existrel_foreign db, table, column
* @param array $existrel existed relations
* @param array $existrel_foreign existed relations for foreign keys
* @param array $options_array options array
* @param string $db current database
* @param string $table current table

166
po/da.po
View File

@ -4,8 +4,8 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-08-18 06:16-0400\n"
"PO-Revision-Date: 2013-08-23 11:32+0200\n"
"Last-Translator: Michal Čihař <michal@cihar.com>\n"
"PO-Revision-Date: 2013-09-10 00:39+0200\n"
"Last-Translator: Aputsiaq Niels Janussen <aj@isit.gl>\n"
"Language-Team: Danish <http://l10n.cihar.com/projects/phpmyadmin/master/da/>\n"
"Language: da\n"
"MIME-Version: 1.0\n"
@ -687,10 +687,9 @@ msgid "Back"
msgstr "Tilbage"
#: index.php:115 libraries/Footer.class.php:72
#, fuzzy
#| msgid "phpMyAdmin homepage"
msgid "phpMyAdmin Demo Server"
msgstr "phpMyAdmin hjemmeside"
msgstr "phpMyAdmin - demoserver"
#: index.php:119
#, php-format
@ -699,6 +698,8 @@ msgid ""
"change root, debian-sys-maint and pma users. More information is available "
"at %s."
msgstr ""
"Du anvender demoserveren. Du kan foretage alt her, men undlad venligst at "
"rette root, debian-sys-maint og pma-brugere. Mere information fås på %s."
#: index.php:129
msgid "General Settings"
@ -902,7 +903,7 @@ msgstr "\"DROP DATABASE\" erklæringer kan ikke bruges."
#: js/messages.php:35
msgid "Confirm"
msgstr ""
msgstr "Bekræft"
#: js/messages.php:36
#, php-format
@ -934,26 +935,24 @@ msgid "This operation could take a long time. Proceed anyway?"
msgstr "Denne operation kan tage lang tid. Fortsæt alligevel?"
#: js/messages.php:44
#, fuzzy, php-format
#, php-format
#| msgid "Do you really want to execute \"%s\"?"
msgid "Do you really want to delete user group \"%s\"?"
msgstr "Er du sikker på at du vil udføre \"%s\"?"
msgstr "Er du sikker på at du vil slette brugergruppen \"%s\"?"
#: js/messages.php:47
msgid "Missing value in the form!"
msgstr "Ingen værdi i formularen!"
#: js/messages.php:48
#, fuzzy
#| msgid "Not a valid port number"
msgid "Please enter a valid number"
msgstr "Ikke et gyldigt portnummer"
msgstr "Angiv venligst et gyldigt portnummer"
#: js/messages.php:49
#, fuzzy
#| msgid "Please enter correct captcha!"
msgid "Please enter a valid length"
msgstr "Angiv venligst korrekt captcha!"
msgstr "Angiv venligst en gyldig længde"
#: js/messages.php:50
msgid "Add Index"
@ -1751,16 +1750,14 @@ msgid "Show search criteria"
msgstr "Vis søgekriterie"
#: js/messages.php:286
#, fuzzy
#| msgid "Hide search criteria"
msgid "Hide find and replace criteria"
msgstr "Skjul søgekriterie"
msgstr "Skjul kriteriet for søg og erstat"
#: js/messages.php:287
#, fuzzy
#| msgid "Show search criteria"
msgid "Show find and replace criteria"
msgstr "Vis søgekriterie"
msgstr "Vis kriteriet for søg og erstat"
#: js/messages.php:290 libraries/TableSearch.class.php:212
msgid "Zoom Search"
@ -1972,10 +1969,9 @@ msgid "Hide Panel"
msgstr "Skjul panel"
#: js/messages.php:379
#, fuzzy
#| msgid "Show logo in navigation panel"
msgid "Show hidden navigation tree items"
msgstr "Vis logoet i navigationspanel"
msgstr "Vis skjulte elementer i navigationstræet"
#: js/messages.php:382
msgid "The requested page was not found in the history, it may have expired."
@ -2694,16 +2690,16 @@ msgstr ""
"Viewet har som minimum dette antal rækker. Se venligst %sdokumentationen%s."
#: libraries/DisplayResults.class.php:4865
#, fuzzy, php-format
#, php-format
#| msgid "Showing rows"
msgid "Showing rows %1s - %2s"
msgstr "Viser poster"
msgstr "Viser rækkerne %1s - %2s"
#: libraries/DisplayResults.class.php:4877
#, fuzzy, php-format
#, php-format
#| msgid "total"
msgid "%d total"
msgstr "total"
msgstr "%d i alt"
#: libraries/DisplayResults.class.php:4889 libraries/sql.lib.php:1641
#, php-format
@ -2830,13 +2826,12 @@ msgstr "Kan ikke læse (flyttet) uploaded fil."
#: libraries/Footer.class.php:76
#, php-format
msgid "Currently running Git revision %1$s from the %2$s branch."
msgstr ""
msgstr "Der køres i øjeblikket Git-revisionen %1$s fra grenen %2$s."
#: libraries/Footer.class.php:83
#, fuzzy
#| msgid "Version information"
msgid "Git information missing!"
msgstr "Versionsinformation"
msgstr "Information om Git mangler!"
#: libraries/Footer.class.php:163 libraries/Footer.class.php:167
#: libraries/Footer.class.php:170
@ -3309,7 +3304,7 @@ msgstr "Tabelsøgning"
#: libraries/TableSearch.class.php:217 libraries/TableSearch.class.php:1170
msgid "Find and Replace"
msgstr ""
msgstr "Søg og erstat"
#: libraries/TableSearch.class.php:239 libraries/insert_edit.lib.php:1357
msgid "Edit/Insert"
@ -3376,38 +3371,33 @@ msgid "Reset zoom"
msgstr "Nulstil zoom"
#: libraries/TableSearch.class.php:1279
#, fuzzy
#| msgid "Replace NULL with"
msgid "Replace with:"
msgstr "Erstat NULL med"
msgstr "Erstat med:"
#: libraries/TableSearch.class.php:1339
msgid "Find and replace - preview"
msgstr ""
msgstr "Søg og erstat - forhåndsvisning"
#: libraries/TableSearch.class.php:1343
#, fuzzy
#| msgid "Column"
msgid "Count"
msgstr "Kolonnenavn"
msgstr "Antal"
#: libraries/TableSearch.class.php:1344
#, fuzzy
#| msgid "Original position"
msgid "Original string"
msgstr "Original position"
msgstr "Original tekststreng"
#: libraries/TableSearch.class.php:1345
#, fuzzy
#| msgid "Related Links"
msgid "Replaced string"
msgstr "Relaterede links"
msgstr "Erstattet tekststreng"
#: libraries/TableSearch.class.php:1369
#, fuzzy
#| msgid "Replicated"
msgid "Replace"
msgstr "Replikeret"
msgstr "Erstat"
#: libraries/Theme.class.php:170
#, php-format
@ -4727,10 +4717,9 @@ msgstr "Slå fremmednøgle-checks fra"
#: libraries/config/messages.inc.php:126
#: libraries/plugins/export/ExportSql.class.php:154
#, fuzzy
#| msgid "Exporting rows from \"%s\" table"
msgid "Export views as tables"
msgstr "Eksporterer rækker fra tabellen \"%s\""
msgstr "Eksportér visninger som tabeller"
#: libraries/config/messages.inc.php:127 libraries/config/messages.inc.php:128
#: libraries/config/messages.inc.php:130 libraries/config/messages.inc.php:136
@ -6121,7 +6110,6 @@ msgid "User preferences storage table"
msgstr "Bruger preference storage tabel"
#: libraries/config/messages.inc.php:456
#, fuzzy
#| msgid ""
#| "Leave blank for no user preferences storage in database, suggested: [kbd]"
#| "pma__userconfig[/kbd]"
@ -6129,17 +6117,15 @@ msgid ""
"Leave blank to disable configurable menus feature, suggested: [kbd]pma__users"
"[/kbd]"
msgstr ""
"Efterlades tom for at undlade lagring af bruger-præferencer i database, "
"forslag: [kbd]pma_userconfig[/kbd]"
"Efterlades tom for at deaktivere muligheden for konfigurérbare menuer, "
"forslag: [kbd]pma_users[/kbd]"
#: libraries/config/messages.inc.php:457
#, fuzzy
#| msgid "Use Tables"
msgid "Users table"
msgstr "Benyt tabeller"
msgstr "Brugertabel"
#: libraries/config/messages.inc.php:458
#, fuzzy
#| msgid ""
#| "Leave blank for no user preferences storage in database, suggested: [kbd]"
#| "pma__userconfig[/kbd]"
@ -6147,17 +6133,15 @@ msgid ""
"Leave blank to disable configurable menus feature, suggested: [kbd]"
"pma__usergroups[/kbd]"
msgstr ""
"Efterlades tom for at undlade lagring af bruger-præferencer i database, "
"forslag: [kbd]pma_userconfig[/kbd]"
"Efterlades tom for at deaktivere muligheden for konfigurérbare menuer, "
"forslag: [kbd]pma__usergroups[/kbd]"
#: libraries/config/messages.inc.php:459
#, fuzzy
#| msgid "Use Host Table"
msgid "User groups table"
msgstr "Brug tabellen host"
msgstr "Tabel for brugergrupper"
#: libraries/config/messages.inc.php:460
#, fuzzy
#| msgid ""
#| "Leave blank for no user preferences storage in database, suggested: [kbd]"
#| "pma__userconfig[/kbd]"
@ -6165,12 +6149,12 @@ msgid ""
"Leave blank to disable the feature to hide and show navigation items, "
"suggested: [kbd]pma__navigationhiding[/kbd]"
msgstr ""
"Efterlades tom for at undlade lagring af bruger-præferencer i database, "
"forslag: [kbd]pma_userconfig[/kbd]"
"Efterlades tom for deaktivere muligheden for at skjule eller vise "
"navigationselementer, forslag: [kbd]pma__navigationhiding[/kbd]"
#: libraries/config/messages.inc.php:461
msgid "Hidden navigation items table"
msgstr ""
msgstr "Tabel for skjulte navigationselementer"
#: libraries/config/messages.inc.php:463
msgid "User for config auth"
@ -6958,7 +6942,6 @@ msgid "%s of %s"
msgstr "%s af %s"
#: libraries/display_import.lib.php:454
#, fuzzy
#| msgid "Uploading your import file…"
msgid "Uploading your import file…"
msgstr "Overfører din importfil …"
@ -7726,34 +7709,29 @@ msgid "An error has occured while loading the navigation tree"
msgstr "Der opstod en fejl under indlæsinng af navigationstræet"
#: libraries/navigation/Navigation.class.php:172
#, fuzzy
#| msgid "Events"
msgid "Events:"
msgstr "Hændelser"
msgstr "Hændelser:"
#: libraries/navigation/Navigation.class.php:173
#, fuzzy
#| msgid "Functions"
msgid "Functions:"
msgstr "Funktioner"
msgstr "Funktioner:"
#: libraries/navigation/Navigation.class.php:174
#, fuzzy
#| msgid "Procedures"
msgid "Procedures:"
msgstr "Procedurer"
msgstr "Procedurer:"
#: libraries/navigation/Navigation.class.php:175
#, fuzzy
#| msgid "Tables"
msgid "Tables:"
msgstr "Tabeller"
msgstr "Tabeller:"
#: libraries/navigation/Navigation.class.php:176
#, fuzzy
#| msgid "Views"
msgid "Views:"
msgstr "Views"
msgstr "Views:"
#: libraries/navigation/NavigationHeader.class.php:183
msgid "Home"
@ -8504,10 +8482,10 @@ msgid "RELATIONS FOR TABLE"
msgstr "RELATIONS FOR TABLE (Relationer for tabellen)"
#: libraries/plugins/export/ExportSql.class.php:1512
#, fuzzy, php-format
#, php-format
#| msgid "Structure for view"
msgid "Structure for view %s exported as a table"
msgstr "Struktur for visning"
msgstr "Struktur for visningen %s blev eksporteret som en tabel"
#: libraries/plugins/export/ExportSql.class.php:1600
msgid "Error reading data:"
@ -8855,16 +8833,14 @@ msgid "User preferences"
msgstr "Brugerpræferencer"
#: libraries/relation.lib.php:264
#, fuzzy
#| msgid "Configuration: %s"
msgid "Configurable menus"
msgstr "Konfiguration: %s"
msgstr "Konfigurérbare menuer"
#: libraries/relation.lib.php:275
#, fuzzy
#| msgid "Reload navigation frame"
msgid "Hide/show navigation items"
msgstr "Genindlæs navigationsramme"
msgstr "Skjul/vis navigationselementer"
#: libraries/relation.lib.php:281
msgid "Quick steps to setup advanced features:"
@ -10019,7 +9995,7 @@ msgstr "Ingen"
#: libraries/server_privileges.lib.php:2623
#: libraries/server_privileges.lib.php:3639
msgid "User group"
msgstr ""
msgstr "Brugergruppe"
#: libraries/server_privileges.lib.php:648
msgid "Resource limits"
@ -10255,10 +10231,9 @@ msgid "Add privileges on the following table:"
msgstr "Tilføj privileges på følgende tabel:"
#: libraries/server_privileges.lib.php:2761
#, fuzzy
#| msgid "Edit server"
msgid "Edit user group"
msgstr "Rediger server"
msgstr "Redigér brugergruppe"
#: libraries/server_privileges.lib.php:2798
msgid "Remove selected users"
@ -10337,84 +10312,73 @@ msgstr ""
#: libraries/server_privileges.lib.php:3584
#, php-format
msgid "Users of '%s' user group"
msgstr ""
msgstr "Brugere fra brugergruppen \"%s\""
#: libraries/server_privileges.lib.php:3595
msgid "No users were found belonging to this user group."
msgstr ""
msgstr "Der blev ikke fundet brugere tilhørende denne brugergruppe."
#: libraries/server_privileges.lib.php:3626
#: libraries/server_privileges.lib.php:4302
#, fuzzy
#| msgid "Users"
msgid "User groups"
msgstr "Brugere"
msgstr "Brugergrupper"
#: libraries/server_privileges.lib.php:3640
#, fuzzy
#| msgid "Server version"
msgid "Server level tabs"
msgstr "Serverversion"
msgstr "Faner på serverniveau"
#: libraries/server_privileges.lib.php:3641
#, fuzzy
#| msgid "Database server"
msgid "Database level tabs"
msgstr "Database-server"
msgstr "Faner på databaseniveau"
#: libraries/server_privileges.lib.php:3642
#, fuzzy
#| msgid "Table comments"
msgid "Table level tabs"
msgstr "Tabel kommentarer"
msgstr "Faner på tabelniveau"
#: libraries/server_privileges.lib.php:3663
#, fuzzy
#| msgid "Views"
msgid "View users"
msgstr "Views"
msgstr "Vis brugere"
#: libraries/server_privileges.lib.php:3700
#: libraries/server_privileges.lib.php:3761
#, fuzzy
#| msgid "Add user"
msgid "Add user group"
msgstr "Opret bruger"
msgstr "Tilføj brugergruppe"
#: libraries/server_privileges.lib.php:3764
#, php-format
msgid "Edit user group: '%s'"
msgstr ""
msgstr "Redigér brugergruppen: \"%s\""
#: libraries/server_privileges.lib.php:3780
#, fuzzy
#| msgid "No privileges."
msgid "User group menu assignments"
msgstr "Ingen privilegier."
msgstr "Menu-tildelinger for brugergruppe"
#: libraries/server_privileges.lib.php:3787
#, fuzzy
#| msgid "Column names: "
msgid "Group name:"
msgstr "Kolonnenavne: "
msgstr "Gruppenavn:"
#: libraries/server_privileges.lib.php:3819
#, fuzzy
#| msgid "Server version"
msgid "Server-level tabs"
msgstr "Serverversion"
msgstr "Faner på serverniveau"
#: libraries/server_privileges.lib.php:3822
#, fuzzy
#| msgid "Database server"
msgid "Database-level tabs"
msgstr "Database-server"
msgstr "Faner på databaseniveau"
#: libraries/server_privileges.lib.php:3825
#, fuzzy
#| msgid "Table comments"
msgid "Table-level tabs"
msgstr "Tabel kommentarer"
msgstr "Faner på tabelniveau"
#: libraries/server_privileges.lib.php:3936
msgid "The selected user was not found in the privilege table."
@ -12587,7 +12551,7 @@ msgstr ""
"tilgængelige på dette system."
#: setup/lib/index.lib.php:226
#, fuzzy, php-format
#, php-format
#| msgid ""
#| "%sLogin cookie validity%s greater than 1440 seconds may cause random "
#| "session invalidation if %ssession.gc_maxlifetime%s is lower than its "
@ -12596,9 +12560,9 @@ msgid ""
"%sLogin cookie validity%s greater than %ssession.gc_maxlifetime%s may cause "
"random session invalidation (currently session.gc_maxlifetime is %d)."
msgstr ""
"%sLogin cookie gyldighed%s større end 1440 sekunder kan forårsage tilfældig "
"afslutning af session hvis %ssession.gc_maxlifetime%s er mindre end dens "
"værdi (aktuelt %d)."
"%sLogin cookie gyldighed%s større end %ssession.gc_maxlifetime%s kan "
"forårsage tilfældig afslutning af session (session.gc_maxlifetime er i "
"øjeblikket %d)."
#: setup/lib/index.lib.php:228
#, php-format

View File

@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-08-18 06:16-0400\n"
"PO-Revision-Date: 2013-08-23 19:00+0200\n"
"PO-Revision-Date: 2013-09-09 20:22+0200\n"
"Last-Translator: Dadan Setia <da2n_s@yahoo.co.id>\n"
"Language-Team: Indonesian "
"<http://l10n.cihar.com/projects/phpmyadmin/master/id/>\n"
@ -4765,6 +4765,8 @@ msgid ""
"Sort order for items in a foreign-key dropdown box; [kbd]content[/kbd] is "
"the referenced data, [kbd]id[/kbd] is the key value"
msgstr ""
"Urutkan agar item dalam kotak dropdown foreign-key, [kbd]content[/kbd] "
"adalah data direferensikan, [kbd]id[/kbd] adalah nilai kunci"
#: libraries/config/messages.inc.php:152
msgid "Foreign key dropdown order"
@ -4910,6 +4912,9 @@ msgid ""
"Specify browser's title bar text. Refer to [doc@cfg_TitleTable]documentation"
"[/doc] for magic strings that can be used to get special values."
msgstr ""
"Tentukan judul teks bar browser. Lihat [doc@cfg_TitleTable]dokumentasi[/doc] "
"untuk magic strings yang dapat digunakan untuk mendapatkan nilai-nilai "
"khusus."
#: libraries/config/messages.inc.php:195
#: libraries/navigation/NavigationHeader.class.php:209
@ -4970,6 +4975,9 @@ msgid ""
"features, see [doc@linked-tables]phpMyAdmin configuration storage[/doc] in "
"documentation"
msgstr ""
"Konfigurasi penyimpanan konfigurasi phpMyAdmin untuk mendapatkan akses ke "
"berbagai fitur tambahan, lihat dokumentasi [doc@linked-tables]konfigurasi "
"penyimpanan phpMyAdmin[/doc]"
#: libraries/config/messages.inc.php:207
msgid "Changes tracking"
@ -5029,6 +5037,11 @@ msgid ""
"strong].[br][em][a@http://sqlvalidator.mimer.com/]Mimer SQL Validator[/a], "
"Copyright 2002 Upright Database Technology. All rights reserved.[/em]"
msgstr ""
"Jika Anda ingin menggunakan layanan Validator SQL, Anda harus ingat bahwa "
"[strong]semua pernyataan SQL disimpan anonim untuk keperluan "
"statistik[/strong].[br][em][a@http://sqlvalidator.mimer.com/]Mimer SQL "
"Validator[/a], Copyright 2002 Upright Database Technology. All rights "
"reserved.[/em]"
#: libraries/config/messages.inc.php:223
msgid "Startup"
@ -5220,6 +5233,8 @@ msgid ""
"Define whether the previous login should be recalled or not in cookie "
"authentication mode"
msgstr ""
"Tentukan apakah login sebelumnya harus diingat atau tidak dalam mode "
"otentikasi cookie"
#: libraries/config/messages.inc.php:277
msgid "Recall user name"

View File

@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-08-18 06:16-0400\n"
"PO-Revision-Date: 2013-09-03 19:11+0200\n"
"PO-Revision-Date: 2013-09-03 23:11+0200\n"
"Last-Translator: Tomasz Nowiński <spamgrinder@o2.pl>\n"
"Language-Team: Polish <http://l10n.cihar.com/projects/phpmyadmin/master/pl/>\n"
"Language: pl\n"
@ -1755,7 +1755,7 @@ msgstr "Edytuj"
#: js/messages.php:273
msgid "No rows selected"
msgstr "Nie żadnych wybrano rekordów"
msgstr "Nie wybrano żadnego rekordu"
#: js/messages.php:274 libraries/DisplayResults.class.php:4983
#: libraries/structure.lib.php:1374 libraries/structure.lib.php:2062
@ -12165,7 +12165,7 @@ msgstr "Kolumny przeniesiono pomyślnie."
#: libraries/structure.lib.php:2571
#, php-format
msgid "The column name '%s' is a MySQL reserved keyword."
msgstr ""
msgstr "Nazwa kolumny '%s' jest słowem kluczowym MySQL."
#: libraries/tbl_columns_definition_form.lib.php:72
#, fuzzy
@ -13173,10 +13173,9 @@ msgid "Choose column to display:"
msgstr "Wybierz kolumny do wyświetlenia"
#: tbl_structure.php:111
#, fuzzy
#| msgid "No rows selected"
msgid "No column selected."
msgstr "Nie żadnych wybrano rekordów"
msgstr "Nie wybrano żadnej kolumny."
#: tbl_tracking.php:136
#, php-format

289
po/pt.po
View File

@ -4,8 +4,8 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-08-18 06:16-0400\n"
"PO-Revision-Date: 2013-08-23 11:34+0200\n"
"Last-Translator: Michal Čihař <michal@cihar.com>\n"
"PO-Revision-Date: 2013-09-07 12:12+0200\n"
"Last-Translator: João Rodrigues <diogo2pt@gmail.com>\n"
"Language-Team: Portuguese "
"<http://l10n.cihar.com/projects/phpmyadmin/master/pt/>\n"
"Language: pt\n"
@ -36,9 +36,10 @@ msgid ""
"parent window, or your browser's security settings are configured to block "
"cross-window updates."
msgstr ""
"A janela de destino no seu browser não pode ser actualizada. Talvez tenha "
"fechado a janela que a originou, ou as configurações de segurança do seu "
"browser encontram-se definidas para não permitir actualizações entre janelas."
"Não foi possível actualizar a janela de destino do seu navegador. Talvez "
"você tenha fechado a janela que a originou, ou as configurações de segurança "
"do seu navegador encontram-se definidas para não permitir actualizações "
"entre janelas."
#: browse_foreigners.php:184
msgid "Search:"
@ -85,7 +86,7 @@ msgstr "Executar"
#: browse_foreigners.php:202 browse_foreigners.php:206
#: libraries/Index.class.php:560 tbl_tracking.php:383
msgid "Keyname"
msgstr "Nome do Índice"
msgstr "Nome da chave"
#: browse_foreigners.php:203 browse_foreigners.php:205
#: libraries/server_collations.lib.php:36
@ -98,7 +99,7 @@ msgstr "Descrição"
#: browse_foreigners.php:289 browse_foreigners.php:301
#: browse_foreigners.php:317 browse_foreigners.php:329
msgid "Use this value"
msgstr "Usar este valor"
msgstr "Utilizar este valor"
#: changelog.php:36 license.php:28
#, php-format
@ -106,8 +107,8 @@ msgid ""
"The %s file is not available on this system, please visit www.phpmyadmin.net "
"for more information."
msgstr ""
"O ficheiro %s não está disponível no seu sistema, por favor visite www."
"phpmyadmin.net para mais informações."
"O ficheiro %s não está disponível no seu sistema. Para mais informações, "
"visite www.phpmyadmin.net."
#: db_create.php:61
#, php-format
@ -116,14 +117,13 @@ msgstr "A base de dados %1$s foi criada."
#: db_datadict.php:52 libraries/operations.lib.php:32
msgid "Database comment: "
msgstr "Comentário da Base de Dados: "
msgstr "Comentário da base de dados: "
#: db_datadict.php:159 libraries/schema/Pdf_Relation_Schema.class.php:1352
#: libraries/tbl_columns_definition_form.lib.php:70 tbl_printview.php:120
#, fuzzy
#| msgid "Table comments"
msgid "Table comments:"
msgstr "Comentários da tabela"
msgstr "Comentários da tabela:"
#: db_datadict.php:168 libraries/Index.class.php:564
#: libraries/TableSearch.class.php:185 libraries/TableSearch.class.php:1231
@ -197,7 +197,7 @@ msgstr "Nulo"
#: libraries/tbl_columns_definition_form.lib.php:288 tbl_printview.php:133
#: tbl_tracking.php:329
msgid "Default"
msgstr "Omissão"
msgstr "Predefinido"
#: db_datadict.php:173 libraries/plugins/export/ExportHtmlword.class.php:406
#: libraries/plugins/export/ExportLatex.class.php:515
@ -206,7 +206,7 @@ msgstr "Omissão"
#: libraries/schema/Pdf_Relation_Schema.class.php:1384
#: libraries/schema/Pdf_Relation_Schema.class.php:1407 tbl_printview.php:135
msgid "Links to"
msgstr "Links para"
msgstr "Ligações para"
#: db_datadict.php:175 db_printview.php:53
#: libraries/config/messages.inc.php:94 libraries/config/messages.inc.php:109
@ -282,16 +282,16 @@ msgstr "Nenhuma tabela encontrada na base de dados."
#: db_export.php:41 libraries/DbSearch.class.php:438
#: libraries/display_export.lib.php:42
msgid "Select All"
msgstr "Selecciona Todas"
msgstr "Seleccionar tudo"
#: db_export.php:47 libraries/DbSearch.class.php:441
#: libraries/display_export.lib.php:48
msgid "Unselect All"
msgstr "Limpa Todas as Selecções"
msgstr "Desseleccionar tudo"
#: db_operations.php:45 tbl_create.php:24
msgid "The database name is empty!"
msgstr "O nome da base de dados está vazia!"
msgstr "O nome da base de dados está vazio!"
#: db_operations.php:130
#, php-format
@ -309,8 +309,8 @@ msgid ""
"The phpMyAdmin configuration storage has been deactivated. To find out why "
"click %shere%s."
msgstr ""
"As configurações do phpMyAdmin para trabalhar com ligações entre Tabelas "
"foram desactivadas. Para saber porquê carregue %shere%s."
"O armazenamento da configuração do phpMyAdmin foi desactivado. Para saber "
"porquê clique %shere%s."
#: db_printview.php:47 db_tracking.php:81 db_tracking.php:204
#: libraries/Menu.class.php:240 libraries/config/messages.inc.php:521
@ -339,7 +339,7 @@ msgstr "Tamanho"
#: db_printview.php:97 libraries/plugins/export/ExportSql.class.php:1115
#: libraries/structure.lib.php:731
msgid "in use"
msgstr "em uso"
msgstr "em utilização"
#: db_printview.php:117 libraries/plugins/export/ExportSql.class.php:1041
#: libraries/schema/Pdf_Relation_Schema.class.php:1357
@ -349,12 +349,12 @@ msgstr "Criação:"
#: db_printview.php:126 libraries/plugins/export/ExportSql.class.php:1054
#: libraries/schema/Pdf_Relation_Schema.class.php:1362
msgid "Last update:"
msgstr "Última atualização:"
msgstr "Última actualização:"
#: db_printview.php:135 libraries/plugins/export/ExportSql.class.php:1067
#: libraries/schema/Pdf_Relation_Schema.class.php:1367
msgid "Last check:"
msgstr "Última Verificação:"
msgstr "Última verificação:"
#: db_printview.php:149 libraries/structure.lib.php:176
#, php-format
@ -530,10 +530,10 @@ msgid "SRID:"
msgstr "SRID:"
#: gis_data_editor.php:184
#, fuzzy, php-format
#, php-format
#| msgid "Geometry"
msgid "Geometry %d:"
msgstr "Geometria"
msgstr "Geometria %d:"
#: gis_data_editor.php:206
msgid "Point:"
@ -561,22 +561,21 @@ msgid "Add a point"
msgstr "Adicionar um ponto"
#: gis_data_editor.php:262
#, fuzzy, php-format
#, php-format
#| msgid "Linestring"
msgid "Linestring %d:"
msgstr "Segmento de Reta"
msgstr "Segmento de reta %d:"
#: gis_data_editor.php:265 gis_data_editor.php:341
#, fuzzy
#| msgid "Outer Ring"
msgid "Outer ring:"
msgstr "Anel Exterior"
msgstr "Anel exterior:"
#: gis_data_editor.php:267 gis_data_editor.php:343
#, fuzzy, php-format
#, php-format
#| msgid "Inner Ring"
msgid "Inner ring %d:"
msgstr "Anel Interior"
msgstr "Anel interior %d:"
#: gis_data_editor.php:303
msgid "Add a linestring"
@ -587,10 +586,10 @@ msgid "Add an inner ring"
msgstr "Adicionar um anel interior"
#: gis_data_editor.php:325
#, fuzzy, php-format
#, php-format
#| msgid "Polygon"
msgid "Polygon %d:"
msgstr "Polígono"
msgstr "Polígono %d:"
#: gis_data_editor.php:384 js/messages.php:325
msgid "Add a polygon"
@ -701,9 +700,8 @@ msgid "Back"
msgstr "Voltar"
#: index.php:115 libraries/Footer.class.php:72
#, fuzzy
msgid "phpMyAdmin Demo Server"
msgstr "Documentação do phpMyAdmin"
msgstr "Servidor demonstrativo do phpMyAdmin"
#: index.php:119
#, php-format
@ -712,6 +710,9 @@ msgid ""
"change root, debian-sys-maint and pma users. More information is available "
"at %s."
msgstr ""
"Está a utilizar um servidor demonstrativo. Pode fazer tudo o que quiser, "
"excepto, alterar os utilizadores root, debian-sys-maint e pma. Para mais "
"informações, veja %s."
#: index.php:129
msgid "General Settings"
@ -743,62 +744,54 @@ msgid "Server:"
msgstr "Servidor:"
#: index.php:256
#, fuzzy
#| msgid "Server type"
msgid "Server type:"
msgstr "Tipo de servidor"
msgstr "Tipo de servidor:"
#: index.php:260 libraries/plugins/export/ExportLatex.class.php:225
#: libraries/plugins/export/ExportSql.class.php:630
#: libraries/plugins/export/ExportXml.class.php:198
#, fuzzy
#| msgid "Server version"
msgid "Server version:"
msgstr "Versão do servidor"
msgstr "Versão do servidor:"
#: index.php:264
#, fuzzy
#| msgid "Protocol version"
msgid "Protocol version:"
msgstr "Versão do protocolo"
msgstr "Versão do protocolo:"
#: index.php:268
#, fuzzy
#| msgid "User"
msgid "User:"
msgstr "Utilizador"
msgstr "Utilizador:"
#: index.php:273
#, fuzzy
#| msgid "Server charset"
msgid "Server charset:"
msgstr "Conjunto de caracteres do servidor"
msgstr "Conjunto de caracteres do servidor:"
#: index.php:285
msgid "Web server"
msgstr "Servidor web"
#: index.php:298
#, fuzzy
#| msgid "Database client version"
msgid "Database client version:"
msgstr "Versão do cliente de base de dados"
msgstr "Versão do cliente de base de dados:"
#: index.php:302
#, fuzzy
#| msgid "PHP extension"
msgid "PHP extension:"
msgstr "Extensão de PHP"
msgstr "Extensão de PHP:"
#: index.php:316
msgid "Show PHP information"
msgstr "Mostra informação do PHP"
#: index.php:339
#, fuzzy
#| msgid "Version information"
msgid "Version information:"
msgstr "Informação de Versão"
msgstr "Informação da versão:"
#: index.php:348 libraries/Util.class.php:429 libraries/Util.class.php:496
#: libraries/config/FormDisplay.tpl.php:149
@ -886,7 +879,6 @@ msgstr ""
"(blowfish_secret)."
#: index.php:491
#, fuzzy
#| msgid ""
#| "Directory [code]config[/code], which is used by the setup script, still "
#| "exists in your phpMyAdmin directory. You should remove it once phpMyAdmin "
@ -897,9 +889,11 @@ msgid ""
"once phpMyAdmin has been configured. Otherwise the security of your server "
"may be compromised by unauthorized people downloading your configuration."
msgstr ""
"A pasta [code]config[/code], que é usado pelo script de instalação, ainda "
"existe na sua pasta phpMyAdmin. Deverá remover esta pasta depois de ter "
"configurado o phpMyAdmin."
"A pasta [code]config[/code], que é utilizada pelo script de instalação, "
"ainda existe na sua pasta phpMyAdmin. É altamente recomendado que remova "
"esta pasta depois de ter configurado o phpMyAdmin. Caso contrário, a "
"segurança do seu servidor pode ser comprometida por pessoas não autorizadas "
"ao transferir a configuração."
#: index.php:501
#, php-format
@ -935,7 +929,7 @@ msgstr "Os comandos \"DROP DATABASE\" estão inibidos."
#: js/messages.php:35
msgid "Confirm"
msgstr ""
msgstr "Confirmar"
#: js/messages.php:36
#, php-format
@ -967,24 +961,23 @@ msgid "This operation could take a long time. Proceed anyway?"
msgstr "Esta operação poderá demorar. Deseja prosseguir?"
#: js/messages.php:44
#, fuzzy, php-format
#, php-format
#| msgid "Do you really want to execute \"%s\"?"
msgid "Do you really want to delete user group \"%s\"?"
msgstr "Você realmente deseja executar \"%s\"?"
msgstr "Deseja realmente eliminar o grupo de utilizadores \"%s\"?"
#: js/messages.php:47
msgid "Missing value in the form!"
msgstr "Nº de dados insuficiente!"
#: js/messages.php:48
#, fuzzy
#| msgid "Not a valid port number"
msgid "Please enter a valid number"
msgstr "Número de porta inválido"
msgstr "Introduza um número válido"
#: js/messages.php:49
msgid "Please enter a valid length"
msgstr ""
msgstr "Introduza um comprimento válido"
#: js/messages.php:50
msgid "Add Index"
@ -1781,16 +1774,14 @@ msgid "Show search criteria"
msgstr "Mostrar critérios de busca"
#: js/messages.php:286
#, fuzzy
#| msgid "Hide search criteria"
msgid "Hide find and replace criteria"
msgstr "Esconder critérios de buca"
msgstr "Esconder critérios de localizar e substituir"
#: js/messages.php:287
#, fuzzy
#| msgid "Show search criteria"
msgid "Show find and replace criteria"
msgstr "Mostrar critérios de busca"
msgstr "Mostrar critérios de localizar e substituir"
#: js/messages.php:290 libraries/TableSearch.class.php:212
msgid "Zoom Search"
@ -2003,10 +1994,9 @@ msgid "Hide Panel"
msgstr "Esconder Painel"
#: js/messages.php:379
#, fuzzy
#| msgid "Show logo in left frame"
msgid "Show hidden navigation tree items"
msgstr "Mostrar logotipo no quadro da esquerda"
msgstr "Mostrar a navegação em árvore escondida"
#: js/messages.php:382
msgid "The requested page was not found in the history, it may have expired."
@ -2335,12 +2325,12 @@ msgid "Unexpected characters on line %s."
msgstr "Caracteres inesperados na linha %s."
#: libraries/Advisor.class.php:437
#, fuzzy, php-format
#, php-format
#| msgid "Unexpected character on line %1$s. Expected tab, but found \"%2$s\""
msgid "Unexpected character on line %1$s. Expected tab, but found \"%2$s\"."
msgstr ""
"Caractere inesperado na linha %1$s. Esperada tabulação, mas encontrado \"%2$s"
"\""
"Carácter inesperado na linha %1$s. Era esperado uma tabulação, mas foi "
"encontrado \"%2$s\"."
#: libraries/Advisor.class.php:470
msgid "per second"
@ -2394,28 +2384,24 @@ msgid "Descending"
msgstr "Descendente"
#: libraries/DBQbe.class.php:364 libraries/TableSearch.class.php:1282
#, fuzzy
#| msgid "Column"
msgid "Column:"
msgstr "Coluna"
msgstr "Coluna:"
#: libraries/DBQbe.class.php:406
#, fuzzy
#| msgid "Sort"
msgid "Sort:"
msgstr "Ordenação"
msgstr "Ordenação:"
#: libraries/DBQbe.class.php:468
#, fuzzy
#| msgid "Show"
msgid "Show:"
msgstr "Mostrar"
msgstr "Mostrar:"
#: libraries/DBQbe.class.php:513
#, fuzzy
#| msgid "Criteria"
msgid "Criteria:"
msgstr "Critérios"
msgstr "Critérios:"
#: libraries/DBQbe.class.php:576
msgid "Add/Delete criteria rows"
@ -2434,14 +2420,13 @@ msgid "Use Tables"
msgstr "Usar Tabelas"
#: libraries/DBQbe.class.php:653 libraries/DBQbe.class.php:757
#, fuzzy
#| msgid "Or"
msgid "Or:"
msgstr "Ou"
msgstr "Ou:"
#: libraries/DBQbe.class.php:657 libraries/DBQbe.class.php:742
msgid "And:"
msgstr ""
msgstr "E:"
#: libraries/DBQbe.class.php:661
msgid "Ins"
@ -2452,18 +2437,17 @@ msgid "Del"
msgstr "Elim"
#: libraries/DBQbe.class.php:680
#, fuzzy
#| msgid "Modify"
msgid "Modify:"
msgstr "Modificar"
msgstr "Modificar:"
#: libraries/DBQbe.class.php:737
msgid "Ins:"
msgstr ""
msgstr "Ins:"
#: libraries/DBQbe.class.php:752
msgid "Del:"
msgstr ""
msgstr "Elim:"
#: libraries/DBQbe.class.php:1321
#, php-format
@ -2479,18 +2463,20 @@ msgid ""
"The server is not responding (or the local server's socket is not correctly "
"configured)."
msgstr ""
"O servidor não está a responder (ou o socket do servidor local está mal "
"configurado)."
#: libraries/DatabaseInterface.class.php:2033
msgid "The server is not responding."
msgstr ""
msgstr "O servidor não está a responder."
#: libraries/DatabaseInterface.class.php:2038
msgid "Please check privileges of directory containing database."
msgstr ""
msgstr "Verifique quais os privilégios que o directório da base de dados tem."
#: libraries/DatabaseInterface.class.php:2048
msgid "Details…"
msgstr ""
msgstr "Informações…"
#: libraries/DbSearch.class.php:98 libraries/DbSearch.class.php:398
msgid "at least one of the words"
@ -2502,7 +2488,7 @@ msgstr "todas as palavras"
#: libraries/DbSearch.class.php:100 libraries/DbSearch.class.php:406
msgid "the exact phrase"
msgstr "a frase exata"
msgstr "a frase exacta"
#: libraries/DbSearch.class.php:101 libraries/DbSearch.class.php:407
msgid "as regular expression"
@ -2611,16 +2597,14 @@ msgstr "Fim"
#: libraries/DisplayResults.class.php:900 libraries/display_export.lib.php:322
#: tbl_chart.php:245
#, fuzzy
#| msgid "Number of rows per page"
msgid "Number of rows:"
msgstr "Número de registos por página"
msgstr "Número de registos:"
#: libraries/DisplayResults.class.php:917
#, fuzzy
#| msgid "Mode"
msgid "Mode:"
msgstr "Modo"
msgstr "Modo:"
#: libraries/DisplayResults.class.php:919
msgid "horizontal"
@ -2744,16 +2728,16 @@ msgstr ""
"%sdocumentação%s."
#: libraries/DisplayResults.class.php:4865
#, fuzzy, php-format
#, php-format
#| msgid "Showing rows"
msgid "Showing rows %1s - %2s"
msgstr "Mostrando registos"
msgstr "A mostrar registos de %1s - %2s"
#: libraries/DisplayResults.class.php:4877
#, fuzzy, php-format
#, php-format
#| msgid "total"
msgid "%d total"
msgstr "total"
msgstr "%d total"
#: libraries/DisplayResults.class.php:4889 libraries/sql.lib.php:1641
#, php-format
@ -2885,10 +2869,9 @@ msgid "Currently running Git revision %1$s from the %2$s branch."
msgstr ""
#: libraries/Footer.class.php:83
#, fuzzy
#| msgid "Version information"
msgid "Git information missing!"
msgstr "Informação de Versão"
msgstr "Falta informação!"
#: libraries/Footer.class.php:163 libraries/Footer.class.php:167
#: libraries/Footer.class.php:170
@ -3174,9 +3157,8 @@ msgid "Temporary data"
msgstr "Dados temporários"
#: libraries/ServerStatusData.class.php:194
#, fuzzy
msgid "Delayed inserts"
msgstr "Delayed inserts"
msgstr "Inserções atrasadas"
#: libraries/ServerStatusData.class.php:195
msgid "Key cache"
@ -3184,7 +3166,7 @@ msgstr "Chave da cache"
#: libraries/ServerStatusData.class.php:196
msgid "Joins"
msgstr ""
msgstr "Junções"
#: libraries/ServerStatusData.class.php:198
msgid "Sorting"
@ -3217,25 +3199,25 @@ msgstr "Ver tabelas abertas"
#: libraries/ServerStatusData.class.php:227
msgid "Show slave hosts"
msgstr ""
msgstr "Mostrar anfitriões secundários"
#: libraries/ServerStatusData.class.php:234
#: libraries/replication_gui.lib.php:49
msgid "Show master status"
msgstr ""
msgstr "Ver estado do principal"
#: libraries/ServerStatusData.class.php:237
msgid "Show slave status"
msgstr ""
msgstr "Ver estado do secundário"
#: libraries/ServerStatusData.class.php:242
msgid "Flush query cache"
msgstr ""
msgstr "Libertar a cache da consulta"
#: libraries/ServerStatusData.class.php:261
#: libraries/engines/innodb.lib.php:144
msgid "InnoDB Status"
msgstr "Estado da InnoDB"
msgstr "Estado do InnoDB"
#: libraries/ServerStatusData.class.php:368
msgid "Query statistics"
@ -3243,15 +3225,15 @@ msgstr "Estatísticas de comandos"
#: libraries/ServerStatusData.class.php:372
msgid "All status variables"
msgstr ""
msgstr "Todas as variáveis de estado"
#: libraries/ServerStatusData.class.php:376
msgid "Monitor"
msgstr ""
msgstr "Monitor"
#: libraries/ServerStatusData.class.php:380
msgid "Advisor"
msgstr ""
msgstr "Conselheiro"
#: libraries/StorageEngine.class.php:216
msgid ""
@ -3295,16 +3277,14 @@ msgid "Target database `%s` was not found!"
msgstr "A base de dados de destino `%s` não foi encontrada!"
#: libraries/Table.class.php:1239
#, fuzzy
#| msgid "Invalid database"
msgid "Invalid database:"
msgstr "Base de Dados inválida"
msgstr "Base de dados inválida:"
#: libraries/Table.class.php:1253
#, fuzzy
#| msgid "Invalid table name"
msgid "Invalid table name:"
msgstr "Nome de tabela inválido"
msgstr "Nome da tabela inválido:"
#: libraries/Table.class.php:1288
#, php-format
@ -3365,7 +3345,7 @@ msgstr "Pesquisa de tabela"
#: libraries/TableSearch.class.php:217 libraries/TableSearch.class.php:1170
msgid "Find and Replace"
msgstr ""
msgstr "Localizar e substituir"
#: libraries/TableSearch.class.php:239 libraries/insert_edit.lib.php:1357
msgid "Edit/Insert"
@ -3410,11 +3390,10 @@ msgid "Additional search criteria"
msgstr "Critérios de pesquisa adicionais"
#: libraries/TableSearch.class.php:1149
#, fuzzy
#| msgid "Do a \"query by example\" (wildcard: \"%\")"
msgid "Do a \"query by example\" (wildcard: \"%\") for two different columns"
msgstr ""
"Faça uma \"pesquisa por formulário\" (caractere universal: \"%\") para duas "
"Faça uma \"pesquisa por formulário\" (carácter universal: \"%\") para duas "
"colunas diferentes"
#: libraries/TableSearch.class.php:1159
@ -3422,53 +3401,46 @@ msgid "Do a \"query by example\" (wildcard: \"%\")"
msgstr "Faça uma \"pesquisa por formulário\" (caractere universal: \"%\")"
#: libraries/TableSearch.class.php:1210
#, fuzzy
msgid "Browse/Edit the points"
msgstr "Listar/Editar os pontos"
msgstr "Navegar/editar os pontos"
#: libraries/TableSearch.class.php:1217
msgid "How to use"
msgstr "Como usar"
#: libraries/TableSearch.class.php:1222
#, fuzzy
#| msgid "Reset"
msgid "Reset zoom"
msgstr "Limpa"
msgstr "Restaurar ampliação"
#: libraries/TableSearch.class.php:1279
#, fuzzy
#| msgid "Replace NULL by"
msgid "Replace with:"
msgstr "Substituir NULL por"
msgstr "Substituir por:"
#: libraries/TableSearch.class.php:1339
msgid "Find and replace - preview"
msgstr ""
msgstr "Localizar e substituir (pré-visualização)"
#: libraries/TableSearch.class.php:1343
#, fuzzy
#| msgid "Column"
msgid "Count"
msgstr "Coluna"
msgstr "Contagem"
#: libraries/TableSearch.class.php:1344
#, fuzzy
#| msgid "Linestring"
msgid "Original string"
msgstr "Segmento de Reta"
msgstr "Segmento original"
#: libraries/TableSearch.class.php:1345
#, fuzzy
#| msgid "Relations"
msgid "Replaced string"
msgstr "Relações"
msgstr "Segmento de substituição"
#: libraries/TableSearch.class.php:1369
#, fuzzy
#| msgid "Replicated"
msgid "Replace"
msgstr "Replicado"
msgstr "Substituir"
#: libraries/Theme.class.php:170
#, php-format
@ -3499,27 +3471,32 @@ msgid "Theme path not found for theme %s!"
msgstr "Encontrado caminho inválido para o tema %s!"
#: libraries/Theme_Manager.class.php:370
#, fuzzy
#| msgid "Theme"
msgid "Theme:"
msgstr "Tema"
msgstr "Tema:"
#: libraries/Types.class.php:297
msgid ""
"A 1-byte integer, signed range is -128 to 127, unsigned range is 0 to 255"
msgstr ""
"Um inteiro de 1 byte, a gama atribuída é de -128 a 127, a gama não atribuída "
"é de 0 a 255"
#: libraries/Types.class.php:299
msgid ""
"A 2-byte integer, signed range is -32,768 to 32,767, unsigned range is 0 to "
"65,535"
msgstr ""
"Um inteiro de 2 byte, a gama atribuída é de -32,768 a 32,767, a gama não "
"atribuída é de 0 a 65,535"
#: libraries/Types.class.php:301
msgid ""
"A 3-byte integer, signed range is -8,388,608 to 8,388,607, unsigned range is "
"0 to 16,777,215"
msgstr ""
"Um inteiro de 3 byte, a gama atribuída é de -8,388,608 a 8,388,607, a gama "
"não atribuída é de 0 a 16,777,215"
#: libraries/Types.class.php:303
msgid ""
@ -3532,6 +3509,9 @@ msgid ""
"An 8-byte integer, signed range is -9,223,372,036,854,775,808 to "
"9,223,372,036,854,775,807, unsigned range is 0 to 18,446,744,073,709,551,615"
msgstr ""
"Um inteiro de 8 byte, a gama atribuída é de -9,223,372,036,854,775,808 a "
"9,223,372,036,854,775,807, a gama não atribuída é de 0 a "
"18,446,744,073,709,551,615"
#: libraries/Types.class.php:307 libraries/Types.class.php:714
msgid ""
@ -3587,7 +3567,7 @@ msgstr "Uma data, intervalo suportado é %1$s até %2$s"
#: libraries/Types.class.php:323 libraries/Types.class.php:726
#, php-format
msgid "A date and time combination, supported range is %1$s to %2$s"
msgstr ""
msgstr "Uma combinação de data e hora, o intervalo suportado é %1$s até %2$s"
#: libraries/Types.class.php:325
msgid ""
@ -3743,25 +3723,22 @@ msgid "Numeric"
msgstr ""
#: libraries/Types.class.php:645 libraries/Types.class.php:979
#, fuzzy
#| msgid "Create an index"
msgctxt "date and time types"
msgid "Date and time"
msgstr "Criar um novo índice"
msgstr "Data e hora"
#: libraries/Types.class.php:654 libraries/Types.class.php:982
#, fuzzy
#| msgid "Linestring"
msgctxt "string types"
msgid "String"
msgstr "Segmento de Reta "
msgstr "Segmento"
#: libraries/Types.class.php:675
#, fuzzy
#| msgid "Total"
msgctxt "spatial types"
msgid "Spatial"
msgstr "Total"
msgstr "Espacial"
#: libraries/Types.class.php:710
msgid "A 4-byte integer, range is -2,147,483,648 to 2,147,483,647"
@ -3811,10 +3788,9 @@ msgid "Max: %s%s"
msgstr "Tamanho máximo: %s%s"
#: libraries/Util.class.php:642 libraries/sql.lib.php:429
#, fuzzy
#| msgid "SQL query"
msgid "SQL query:"
msgstr "Comando SQL"
msgstr "Comando SQL:"
#: libraries/Util.class.php:686 libraries/rte/rte_events.lib.php:114
#: libraries/rte/rte_events.lib.php:123 libraries/rte/rte_events.lib.php:140
@ -4020,7 +3996,6 @@ msgid "Could not load default configuration from: %1$s"
msgstr "Não foi possível carregar configuração padrão de: \"%1$s\""
#: libraries/common.inc.php:597
#, fuzzy
#| msgid ""
#| "The <code>$cfg['PmaAbsoluteUri']</code> directive MUST be set in your "
#| "configuration file!"
@ -4028,7 +4003,7 @@ msgid ""
"The [code]$cfg['PmaAbsoluteUri'][/code] directive MUST be set in your "
"configuration file!"
msgstr ""
"A directiva <code>$cfg['PmaAbsoluteUri']</code> TEM que ser definida no "
"A directiva [code]$cfg['PmaAbsoluteUri'][/code] TEM que ser definida no "
"ficheiro de configuração!"
#: libraries/common.inc.php:630
@ -4044,10 +4019,10 @@ msgstr ""
"configurações."
#: libraries/common.inc.php:657
#, fuzzy, php-format
#, php-format
#| msgid "Server"
msgid "Server %d"
msgstr "Servidor"
msgstr "Servidor %d"
#: libraries/common.inc.php:854
msgid "Invalid authentication method set in configuration:"
@ -4076,17 +4051,15 @@ msgstr "Tecla numérica detectada"
#: libraries/config.values.php:49 libraries/config.values.php:65
#: libraries/config.values.php:70
#, fuzzy
#| msgid "Ins"
msgid "Icons"
msgstr "Ins"
msgstr "Ícones"
#: libraries/config.values.php:50 libraries/config.values.php:66
#: libraries/config.values.php:71
#, fuzzy
#| msgid "Test"
msgid "Text"
msgstr "Teste"
msgstr "Texto"
#: libraries/config.values.php:51 libraries/config.values.php:59
#: libraries/config.values.php:67 libraries/config.values.php:72
@ -12421,10 +12394,9 @@ msgid "FOREIGN KEY relation added"
msgstr "Relação FOREIGN KEY adicionada"
#: pmd_relation_new.php:84
#, fuzzy
#| msgid "Error: Relation not added."
msgid "Error: Relational features are disabled!"
msgstr "Erro: Relação não adicionada."
msgstr "Erro: as características relacionais estão desactivadas!"
#: pmd_relation_new.php:100
msgid "Internal relation added"
@ -13045,10 +13017,9 @@ msgid "Choose column to display:"
msgstr "Escolha a coluna para mostrar"
#: tbl_structure.php:111
#, fuzzy
#| msgid "No rows selected"
msgid "No column selected."
msgstr "Nenhum registo(linha) seleccionado"
msgstr "Nenhuma coluna seleccionada."
#: tbl_tracking.php:136
#, php-format
@ -14148,10 +14119,9 @@ msgid "Slow launch time"
msgstr ""
#: libraries/advisory_rules.txt:386
#, fuzzy
#| msgid "long_query_time is set to %d second(s)."
msgid "Slow_launch_threads is above 2s"
msgstr "long_query_time está configurado para %d segundo(s)"
msgstr "Slow_launch_threads está acima de 2s"
#: libraries/advisory_rules.txt:387
#, fuzzy
@ -14162,10 +14132,10 @@ msgid ""
msgstr "Tabelas em tracking"
#: libraries/advisory_rules.txt:388
#, fuzzy, php-format
#, php-format
#| msgid "long_query_time is set to %d second(s)."
msgid "slow_launch_time is set to %s"
msgstr "long_query_time está configurado para %d segundo(s)"
msgstr "slow_launch_time está definido como %s"
#: libraries/advisory_rules.txt:392
#, fuzzy
@ -14269,10 +14239,9 @@ msgid "Is InnoDB disabled?"
msgstr ""
#: libraries/advisory_rules.txt:432
#, fuzzy
#| msgid "Could not save recent table"
msgid "You do not have InnoDB enabled."
msgstr "Não foi possível salvar a tabela recente"
msgstr "Não possui o InnoDB activo."
#: libraries/advisory_rules.txt:433
msgid "InnoDB is usually the better choice for table engines."

View File

@ -4,8 +4,8 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-08-18 06:16-0400\n"
"PO-Revision-Date: 2013-08-26 03:51+0200\n"
"Last-Translator: Mauricio Bastos <msbmail@gmail.com>\n"
"PO-Revision-Date: 2013-09-04 22:24+0200\n"
"Last-Translator: Rodrigo Souza <rodrigo.chrome@outlook.com>\n"
"Language-Team: Portuguese (Brazil) "
"<http://l10n.cihar.com/projects/phpmyadmin/master/pt_BR/>\n"
"Language: pt_BR\n"
@ -10388,10 +10388,9 @@ msgid "Table level tabs"
msgstr "Guias de Tabelas"
#: libraries/server_privileges.lib.php:3663
#, fuzzy
#| msgid "Views"
msgid "View users"
msgstr "Views"
msgstr "Ver usuários"
#: libraries/server_privileges.lib.php:3700
#: libraries/server_privileges.lib.php:3761
@ -10415,22 +10414,19 @@ msgid "Group name:"
msgstr "Nome do Grupo:"
#: libraries/server_privileges.lib.php:3819
#, fuzzy
#| msgid "Server version"
msgid "Server-level tabs"
msgstr "Versão do servidor"
msgstr "Guias do Servidor"
#: libraries/server_privileges.lib.php:3822
#, fuzzy
#| msgid "Database server"
msgid "Database-level tabs"
msgstr "Servidor de banco de dados"
msgstr "Guias do Banco de Dados"
#: libraries/server_privileges.lib.php:3825
#, fuzzy
#| msgid "Table comments"
msgid "Table-level tabs"
msgstr "Comentários da tabela"
msgstr "Guias de Tabelas"
#: libraries/server_privileges.lib.php:3936
msgid "The selected user was not found in the privilege table."
@ -12622,7 +12618,7 @@ msgstr ""
"disponíveis neste sistema."
#: setup/lib/index.lib.php:226
#, fuzzy, php-format
#, php-format
#| msgid ""
#| "%sLogin cookie validity%s greater than 1440 seconds may cause random "
#| "session invalidation if %ssession.gc_maxlifetime%s is lower than its "
@ -12631,9 +12627,9 @@ msgid ""
"%sLogin cookie validity%s greater than %ssession.gc_maxlifetime%s may cause "
"random session invalidation (currently session.gc_maxlifetime is %d)."
msgstr ""
"A %svalidação dos cookies de login%s com mais de 1440 segundos pode causar "
"invalidação aleatória de sessão caso a %ssession.gc_maxlifetime%s seja menor "
"que seu valor (atualmente %d)."
"A %svalidação dos cookies de login%s com mais de %ssession.gc_maxlifetime%s "
"pode causar invalidação aleatória de sessão (atualmente a "
"session.gc_maslifetime é %d)."
#: setup/lib/index.lib.php:228
#, php-format

View File

@ -27,9 +27,10 @@ $header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('server_privileges.js');
if ((empty($_REQUEST['viewing_mode']) || $_REQUEST['viewing_mode'] != 'db')
if ((isset($_REQUEST['viewing_mode']) && $_REQUEST['viewing_mode'] == 'server')
&& $GLOBALS['cfgRelation']['menuswork']
) {
include_once 'libraries/server_users.lib.php';
$response->addHTML('<div>');
$response->addHTML(PMA_getHtmlForSubMenusOnUsersPage('server_privileges.php'));
}
@ -273,7 +274,7 @@ if ($GLOBALS['is_ajax_request']
* Displays the links
*/
if (isset($_REQUEST['viewing_mode']) && $_REQUEST['viewing_mode'] == 'db') {
$_REQUEST['db'] = $_REQUEST['checkprivs'];
$_REQUEST['db'] = $_REQUEST['checkprivsdb'];
$url_query .= '&amp;goto=db_operations.php';
@ -322,10 +323,26 @@ if (isset($_REQUEST['export'])
}
}
if (empty($_REQUEST['adduser'])
&& (! isset($_REQUEST['checkprivs'])
|| ! strlen($_REQUEST['checkprivs']))
) {
if (isset($_REQUEST['adduser'])) {
// Add user
$response->addHTML(
PMA_getHtmlForAddUser((isset($dbname) ? $dbname : ''))
);
} elseif (isset($_REQUEST['checkprivsdb'])) {
if (isset($_REQUEST['checkprivstable'])) {
// check the privileges for a particular table.
$response->addHTML(
PMA_getHtmlForSpecificTablePrivileges(
$_REQUEST['checkprivsdb'], $_REQUEST['checkprivstable']
)
);
} else {
// check the privileges for a particular database.
$response->addHTML(
PMA_getHtmlForSpecificDbPrivileges($_REQUEST['checkprivsdb'])
);
}
} else {
if (! isset($username)) {
// No username is given --> display the overview
$response->addHTML(
@ -352,19 +369,9 @@ if (empty($_REQUEST['adduser'])
)
);
}
} elseif (isset($_REQUEST['adduser'])) {
// Add user
$response->addHTML(
PMA_getHtmlForAddUser((isset($dbname) ? $dbname : ''))
);
} else {
// check the privileges for a particular database.
$response->addHTML(
PMA_getHtmlForSpecificDbPrivileges()
);
} // end if (empty($_REQUEST['adduser']) && empty($checkprivs))... elseif... else...
}
if ((empty($_REQUEST['viewing_mode']) || $_REQUEST['viewing_mode'] != 'db')
if ((isset($_REQUEST['viewing_mode']) && $_REQUEST['viewing_mode'] == 'server')
&& $GLOBALS['cfgRelation']['menuswork']
) {
$response->addHTML('</div>');

View File

@ -7,7 +7,8 @@
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/server_privileges.lib.php';
require_once 'libraries/server_users.lib.php';
require_once 'libraries/server_user_groups.lib.php';
PMA_getRelationsParam();
if (! $GLOBALS['cfgRelation']['menuswork']) {

View File

@ -20,7 +20,7 @@ require_once './setup/lib/ConfigGenerator.class.php';
$config_readable = false;
$config_writable = false;
$config_exists = false;
check_config_rw($config_readable, $config_writable, $config_exists);
PMA_checkConfigRw($config_readable, $config_writable, $config_exists);
echo '<h2>' . __('Configuration file') . '</h2>';
PMA_displayFormTop('config.php');

View File

@ -25,19 +25,19 @@ $cf = ConfigFile::getInstance();
$separator = PMA_URL_getArgSeparator('html');
// message handling
messages_begin();
PMA_messagesBegin();
//
// Check phpMyAdmin version
//
if (isset($_GET['version_check'])) {
PMA_version_check();
PMA_versionCheck();
}
//
// Perform various security, compatibility and consistency checks
//
perform_config_checks();
PMA_performConfigChecks();
//
// Check whether we can read/write configuration
@ -45,9 +45,9 @@ perform_config_checks();
$config_readable = false;
$config_writable = false;
$config_exists = false;
check_config_rw($config_readable, $config_writable, $config_exists);
PMA_checkConfigRw($config_readable, $config_writable, $config_exists);
if (!$config_writable || !$config_readable) {
messages_set(
PMA_messagesSet(
'error', 'config_rw', __('Cannot load or save configuration'),
PMA_sanitize(
__(
@ -84,7 +84,7 @@ if (!$is_https) {
)
);
}
messages_set('notice', 'no_https', __('Insecure connection'), $text);
PMA_messagesSet('notice', 'no_https', __('Insecure connection'), $text);
}
echo '<form id="select_lang" method="post" action="'
@ -112,7 +112,7 @@ echo '</form>';
switch ($action_done) {
case 'config_saved':
/* Use uniqid to display this message every time configuration is saved */
messages_set(
PMA_messagesSet(
'notice', uniqid('config_saved'), __('Configuration saved.'),
PMA_sanitize(
__(
@ -130,8 +130,8 @@ default:
echo '<h2>' . __('Overview') . '</h2>';
// message handling
messages_end();
messages_show_html();
PMA_messagesEnd();
PMA_messagesShowHtml();
echo '<a href="#" id="show_hidden_messages" style="display:none">';
echo __('Show hidden messages (#MSG_COUNT)');

View File

@ -15,7 +15,7 @@ if (!defined('PHPMYADMIN')) {
*
* @return void
*/
function messages_begin()
function PMA_messagesBegin()
{
if (! isset($_SESSION['messages']) || !is_array($_SESSION['messages'])) {
$_SESSION['messages'] = array('error' => array(), 'notice' => array());
@ -40,7 +40,7 @@ function messages_begin()
*
* @return void
*/
function messages_set($type, $id, $title, $message)
function PMA_messagesSet($type, $id, $title, $message)
{
$fresh = ! isset($_SESSION['messages'][$type][$id]);
$_SESSION['messages'][$type][$id] = array(
@ -55,7 +55,7 @@ function messages_set($type, $id, $title, $message)
*
* @return void
*/
function messages_end()
function PMA_messagesEnd()
{
foreach ($_SESSION['messages'] as &$messages) {
$remove_ids = array();
@ -71,11 +71,11 @@ function messages_end()
}
/**
* Prints message list, must be called after messages_end()
* Prints message list, must be called after PMA_messagesEnd()
*
* @return void
*/
function messages_show_html()
function PMA_messagesShowHtml()
{
$old_ids = array();
foreach ($_SESSION['messages'] as $type => $messages) {
@ -101,7 +101,7 @@ function messages_show_html()
*
* @return void
*/
function PMA_version_check()
function PMA_versionCheck()
{
// version check messages should always be visible so let's make
// a unique message id each time we run it
@ -111,7 +111,7 @@ function PMA_version_check()
$version_data = PMA_Util::getLatestVersion();
if (empty($version_data)) {
messages_set(
PMA_messagesSet(
'error',
$message_id,
__('Version check'),
@ -125,7 +125,7 @@ function PMA_version_check()
$version_upstream = PMA_Util::versionToInt($version);
if ($version_upstream === false) {
messages_set(
PMA_messagesSet(
'error',
$message_id,
__('Version check'),
@ -136,7 +136,7 @@ function PMA_version_check()
$version_local = PMA_Util::versionToInt($GLOBALS['PMA_Config']->get('PMA_VERSION'));
if ($version_local === false) {
messages_set(
PMA_messagesSet(
'error',
$message_id,
__('Version check'),
@ -148,7 +148,7 @@ function PMA_version_check()
if ($version_upstream > $version_local) {
$version = htmlspecialchars($version);
$date = htmlspecialchars($date);
messages_set(
PMA_messagesSet(
'notice',
$message_id,
__('Version check'),
@ -156,14 +156,14 @@ function PMA_version_check()
);
} else {
if ($version_local % 100 == 0) {
messages_set(
PMA_messagesSet(
'notice',
$message_id,
__('Version check'),
PMA_sanitize(sprintf(__('You are using Git version, run [kbd]git pull[/kbd] :-)[br]The latest stable version is %s, released on %s.'), $version, $date))
);
} else {
messages_set(
PMA_messagesSet(
'notice',
$message_id,
__('Version check'),
@ -182,7 +182,7 @@ function PMA_version_check()
*
* @return void
*/
function check_config_rw(&$is_readable, &$is_writable, &$file_exists)
function PMA_checkConfigRw(&$is_readable, &$is_writable, &$file_exists)
{
$file_path = ConfigFile::getInstance()->getFilePath();
$file_dir = dirname($file_path);
@ -201,12 +201,12 @@ function check_config_rw(&$is_readable, &$is_writable, &$file_exists)
/**
* Performs various compatibility, security and consistency checks on current config
*
* Outputs results to message list, must be called between messages_begin()
* and messages_end()
* Outputs results to message list, must be called between PMA_messagesBegin()
* and PMA_messagesEnd()
*
* @return void
*/
function perform_config_checks()
function PMA_performConfigChecks()
{
$cf = ConfigFile::getInstance();
$blowfish_secret = $cf->get('blowfish_secret');
@ -214,15 +214,33 @@ function perform_config_checks()
$cookie_auth_used = false;
$strAllowArbitraryServerWarning = __('This %soption%s should be disabled as it allows attackers to bruteforce login to any MySQL server. If you feel this is necessary, use %strusted proxies list%s. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.');
$strAllowArbitraryServerWarning = sprintf($strAllowArbitraryServerWarning, '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]', '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]');
$strAllowArbitraryServerWarning = sprintf(
$strAllowArbitraryServerWarning,
'[a@?page=form&amp;formset=Features#tab_Security]',
'[/a]', '[a@?page=form&amp;formset=Features#tab_Security]',
'[/a]'
);
$strBlowfishSecretMsg = __('You didn\'t have blowfish secret set and have enabled cookie authentication, so a key was automatically generated for you. It is used to encrypt cookies; you don\'t need to remember it.');
$strBZipDumpWarning = __('%sBzip2 compression and decompression%s requires functions (%s) which are unavailable on this system.');
$strBZipDumpWarning = sprintf($strBZipDumpWarning, '[a@?page=form&amp;formset=Features#tab_Import_export]', '[/a]', '%s');
$strBZipDumpWarning = sprintf(
$strBZipDumpWarning,
'[a@?page=form&amp;formset=Features#tab_Import_export]',
'[/a]', '%s'
);
$strDirectoryNotice = __('This value should be double checked to ensure that this directory is neither world accessible nor readable or writable by other users on your server.');
$strForceSSLNotice = __('This %soption%s should be enabled if your web server supports it.');
$strForceSSLNotice = sprintf($strForceSSLNotice, '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]');
$strForceSSLNotice = sprintf(
$strForceSSLNotice,
'[a@?page=form&amp;formset=Features#tab_Security]',
'[/a]'
);
$strGZipDumpWarning = __('%sGZip compression and decompression%s requires functions (%s) which are unavailable on this system.');
$strGZipDumpWarning = sprintf($strGZipDumpWarning, '[a@?page=form&amp;formset=Features#tab_Import_export]', '[/a]', '%s');
$strGZipDumpWarning = sprintf(
$strGZipDumpWarning,
'[a@?page=form&amp;formset=Features#tab_Import_export]',
'[/a]',
'%s'
);
$strLoginCookieValidityWarning = __('%sLogin cookie validity%s greater than %ssession.gc_maxlifetime%s may cause random session invalidation (currently session.gc_maxlifetime is %d).');
$strLoginCookieValidityWarning = sprintf($strLoginCookieValidityWarning, '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]', '[a@' . PMA_getPHPDocLink('session.configuration.php#ini.session.gc-maxlifetime') . ']', '[/a]', ini_get('session.gc_maxlifetime'));
$strLoginCookieValidityWarning2 = __('%sLogin cookie validity%s should be set to 1800 seconds (30 minutes) at most. Values larger than 1800 may pose a security risk such as impersonation.');
@ -259,7 +277,7 @@ function perform_config_checks()
//
if (!$cf->getValue("Servers/$i/ssl")) {
$title = PMA_lang(PMA_langName('Servers/1/ssl')) . " ($server_name)";
messages_set(
PMA_messagesSet(
'notice',
"Servers/$i/ssl",
$title,
@ -274,7 +292,7 @@ function perform_config_checks()
if ($cf->getValue("Servers/$i/extension") == 'mysql') {
$title = PMA_lang(PMA_langName('Servers/1/extension'))
. " ($server_name)";
messages_set(
PMA_messagesSet(
'notice',
"Servers/$i/extension",
$title,
@ -292,7 +310,7 @@ function perform_config_checks()
) {
$title = PMA_lang(PMA_langName('Servers/1/auth_type'))
. " ($server_name)";
messages_set(
PMA_messagesSet(
'notice',
"Servers/$i/auth_type",
$title,
@ -311,7 +329,7 @@ function perform_config_checks()
) {
$title = PMA_lang(PMA_langName('Servers/1/AllowNoPassword'))
. " ($server_name)";
messages_set(
PMA_messagesSet(
'notice',
"Servers/$i/AllowNoPassword",
$title,
@ -328,7 +346,7 @@ function perform_config_checks()
if ($cookie_auth_used) {
if ($blowfish_secret_set) {
// 'cookie' auth used, blowfish_secret was generated
messages_set(
PMA_messagesSet(
'notice',
'blowfish_secret_created',
PMA_lang(PMA_langName('blowfish_secret')),
@ -349,7 +367,7 @@ function perform_config_checks()
$blowfish_warnings[] = PMA_lang(__('Key should contain letters, numbers [em]and[/em] special characters.'));
}
if (!empty($blowfish_warnings)) {
messages_set(
PMA_messagesSet(
'error',
'blowfish_warnings' . count($blowfish_warnings),
PMA_lang(PMA_langName('blowfish_secret')),
@ -364,7 +382,7 @@ function perform_config_checks()
// should be enabled if possible
//
if (!$cf->getValue('ForceSSL')) {
messages_set(
PMA_messagesSet(
'notice',
'ForceSSL',
PMA_lang(PMA_langName('ForceSSL')),
@ -377,7 +395,7 @@ function perform_config_checks()
// should be disabled
//
if ($cf->getValue('AllowArbitraryServer')) {
messages_set(
PMA_messagesSet(
'notice',
'AllowArbitraryServer',
PMA_lang(PMA_langName('AllowArbitraryServer')),
@ -390,7 +408,7 @@ function perform_config_checks()
// value greater than session.gc_maxlifetime will cause
// random session invalidation after that time
if ($cf->getValue('LoginCookieValidity') > ini_get('session.gc_maxlifetime')) {
messages_set(
PMA_messagesSet(
'error',
'LoginCookieValidity',
PMA_lang(PMA_langName('LoginCookieValidity')),
@ -403,7 +421,7 @@ function perform_config_checks()
// should be at most 1800 (30 min)
//
if ($cf->getValue('LoginCookieValidity') > 1800) {
messages_set(
PMA_messagesSet(
'notice',
'LoginCookieValidity',
PMA_lang(PMA_langName('LoginCookieValidity')),
@ -419,7 +437,7 @@ function perform_config_checks()
if ($cf->getValue('LoginCookieStore') != 0
&& $cf->getValue('LoginCookieValidity') > $cf->getValue('LoginCookieStore')
) {
messages_set(
PMA_messagesSet(
'error',
'LoginCookieValidity',
PMA_lang(PMA_langName('LoginCookieValidity')),
@ -432,7 +450,7 @@ function perform_config_checks()
// should not be world-accessible
//
if ($cf->getValue('SaveDir') != '') {
messages_set(
PMA_messagesSet(
'notice',
'SaveDir',
PMA_lang(PMA_langName('SaveDir')),
@ -445,7 +463,7 @@ function perform_config_checks()
// should not be world-accessible
//
if ($cf->getValue('TempDir') != '') {
messages_set(
PMA_messagesSet(
'notice',
'TempDir',
PMA_lang(PMA_langName('TempDir')),
@ -460,7 +478,7 @@ function perform_config_checks()
if ($cf->getValue('GZipDump')
&& (@!function_exists('gzopen') || @!function_exists('gzencode'))
) {
messages_set(
PMA_messagesSet(
'error',
'GZipDump',
PMA_lang(PMA_langName('GZipDump')),
@ -481,7 +499,7 @@ function perform_config_checks()
$functions .= @function_exists('bzcompress')
? ''
: ($functions ? ', ' : '') . 'bzcompress';
messages_set(
PMA_messagesSet(
'error',
'BZipDump',
PMA_lang(PMA_langName('BZipDump')),
@ -494,7 +512,7 @@ function perform_config_checks()
// requires zip_open in import
//
if ($cf->getValue('ZipDump') && !@function_exists('zip_open')) {
messages_set(
PMA_messagesSet(
'error',
'ZipDump_import',
PMA_lang(PMA_langName('ZipDump')),
@ -507,7 +525,7 @@ function perform_config_checks()
// requires gzcompress in export
//
if ($cf->getValue('ZipDump') && !@function_exists('gzcompress')) {
messages_set(
PMA_messagesSet(
'error',
'ZipDump_export',
PMA_lang(PMA_langName('ZipDump')),

View File

@ -93,12 +93,12 @@ $multi_edit_columns_name = isset($_REQUEST['fields_name'])
// u p d a t e s f o r I n t e r n a l r e l a t i o n s
if (isset($_POST['destination_db']) && $cfgRelation['relwork']) {
PMA_handleUpdatesForInternalRelations(
PMA_handleUpdatesForInternalRelations(
$_POST['destination_db'], $multi_edit_columns_name,
$_POST['destination_table'],
$_POST['destination_column'], $cfgRelation, $db, $table,
isset($existrel) ? $existrel : null
);
);
} // end if (updates for internal relations)
$html_output = '';

View File

@ -15,9 +15,8 @@
*
* @package PhpMyAdmin-test
*/
class Drizzle
{
if (!defined("DRIZZLE_CAPABILITIES_COMPRESS")) {
define("DRIZZLE_CAPABILITIES_COMPRESS", 2);
}
/**
@ -38,6 +37,7 @@ require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/Index.class.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/dbi/DBIDrizzle.class.php';
require_once 'libraries/Theme.class.php';
/**
* Tests for PMA_DBI_Drizzle class
@ -59,7 +59,30 @@ class PMA_DBI_Drizzle_Test extends PHPUnit_Framework_TestCase
* @return void
*/
protected function setUp()
{
{
$GLOBALS['cfg']['Server']['host'] = "localhost";
$GLOBALS['cfg']['Server']['socket'] = "socket";
$GLOBALS['cfg']['Server']['port'] = 4080;
$GLOBALS['cfg']['Server']['connect_type'] = "http";
$GLOBALS['cfg']['PersistentConnections'] = false;
$GLOBALS['cfg']['Server']['compress'] = true;
$GLOBALS['cfg']['Server']['ssl'] = false;
$GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
$GLOBALS['cfg']['ActionLinksMode'] = "both";
$GLOBALS['cfg']['DefaultTabDatabase'] = 'db_structure.php';
$GLOBALS['pmaThemeImage'] = 'image';
//$_SESSION
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
$_SESSION['PMA_Theme'] = new PMA_Theme();
//Mock DBI, just for postConnect usage
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
$this->object = new PMA_DBI_Drizzle();
}
@ -88,7 +111,7 @@ class PMA_DBI_Drizzle_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
false,
$this->object->realMultiQuery(null, "select * from PMA")
);
);
}
/**
@ -105,7 +128,7 @@ class PMA_DBI_Drizzle_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
false,
$this->object->selectDb("PMA")
);
);
}
/**
@ -121,12 +144,12 @@ class PMA_DBI_Drizzle_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
false,
$this->object->moreResults()
);
);
//PHP's 'mysql' extension does not support multi_queries
$this->assertEquals(
false,
$this->object->nextResult()
);
);
}
/**
@ -174,4 +197,244 @@ class PMA_DBI_Drizzle_Test extends PHPUnit_Framework_TestCase
$this->object->storeResult()
);
}
/**
* Test for connect
*
* @return void
*
* @group medium
*/
public function testDBIFunction()
{
$user = "PMA_user";
$password = "pma_password";
$is_controluser = false;
$server = null;
//$server = null;
$link = $this->object->connect($user, $password);
$this->assertEquals(
"DrizzleCon_addUds",
$link->getType()
);
//$server['host'] = 'host'
$server['host'] = 'host';
$link = $this->object->connect($user, $password);
$this->assertEquals(
"DrizzleCon_addUds",
$link->getType()
);
//selectDb
$dbname = "dbname";
$this->assertEquals(
"selectDb" . $dbname,
$this->object->selectDb($dbname, $link)
);
//realQuery
$query = "query";
$options = false;
$this->assertEquals(
"query" . $query,
$this->object->realQuery($query, $link, $options)
);
//fetchArray
$result = $link;
$this->assertEquals(
"fetchRow " . PMA_Drizzle::FETCH_BOTH,
$this->object->fetchArray($result)
);
//fetchAssoc
$result = $link;
$this->assertEquals(
"fetchRow " . PMA_Drizzle::FETCH_ASSOC,
$this->object->fetchAssoc($result)
);
//fetchRow
$result = $link;
$this->assertEquals(
"fetchRow " . PMA_Drizzle::FETCH_NUM,
$this->object->fetchRow($result)
);
//dataSeek
$result = $link;
$offset = 10;
$this->assertEquals(
"seek" . $offset,
$this->object->dataSeek($result, 10)
);
//numRows
$result = $link;
$this->assertEquals(
"numRows",
$this->object->numRows($result)
);
//numFields
$result = $link;
$this->assertEquals(
"numColumns",
$this->object->numFields($result)
);
}
}
/**
* Mock class for Drizzle
*
* @package PhpMyAdmin-test
*/
class Drizzle
{
/**
* Constructor
*/
public function __construct()
{
}
/**
* Creates a new connection using unix domain socket
*
* @param string $uds socket
* @param string $user username
* @param string $password password
* @param string $db database name
* @param integer $options connection options
*
* @return Mock_Con
*/
public function addUds($uds, $user, $password, $db, $options)
{
return new Mock_Con("DrizzleCon_addUds");
}
/**
* Creates a new database conection using TCP
*
* @param string $host Drizzle host
* @param integer $port Drizzle port
* @param string $user username
* @param string $password password
* @param string $db database name
* @param integer $options connection options
*
* @return Mock_Con
*/
public function addTcp($host, $port, $user, $password, $db, $options)
{
return new Mock_Con("DrizzleCon_addTcp");
}
}
/**
* Mock class for Mock_Connection
*
* @package PhpMyAdmin-test
*/
class Mock_Con
{
var $type;
/**
* Constructor
*
* @param string $type type
*/
public function __construct($type)
{
$this->type = $type;
}
/**
* Creates a new database conection using TCP
*
* @return Mock_Con
*/
public function getType()
{
return $this->type;
}
/**
* selectDb
*
* @param string $dbname database name
*
* @return string
*/
public function selectDb($dbname)
{
return "selectDb" . $dbname;
}
/**
* query
*
* @param string $query query string
* @param int $buffer_mode buffer mode
*
* @return string
*/
public function query($query, $buffer_mode)
{
return "query" . $query;
}
/**
* fetchRow
*
* @param string $mode fetch mode
*
* @return string
*/
public function fetchRow($mode)
{
return "fetchRow " . $mode;
}
/**
* $offset
*
* @param int $offset offset
*
* @return string
*/
public function seek($offset)
{
return "seek" . $offset;
}
/**
* numRows
*
* @return string
*/
public function numRows()
{
return "numRows";
}
/**
* numColumns
*
* @return string
*/
public function numColumns()
{
return "numColumns";
}
}

View File

@ -85,18 +85,36 @@ class PMA_DBI_Mysql_Test extends PHPUnit_Framework_TestCase
$this->markTestSkipped("Cannot redefine function");
}
//FOR UT, we just test the right mysql client API is called
runkit_function_redefine('mysql_pconnect','','return "mysql_pconnect";');
runkit_function_redefine('mysql_connect','','return "mysql_connect";');
runkit_function_redefine('mysql_query','','return "mysql_query";');
runkit_function_redefine('mysql_fetch_array','','return "mysql_fetch_array";');
runkit_function_redefine('mysql_data_seek','','return "mysql_data_seek";');
runkit_function_redefine('mysql_get_host_info','','return "mysql_get_host_info";');
runkit_function_redefine('mysql_get_proto_info','','return "mysql_get_proto_info";');
runkit_function_redefine('mysql_field_flags','','return "mysql_field_flags";');
runkit_function_redefine('mysql_field_name','','return "mysql_field_name";');
runkit_function_redefine('mysql_field_len','','return "mysql_field_len";');
runkit_function_redefine('mysql_num_fields','','return "mysql_num_fields";');
runkit_function_redefine('mysql_affected_rows','','return "mysql_affected_rows";');
runkit_function_redefine('mysql_pconnect', '', 'return "mysql_pconnect";');
runkit_function_redefine('mysql_connect', '', 'return "mysql_connect";');
runkit_function_redefine('mysql_query', '', 'return "mysql_query";');
runkit_function_redefine(
'mysql_fetch_array', '', 'return "mysql_fetch_array";'
);
runkit_function_redefine(
'mysql_data_seek', '', 'return "mysql_data_seek";'
);
runkit_function_redefine(
'mysql_get_host_info', '', 'return "mysql_get_host_info";'
);
runkit_function_redefine(
'mysql_get_proto_info', '', 'return "mysql_get_proto_info";'
);
runkit_function_redefine(
'mysql_field_flags', '', 'return "mysql_field_flags";'
);
runkit_function_redefine(
'mysql_field_name', '', 'return "mysql_field_name";'
);
runkit_function_redefine(
'mysql_field_len', '', 'return "mysql_field_len";'
);
runkit_function_redefine(
'mysql_num_fields', '', 'return "mysql_num_fields";'
);
runkit_function_redefine(
'mysql_affected_rows', '', 'return "mysql_affected_rows";'
);
//test for fieldFlags
$result = array("table1", "table2");

View File

@ -85,18 +85,36 @@ class PMA_DBI_Mysqli_Test extends PHPUnit_Framework_TestCase
}
//FOR UT, we just test the right mysql client API is called
runkit_function_redefine('mysqli_real_connect','','return "mysqli_real_connect";');
runkit_function_redefine('mysqli_init','','return "mysqli_init";');
runkit_function_redefine('mysqli_options','','return "mysqli_options";');
runkit_function_redefine('mysqli_query','','return "mysqli_query";');
runkit_function_redefine('mysqli_multi_query','','return "mysqli_multi_query";');
runkit_function_redefine('mysqli_fetch_array','','return "mysqli_fetch_array";');
runkit_function_redefine('mysqli_data_seek','','return "mysqli_data_seek";');
runkit_function_redefine('mysqli_more_results','','return "mysqli_more_results";');
runkit_function_redefine('mysqli_next_result','','return "mysqli_next_result";');
runkit_function_redefine('mysqli_get_host_info','','return "mysqli_get_host_info";');
runkit_function_redefine('mysqli_get_proto_info','','return "mysqli_get_proto_info";');
runkit_function_redefine('mysqli_get_client_info','','return "mysqli_get_client_info";');
runkit_function_redefine(
'mysqli_real_connect', '', 'return "mysqli_real_connect";'
);
runkit_function_redefine('mysqli_init', '', 'return "mysqli_init";');
runkit_function_redefine('mysqli_options', '', 'return "mysqli_options";');
runkit_function_redefine('mysqli_query', '', 'return "mysqli_query";');
runkit_function_redefine(
'mysqli_multi_query', '', 'return "mysqli_multi_query";'
);
runkit_function_redefine(
'mysqli_fetch_array', '', 'return "mysqli_fetch_array";'
);
runkit_function_redefine(
'mysqli_data_seek', '', 'return "mysqli_data_seek";'
);
runkit_function_redefine(
'mysqli_more_results', '', 'return "mysqli_more_results";'
);
runkit_function_redefine(
'mysqli_next_result', '', 'return "mysqli_next_result";'
);
runkit_function_redefine(
'mysqli_get_host_info', '', 'return "mysqli_get_host_info";'
);
runkit_function_redefine(
'mysqli_get_proto_info', '', 'return "mysqli_get_proto_info";'
);
runkit_function_redefine(
'mysqli_get_client_info', '', 'return "mysqli_get_client_info";'
);
$user = 'PMA_user';
$password = 'PMA_password';

View File

@ -19,7 +19,7 @@ class Node_Database_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -31,7 +31,7 @@ class Node_Database_Test extends PHPUnit_Framework_TestCase
/**
* Test for __construct
*
*
* @return void
*/
public function testConstructor()
@ -45,6 +45,7 @@ class Node_Database_Test extends PHPUnit_Framework_TestCase
'db_structure.php',
$parent->links['text']
);
$this->assertContains('database', $parent->classes);
}
}
?>

View File

@ -19,7 +19,7 @@ class Node_Table_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -47,6 +47,7 @@ class Node_Table_Container_Test extends PHPUnit_Framework_TestCase
$parent->links['text']
);
$this->assertEquals('tables', $parent->real_name);
$this->assertContains('tableContainer', $parent->classes);
}
}
?>

View File

@ -19,7 +19,7 @@ class Node_Table_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -46,6 +46,39 @@ class Node_Table_Test extends PHPUnit_Framework_TestCase
'sql.php',
$parent->links['text']
);
$this->assertContains('table', $parent->classes);
}
/**
* Tests whether the node icon is properly set based on the icon target.
*
* @param string $target target of the icon
* @param string $imageName name of the image that should be set
*
* @return void
* @dataProvider providerForTestIcon
*/
public function testIcon($target, $imageName)
{
$GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = $target;
$node = PMA_NodeFactory::getInstance('Node_Table');
$this->assertContains($imageName, $node->icon);
}
/**
* Data provider for testIcon().
*
* @return array data for testIcon()
*/
public function providerForTestIcon()
{
return array(
array('tbl_structure.php', 'b_props'),
array('tbl_select.php', 'b_search'),
array('tbl_change.php', 'b_insrow'),
array('tbl_sql.php', 'b_sql'),
array('sql.php', 'b_browse'),
);
}
}
?>

View File

@ -19,7 +19,7 @@ class Node_View_Container_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -47,6 +47,7 @@ class Node_View_Container_Test extends PHPUnit_Framework_TestCase
$parent->links['text']
);
$this->assertEquals('views', $parent->real_name);
$this->assertContains('viewContainer', $parent->classes);
}
}
?>

View File

@ -19,7 +19,7 @@ class Node_View_Test extends PHPUnit_Framework_TestCase
{
/**
* SetUp for test cases
*
*
* @return void
*/
public function setup()
@ -46,6 +46,8 @@ class Node_View_Test extends PHPUnit_Framework_TestCase
'sql.php',
$parent->links['text']
);
$this->assertContains('b_props', $parent->icon);
$this->assertContains('view', $parent->classes);
}
}
?>

View File

@ -215,8 +215,8 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$this->object->exportHeader();
$result = ob_get_clean();
$expected =
'<html xmlns:o="urn:schemas-microsoft-com:office:office"
$expected
= '<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
@ -241,8 +241,8 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
$this->object->exportHeader();
$result = ob_get_clean();
$expected =
'<html xmlns:o="urn:schemas-microsoft-com:office:office"
$expected
= '<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">

View File

@ -22,11 +22,11 @@ require_once 'libraries/Util.class.php';
class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
{
/**
* Test for messages_begin()
* Test for PMA_messagesBegin()
*
* @return void
*/
public function testMessagesBegin()
public function testPMAmessagesBegin()
{
$_SESSION['messages'] = array(
array(
@ -35,7 +35,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
)
);
messages_begin();
PMA_messagesBegin();
$this->assertEquals(
array(
@ -58,7 +58,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
// case 2
unset($_SESSION['messages']);
messages_begin();
PMA_messagesBegin();
$this->assertEquals(
array(
'error' => array(),
@ -69,13 +69,13 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for messages_set
* Test for PMA_messagesSet
*
* @return void
*/
public function testMessagesSet()
public function testPMAmessagesSet()
{
messages_set('type', '123', 'testTitle', 'msg');
PMA_messagesSet('type', '123', 'testTitle', 'msg');
$this->assertEquals(
array(
@ -89,11 +89,11 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for messages_end
* Test for PMA_messagesEnd
*
* @return void
*/
public function testMessagesEnd()
public function testPMAmessagesEnd()
{
$_SESSION['messages'] = array(
array(
@ -102,7 +102,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
)
);
messages_end();
PMA_messagesEnd();
$this->assertEquals(
array(
@ -118,11 +118,11 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for messages_show_html
* Test for PMA_messagesShowHtml
*
* @return void
*/
public function testMessagesShowHTML()
public function testPMAMessagesShowHTML()
{
$_SESSION['messages'] = array(
'type' => array(
@ -132,7 +132,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
);
ob_start();
messages_show_html();
PMA_messagesShowHtml();
$result = ob_get_clean();
$this->assertContains(
@ -162,7 +162,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for PMA_version_check
* Test for PMA_versionCheck
*
* @return void
*/
@ -179,7 +179,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
$GLOBALS['PMA_Config'] = $pmaconfig;
PMA_version_check();
PMA_versionCheck();
$this->assertArrayHasKey(
'notice',
@ -210,7 +210,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for PMA_version_check
* Test for PMA_versionCheck
*
* @return void
*/
@ -227,7 +227,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
$GLOBALS['PMA_Config'] = $pmaconfig;
PMA_version_check();
PMA_versionCheck();
$this->assertArrayHasKey(
'notice',
@ -258,7 +258,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for PMA_version_check
* Test for PMA_versionCheck
*
* @return void
*/
@ -275,7 +275,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
$GLOBALS['PMA_Config'] = $pmaconfig;
PMA_version_check();
PMA_versionCheck();
$this->assertArrayHasKey(
'notice',
@ -306,11 +306,11 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for check_config_rw
* Test for PMA_checkConfigRw
*
* @return void
*/
public function testCheckConfigRW()
public function testPMACheckConfigRw()
{
if (! PMA_HAS_RUNKIT) {
$this->markTestSkipped('Cannot redefine constant');
@ -331,7 +331,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
$is_writable = false;
$file_exists = false;
check_config_rw($is_readable, $is_writable, $file_exists);
PMA_checkConfigRw($is_readable, $is_writable, $file_exists);
$this->assertTrue(
$is_readable
@ -350,7 +350,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
'test/test_data/test.file'
);
check_config_rw($is_readable, $is_writable, $file_exists);
PMA_checkConfigRw($is_readable, $is_writable, $file_exists);
$this->assertTrue(
$is_readable
@ -372,11 +372,11 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for perform_config_checks
* Test for PMA_performConfigChecks
*
* @return void
*/
public function testPerformConfigChecks()
public function testPMAPerformConfigChecks()
{
$GLOBALS['cfg']['AvailableCharsets'] = array();
@ -442,7 +442,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
$errorArrayKeys[] = 'ZipDump_export';
}
perform_config_checks();
PMA_performConfigChecks();
foreach ($noticeArrayKeys as $noticeKey) {
$this->assertArrayHasKey(
@ -484,7 +484,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
$_SESSION[$sessionID]['BZipDump'] = false;
$_SESSION[$sessionID]['ZipDump'] = false;
perform_config_checks();
PMA_performConfigChecks();
$this->assertArrayHasKey(
'blowfish_secret_created',
$_SESSION['messages']['notice']
@ -512,7 +512,7 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase
'auth_type' => 'cookie'
)
);
perform_config_checks();
PMA_performConfigChecks();
$this->assertArrayHasKey(
'blowfish_warnings2',
$_SESSION['messages']['error']

View File

@ -1199,6 +1199,28 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
);
// case 5
$GLOBALS['cfg']['ProtectBinary'] = false;
$GLOBALS['cfg']['LongtextDoubleTextarea'] = true;
$GLOBALS['cfg']['LimitChars'] = 100;
$column['is_blob'] = false;
$column['len'] = 255;
$column['is_char'] = false;
$GLOBALS['cfg']['TextareaRows'] = 20;
$GLOBALS['cfg']['TextareaCols'] = 10;
$result = PMA_getBinaryAndBlobColumn(
$column, '1223', null, 20, 'a', 'b', 'c', 2, 1, 1, '/', null,
'foo', true
);
$this->assertEquals(
"\na\n"
. '<textarea name="fieldsb" class="" rows="20" cols="10" dir="/" '
. 'id="field_1_3" c tabindex="3"></textarea>',
$result
);
// case 6
$column['is_blob'] = false;
$column['len'] = 10;
$GLOBALS['cfg']['LimitChars'] = 40;

View File

@ -136,7 +136,7 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
);
// $cfg['Servers'][$i]['table_info']
$result = "\$cfg['Servers'][\$i]['table_info'] ... </th>"
. "<td class=\"right\">"
. "<td class=\"right\">"
. "<font color=\"red\"><strong>not OK</strong></font>";
$this->assertContains(
$result,

View File

@ -19,6 +19,7 @@ require_once 'libraries/Message.class.php';
require_once 'libraries/sanitizing.lib.php';
require_once 'libraries/sqlparser.lib.php';
require_once 'libraries/js_escape.lib.php';
require_once 'libraries/database_interface.inc.php';
/**
* PMA_ServerBinlog_Test class
@ -202,4 +203,65 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
$html
);
}
/**
* Test for PMA_getAllLogItemInfo
*
* @return void
*/
public function testPMAGetAllLogItemInfo()
{
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$fetchAssoc = array(
'Info' => 'Info',
'Log_name' => 'Log_name',
'Pos' => 'Pos',
'Event_type' => 'Event_type',
'Server_id' => 'Server_id',
'Orig_log_pos' => 'Orig_log_pos',
'End_log_pos' => 'End_log_pos',
);
$dbi->expects($this->at(0))->method('fetchAssoc')
->will($this->returnValue($fetchAssoc));
$dbi->expects($this->at(1))->method('fetchAssoc')
->will($this->returnValue(false));
$GLOBALS['dbi'] = $dbi;
$GLOBALS['cfg']['LimitChars'] = 2;
$result = array();
$dontlimitchars = ";";
$html = PMA_getAllLogItemInfo($result, $dontlimitchars);
$value = $fetchAssoc;
$this->assertContains(
$value['Log_name'],
$html
);
$this->assertContains(
$value['Pos'],
$html
);
$this->assertContains(
$value['Event_type'],
$html
);
$this->assertContains(
$value['Server_id'],
$html
);
$this->assertContains(
$value['Orig_log_pos'],
$html
);
$this->assertContains(
htmlspecialchars($value['Info']),
$html
);
}
}

View File

@ -245,4 +245,42 @@ class PMA_ServerDatabases_Test extends PHPUnit_Framework_TestCase
$sort_order
);
}
/**
* Test for PMA_getHtmlForColumnOrder
*
* @return void
*/
public function testPMAGetHtmlForColumnOrder()
{
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
$column_order = array(
"first_database" => array(
'format' => 'byte',
'footer' => '10333',
)
);
$first_database = array(
"first_database" => "db1"
);
$html = PMA_getHtmlForColumnOrder($column_order, $first_database);
$stat = $column_order["first_database" ];
list($value, $unit)
= PMA_Util::formatByteDown($stat['footer'], 3, 1);
$this->assertContains(
$value,
$html
);
$this->assertContains(
$unit,
$html
);
}
}

View File

@ -57,12 +57,22 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['Server']['pmadb'] = 'pmadb';
$GLOBALS['cfg']['Server']['usergroups'] = 'usergroups';
$GLOBALS['cfg']['Server']['users'] = 'users';
$GLOBALS['cfg']['ActionLinksMode'] = "both";
$GLOBALS['cfg']['DefaultTabDatabase'] = 'db_structure.php';
$GLOBALS['cfg']['QueryWindowHeight'] = 100;
$GLOBALS['cfg']['QueryWindowWidth'] = 100;
$GLOBALS['cfg']['PmaAbsoluteUri'] = "PmaAbsoluteUri";
$GLOBALS['cfg']['DefaultTabTable'] = "db_structure.php";
$GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = "db_structure.php";
$GLOBALS['cfg']['Confirm'] = "Confirm";
$GLOBALS['table'] = "table";
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
$GLOBALS['pmaThemeImage'] = 'image';
$GLOBALS['server'] = 1;
$GLOBALS['username'] = "pma_username";
$GLOBALS['collation_connection'] = "collation_connection";
$GLOBALS['text_dir'] = "text_dir";
//$_POST
$_POST['pred_password'] = 'none';
@ -70,6 +80,12 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
$_SESSION['PMA_Theme'] = new PMA_Theme();
$pmaconfig = $this->getMockBuilder('PMA_Config')
->disableOriginalConstructor()
->getMock();
$GLOBALS['PMA_Config'] = $pmaconfig;
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
@ -294,6 +310,38 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for PMA_getHtmlForUserGroupDialog
*
* @return void
*/
public function testPMAGetHtmlForUserGroupDialog()
{
$username = "pma_username";
$is_menuswork = true;
$_REQUEST['edit_user_group_dialog'] = "edit_user_group_dialog";
$GLOBALS['is_ajax_request'] = false;
//PMA_getHtmlForUserGroupDialog
$html = PMA_getHtmlForUserGroupDialog($username, $is_menuswork);
$this->assertContains(
'<form class="ajax" id="changeUserGroupForm"',
$html
);
//PMA_URL_getHiddenInputs
$params = array('username' => $username);
$html_output = PMA_URL_getHiddenInputs($params);
$this->assertContains(
$html_output,
$html
);
//__('User group')
$this->assertContains(
__('User group'),
$html
);
}
/**
* Test for PMA_getHtmlToChooseUserGroup
*
@ -323,6 +371,118 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
);
}
/**
* Test for PMA_getHtmlForDisplayResourceLimits
*
* @return void
*/
public function testPMAGetHtmlForDisplayResourceLimits()
{
$row = array(
'max_questions' => 'max_questions',
'max_updates' => 'max_updates',
'max_connections' => 'max_connections',
'max_user_connections' => 'max_user_connections',
);
//PMA_getHtmlForDisplayResourceLimits
$html = PMA_getHtmlForDisplayResourceLimits($row);
$this->assertContains(
'<legend>' . __('Resource limits') . '</legend>',
$html
);
$this->assertContains(
__('Note: Setting these options to 0 (zero) removes the limit.'),
$html
);
$this->assertContains(
'MAX QUERIES PER HOUR',
$html
);
$this->assertContains(
$row['max_connections'],
$html
);
$this->assertContains(
$row['max_updates'],
$html
);
$this->assertContains(
$row['max_connections'],
$html
);
$this->assertContains(
$row['max_user_connections'],
$html
);
$this->assertContains(
__('Limits the number of simultaneous connections the user may have.'),
$html
);
$this->assertContains(
__('Limits the number of simultaneous connections the user may have.'),
$html
);
}
/**
* Test for PMA_getSqlQueryForDisplayPrivTable
*
* @return void
*/
public function testPMAGetSqlQueryForDisplayPrivTable()
{
$username = "pma_username";
$db = '*';
$table = "pma_table";
$hostname = "pma_hostname";
//$db == '*'
$ret = PMA_getSqlQueryForDisplayPrivTable(
$db, $table, $username, $hostname
);
$sql = "SELECT * FROM `mysql`.`user`"
." WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'"
." AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "';";
$this->assertEquals(
$sql,
$ret
);
//$table == '*'
$db = "pma_db";
$table = "*";
$ret = PMA_getSqlQueryForDisplayPrivTable(
$db, $table, $username, $hostname
);
$sql = "SELECT * FROM `mysql`.`db`"
." WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'"
." AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "'"
." AND '" . PMA_Util::unescapeMysqlWildcards($db) . "'"
." LIKE `Db`;";
$this->assertEquals(
$sql,
$ret
);
//$table == 'pma_table'
$db = "pma_db";
$table = "pma_table";
$ret = PMA_getSqlQueryForDisplayPrivTable(
$db, $table, $username, $hostname
);
$sql = "SELECT `Table_priv`"
." FROM `mysql`.`tables_priv`"
." WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'"
." AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "'"
." AND `Db` = '" . PMA_Util::unescapeMysqlWildcards($db) . "'"
." AND `Table_name` = '" . PMA_Util::sqlAddSlashes($table) . "';";
$this->assertEquals(
$sql,
$ret
);
}
/**
* Test for PMA_getDataForChangeOrCopyUser
*
@ -579,42 +739,6 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
);
}
/**
* Test for PMA_getHtmlForSubMenusOnUsersPage
*
* @return void
*/
public function testPMAGetHtmlForSubMenusOnUsersPage()
{
$html = PMA_getHtmlForSubMenusOnUsersPage('server_privileges.php');
//validate 1: topmenu2
$this->assertContains(
'<ul id="topmenu2">',
$html
);
//validate 2: tabactive for server_privileges.php
$this->assertContains(
'<a class="tabactive" href="server_privileges.php',
$html
);
$this->assertContains(
__('Users overview'),
$html
);
//validate 3: not-active for server_user_groups.php
$this->assertContains(
'<a href="server_user_groups.php',
$html
);
$this->assertContains(
__('User groups'),
$html
);
}
/**
* Test for PMA_getSqlQueriesForDisplayAndAddUser
*

View File

@ -12,7 +12,7 @@ require_once 'libraries/relation.lib.php';
/*
* Include to test.
*/
require_once 'libraries/server_privileges.lib.php';
require_once 'libraries/server_user_groups.lib.php';
/**
* Tests for server_user_groups.lib.php
@ -99,12 +99,8 @@ class PMA_ServerUserGroupsTest extends PHPUnit_Framework_TestCase
$this->returnValue(
array(
'usergroup' => 'usergroup',
'server_sql' => 'Y',
'server_databases' => 'N',
'db_sql' => 'Y',
'db_structure' => 'N',
'table_sql' => 'Y',
'table_browse' => 'N'
'tab' => 'server_sql',
'allowed' => 'Y'
)
)
);
@ -122,33 +118,33 @@ class PMA_ServerUserGroupsTest extends PHPUnit_Framework_TestCase
$html
);
$url_tag = '<a class="" href="server_user_groups.php'
. PMA_URL_getCommon(
array(
'viewUsers'=>1, 'userGroup'=>htmlspecialchars('usergroup')
)
);
. PMA_URL_getCommon(
array(
'viewUsers'=>1, 'userGroup'=>htmlspecialchars('usergroup')
)
);
$this->assertContains(
$url_tag,
$html
);
$url_tag = '<a class="" href="server_user_groups.php'
. PMA_URL_getCommon(
array(
'editUserGroup'=>1,
'userGroup'=>htmlspecialchars('usergroup')
)
);
. PMA_URL_getCommon(
array(
'editUserGroup'=>1,
'userGroup'=>htmlspecialchars('usergroup')
)
);
$this->assertContains(
$url_tag,
$html
);
$url_tag = '<a class="deleteUserGroup ajax" href="server_user_groups.php'
. PMA_URL_getCommon(
array(
'deleteUserGroup'=> 1,
'userGroup'=>htmlspecialchars('usergroup')
)
);
. PMA_URL_getCommon(
array(
'deleteUserGroup'=> 1,
'userGroup'=>htmlspecialchars('usergroup')
)
);
$this->assertContains(
$url_tag,
$html
@ -208,22 +204,22 @@ class PMA_ServerUserGroupsTest extends PHPUnit_Framework_TestCase
->method('tryQuery')
->with($expectedQuery)
->will($this->returnValue(true));
$dbi->expects($this->once())
$dbi->expects($this->at(1))
->method('fetchAssoc')
->withAnyParameters()
->will(
$this->returnValue(
array(
'usergroup' => 'ug',
'server_sql' => 'Y',
'server_databases' => 'N',
'db_sql' => 'Y',
'db_structure' => 'N',
'table_sql' => 'Y',
'table_browse' => 'N'
'tab' => 'server_sql',
'allowed' => 'Y'
)
)
);
$dbi->expects($this->at(2))
->method('fetchAssoc')
->withAnyParameters()
->will($this->returnValue(false));
$dbi->expects($this->once())
->method('freeResult');
$GLOBALS['dbi'] = $dbi;

View File

@ -0,0 +1,62 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Tests for server_users.lib.php
*
* @package PhpMyAdmin-test
*/
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/url_generating.lib.php';
/*
* Include to test.
*/
require_once 'libraries/server_users.lib.php';
/**
* PMA_ServerUsers_Test class
*
* This class is for testing server_users.lib.php functions
*
* @package PhpMyAdmin-test
*/
class PMA_ServerUsers_Test extends PHPUnit_Framework_TestCase
{
/**
* Test for PMA_getHtmlForSubMenusOnUsersPage
*
* @return void
*/
public function testPMAGetHtmlForSubMenusOnUsersPage()
{
$html = PMA_getHtmlForSubMenusOnUsersPage('server_privileges.php');
//validate 1: topmenu2
$this->assertContains(
'<ul id="topmenu2">',
$html
);
//validate 2: tabactive for server_privileges.php
$this->assertContains(
'<a class="tabactive" href="server_privileges.php',
$html
);
$this->assertContains(
__('Users overview'),
$html
);
//validate 3: not-active for server_user_groups.php
$this->assertContains(
'<a href="server_user_groups.php',
$html
);
$this->assertContains(
__('User groups'),
$html
);
}
}
?>

View File

@ -0,0 +1,403 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Tests for libraries/tbl_printview.lib.php
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/tbl_printview.lib.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/relation.lib.php';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/Tracker.class.php';
require_once 'libraries/Message.class.php';
require_once 'libraries/Table.class.php';
require_once 'libraries/js_escape.lib.php';
/**
* Tests for libraries/tbl_printview.lib.php
*
* @package PhpMyAdmin-test
*/
class PMA_TblPrintViewTest extends PHPUnit_Framework_TestCase
{
/**
* Setup function for test cases
*
* @access protected
* @return void
*/
protected function setUp()
{
/**
* SET these to avoid undefined index error
*/
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
}
/**
* Tests for PMA_getHtmlForTablesInfo() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForTablesInfo()
{
$the_tables = array("PMA_table1", "PMA_table2");
$html = PMA_getHtmlForTablesInfo($the_tables);
$this->assertContains(
__('Showing tables:'),
$html
);
$this->assertContains(
"`PMA_table1`, `PMA_table2`",
$html
);
}
/**
* Tests for PMA_getHtmlForPrintViewFooter() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForPrintViewFooter()
{
$html = PMA_getHtmlForPrintViewFooter();
$this->assertContains(
'<input type="button" class="button" id="print" value="Print" />',
$html
);
$this->assertContains(
"PMA_disable_floating_menubar",
$html
);
}
/**
* Tests for PMA_getHtmlForRowStatistics() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForRowStatistics()
{
$showtable = array(
'Row_format' => "Fixed",
'Rows' => 10,
'Avg_row_length' => 123,
'Data_length' => 345,
'Auto_increment' => 1234,
'Create_time' => "today",
'Update_time' => "time2",
'Check_time' => "yesterday",
);
$cell_align_left = "cell_align_left";
$avg_size = 12;
$avg_unit = 45;
$mergetable = false;
$html = PMA_getHtmlForRowStatistics(
$showtable, $cell_align_left, $avg_size, $avg_unit, $mergetable
);
$this->assertContains(
__('Row Statistics:'),
$html
);
//validation 1 : Row_format
$this->assertContains(
__('Format'),
$html
);
$this->assertContains(
$cell_align_left,
$html
);
//$showtable['Row_format'] == 'Fixed'
$this->assertContains(
__('static'),
$html
);
//validation 2 : Avg_row_length
$length = PMA_Util::formatNumber(
$showtable['Avg_row_length'], 0
);
$this->assertContains(
$length,
$html
);
$this->assertContains(
__('Row size'),
$html
);
$this->assertContains(
$avg_size . ' ' . $avg_unit,
$html
);
//validation 3 : Auto_increment
$average = PMA_Util::formatNumber(
$showtable['Auto_increment'], 0
);
$this->assertContains(
$average,
$html
);
$this->assertContains(
__('Next autoindex'),
$html
);
//validation 4 : Create_time
$time = PMA_Util::localisedDate(
strtotime($showtable['Create_time'])
);
$this->assertContains(
__('Creation'),
$html
);
$this->assertContains(
$time,
$html
);
//validation 5 : Update_time
$time = PMA_Util::localisedDate(
strtotime($showtable['Update_time'])
);
$this->assertContains(
__('Last update'),
$html
);
$this->assertContains(
$time,
$html
);
//validation 6 : Check_time
$time = PMA_Util::localisedDate(
strtotime($showtable['Check_time'])
);
$this->assertContains(
__('Last check'),
$html
);
$this->assertContains(
$time,
$html
);
}
/**
* Tests for PMA_getHtmlForSpaceUsage() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForSpaceUsage()
{
$data_size = '10';
$data_unit = '11';
$index_size = '12';
$index_unit = '13';
$free_size = '14';
$free_unit = '15';
$effect_size = '16';
$effect_unit = '17';
$tot_size = '18';
$tot_unit = '19';
$mergetable = false;
$html = PMA_getHtmlForSpaceUsage(
$data_size, $data_unit, $index_size, $index_unit,
$free_size, $free_unit, $effect_size, $effect_unit,
$tot_size, $tot_unit, $mergetable
);
//validation 1 : title
$this->assertContains(
__('Space usage:'),
$html
);
//validation 2 : $data_size & $data_unit
$this->assertContains(
$data_size,
$html
);
$this->assertContains(
$data_unit,
$html
);
//validation 3 : $index_size & $index_unit
$this->assertContains(
$index_size,
$html
);
$this->assertContains(
$index_unit,
$html
);
//validation 4 : Overhead
$this->assertContains(
__('Overhead'),
$html
);
$this->assertContains(
$free_size,
$html
);
$this->assertContains(
$free_unit,
$html
);
//validation 5 : Effective
$this->assertContains(
__('Effective'),
$html
);
$this->assertContains(
$effect_size,
$html
);
$this->assertContains(
$effect_unit,
$html
);
//validation 6 : $tot_size & $tot_unit
$this->assertContains(
$tot_size,
$html
);
$this->assertContains(
$tot_unit,
$html
);
}
/**
* Tests for PMA_getHtmlForSpaceUsageAndRowStatistics() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForSpaceUsageAndRowStatistics()
{
$showtable = array(
'Row_format' => "Fixed",
'Rows' => 10,
'Avg_row_length' => 123,
'Data_length' => 345,
'Auto_increment' => 1234,
'Create_time' => "today",
'Update_time' => "time2",
'Check_time' => "yesterday",
'Data_length' => 10,
'Index_length' => 12334,
'Data_length' => 4567,
'Data_free' => 3456,
'Check_time' => 1234,
);
$db = "pma_db";
$table = "pma_table";
$cell_align_left = "cell_align_left";
$html = PMA_getHtmlForSpaceUsageAndRowStatistics(
$showtable, $db, $table, $cell_align_left
);
//validation 1 : $data_size, $data_unit
list($data_size, $data_unit) = PMA_Util::formatByteDown(
$showtable['Data_length']
);
$this->assertContains(
$data_size,
$html
);
$this->assertContains(
$data_unit,
$html
);
//validation 2 : $data_size, $data_unit
list($index_size, $index_unit)
= PMA_Util::formatByteDown(
$showtable['Index_length']
);
$this->assertContains(
$data_size,
$html
);
$this->assertContains(
$data_unit,
$html
);
//validation 3 : $free_size, $free_unit
list($free_size, $free_unit)
= PMA_Util::formatByteDown(
$showtable['Data_free']
);
$this->assertContains(
$free_size,
$html
);
$this->assertContains(
$free_unit,
$html
);
//validation 4 : $effect_size, $effect_unit
list($effect_size, $effect_unit)
= PMA_Util::formatByteDown(
$showtable['Data_length'] + $showtable['Index_length']
- $showtable['Data_free']
);
$this->assertContains(
$effect_size,
$html
);
$this->assertContains(
$effect_unit,
$html
);
//validation 5 : $effect_size, $effect_unit
list($tot_size, $tot_unit) = PMA_Util::formatByteDown(
$showtable['Data_length'] + $showtable['Index_length']
);
$this->assertContains(
$tot_size,
$html
);
$this->assertContains(
$tot_unit,
$html
);
}
}
?>

View File

@ -11,6 +11,10 @@
*/
require_once 'libraries/tbl_relation.lib.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/relation.lib.php';
/**
* Tests for libraries/tbl_relation.lib.php
@ -19,6 +23,25 @@ require_once 'libraries/Util.class.php';
*/
class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
{
/**
* Configures environment
*
* @return void
*/
protected function setUp()
{
$GLOBALS['server'] = 0;
$GLOBALS['pma'] = new DataBasePMAMockForTblRelation();
$GLOBALS['pma']->databases = new DataBaseMockForTblRelation();
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
}
/**
* Tests for PMA_generateRelationalDropdown() method.
*
@ -72,12 +95,12 @@ class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
// test for selected value not found in values array and its escaping
$this->assertContains(
'<option value="valu&lt;4" selected="selected">valu&lt;4'
'<option value="valu&lt;4" selected="selected">valu&lt;4'
. '</option></select>',
PMA_generateRelationalDropdown('name', $values, 'valu<4')
);
}
/**
* Tests for PMA_generateDropdown() method.
*
@ -90,7 +113,7 @@ class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
$select_name = "select_name";
$choices = array("choice1", "choice2");
$selected_value = "";
$html_output = PMA_generateDropdown(
$dropdown_question, $select_name, $choices, $selected_value
);
@ -115,7 +138,7 @@ class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
$html_output
);
}
/**
* Tests for PMA_backquoteSplit() method.
*
@ -131,7 +154,7 @@ class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
PMA_backquoteSplit($text)
);
}
/**
* Tests for PMA_getSQLToCreateForeignKey() method.
*
@ -149,15 +172,15 @@ class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
$sql = PMA_getSQLToCreateForeignKey(
$table, $field, $foreignDb, $foreignTable, $foreignField
);
$sql_excepted = 'ALTER TABLE `PMA_table` ADD '
. 'FOREIGN KEY (`PMA_field`) REFERENCES '
$sql_excepted = 'ALTER TABLE `PMA_table` ADD '
. 'FOREIGN KEY (`PMA_field`) REFERENCES '
. '`foreignDb`.`foreignTable`(`foreignField`);';
$this->assertEquals(
$sql_excepted,
$sql
);
}
/**
* Tests for PMA_getSQLToDropForeignKey() method.
*
@ -174,5 +197,232 @@ class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
PMA_getSQLToDropForeignKey($table, $fk)
);
}
/**
* Tests for PMA_getHtmlForCommonForm() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForCommonForm()
{
$db = "pma_db";
$table = "pma_table";
$columns = array(
array("Field" => "Field1")
);
$cfgRelation = array(
'displaywork' => true,
'relwork' => true,
'displaywork' => true,
);
$tbl_storage_engine = "InnerDB";
$existrel = array();
$existrel_foreign = array();
$options_array = array();
$save_row = array();
foreach ($columns as $row) {
$save_row[] = $row;
}
$html = PMA_getHtmlForCommonForm(
$db, $table, $columns, $cfgRelation,
$tbl_storage_engine, $existrel, $existrel_foreign, $options_array
);
//case 1: PMA_getHtmlForCommonFormHeader
$this->assertContains(
PMA_getHtmlForCommonFormHeader($db, $table),
$html
);
$this->assertContains(
PMA_URL_getHiddenInputs($db, $table),
$html
);
//case 2: PMA_getHtmlForCommonFormRows
$this->assertContains(
__('Relations'),
$html
);
$this->assertContains(
__('Column'),
$html
);
$this->assertContains(
__('Internal relation'),
$html
);
$this->assertContains(
__('Choose column to display:'),
$html
);
//case 3: PMA_getHtmlForCommonFormTableHeaders
$this->assertContains(
PMA_getHtmlForCommonFormTableHeaders($cfgRelation, $tbl_storage_engine),
$html
);
//case 4: PMA_getHtmlForRow
$row = PMA_getHtmlForRow(
$save_row, 0, true, $cfgRelation, $existrel, $db,
$tbl_storage_engine, $existrel_foreign, $options_array
);
$this->assertContains(
$row,
$html
);
//case 5: PMA_getHtmlForDisplayFieldInfos
$this->assertContains(
PMA_getHtmlForDisplayFieldInfos($db, $table, $save_row),
$html
);
//case 6: PMA_getHtmlForCommonFormFooter
$this->assertContains(
PMA_getHtmlForCommonFormFooter(),
$html
);
}
/**
* Tests for PMA_getHtmlForDisplayFieldInfos() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForDisplayFieldInfos()
{
$db = "pma_db";
$table = "pma_table";
$save_row = array(
array("Field" => "Field1"),
array("Field" => "Field2"),
);
$html = PMA_getHtmlForDisplayFieldInfos($db, $table, $save_row);
$this->assertContains(
__('Choose column to display:'),
$html
);
$this->assertContains(
htmlspecialchars($save_row[0]['Field']),
$html
);
$this->assertContains(
htmlspecialchars($save_row[1]['Field']),
$html
);
}
/**
* Tests for PMA_getQueryForDisplayUpdate() method.
*
* @return void
* @test
*/
public function testPMAGetQueryForDisplayUpdate()
{
$disp = true;
$display_field = '';
$db = "pma_db";
$table = "pma_table";
$cfgRelation = array(
'displaywork' => true,
'relwork' => true,
'displaywork' => true,
'table_info' => 'table_info',
);
$GLOBALS['cfgRelation']['db'] = 'global_db';
//case 1: $disp == true && $display_field == ''
$query = PMA_getQueryForDisplayUpdate(
$disp, $display_field, $db, $table, $cfgRelation
);
$query_expect = "DELETE FROM `global_db`.`table_info` "
. "WHERE db_name = 'pma_db' AND table_name = 'pma_table'";
$this->assertEquals(
$query_expect,
$query
);
//case 2: $disp == true && $display_field == 'display_field'
$display_field == 'display_field';
$query = PMA_getQueryForDisplayUpdate(
$disp, $display_field, $db, $table, $cfgRelation
);
$query_expect = "DELETE FROM `global_db`.`table_info` "
. "WHERE db_name = 'pma_db' AND table_name = 'pma_table'";
$this->assertEquals(
$query_expect,
$query
);
//case 3: $disp == false && $display_field == 'display_field'
$disp = false;
$display_field = 'display_field';
$query = PMA_getQueryForDisplayUpdate(
$disp, $display_field, $db, $table, $cfgRelation
);
$query_expect = "INSERT INTO `global_db`.`table_info`"
. "(db_name, table_name, display_field)"
. " VALUES('pma_db','pma_table','display_field')";
$this->assertEquals(
$query_expect,
$query
);
//case 4: $disp == false && $display_field == ''
$disp = false;
$display_field = '';
$query = PMA_getQueryForDisplayUpdate(
$disp, $display_field, $db, $table, $cfgRelation
);
$query_expect = '';
$this->assertEquals(
$query_expect,
$query
);
}
}
/**
* Mock class for DataBasePMAMock
*
* @package PhpMyAdmin-test
*/
Class DataBasePMAMockForTblRelation
{
var $databases;
}
/**
* Mock class for DataBaseMock
*
* @package PhpMyAdmin-test
*/
Class DataBaseMockForTblRelation
{
/**
* mock function to return table is existed
*
* @param string $name table name
*
* @return bool
*/
function exists($name)
{
return true;
}
}
?>

View File

@ -36,11 +36,6 @@ class PMA_GetTableCount_Test extends PHPUnit_Framework_TestCase
{
$GLOBALS['PMA_Config'] = new PMA_Config();
$GLOBALS['PMA_Config']->enableBc();
// $GLOBALS['cfg']['Server'] = array(
// 'host' => 'host',
// 'verbose' => 'verbose',
// 'extension' => 'mysql'
// );
$GLOBALS['cfg']['OBGzip'] = false;
$_SESSION['PMA_Theme'] = new PMA_Theme();
$GLOBALS['pmaThemeImage'] = 'theme/';