Merge branch 'master' into DBI_naming_cleanUp2

Conflicts:
	sql.php
This commit is contained in:
Kasun Chathuranga 2013-05-05 20:58:07 +05:30
commit 5ef0833210
20 changed files with 2096 additions and 2315 deletions

View File

@ -216,7 +216,7 @@ JQPlotChartFactory.prototype.createChart = function (type, elementId) {
*/
var JQPlotChart = function (elementId) {
Chart.call(this, elementId);
this.plot;
this.plot = null;
this.validator;
};
JQPlotChart.prototype = new Chart();

View File

@ -670,7 +670,7 @@ AJAX.registerOnload('config.js', function () {
// detect localStorage state
var ls_supported = window.localStorage || false;
var ls_exists = ls_supported ? (window.localStorage['config'] || false) : false;
var ls_exists = ls_supported ? (window.localStorage.config || false) : false;
$('div.localStorage-' + (ls_supported ? 'un' : '') + 'supported').hide();
$('div.localStorage-' + (ls_exists ? 'empty' : 'exists')).hide();
if (ls_exists) {

View File

@ -1444,9 +1444,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
.dblclick(function (e) {
e.preventDefault();
$("<div/>")
.prop("title", PMA_messages["strColNameCopyTitle"])
.prop("title", PMA_messages.strColNameCopyTitle)
.addClass("modal-copy")
.text(PMA_messages["strColNameCopyText"])
.text(PMA_messages.strColNameCopyText)
.append(
$("<input/>")
.prop("readonly", true)

View File

@ -134,8 +134,8 @@ $(function () {
if (this.value !== '') {
var arr = jQuery.parseJSON(this.value);
var $form = $(this).closest('form');
$form.find('input[name=db]').val(arr['db']);
$form.find('input[name=table]').val(arr['table']);
$form.find('input[name=db]').val(arr.db);
$form.find('input[name=table]').val(arr.table);
$form.submit();
}
});

View File

@ -67,7 +67,7 @@ function make_zero() { // Function called if the user stays after seeing the c
var dx, dy, dy2;
var cur_click;
var cur_click = null;
// update in Main()
var sm_x = 2, sm_y = 2;
var sm_s = 0;

View File

@ -16,15 +16,15 @@
*/
function checkAddUser(the_form)
{
if (the_form.elements['pred_hostname'].value == 'userdefined' && the_form.elements['hostname'].value === '') {
if (the_form.elements.pred_hostname.value == 'userdefined' && the_form.elements.hostname.value === '') {
alert(PMA_messages.strHostEmpty);
the_form.elements['hostname'].focus();
the_form.elements.hostname.focus();
return false;
}
if (the_form.elements['pred_username'].value == 'userdefined' && the_form.elements['username'].value === '') {
if (the_form.elements.pred_username.value == 'userdefined' && the_form.elements.username.value === '') {
alert(PMA_messages.strUserEmpty);
the_form.elements['username'].focus();
the_form.elements.username.focus();
return false;
}
@ -196,7 +196,7 @@ AJAX.registerOnload('server_privileges.js', function () {
'username' : username
};
$.get(href, params, function(data) {
if (data['user_exists']) {
if (data.user_exists) {
$warning.show();
} else {
$warning.hide();

View File

@ -377,7 +377,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
}
}
sql_query = sql_query.substring(0, sql_query.length - 2);
sql_query += ' WHERE ' + PMA_urldecode(searchedData[searchedDataKey]['where_clause']);
sql_query += ' WHERE ' + PMA_urldecode(searchedData[searchedDataKey].where_clause);
//Post SQL query to sql.php
$.post('sql.php', {
@ -546,7 +546,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
// extra Y values
value[dataLabel], // for highlighter
// (may set an undefined value)
value['where_clause'], // for click on point
value.where_clause, // for click on point
key // key from searchedData
]);
});

View File

@ -0,0 +1,220 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Display the form to edit/create an index
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) {
// coming already from form
$add_fields
= count($_REQUEST['index']['columns']['names']) - $index->getColumnCount();
if (isset($_REQUEST['add_fields'])) {
$add_fields += $_REQUEST['added_fields'];
}
} elseif (isset($_REQUEST['create_index'])) {
$add_fields = $_REQUEST['added_fields'];
} else {
$add_fields = 1;
}// end preparing form values
$html = "";
$html .= '<form action="tbl_indexes.php" method="post" name="index_frm" id="index_frm" class="ajax"'
. 'onsubmit="if (typeof(this.elements[\'index[Key_name]\'].disabled) != \'undefined\') {'
. 'this.elements[\'index[Key_name]\'].disabled = false}">';
$form_params = array(
'db' => $db,
'table' => $table,
);
if (isset($_REQUEST['create_index'])) {
$form_params['create_index'] = 1;
} elseif (isset($_REQUEST['old_index'])) {
$form_params['old_index'] = $_REQUEST['old_index'];
} elseif (isset($_REQUEST['index'])) {
$form_params['old_index'] = $_REQUEST['index'];
}
$html .= PMA_generate_common_hidden_inputs($form_params);
$html .= '<fieldset id="index_edit_fields">';
if ($GLOBALS['is_ajax_request'] != true) {
$html .= '<legend>';
if (isset($_REQUEST['create_index'])) {
$html .= __('Add index');
} else {
$html .= __('Edit index');
}
$html .= '</legend>';
}
$html .= '<div class="index_info">';
$html .= '<div>'
. '<div class="label">'
. '<strong>'
. '<label for="input_index_name">'
. __('Index name:')
. PMA_Util::showHint(
PMA_Message::notice(
__(
'("PRIMARY" <b>must</b> be the name of'
. ' and <b>only of</b> a primary key!)'
)
)
)
. '</label>'
. '</strong>'
. '</div>'
. '<input type="text" name="index[Key_name]" id="input_index_name" size="25"'
. 'value="' . htmlspecialchars($index->getName()) . '"'
. 'onfocus="this.select()" />'
. '</div>';
if (PMA_MYSQL_INT_VERSION > 50500) {
$html .= '<div>'
. '<div class="label">'
. '<strong>'
. '<label for="input_index_comment">'
. __('Comment:')
. '</label>'
. '</strong>'
. '</div>'
. '<input type="text" name="index[Index_comment]" id="input_index_comment" size="30"'
. 'value="' . htmlspecialchars($index->getComment()) . '"'
. 'onfocus="this.select()" />'
. '</div>';
}
$html .= '<div>'
. '<div class="label">'
. '<strong>'
. '<label for="select_index_type">'
. __('Index type:')
. PMA_Util::showMySQLDocu('SQL-Syntax', 'ALTER_TABLE')
. '</label>'
. '</strong>'
. '</div>'
. '<select name="index[Index_type]" id="select_index_type" >'
. $index->generateIndexSelector()
. '</select>'
. '</div>';
$html .= '<div class="clearfloat"></div>';
$html .= '</div>';
$html .= '<table id="index_columns">';
$html .= '<thead>'
. '<tr>'
. '<th>' . __('Column') . '</th>'
. '<th>' . __('Size') . '</th>'
. '</tr>'
. '</thead>';
$odd_row = true;
$spatial_types = array(
'geometry', 'point', 'linestring', 'polygon', 'multipoint',
'multilinestring', 'multipolygon', 'geomtrycollection'
);
$html .= '<tbody>';
foreach ($index->getColumns() as $column) {
$html .= '<tr class="';
$html .= $odd_row ? 'odd' : 'even';
$html .= 'noclick">';
$html .= '<td>';
$html .= '<select name="index[columns][names][]">';
$html .= '<option value="">-- ' . __('Ignore') . ' --</option>';
foreach ($fields as $field_name => $field_type) {
if (($index->getType() != 'FULLTEXT'
|| preg_match('/(char|text)/i', $field_type))
&& ($index->getType() != 'SPATIAL'
|| in_array($field_type, $spatial_types))
) {
$html .= '<option value="' . htmlspecialchars($field_name) . '"'
. (($field_name == $column->getName())
? ' selected="selected"'
: '') . '>'
. htmlspecialchars($field_name) . ' ['
. htmlspecialchars($field_type) . ']'
. '</option>' . "\n";
}
} // end foreach $fields
$html .= '</select>';
$html .= '</td>';
$html .= '<td>';
$html .= '<input type="text" size="5" onfocus="this.select()"'
. 'name="index[columns][sub_parts][]" value="';
if ($index->getType() != 'SPATIAL') {
$html .= $column->getSubPart();
}
$html .= '"/>';
$html .= '</td>';
$html .= '</tr>';
$odd_row = !$odd_row;
} // end foreach $edited_index_info['Sequences']
for ($i = 0; $i < $add_fields; $i++) {
$html .= '<tr class="';
$html .= $odd_row ? 'odd' : 'even';
$html .= 'noclick">';
$html .= '<td>';
$html .= '<select name="index[columns][names][]">';
$html .= '<option value="">-- ' . __('Ignore') . ' --</option>';
foreach ($fields as $field_name => $field_type) {
$html .= '<option value="' . htmlspecialchars($field_name) . '">'
. htmlspecialchars($field_name) . ' ['
. htmlspecialchars($field_type) . ']'
. '</option>' . "\n";
} // end foreach $fields
$html .= '</select>';
$html .= '</td>';
$html .= '<td>'
. '<input type="text" size="5" onfocus="this.select()"'
. 'name="index[columns][sub_parts][]" value="" />'
. '</td>';
$html .= '</tr>';
$odd_row = !$odd_row;
} // end foreach $edited_index_info['Sequences']
$html .= '</tbody>';
$html .= '</table>';
$html .= '</fieldset>';
$html .= '<fieldset class="tblFooters">';
if ($GLOBALS['is_ajax_request'] != true || ! empty($_REQUEST['ajax_page_request'])) {
$html .= '<input type="submit" name="do_save_data" value="' . __('Save') . '" />';
$html .= '<span id="addMoreColumns">';
$html .= __('Or') . ' ';
$html .= printf(
__('Add %s column(s) to index') . "\n",
'<input type="text" name="added_fields" size="2" value="1" />'
);
$html .= '<input type="submit" name="add_fields" value="' . __('Go') . '" />' . "\n";
$html .= '</span>';
} else {
$btn_value = sprintf(__('Add %s column(s) to index'), 1);
$html .= '<div class="slider"></div>';
$html .= '<div class="add_fields">';
$html .= '<input type="submit" value="' . $btn_value . '" />';
$html .= '</div>';
}
$html .= '</fieldset>';
$html .= '</form>';
$response = PMA_Response::getInstance();
$response->addHTML($html);
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('indexes.js');
?>

529
libraries/sql.lib.php Normal file
View File

@ -0,0 +1,529 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* set of functions for the sql executor
*
* @package PhpMyAdmin
*/
if (!defined('PHPMYADMIN')) {
exit;
}
/**
* Initialize some parameters needed to display results
*
* @param string $sql_query SQL statement
* @param boolean $is_select select query or not
*
* @return array set of parameters
*
* @access public
*/
function PMA_getDisplayPropertyParams($sql_query, $is_select)
{
$is_explain = $is_count = $is_export = $is_delete = $is_insert = $is_affected = $is_show = $is_maint = $is_analyse = $is_group = $is_func = $is_replace = false;
if ($is_select) {
$is_group = preg_match('@(GROUP[[:space:]]+BY|HAVING|SELECT[[:space:]]+DISTINCT)[[:space:]]+@i', $sql_query);
$is_func = ! $is_group && (preg_match('@[[:space:]]+(SUM|AVG|STD|STDDEV|MIN|MAX|BIT_OR|BIT_AND)\s*\(@i', $sql_query));
$is_count = ! $is_group && (preg_match('@^SELECT[[:space:]]+COUNT\((.*\.+)?.*\)@i', $sql_query));
$is_export = preg_match('@[[:space:]]+INTO[[:space:]]+OUTFILE[[:space:]]+@i', $sql_query);
$is_analyse = preg_match('@[[:space:]]+PROCEDURE[[:space:]]+ANALYSE@i', $sql_query);
} elseif (preg_match('@^EXPLAIN[[:space:]]+@i', $sql_query)) {
$is_explain = true;
} elseif (preg_match('@^DELETE[[:space:]]+@i', $sql_query)) {
$is_delete = true;
$is_affected = true;
} elseif (preg_match('@^(INSERT|LOAD[[:space:]]+DATA|REPLACE)[[:space:]]+@i', $sql_query)) {
$is_insert = true;
$is_affected = true;
if (preg_match('@^(REPLACE)[[:space:]]+@i', $sql_query)) {
$is_replace = true;
}
} elseif (preg_match('@^UPDATE[[:space:]]+@i', $sql_query)) {
$is_affected = true;
} elseif (preg_match('@^[[:space:]]*SHOW[[:space:]]+@i', $sql_query)) {
$is_show = true;
} elseif (preg_match('@^(CHECK|ANALYZE|REPAIR|OPTIMIZE)[[:space:]]+TABLE[[:space:]]+@i', $sql_query)) {
$is_maint = true;
}
return array(
$is_group, $is_func, $is_count, $is_export, $is_analyse, $is_explain,
$is_delete, $is_affected, $is_insert, $is_replace,$is_show, $is_maint
);
}
/**
* Get the database name inside a USE query
*
* @param string $sql SQL query
* @param array $databases array with all databases
*
* @return strin $db new database name
*/
function PMA_getNewDatabase($sql, $databases)
{
$db = '';
// loop through all the databases
foreach ($databases as $database) {
if (strpos($sql, $database['SCHEMA_NAME']) !== false) {
$db = $database;
break;
}
}
return $db;
}
/**
* Get the table name in a sql query
* If there are several tables in the SQL query,
* first table wil lreturn
*
* @param string $sql SQL query
* @param array $tables array of names in current database
*
* @return string $table table name
*/
function PMA_getTableNameBySQL($sql, $tables)
{
$table = '';
// loop through all the tables in the database
foreach ($tables as $tbl) {
if (strpos($sql, $tbl)) {
$table .= ' ' . $tbl;
}
}
if (count(explode(' ', trim($table))) > 1) {
$tmp_array = explode(' ', trim($table));
return $tmp_array[0];
}
return trim($table);
}
/**
* Generate table html when SQL statement have multiple queries
* which return displayable results
*
* @param PMA_DisplayResults $displayResultsObject object
* @param string $db database name
* @param array $sql_data information about
* SQL statement
* @param string $goto URL to go back in case
* of errors
* @param string $pmaThemeImage path for theme images
* directory
* @param string $text_dir text direction
* @param string $printview whether printview is enabled
* @param string $url_query URL query
* @param array $disp_mode the display mode
* @param string $sql_limit_to_append limit clause
* @param bool $resultSetContainsUniqueKey result contains a unique key
*
* @return string $table_html html content
*/
function getTableHtmlForMultipleQueries(
$displayResultsObject, $db, $sql_data, $goto, $pmaThemeImage,
$text_dir, $printview, $url_query, $disp_mode, $sql_limit_to_append,
$resultSetContainsUniqueKey
) {
$table_html = '';
$tables_array = PMA_DBI_getTables($db);
$databases_array = PMA_DBI_getDatabasesFull();
$multi_sql = implode(";", $sql_data['valid_sql']);
$querytime_before = array_sum(explode(' ', microtime()));
// Assignment for variable is not needed since the results are
// looiping using the connection
@PMA_DBI_tryMultiQuery($multi_sql);
$querytime_after = array_sum(explode(' ', microtime()));
$querytime = $querytime_after - $querytime_before;
$sql_no = 0;
do {
$analyzed_sql = array();
$is_affected = false;
$result = PMA_DBI_storeResult();
$fields_meta = ($result !== false)
? PMA_DBI_getFieldsMeta($result)
: array();
$fields_cnt = count($fields_meta);
// Initialize needed params related to each query in multiquery statement
if (isset($sql_data['valid_sql'][$sql_no])) {
// 'Use' query can change the database
if (stripos($sql_data['valid_sql'][$sql_no], "use ")) {
$db = PMA_getNewDatabase(
$sql_data['valid_sql'][$sql_no],
$databases_array
);
}
$parsed_sql = PMA_SQP_parse($sql_data['valid_sql'][$sql_no]);
$table = PMA_getTableNameBySQL(
$sql_data['valid_sql'][$sql_no],
$tables_array
);
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
$is_select = isset($analyzed_sql[0]['queryflags']['select_from']);
$unlim_num_rows = PMA_Table::countRecords($db, $table, true);
$showtable = PMA_Table::sGetStatusInfo($db, $table, null, true);
$url_query = PMA_generate_common_url($db, $table);
list($is_group, $is_func, $is_count, $is_export, $is_analyse,
$is_explain, $is_delete, $is_affected, $is_insert, $is_replace,
$is_show, $is_maint)
= PMA_getDisplayPropertyParams(
$sql_data['valid_sql'][$sql_no], $is_select
);
// Handle remembered sorting order, only for single table query
if ($GLOBALS['cfg']['RememberSorting']
&& ! ($is_count || $is_export || $is_func || $is_analyse)
&& isset($analyzed_sql[0]['select_expr'])
&& (count($analyzed_sql[0]['select_expr']) == 0)
&& isset($analyzed_sql[0]['queryflags']['select_from'])
&& count($analyzed_sql[0]['table_ref']) == 1
) {
PMA_handleSortOrder(
$db,
$table,
$analyzed_sql,
$sql_data['valid_sql'][$sql_no]
);
}
// Do append a "LIMIT" clause?
if (($_SESSION['tmp_user_values']['max_rows'] != 'all')
&& ! ($is_count || $is_export || $is_func || $is_analyse)
&& isset($analyzed_sql[0]['queryflags']['select_from'])
&& ! isset($analyzed_sql[0]['queryflags']['offset'])
&& empty($analyzed_sql[0]['limit_clause'])
) {
$sql_limit_to_append = ' LIMIT '
. $_SESSION['tmp_user_values']['pos']
. ', ' . $_SESSION['tmp_user_values']['max_rows'] . " ";
$sql_data['valid_sql'][$sql_no] = PMA_getSqlWithLimitClause(
$sql_data['valid_sql'][$sql_no],
$analyzed_sql,
$sql_limit_to_append
);
}
// Set the needed properties related to executing sql query
$displayResultsObject->__set('db', $db);
$displayResultsObject->__set('table', $table);
$displayResultsObject->__set('goto', $goto);
}
if (! $is_affected) {
$num_rows = ($result) ? @PMA_DBI_numRows($result) : 0;
} elseif (! isset($num_rows)) {
$num_rows = @PMA_DBI_affectedRows();
}
if (isset($sql_data['valid_sql'][$sql_no])) {
$displayResultsObject->__set(
'sql_query',
$sql_data['valid_sql'][$sql_no]
);
$displayResultsObject->setProperties(
$unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func,
$is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage,
$text_dir, $is_maint, $is_explain, $is_show, $showtable,
$printview, $url_query, $resultSetContainsUniqueKey
);
}
if ($num_rows == 0) {
continue;
}
// With multiple results, operations are limied
$disp_mode = 'nnnn000000';
$is_limited_display = true;
// Collect the tables
$table_html .= $displayResultsObject->getTable(
$result, $disp_mode, $analyzed_sql, $is_limited_display
);
// Free the result to save the memory
PMA_DBI_freeResult($result);
$sql_no++;
} while (PMA_DBI_moreResults() && PMA_DBI_nextResult());
return $table_html;
}
/**
* Handle remembered sorting order, only for single table query
*
* @param string $db database name
* @param string $table table name
* @param array &$analyzed_sql the analyzed query
* @param string &$full_sql_query SQL query
*
* @return void
*/
function PMA_handleSortOrder($db, $table, &$analyzed_sql, &$full_sql_query)
{
$pmatable = new PMA_Table($table, $db);
if (empty($analyzed_sql[0]['order_by_clause'])) {
$sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN);
if ($sorted_col) {
// retrieve the remembered sorting order for current table
$sql_order_to_append = ' ORDER BY ' . $sorted_col . ' ';
$full_sql_query = $analyzed_sql[0]['section_before_limit']
. $sql_order_to_append . $analyzed_sql[0]['limit_clause']
. ' ' . $analyzed_sql[0]['section_after_limit'];
// update the $analyzed_sql
$analyzed_sql[0]['section_before_limit'] .= $sql_order_to_append;
$analyzed_sql[0]['order_by_clause'] = $sorted_col;
}
} else {
// store the remembered table into session
$pmatable->setUiProp(
PMA_Table::PROP_SORTED_COLUMN,
$analyzed_sql[0]['order_by_clause']
);
}
}
/**
* Append limit clause to SQL query
*
* @param string $full_sql_query SQL query
* @param array $analyzed_sql the analyzed query
* @param string $sql_limit_to_append clause to append
*
* @return string limit clause appended SQL query
*/
function PMA_getSqlWithLimitClause($full_sql_query, $analyzed_sql,
$sql_limit_to_append
) {
return $analyzed_sql[0]['section_before_limit'] . "\n"
. $sql_limit_to_append . $analyzed_sql[0]['section_after_limit'];
}
/**
* Get column name from a drop SQL statement
*
* @param string $sql SQL query
*
* @return string $drop_column Name of the column
*/
function PMA_getColumnNameInColumnDropSql($sql)
{
$tmpArray1 = explode('DROP', $sql);
$str_to_check = trim($tmpArray1[1]);
if (stripos($str_to_check, 'COLUMN') !== false) {
$tmpArray2 = explode('COLUMN', $str_to_check);
$str_to_check = trim($tmpArray2[1]);
}
$tmpArray3 = explode(' ', $str_to_check);
$str_to_check = trim($tmpArray3[0]);
$drop_column = str_replace(';', '', trim($str_to_check));
$drop_column = str_replace('`', '', $drop_column);
return $drop_column;
}
/**
* Verify whether the result set contains all the columns
* of at least one unique key
*
* @param string $db database name
* @param string $table table name
* @param string $fields_meta meta fields
*
* @return boolean whether the result set contains a unique key
*/
function PMA_resultSetContainsUniqueKey($db, $table, $fields_meta)
{
$resultSetColumnNames = array();
foreach ($fields_meta as $oneMeta) {
$resultSetColumnNames[] = $oneMeta->name;
}
foreach (PMA_Index::getFromTable($table, $db) as $index) {
if ($index->isUnique()) {
$indexColumns = $index->getColumns();
$numberFound = 0;
foreach ($indexColumns as $indexColumnName => $dummy) {
if (in_array($indexColumnName, $resultSetColumnNames)) {
$numberFound++;
}
}
if ($numberFound == count($indexColumns)) {
return true;
}
}
}
return false;
}
/**
* Get the HTML for relational column dropdown
* During grid edit, if we have a relational field, returns the html for the
* dropdown
*
* @param string $db current database
* @param string $table current table
* @param string $column current column
* @param string $curr_value current selected value
*
* @return string $dropdown html for the dropdown
*/
function PMA_getHtmlForRelationalColumnDropdown($db, $table, $column, $curr_value)
{
$foreigners = PMA_getForeigners($db, $table, $column);
$display_field = PMA_getDisplayField(
$foreigners[$column]['foreign_db'],
$foreigners[$column]['foreign_table']
);
$foreignData = PMA_getForeignData($foreigners, $column, false, '', '');
if ($foreignData['disp_row'] == null) {
//Handle the case when number of values
//is more than $cfg['ForeignKeyMaxLimit']
$_url_params = array(
'db' => $db,
'table' => $table,
'field' => $column
);
$dropdown = '<span class="curr_value">'
. htmlspecialchars($_REQUEST['curr_value'])
. '</span>'
. '<a href="browse_foreigners.php'
. PMA_generate_common_url($_url_params) . '"'
. ' target="_blank" class="browse_foreign" ' .'>'
. __('Browse foreign values')
. '</a>';
} else {
$dropdown = PMA_foreignDropdown(
$foreignData['disp_row'],
$foreignData['foreign_field'],
$foreignData['foreign_display'],
$curr_value,
$cfg['ForeignKeyMaxLimit']
);
$dropdown = '<select>' . $dropdown . '</select>';
}
return $dropdown;
}
/**
* Get the HTML for the enum column dropdown
* During grid edit, if we have a enum field, returns the html for the
* dropdown
*
* @param string $db current database
* @param string $table current table
* @param string $column current column
* @param string $curr_value currently selected value
*
* @return string $dropdown html for the dropdown
*/
function PMA_getHtmlForEnumColumnDropdown($db, $table, $column, $curr_value)
{
$values = PMA_getValuesForColumn($db, $table, $column);
$dropdown = '<option value="">&nbsp;</option>';
$dropdown .= PMA_getHtmlForOptionsList($values, array($curr_value));
$dropdown = '<select>' . $dropdown . '</select>';
return $dropdown;
}
/**
* Get the HTML for the set column dropdown
* During grid edit, if we have a set field, returns the html for the
* dropdown
*
* @param string $db current database
* @param string $table current table
* @param string $column current column
* @param string $curr_value currently selected value
*
* @return string $dropdown html for the set column
*/
function PMA_getHtmlForSetColumn($db, $table, $column, $curr_value)
{
$values = PMA_getValuesForColumn($db, $table, $column);
$dropdown = '';
//converts characters of $curr_value to HTML entities
$converted_curr_value = htmlentities(
$curr_value, ENT_COMPAT, "UTF-8"
);
$selected_values = explode(',', $converted_curr_value);
$dropdown .= PMA_getHtmlForOptionsList($values, $selected_values);
$select_size = (sizeof($values) > 10) ? 10 : sizeof($values);
$dropdown = '<select multiple="multiple" size="' . $select_size . '">'
. $dropdown . '</select>';
return $dropdown;
}
/**
* Get all the values for a enum column or set column in a table
*
* @param string $db current database
* @param string $table current table
* @param string $column current column
*
* @return array $values array containing the value list for the column
*/
function PMA_getValuesForColumn($db, $table, $column)
{
$field_info_query = PMA_DBI_getColumnsSql($db, $table, $column);
$field_info_result = PMA_DBI_fetchResult(
$field_info_query, null, null, null, PMA_DBI_QUERY_STORE
);
$values = PMA_Util::parseEnumSetValues($field_info_result[0]['Type']);
return $values;
}
/**
* Get HTML for options list
*
* @param array $values set of values
* @param array $selected_values currently selected values
*
* @return string $options HTML for options list
*/
function PMA_getHtmlForOptionsList($values, $selected_values)
{
$options = '';
foreach ($values as $value) {
$options .= '<option value="' . $value . '"';
if (in_array($value, $selected_values, true)) {
$options .= ' selected="selected" ';
}
$options .= '>' . $value . '</option>';
}
return $options;
}
?>

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-05-03 15:57+0200\n"
"PO-Revision-Date: 2013-05-02 13:10+0200\n"
"PO-Revision-Date: 2013-05-04 21:11+0200\n"
"Last-Translator: Michal Čihař <michal@cihar.com>\n"
"Language-Team: Czech <http://l10n.cihar.com/projects/phpmyadmin/master/cs/>\n"
"Language: cs\n"
@ -5524,20 +5524,20 @@ msgid "Control host"
msgstr "Kontrolní host"
#: libraries/config/messages.inc.php:389
#, fuzzy
#| msgid ""
#| "An alternate host to hold the configuration storage; leave blank to use "
#| "the already defined host"
msgid ""
"An alternate port to connect to the host that holds the configuration "
"storage; leave blank to use the already defined port"
msgstr "Jiný server na kterém bude umístěno úložiště nastavení phpMyAdmina"
msgstr ""
"Jiný port pro připojení k serveru serveru, na kterém bude umístěno úložiště "
"nastavení phpMyAdmina"
#: libraries/config/messages.inc.php:390
#, fuzzy
#| msgid "Control host"
msgid "Control port"
msgstr "Kontrolní host"
msgstr "Kontrolní port"
#: libraries/config/messages.inc.php:391
msgid "Count tables when showing database list"

288
po/da.po
View File

@ -4,16 +4,15 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-05-03 15:57+0200\n"
"PO-Revision-Date: 2013-03-30 01:34+0200\n"
"PO-Revision-Date: 2013-05-04 18:53+0200\n"
"Last-Translator: Aputsiaq Niels Janussen <aj@isit.gl>\n"
"Language-Team: Danish <http://l10n.cihar.com/projects/phpmyadmin/master/da/"
">\n"
"Language-Team: Danish <http://l10n.cihar.com/projects/phpmyadmin/master/da/>\n"
"Language: da\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 1.5-dev\n"
"X-Generator: Weblate 1.6-dev\n"
#: browse_foreigners.php:36 browse_foreigners.php:60 js/messages.php:335
#: libraries/DisplayResults.class.php:809
@ -41,10 +40,9 @@ msgstr ""
"blokere opdateringer mellem vinduer."
#: browse_foreigners.php:166
#, fuzzy
#| msgid "Search"
msgid "Search:"
msgstr "Søg"
msgstr "Søg:"
#: browse_foreigners.php:170 gis_data_editor.php:396 js/messages.php:209
#: libraries/DbSearch.class.php:455 libraries/DisplayResults.class.php:1657
@ -118,10 +116,9 @@ msgstr "Databasekommentar: "
#: db_datadict.php:157 libraries/schema/Pdf_Relation_Schema.class.php:1332
#: libraries/tbl_columns_definition_form.inc.php:836 tbl_printview.php:120
#, fuzzy
#| msgid "Table comments"
msgid "Table comments:"
msgstr "Tabel kommentarer"
msgstr "Tabelkommentarer:"
#: db_datadict.php:166 libraries/Index.class.php:565
#: libraries/TableSearch.class.php:183 libraries/TableSearch.class.php:1189
@ -339,24 +336,21 @@ msgstr "i brug"
#: db_printview.php:185 libraries/plugins/export/ExportSql.class.php:946
#: libraries/schema/Pdf_Relation_Schema.class.php:1337
#, fuzzy
#| msgid "Creation"
msgid "Creation:"
msgstr "Oprettelse"
msgstr "Oprettelse:"
#: db_printview.php:194 libraries/plugins/export/ExportSql.class.php:959
#: libraries/schema/Pdf_Relation_Schema.class.php:1342
#, fuzzy
#| msgid "Last update"
msgid "Last update:"
msgstr "Sidste opdatering"
msgstr "Seneste opdatering:"
#: db_printview.php:203 libraries/plugins/export/ExportSql.class.php:972
#: libraries/schema/Pdf_Relation_Schema.class.php:1347
#, fuzzy
#| msgid "Last check"
msgid "Last check:"
msgstr "Sidste check"
msgstr "Seneste tjek:"
#: db_printview.php:220 libraries/structure.lib.php:176
#, php-format
@ -526,22 +520,20 @@ msgid "Use OpenStreetMaps as Base Layer"
msgstr "Brug OpenStreetMaps som basislag"
#: gis_data_editor.php:161
#, fuzzy
#| msgid "SRID"
msgid "SRID:"
msgstr "SRID"
msgstr "SRID:"
#: gis_data_editor.php:184
#, fuzzy, php-format
#, php-format
#| msgid "Geometry"
msgid "Geometry %d:"
msgstr "Geometri"
msgstr "Geometri %d:"
#: gis_data_editor.php:206
#, fuzzy
#| msgid "Point"
msgid "Point:"
msgstr "Punkt"
msgstr "Punkt:"
#: gis_data_editor.php:207 gis_data_editor.php:234 gis_data_editor.php:289
#: gis_data_editor.php:362 js/messages.php:300
@ -565,22 +557,21 @@ msgid "Add a point"
msgstr "Tilføj et punkt"
#: gis_data_editor.php:262
#, fuzzy, php-format
#, php-format
#| msgid "Linestring"
msgid "Linestring %d:"
msgstr "Linjestreng"
msgstr "Linjestreng %d:"
#: gis_data_editor.php:265 gis_data_editor.php:341
#, fuzzy
#| msgid "Outer Ring:"
msgid "Outer ring:"
msgstr "Ydre ring:"
#: gis_data_editor.php:267 gis_data_editor.php:343
#, fuzzy, php-format
#, php-format
#| msgid "Inner Ring"
msgid "Inner ring %d:"
msgstr "Indre ring"
msgstr "Indre ring %d:"
#: gis_data_editor.php:303
msgid "Add a linestring"
@ -591,10 +582,10 @@ msgid "Add an inner ring"
msgstr "Tilføj en indre ring"
#: gis_data_editor.php:325
#, fuzzy, php-format
#, php-format
#| msgid "Polygon"
msgid "Polygon %d:"
msgstr "Polygon"
msgstr "Polygon %d:"
#: gis_data_editor.php:384 js/messages.php:311
msgid "Add a polygon"
@ -738,62 +729,54 @@ msgid "Server:"
msgstr "Server:"
#: index.php:240
#, fuzzy
#| msgid "Server type"
msgid "Server type:"
msgstr "Servertype"
msgstr "Servertype:"
#: index.php:244 libraries/plugins/export/ExportLatex.class.php:225
#: libraries/plugins/export/ExportSql.class.php:612
#: libraries/plugins/export/ExportXml.class.php:198
#, fuzzy
#| msgid "Server version"
msgid "Server version:"
msgstr "Serverversion"
msgstr "Serverversion:"
#: index.php:248
#, fuzzy
#| msgid "Protocol version"
msgid "Protocol version:"
msgstr "Protokolversion"
msgstr "Protokolversion:"
#: index.php:252
#, fuzzy
#| msgid "User"
msgid "User:"
msgstr "Bruger"
msgstr "Bruger:"
#: index.php:257
#, fuzzy
#| msgid "Server charset"
msgid "Server charset:"
msgstr "Servers tegnsæt"
msgstr "Servers tegnsæt:"
#: index.php:269
msgid "Web server"
msgstr "Webserver"
#: index.php:282
#, fuzzy
#| msgid "Database client version"
msgid "Database client version:"
msgstr "Databaseklientversion"
msgstr "Databaseklientversion:"
#: index.php:286
#, fuzzy
#| msgid "PHP extension"
msgid "PHP extension:"
msgstr "PHP udvidelse"
msgstr "PHP-udvidelse:"
#: index.php:300
msgid "Show PHP information"
msgstr "Vis PHP-information"
#: index.php:323
#, fuzzy
#| msgid "Version information"
msgid "Version information:"
msgstr "Versionsinformation"
msgstr "Versionsinformation:"
#: index.php:332 libraries/Util.class.php:430 libraries/Util.class.php:516
#: libraries/config/FormDisplay.tpl.php:145
@ -882,7 +865,6 @@ msgstr ""
"Konfigurationsfilen skal nu bruge et hemmeligt kodeord (blowfish_secret)."
#: index.php:460
#, 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 "
@ -894,8 +876,10 @@ msgid ""
"may be compromised by unauthorized people downloading your configuration."
msgstr ""
"Mappen [code]config[/code], som bruges af setup scriptet, eksisterer stadig "
"i din phpMyAdmin mappe. Du bør slette den, når phpMyAdmin er blevet "
"konfigureret."
"i din phpMyAdmin mappe. Det anbefales kraftigt at fjerne den, når phpMyAdmin "
"er blevet konfigureret. Sker dette ikke, er der risiko for at sikkerheden "
"på din server kompromitteres, ved at personer uden adgangstilladelse henter "
"din konfiguration."
#: index.php:470
#, php-format
@ -2337,28 +2321,24 @@ msgid "Descending"
msgstr "Faldende"
#: libraries/DBQbe.class.php:364
#, fuzzy
#| msgid "Column"
msgid "Column:"
msgstr "Kolonnenavn"
msgstr "Kolonne:"
#: libraries/DBQbe.class.php:406
#, fuzzy
#| msgid "Sort"
msgid "Sort:"
msgstr "Sorter"
msgstr "Sortér:"
#: libraries/DBQbe.class.php:468 libraries/DisplayResults.class.php:903
#, fuzzy
#| msgid "Show"
msgid "Show:"
msgstr "Vis"
msgstr "Vis:"
#: libraries/DBQbe.class.php:513
#, fuzzy
#| msgid "Criteria"
msgid "Criteria:"
msgstr "Kriterier"
msgstr "Kriterie:"
#: libraries/DBQbe.class.php:576
msgid "Add/Delete criteria rows"
@ -2377,14 +2357,13 @@ msgid "Use Tables"
msgstr "Benyt tabeller"
#: libraries/DBQbe.class.php:653 libraries/DBQbe.class.php:757
#, fuzzy
#| msgid "Or"
msgid "Or:"
msgstr "Eller"
msgstr "Eller:"
#: libraries/DBQbe.class.php:657 libraries/DBQbe.class.php:742
msgid "And:"
msgstr ""
msgstr "Og:"
#: libraries/DBQbe.class.php:661
msgid "Ins"
@ -2395,18 +2374,17 @@ msgid "Del"
msgstr "Del (Slet)"
#: libraries/DBQbe.class.php:680
#, fuzzy
#| msgid "Modify"
msgid "Modify:"
msgstr "Ret"
msgstr "Ret:"
#: libraries/DBQbe.class.php:737
msgid "Ins:"
msgstr ""
msgstr "Indsæt:"
#: libraries/DBQbe.class.php:752
msgid "Del:"
msgstr ""
msgstr "Slet:"
#: libraries/DBQbe.class.php:1322
#, php-format
@ -2531,10 +2509,9 @@ msgid "End"
msgstr "Slut"
#: libraries/DisplayResults.class.php:904 tbl_chart.php:241
#, fuzzy
#| msgid "Start row"
msgid "Start row:"
msgstr "Startrække"
msgstr "Startrække:"
#: libraries/DisplayResults.class.php:908 libraries/display_export.lib.php:175
#: tbl_chart.php:245
@ -2542,10 +2519,9 @@ msgid "Number of rows:"
msgstr "Antal rækker:"
#: libraries/DisplayResults.class.php:917
#, fuzzy
#| msgid "Mode"
msgid "Mode:"
msgstr "Tilstand"
msgstr "Tilstand:"
#: libraries/DisplayResults.class.php:919
msgid "horizontal"
@ -3191,16 +3167,14 @@ msgid "Target database `%s` was not found!"
msgstr "Mål-databasen '%s' blev ikke fundet!"
#: libraries/Table.class.php:1164
#, fuzzy
#| msgid "Invalid database"
msgid "Invalid database:"
msgstr "Ugyldig database"
msgstr "Ugyldig database:"
#: libraries/Table.class.php:1178
#, fuzzy
#| msgid "Invalid table name"
msgid "Invalid table name:"
msgstr "Ugyldigt tabelnavn"
msgstr "Ugyldigt tabelnavn:"
#: libraries/Table.class.php:1210
#, php-format
@ -3352,10 +3326,9 @@ msgid "Theme path not found for theme %s!"
msgstr "Sti til tema ikke fundet for tema %s!"
#: libraries/Theme_Manager.class.php:363
#, fuzzy
#| msgid "Theme"
msgid "Theme:"
msgstr "Tema"
msgstr "Tema:"
#: libraries/Types.class.php:296
msgid ""
@ -3699,10 +3672,9 @@ msgid "Max: %s%s"
msgstr "Maksimum størrelse: %s%s"
#: libraries/Util.class.php:674 sql.php:1116
#, fuzzy
#| msgid "SQL query"
msgid "SQL query:"
msgstr "SQL-forespørgsel"
msgstr "SQL-forespørgsel:"
#: libraries/Util.class.php:718 libraries/rte/rte_events.lib.php:114
#: libraries/rte/rte_events.lib.php:123 libraries/rte/rte_events.lib.php:140
@ -3932,10 +3904,10 @@ msgstr ""
"Ugyldigt værtsnavn for server %1$s. Gennemgå venligst din konfiguration."
#: libraries/common.inc.php:654
#, fuzzy, php-format
#, php-format
#| msgid "Server"
msgid "Server %d"
msgstr "Server"
msgstr "Server %d"
#: libraries/common.inc.php:847
msgid "Invalid authentication method set in configuration:"
@ -4436,28 +4408,25 @@ msgstr "Indsæt feltnavne i første række"
#: libraries/config/messages.inc.php:73 libraries/config/messages.inc.php:243
#: libraries/config/messages.inc.php:250
#: libraries/plugins/import/ImportCsv.class.php:141
#, fuzzy
#| msgid "Columns enclosed with:"
msgid "Columns enclosed with"
msgstr "Kolonner indrammet med:"
msgstr "Kolonner indrammet med"
#: libraries/config/messages.inc.php:74 libraries/config/messages.inc.php:244
#: libraries/config/messages.inc.php:251
#: libraries/plugins/import/ImportCsv.class.php:148
#, fuzzy
#| msgid "Columns escaped with:"
msgid "Columns escaped with"
msgstr "Kolonner escaped med:"
msgstr "Kolonner escaped med"
#: libraries/config/messages.inc.php:75 libraries/config/messages.inc.php:81
#: libraries/config/messages.inc.php:88 libraries/config/messages.inc.php:97
#: libraries/config/messages.inc.php:105 libraries/config/messages.inc.php:109
#: libraries/config/messages.inc.php:140 libraries/config/messages.inc.php:143
#: libraries/config/messages.inc.php:145
#, fuzzy
#| msgid "Replace NULL with:"
msgid "Replace NULL with"
msgstr "Erstat NULL med:"
msgstr "Erstat NULL med"
#: libraries/config/messages.inc.php:76 libraries/config/messages.inc.php:82
msgid "Remove CRLF characters within columns"
@ -4466,17 +4435,15 @@ msgstr "Fjern CRLF-tegn i kolonner"
#: libraries/config/messages.inc.php:77 libraries/config/messages.inc.php:247
#: libraries/config/messages.inc.php:255
#: libraries/plugins/import/ImportCsv.class.php:126
#, fuzzy
#| msgid "Columns terminated by"
msgid "Columns terminated with"
msgstr "Kolonner afsluttes med"
#: libraries/config/messages.inc.php:78 libraries/config/messages.inc.php:242
#: libraries/plugins/import/ImportCsv.class.php:155
#, fuzzy
#| msgid "Lines terminated with:"
msgid "Lines terminated with"
msgstr "Linjer afsluttet med:"
msgstr "Linjer afsluttet med"
#: libraries/config/messages.inc.php:80
msgid "Excel edition"
@ -5889,7 +5856,6 @@ msgid "Display columns table"
msgstr "Visningskolonnetabel"
#: libraries/config/messages.inc.php:437
#, fuzzy
#| msgid ""
#| "Leave blank for no \"persistent\" tables'UI preferences across sessions, "
#| "suggested: [kbd]pma__table_uiprefs[/kbd]"
@ -5897,8 +5863,8 @@ msgid ""
"Leave blank for no \"persistent\" tables' UI preferences across sessions, "
"suggested: [kbd]pma__table_uiprefs[/kbd]"
msgstr ""
"Efterlades tom for at undlade \"vedvarende\" brugerflade-præferencer for "
"tabel på tværs af sessioner, forslag: [kbd]pma_table_uiprefs[/kbd]"
"Efterlades tom for at undlade \"vedvarende\" brugerflade-præferencer for tabel "
"på tværs af sessioner, forslag: [kbd]pma_table_uiprefs[/kbd]"
#: libraries/config/messages.inc.php:438
msgid "UI preferences table"
@ -6406,10 +6372,9 @@ msgid "Empty phpMyAdmin control user password while using pmadb"
msgstr "Tom phpMyAdmin adgangskode for kontrolbruger ved brug af pmadb"
#: libraries/config/validate.lib.php:435
#, fuzzy
#| msgid "Incorrect value"
msgid "Incorrect value:"
msgstr "Ukorrekt værdi"
msgstr "Forkert værdi:"
#: libraries/config/validate.lib.php:443
#, php-format
@ -6475,16 +6440,14 @@ msgstr "Adgangskode:"
#: libraries/display_change_password.lib.php:67
#: libraries/replication_gui.lib.php:379
#: libraries/server_privileges.lib.php:1226
#, fuzzy
#| msgid "Re-type"
msgid "Re-type:"
msgstr "Skriv igen"
msgstr "Skriv igen:"
#: libraries/display_change_password.lib.php:74
#, fuzzy
#| msgid "Password Hashing"
msgid "Password Hashing:"
msgstr "Adgangskodehashing"
msgstr "Adgangskodehashing:"
#: libraries/display_change_password.lib.php:87
msgid "MySQL 4.0 compatible"
@ -6499,10 +6462,9 @@ msgid "Create"
msgstr "Opret"
#: libraries/display_create_database.lib.php:43
#, fuzzy
#| msgid "Create database"
msgid "Create database:"
msgstr "Opret ny database"
msgstr "Opret ny database:"
#: libraries/display_create_database.lib.php:47
#: libraries/server_privileges.lib.php:2938 server_privileges.php:149
@ -6684,10 +6646,9 @@ msgid "no branch"
msgstr "ingen gren"
#: libraries/display_git_revision.lib.php:64
#, fuzzy
#| msgid "Git revision"
msgid "Git revision:"
msgstr "Git-revision"
msgstr "Git-revision:"
#: libraries/display_git_revision.lib.php:67
#, php-format
@ -7233,10 +7194,9 @@ msgid "Binary - do not edit"
msgstr "Binært - må ikke ændres"
#: libraries/insert_edit.lib.php:1185 libraries/sql_query_form.lib.php:480
#, fuzzy
#| msgid "web server upload directory"
msgid "web server upload directory:"
msgstr "webserver upload-mappe"
msgstr "webserver upload-mappe:"
#: libraries/insert_edit.lib.php:1400
#, php-format
@ -7641,10 +7601,9 @@ msgid "New"
msgstr "Ny"
#: libraries/operations.lib.php:75
#, fuzzy
#| msgid "Rename database to"
msgid "Rename database to:"
msgstr "Omdøb database til"
msgstr "Omdøb database til:"
#: libraries/operations.lib.php:107
#, php-format
@ -7675,10 +7634,9 @@ msgid "Data only"
msgstr "Kun data"
#: libraries/operations.lib.php:175
#, fuzzy
#| msgid "Copy database to"
msgid "Copy database to:"
msgstr "Kopier database til"
msgstr "Kopier database til:"
#: libraries/operations.lib.php:186
msgid "CREATE DATABASE before copying"
@ -7853,7 +7811,7 @@ msgstr ""
#: libraries/plugins/auth/AuthenticationConfig.class.php:142
msgid "Retry to connect"
msgstr ""
msgstr "Forsøg at tilslutte igen"
#: libraries/plugins/auth/AuthenticationCookie.class.php:44
msgid "Failed to use Blowfish from mcrypt!"
@ -7880,10 +7838,9 @@ msgid "Username:"
msgstr "Brugernavn:"
#: libraries/plugins/auth/AuthenticationCookie.class.php:225
#, fuzzy
#| msgid "Server Choice"
msgid "Server Choice:"
msgstr "Servervalg"
msgstr "Servervalg:"
#: libraries/plugins/auth/AuthenticationCookie.class.php:583
#: libraries/plugins/auth/AuthenticationSignon.class.php:249
@ -8043,24 +8000,21 @@ msgstr "Object oprettelsesindstillinger"
#: libraries/plugins/export/ExportLatex.class.php:121
#: libraries/plugins/export/ExportLatex.class.php:166
#, fuzzy
#| msgid "Table caption"
msgid "Table caption:"
msgstr "Tabeloverskrift"
msgstr "Tabeloverskrift:"
#: libraries/plugins/export/ExportLatex.class.php:126
#: libraries/plugins/export/ExportLatex.class.php:171
#, fuzzy
#| msgid "Table caption (continued)"
msgid "Table caption (continued):"
msgstr "Tabeloverskrift (fortsat)"
msgstr "Tabeloverskrift (fortsat):"
#: libraries/plugins/export/ExportLatex.class.php:131
#: libraries/plugins/export/ExportLatex.class.php:176
#, fuzzy
#| msgid "Label key"
msgid "Label key:"
msgstr "Mærke nøgle"
msgstr "Mærke nøgle:"
#: libraries/plugins/export/ExportLatex.class.php:137
#: libraries/plugins/export/ExportOdt.class.php:103
@ -8080,58 +8034,51 @@ msgid "Display MIME types"
msgstr "Vis MIME-typer"
#: libraries/plugins/export/ExportLatex.class.php:162
#, fuzzy
#| msgid "Put columns names in the first row"
msgid "Put columns names in the first row:"
msgstr "Indsæt feltnavne i første række"
msgstr "Indsæt feltnavne i første række:"
#: libraries/plugins/export/ExportLatex.class.php:218
#: libraries/plugins/export/ExportSql.class.php:601
#: libraries/plugins/export/ExportXml.class.php:191
#: libraries/replication_gui.lib.php:68 libraries/replication_gui.lib.php:293
#: libraries/server_privileges.lib.php:1081 sql.php:1110
#, fuzzy
#| msgid "Host"
msgid "Host:"
msgstr "Vært"
msgstr "Vært:"
#: libraries/plugins/export/ExportLatex.class.php:223
#: libraries/plugins/export/ExportSql.class.php:608
#: libraries/plugins/export/ExportXml.class.php:196 sql.php:1113
#, fuzzy
#| msgid "Generation Time"
msgid "Generation Time:"
msgstr "Genereringstid"
msgstr "Genereringstid:"
#: libraries/plugins/export/ExportLatex.class.php:226
#: libraries/plugins/export/ExportSql.class.php:614
#: libraries/plugins/export/ExportXml.class.php:199
#, fuzzy
#| msgid "PHP Version"
msgid "PHP Version:"
msgstr "PHP-version"
msgstr "PHP-version:"
#: libraries/plugins/export/ExportLatex.class.php:251
#: libraries/plugins/export/ExportSql.class.php:760
#: libraries/plugins/export/ExportXml.class.php:390
#: libraries/plugins/export/PMA_ExportPdf.class.php:115 sql.php:1111
#, fuzzy
#| msgid "Database"
msgid "Database:"
msgstr "Database"
msgstr "Database:"
#: libraries/plugins/export/ExportLatex.class.php:301
#: libraries/plugins/export/ExportSql.class.php:1545
#, fuzzy
#| msgid "Data"
msgid "Data:"
msgstr "Data"
msgstr "Data:"
#: libraries/plugins/export/ExportLatex.class.php:485
#, fuzzy
#| msgid "Structure"
msgid "Structure:"
msgstr "Struktur"
msgstr "Struktur:"
#: libraries/plugins/export/ExportMediawiki.class.php:84
msgid "Export table names"
@ -8306,10 +8253,9 @@ msgid "Export contents"
msgstr "Eksport indhold"
#: libraries/plugins/export/PMA_ExportPdf.class.php:116
#, fuzzy
#| msgid "Table"
msgid "Table:"
msgstr "Tabel"
msgstr "Tabel:"
#: libraries/plugins/import/ImportCsv.class.php:63
#: libraries/plugins/import/ImportOds.class.php:74
@ -8689,10 +8635,9 @@ msgstr ""
#: libraries/replication_gui.lib.php:60 libraries/replication_gui.lib.php:273
#: libraries/server_privileges.lib.php:1024
#, fuzzy
#| msgid "User name"
msgid "User name:"
msgstr "Brugernavn"
msgstr "Brugernavn:"
#: libraries/replication_gui.lib.php:61 libraries/replication_gui.lib.php:276
#: libraries/replication_gui.lib.php:283
@ -8702,10 +8647,9 @@ msgid "User name"
msgstr "Brugernavn"
#: libraries/replication_gui.lib.php:72
#, fuzzy
#| msgid "Port"
msgid "Port:"
msgstr "Port"
msgstr "Port:"
#: libraries/replication_gui.lib.php:112
msgid "Master status"
@ -8752,10 +8696,9 @@ msgstr "Enhver bruger"
#: libraries/replication_gui.lib.php:372
#: libraries/server_privileges.lib.php:1175
#: libraries/server_privileges.lib.php:2292
#, fuzzy
#| msgid "Use text field"
msgid "Use text field:"
msgstr "Brug tekstfelt"
msgstr "Brug tekstfelt:"
#: libraries/replication_gui.lib.php:326
#: libraries/server_privileges.lib.php:1139
@ -8792,10 +8735,9 @@ msgid "Re-type"
msgstr "Skriv igen"
#: libraries/replication_gui.lib.php:386
#, fuzzy
#| msgid "Generate Password"
msgid "Generate Password:"
msgstr "Generer adgangskode"
msgstr "Generer adgangskode:"
#: libraries/rte/rte_events.lib.php:110 libraries/rte/rte_events.lib.php:119
#: libraries/rte/rte_events.lib.php:157 libraries/rte/rte_routines.lib.php:296
@ -8841,10 +8783,9 @@ msgstr "Rediger hændelse"
#: libraries/rte/rte_routines.lib.php:1478
#: libraries/rte/rte_routines.lib.php:1518
#: libraries/rte/rte_triggers.lib.php:230
#, fuzzy
#| msgid "Error in processing request"
msgid "Error in processing request:"
msgstr "Fejl i udførsel af forespørgsel"
msgstr "Fejl i udførsel af forespørgsel:"
#: libraries/rte/rte_events.lib.php:417 libraries/rte/rte_routines.lib.php:931
#: libraries/rte/rte_triggers.lib.php:347
@ -9355,10 +9296,9 @@ msgid "Unknown language: %1$s."
msgstr "Ukendt sprog: %1$s."
#: libraries/select_server.lib.php:39 libraries/select_server.lib.php:44
#, fuzzy
#| msgid "Current Server"
msgid "Current Server:"
msgstr "Aktuel server"
msgstr "Aktuel server:"
#: libraries/server_privileges.lib.php:135 server_privileges.php:94
msgid "No privileges."
@ -9613,6 +9553,8 @@ msgid ""
"An account already exists with the same username but possibly a different "
"hostname. Are you sure you wish to proceed?"
msgstr ""
"Der findes allerede en konto med samme brugernavn, men muligvis med et andet "
"værtsnavn. Er du sikker på at du vil fortsætte?"
#: libraries/server_privileges.lib.php:1204
msgid "Do not change the password"
@ -9738,10 +9680,9 @@ msgid "Column-specific privileges"
msgstr "Kolonne-specifikke privilegier"
#: libraries/server_privileges.lib.php:2288
#, fuzzy
#| msgid "Add privileges on the following database"
msgid "Add privileges on the following database:"
msgstr "Tilføj privilegier på følgende database"
msgstr "Tilføj privilegier på følgende database:"
#: libraries/server_privileges.lib.php:2308
msgid "Wildcards % and _ should be escaped with a \\ to use them literally"
@ -9749,10 +9690,9 @@ msgstr ""
"Jokertegn % og _ skal escapes med en \\ for brug af dem som almindelige tegn"
#: libraries/server_privileges.lib.php:2326
#, fuzzy
#| msgid "Add privileges on the following table"
msgid "Add privileges on the following table:"
msgstr "Tilføj privileges på følgende tabel"
msgstr "Tilføj privileges på følgende tabel:"
#: libraries/server_privileges.lib.php:2543
msgid "Remove selected users"
@ -9792,10 +9732,9 @@ msgid "Privileges for %s"
msgstr "Privilegier for %s"
#: libraries/server_privileges.lib.php:2860
#, fuzzy
#| msgid "Edit Privileges"
msgid "Edit Privileges:"
msgstr "Ret privilegier"
msgstr "Ret privilegier:"
#: libraries/server_privileges.lib.php:2914
msgid "Users overview"
@ -9838,10 +9777,9 @@ msgid "Clear"
msgstr "Ryd"
#: libraries/sql_query_form.lib.php:318
#, fuzzy
#| msgid "Bookmark this SQL query"
msgid "Bookmark this SQL query:"
msgstr "Lav bogmærke til denne SQL-forespørgsel"
msgstr "Lav bogmærke til denne SQL-forespørgsel:"
#: libraries/sql_query_form.lib.php:326 sql.php:1330
msgid "Let every user access this bookmark"
@ -10230,22 +10168,19 @@ msgid "Table name"
msgstr "Tabelnavn"
#: libraries/tbl_columns_definition_form.inc.php:838
#, fuzzy
#| msgid "Storage Engine"
msgid "Storage Engine:"
msgstr "Datalager"
msgstr "Datalager:"
#: libraries/tbl_columns_definition_form.inc.php:842
#, fuzzy
#| msgid "Collation"
msgid "Collation:"
msgstr "Tegnsæt (sortering)"
msgstr "Tegnsæt (sortering):"
#: libraries/tbl_columns_definition_form.inc.php:876
#, fuzzy
#| msgid "PARTITION definition"
msgid "PARTITION definition:"
msgstr "PARTITION-definition"
msgstr "PARTITION-definition:"
#: libraries/tbl_common.inc.php:54
#, php-format
@ -10371,10 +10306,9 @@ msgid "Hide/Show Tables with no relation"
msgstr "Skjul/Vis tabeller uden relation"
#: pmd_general.php:218
#, fuzzy
#| msgid "Number of tables"
msgid "Number of tables:"
msgstr "Antal tabeller"
msgstr "Antal tabeller:"
#: pmd_general.php:467
msgid "Delete relation"
@ -10419,10 +10353,9 @@ msgid "Page creation failed"
msgstr "Sideoprettelse fejlede"
#: pmd_pdf.php:113
#, fuzzy
#| msgid "Page"
msgid "Page:"
msgstr "Side"
msgstr "Side:"
#: pmd_pdf.php:123
msgid "Import from selected page"
@ -10441,10 +10374,9 @@ msgid "New page name: "
msgstr "Nyt sidenavn: "
#: pmd_pdf.php:141
#, fuzzy
#| msgid "Export/Import to scale"
msgid "Export/Import to scale:"
msgstr "Eksportér/importér til skala"
msgstr "Eksportér/importér til skala:"
#: pmd_pdf.php:146
msgid "recommended"
@ -10463,10 +10395,9 @@ msgid "FOREIGN KEY relation added"
msgstr "FOREIGN KEY relation tilføjet"
#: pmd_relation_new.php:82
#, fuzzy
#| msgid "Error: Relation not added."
msgid "Error: Relational features are disabled!"
msgstr "Fejl: Relation ikke tilføjet."
msgstr "Fejl: Relationelle egenskaber er slået fra!"
#: pmd_relation_new.php:98
msgid "Internal relation added"
@ -10559,10 +10490,9 @@ msgid "All"
msgstr "Alle"
#: querywindow.php:154
#, fuzzy
#| msgid "SQL history"
msgid "SQL history:"
msgstr "SQL-historik"
msgstr "SQL-historik:"
#: schema_edit.php:36 schema_edit.php:42 schema_edit.php:48 schema_edit.php:53
#, php-format
@ -11196,22 +11126,19 @@ msgid "Questions since startup: %s"
msgstr "Forespørgsler siden startup: %s"
#: server_status_queries.php:79
#, fuzzy
#| msgid "per hour"
msgid "per hour:"
msgstr "pr. time"
msgstr "pr. time:"
#: server_status_queries.php:82
#, fuzzy
#| msgid "per minute"
msgid "per minute:"
msgstr "pr. minut"
msgstr "pr. minut:"
#: server_status_queries.php:86
#, fuzzy
#| msgid "per second"
msgid "per second:"
msgstr "pr. sekund"
msgstr "pr. sekund:"
#: server_status_queries.php:118
msgid "Statements"
@ -12313,10 +12240,9 @@ msgid "SQL result"
msgstr "SQL-resultat"
#: sql.php:1115
#, fuzzy
#| msgid "Generated by"
msgid "Generated by:"
msgstr "Genereret af"
msgstr "Genereret af:"
#: sql.php:1237
msgid ""
@ -12336,10 +12262,9 @@ msgid "Bookmark this SQL query"
msgstr "Lav bogmærke til denne SQL-forespørgsel"
#: sql.php:1322
#, fuzzy
#| msgid "Label"
msgid "Label:"
msgstr "Mærke"
msgstr "Etikette:"
#: tbl_chart.php:38
msgid "No data to display"
@ -12520,22 +12445,19 @@ msgid "The table name is empty!"
msgstr "Intet tabelnavn!"
#: tbl_printview.php:65
#, fuzzy
#| msgid "Showing tables"
msgid "Showing tables:"
msgstr "Viser tabeller"
msgstr "Viser tabeller:"
#: tbl_printview.php:296
#, fuzzy
#| msgid "Space usage"
msgid "Space usage:"
msgstr "Pladsforbrug"
msgstr "Pladsforbrug:"
#: tbl_printview.php:345
#, fuzzy
#| msgid "Row Statistics"
msgid "Row Statistics:"
msgstr "Rækkestatistik"
msgstr "Rækkestatistik:"
#: tbl_relation.php:213
#, php-format
@ -12567,16 +12489,14 @@ msgid "No index defined! Create one below"
msgstr "Intet indeks defineret! Opret ét nedenfor"
#: tbl_relation.php:544
#, fuzzy
#| msgid "Choose column to display"
msgid "Choose column to display:"
msgstr "Vælg kolonne til visning"
msgstr "Vælg kolonne til visning:"
#: tbl_structure.php:125
#, fuzzy
#| msgid "No rows selected"
msgid "No column selected."
msgstr "Ingen rækker valgt"
msgstr "Der er ikke valgt kolonner."
#: tbl_structure.php:149
#, php-format

2296
po/ko.po

File diff suppressed because it is too large Load Diff

View File

@ -4,10 +4,10 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-05-03 15:57+0200\n"
"PO-Revision-Date: 2013-05-03 14:59+0200\n"
"Last-Translator: Genti Ereqi <gereqi@gmail.com>\n"
"Language-Team: Albanian <http://l10n.cihar.com/projects/phpmyadmin/master/sq/"
">\n"
"PO-Revision-Date: 2013-05-04 21:12+0200\n"
"Last-Translator: Michal Čihař <michal@cihar.com>\n"
"Language-Team: Albanian "
"<http://l10n.cihar.com/projects/phpmyadmin/master/sq/>\n"
"Language: sq\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -2374,12 +2374,12 @@ msgstr[0] "<b>Gjithsej:</b> <i>%s</i> korrespondon"
msgstr[1] "<b>Gjithsej:</b> <i>%s</i> korrespondojnë"
#: libraries/DbSearch.class.php:331
#, fuzzy, php-format
#, php-format
#| msgid "%s match(es) inside table <i>%s</i>"
msgid "%1$s match in <strong>%2$s</strong>"
msgid_plural "%1$s matches in <strong>%2$s</strong>"
msgstr[0] "%s korrispondon(jnë) tek tabela <i>%s</i>"
msgstr[1] "%s korrispondon(jnë) tek tabela <i>%s</i>"
msgstr[0] "%1$s korrespondon tek tabela <strong>%2$s</strong>"
msgstr[1] "%1$s korrespondojnë tek tabela <strong>%2$s</strong>"
#: libraries/DbSearch.class.php:346 libraries/Menu.class.php:250
#: libraries/Util.class.php:3227 libraries/Util.class.php:3440

View File

@ -4,10 +4,10 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.1-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2013-05-03 15:57+0200\n"
"PO-Revision-Date: 2013-05-02 12:47+0200\n"
"PO-Revision-Date: 2013-05-04 08:53+0200\n"
"Last-Translator: Anders Jonsson <jonars03@student.umu.se>\n"
"Language-Team: Swedish <http://l10n.cihar.com/projects/phpmyadmin/master/sv/"
">\n"
"Language-Team: Swedish "
"<http://l10n.cihar.com/projects/phpmyadmin/master/sv/>\n"
"Language: sv\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -7740,7 +7740,7 @@ msgstr ""
#: libraries/plugins/auth/AuthenticationConfig.class.php:142
msgid "Retry to connect"
msgstr ""
msgstr "Försök ansluta igen"
#: libraries/plugins/auth/AuthenticationCookie.class.php:44
msgid "Failed to use Blowfish from mcrypt!"
@ -10296,10 +10296,9 @@ msgid "FOREIGN KEY relation added"
msgstr "FOREIGN KEY-relation tillagd"
#: pmd_relation_new.php:82
#, fuzzy
#| msgid "Error: Relation not added."
msgid "Error: Relational features are disabled!"
msgstr "Fel: Relation inte tillagd."
msgstr "Fel: Relationella funktioner är inaktiverade!"
#: pmd_relation_new.php:98
msgid "Internal relation added"

View File

@ -7,7 +7,7 @@
*/
/**
*
* requirements
*/
require_once 'libraries/common.inc.php';
@ -16,6 +16,7 @@ require_once 'libraries/common.inc.php';
*/
require_once 'libraries/server_common.inc.php';
$response = PMA_Response::getInstance();
$url_params = array();
/**
@ -69,30 +70,30 @@ if (empty($_REQUEST['dontlimitchars'])) {
/**
* Displays the sub-page heading
*/
echo '<h2>' . "\n"
. PMA_Util::getImage('s_tbl.png')
. ' ' . __('Binary log') . "\n"
. '</h2>' . "\n";
$html = '<h2>' . "\n"
. PMA_Util::getImage('s_tbl.png')
. ' ' . __('Binary log') . "\n"
. '</h2>' . "\n";
/**
* Display log selector.
*/
if (count($binary_logs) > 1) {
echo '<form action="server_binlog.php" method="get">';
echo PMA_generate_common_hidden_inputs($url_params);
echo '<fieldset><legend>';
echo __('Select binary log to view');
echo '</legend><select name="log">';
$html .= '<form action="server_binlog.php" method="get">';
$html .= PMA_generate_common_hidden_inputs($url_params);
$html .= '<fieldset><legend>';
$html .= __('Select binary log to view');
$html .= '</legend><select name="log">';
$full_size = 0;
foreach ($binary_logs as $each_log) {
echo '<option value="' . $each_log['Log_name'] . '"';
$html .= '<option value="' . $each_log['Log_name'] . '"';
if ($each_log['Log_name'] == $_REQUEST['log']) {
echo ' selected="selected"';
$html .= ' selected="selected"';
}
echo '>' . $each_log['Log_name'];
$html .= '>' . $each_log['Log_name'];
if (isset($each_log['File_size'])) {
$full_size += $each_log['File_size'];
echo ' ('
$html .= ' ('
. implode(
' ',
PMA_Util::formatByteDown(
@ -101,28 +102,28 @@ if (count($binary_logs) > 1) {
)
. ')';
}
echo '</option>';
$html .= '</option>';
}
echo '</select> ';
echo count($binary_logs) . ' ' . __('Files') . ', ';
$html .= '</select> ';
$html .= count($binary_logs) . ' ' . __('Files') . ', ';
if ($full_size > 0) {
echo implode(
$html .= implode(
' ', PMA_Util::formatByteDown($full_size)
);
}
echo '</fieldset>';
echo '<fieldset class="tblFooters">';
echo '<input type="submit" value="' . __('Go') . '" />';
echo '</fieldset>';
echo '</form>';
$html .= '</fieldset>';
$html .= '<fieldset class="tblFooters">';
$html .= '<input type="submit" value="' . __('Go') . '" />';
$html .= '</fieldset>';
$html .= '</form>';
}
echo PMA_Util::getMessage(PMA_Message::success());
$html .= PMA_Util::getMessage(PMA_Message::success());
/**
* Displays the page
*/
echo '<table cellpadding="2" cellspacing="1">'
$html .= '<table cellpadding="2" cellspacing="1">'
. '<thead>'
. '<tr>'
. '<td colspan="6" class="center">';
@ -135,14 +136,14 @@ if ($pos > 0) {
$this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows'];
}
echo '<a href="server_binlog.php'
$html .= '<a href="server_binlog.php'
. PMA_generate_common_url($this_url_params) . '"';
if ($GLOBALS['cfg']['NavigationBarIconic']) {
echo ' title="' . _pgettext('Previous page', 'Previous') . '">';
$html .= ' title="' . _pgettext('Previous page', 'Previous') . '">';
} else {
echo '>' . _pgettext('Previous page', 'Previous');
$html .= '>' . _pgettext('Previous page', 'Previous');
} // end if... else...
echo ' &lt; </a> - ';
$html .= ' &lt; </a> - ';
}
$this_url_params = $url_params;
@ -158,7 +159,7 @@ if ($dontlimitchars) {
$tempTitle = __('Show Full Queries');
$tempImgMode = 'full';
}
echo '<a href="server_binlog.php' . PMA_generate_common_url($this_url_params)
$html .= '<a href="server_binlog.php' . PMA_generate_common_url($this_url_params)
. '" title="' . $tempTitle . '">'
. '<img src="' .$pmaThemeImage . 's_' . $tempImgMode . 'text.png"'
. 'alt="' . $tempTitle . '" /></a>';
@ -168,17 +169,17 @@ echo '<a href="server_binlog.php' . PMA_generate_common_url($this_url_params)
if ($num_rows >= $GLOBALS['cfg']['MaxRows']) {
$this_url_params = $url_params;
$this_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxRows'];
echo ' - <a href="server_binlog.php' . PMA_generate_common_url($this_url_params)
$html .= ' - <a href="server_binlog.php' . PMA_generate_common_url($this_url_params)
. '"';
if ($GLOBALS['cfg']['NavigationBarIconic']) {
echo ' title="' . _pgettext('Next page', 'Next') . '">';
$html .= ' title="' . _pgettext('Next page', 'Next') . '">';
} else {
echo '>' . _pgettext('Next page', 'Next');
$html .= '>' . _pgettext('Next page', 'Next');
} // end if... else...
echo ' &gt; </a>';
$html .= ' &gt; </a>';
}
echo '</td>'
$html .= '</td>'
. '</tr>'
. '<tr>'
. '<th>' . __('Log name') . '</th>'
@ -201,7 +202,7 @@ while ($value = PMA_DBI_fetchAssoc($result)) {
) . '...';
}
echo '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">'
$html .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">'
. '<td>&nbsp;' . $value['Log_name'] . '&nbsp;</td>'
. '<td class="right">&nbsp;' . $value['Pos'] . '&nbsp;</td>'
. '<td>&nbsp;' . $value['Event_type'] . '&nbsp;</td>'
@ -215,5 +216,7 @@ while ($value = PMA_DBI_fetchAssoc($result)) {
$odd_row = !$odd_row;
}
echo '</tbody>'
$html .= '</tbody>'
. '</table>';
$response->addHTML($html);

View File

@ -60,6 +60,30 @@ exit;
*/
function getServerTrafficHtml($ServerStatusData)
{
//display the server state General Information
$retval = getServerStateGeneralInfoHtml($ServerStatusData);
//display the server state traffic
$retval .= getServerStateTrafficHtml($ServerStatusData);
//display the server state connection information
$retval .= getServerStateConnectionsHtml($ServerStatusData);
//display the Table Process List information
$retval .= getTableProcesslistHtml($ServerStatusData);
return $retval;
}
/**
* Prints server state General information
*
* @param Object $ServerStatusData An instance of the PMA_ServerStatusData class
*
* @return string
*/
function getServerStateGeneralInfoHtml($ServerStatusData)
{
$hour_factor = 3600 / $ServerStatusData->status['Uptime'];
$start_time = PMA_DBI_fetchValue(
'SELECT UNIX_TIMESTAMP() - ' . $ServerStatusData->status['Uptime']
@ -127,16 +151,7 @@ function getServerTrafficHtml($ServerStatusData)
}
}
}
//display the server state traffic
$retval .= getServerStateTrafficHtml($ServerStatusData);
//display the server state connection information
$retval .= getServerStateConnectionsHtml($ServerStatusData);
//display the Table Process List information
$retval .= getTableProcesslistHtml($ServerStatusData);
return $retval;
}

View File

@ -467,78 +467,8 @@ exit;
*/
function getPrintMonitorHtml($ServerStatusData)
{
$retval = '<div class="tabLinks">';
$retval .= '<a href="#pauseCharts">';
$retval .= PMA_Util::getImage('play.png') . __('Start Monitor');
$retval .= '</a>';
$retval .= '<a href="#settingsPopup" class="popupLink">';
$retval .= PMA_Util::getImage('s_cog.png') . __('Settings');
$retval .= '</a>';
if (! PMA_DRIZZLE) {
$retval .= '<a href="#monitorInstructionsDialog">';
$retval .= PMA_Util::getImage('b_help.png') . __('Instructions/Setup');
}
$retval .= '<a href="#endChartEditMode" style="display:none;">';
$retval .= PMA_Util::getImage('s_okay.png');
$retval .= __('Done rearranging/editing charts');
$retval .= '</a>';
$retval .= '</div>';
$retval .= '<div class="popupContent settingsPopup">';
$retval .= '<a href="#addNewChart">';
$retval .= PMA_Util::getImage('b_chart.png') . __('Add chart');
$retval .= '</a>';
//$retval .= '<a href="#rearrangeCharts">';
//$retval .= PMA_Util::getImage('b_tblops.png') . __('Rearrange/edit charts');
//$retval .= '</a>';
$retval .= '<div class="clearfloat paddingtop"></div>';
$retval .= '<div class="floatleft">';
$retval .= __('Refresh rate') . '<br />';
$retval .= PMA_getRefreshList(
'gridChartRefresh',
5,
Array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200)
);
$retval .= '<br />';
$retval .= '</div>';
$retval .= '<div class="floatleft">';
$retval .= __('Chart columns');
$retval .= '<br />';
$retval .= '<select name="chartColumns">';
$retval .= '<option>1</option>';
$retval .= '<option>2</option>';
$retval .= '<option>3</option>';
$retval .= '<option>4</option>';
$retval .= '<option>5</option>';
$retval .= '<option>6</option>';
$retval .= '<option>7</option>';
$retval .= '<option>8</option>';
$retval .= '<option>9</option>';
$retval .= '<option>10</option>';
$retval .= '</select>';
$retval .= '</div>';
$retval .= '<div class="clearfloat paddingtop">';
$retval .= '<b>' . __('Chart arrangement') . '</b> ';
$retval .= PMA_Util::showHint(
__(
'The arrangement of the charts is stored to the browsers local storage. '
. 'You may want to export it if you have a complicated set up.'
)
);
$retval .= '<br/>';
$retval .= '<a class="ajax" href="#importMonitorConfig">';
$retval .= __('Import');
$retval .= '</a>';
$retval .= '&nbsp;&nbsp;';
$retval .= '<a class="disableAjax" href="#exportMonitorConfig">';
$retval .= __('Export');
$retval .= '</a>';
$retval .= '&nbsp;&nbsp;';
$retval .= '<a href="#clearMonitorConfig">';
$retval .= __('Reset to default');
$retval .= '</a>';
$retval .= '</div>';
$retval .= '</div>';
$retval = getTabLinksHtml();
$retval .= getPopContentHtml();
$retval .= '<div id="monitorInstructionsDialog" title="';
$retval .= __('Monitor Instructions') . '" style="display:none;">';
@ -753,4 +683,101 @@ function PMA_getRefreshList($name,
return $return;
}
/**
* Prints html with Tab Links
*
* @param null
*
* @return string
*/
function getTabLinksHtml()
{
$retval = '<div class="tabLinks">';
$retval .= '<a href="#pauseCharts">';
$retval .= PMA_Util::getImage('play.png') . __('Start Monitor');
$retval .= '</a>';
$retval .= '<a href="#settingsPopup" class="popupLink">';
$retval .= PMA_Util::getImage('s_cog.png') . __('Settings');
$retval .= '</a>';
if (! PMA_DRIZZLE) {
$retval .= '<a href="#monitorInstructionsDialog">';
$retval .= PMA_Util::getImage('b_help.png') . __('Instructions/Setup');
}
$retval .= '<a href="#endChartEditMode" style="display:none;">';
$retval .= PMA_Util::getImage('s_okay.png');
$retval .= __('Done rearranging/editing charts');
$retval .= '</a>';
$retval .= '</div>';
return $retval;
}
/**
* Prints html with Pop Content
*
* @param null
*
* @return string
*/
function getPopContentHtml()
{
$retval = '<div class="popupContent settingsPopup">';
$retval .= '<a href="#addNewChart">';
$retval .= PMA_Util::getImage('b_chart.png') . __('Add chart');
$retval .= '</a>';
//$retval .= '<a href="#rearrangeCharts">';
//$retval .= PMA_Util::getImage('b_tblops.png') . __('Rearrange/edit charts');
//$retval .= '</a>';
$retval .= '<div class="clearfloat paddingtop"></div>';
$retval .= '<div class="floatleft">';
$retval .= __('Refresh rate') . '<br />';
$retval .= PMA_getRefreshList(
'gridChartRefresh',
5,
Array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200)
);
$retval .= '<br />';
$retval .= '</div>';
$retval .= '<div class="floatleft">';
$retval .= __('Chart columns');
$retval .= '<br />';
$retval .= '<select name="chartColumns">';
$retval .= '<option>1</option>';
$retval .= '<option>2</option>';
$retval .= '<option>3</option>';
$retval .= '<option>4</option>';
$retval .= '<option>5</option>';
$retval .= '<option>6</option>';
$retval .= '<option>7</option>';
$retval .= '<option>8</option>';
$retval .= '<option>9</option>';
$retval .= '<option>10</option>';
$retval .= '</select>';
$retval .= '</div>';
$retval .= '<div class="clearfloat paddingtop">';
$retval .= '<b>' . __('Chart arrangement') . '</b> ';
$retval .= PMA_Util::showHint(
__(
'The arrangement of the charts is stored to the browsers local storage. '
. 'You may want to export it if you have a complicated set up.'
)
);
$retval .= '<br/>';
$retval .= '<a class="ajax" href="#importMonitorConfig">';
$retval .= __('Import');
$retval .= '</a>';
$retval .= '&nbsp;&nbsp;';
$retval .= '<a class="disableAjax" href="#exportMonitorConfig">';
$retval .= __('Export');
$retval .= '</a>';
$retval .= '&nbsp;&nbsp;';
$retval .= '<a href="#clearMonitorConfig">';
$retval .= __('Reset to default');
$retval .= '</a>';
$retval .= '</div>';
$retval .= '</div>';
return $retval;
}
?>

509
sql.php
View File

@ -16,6 +16,7 @@ require_once 'libraries/Table.class.php';
require_once 'libraries/Header.class.php';
require_once 'libraries/check_user_privileges.lib.php';
require_once 'libraries/bookmark.lib.php';
require_once 'libraries/sql.lib.php';
$response = PMA_Response::getInstance();
$header = $response->getHeader();
@ -123,27 +124,12 @@ if (isset($fields['dbase'])) {
$db = $fields['dbase'];
}
/**
* During grid edit, if we have a relational field, show the dropdown for it
*
* Logic taken from libraries/DisplayResults.class.php
*
* This doesn't seem to be the right place to do this, but I can't think of any
* better place either.
*/
// During grid edit, if we have a relational field, show the dropdown for it.
if (isset($_REQUEST['get_relational_values'])
&& $_REQUEST['get_relational_values'] == true
) {
$column = $_REQUEST['column'];
$foreigners = PMA_getForeigners($db, $table, $column);
$display_field = PMA_getDisplayField(
$foreigners[$column]['foreign_db'],
$foreigners[$column]['foreign_table']
);
$foreignData = PMA_getForeignData($foreigners, $column, false, '', '');
if ($_SESSION['tmp_user_values']['relational_display'] == 'D'
&& isset($display_field)
&& strlen($display_field)
@ -154,104 +140,28 @@ if (isset($_REQUEST['get_relational_values'])
} else {
$curr_value = $_REQUEST['curr_value'];
}
if ($foreignData['disp_row'] == null) {
//Handle the case when number of values
//is more than $cfg['ForeignKeyMaxLimit']
$_url_params = array(
'db' => $db,
'table' => $table,
'field' => $column
);
$dropdown = '<span class="curr_value">'
. htmlspecialchars($_REQUEST['curr_value'])
. '</span>'
. '<a href="browse_foreigners.php'
. PMA_generate_common_url($_url_params) . '"'
. ' target="_blank" class="browse_foreign" ' .'>'
. __('Browse foreign values')
. '</a>';
} else {
$dropdown = PMA_foreignDropdown(
$foreignData['disp_row'],
$foreignData['foreign_field'],
$foreignData['foreign_display'],
$curr_value,
$cfg['ForeignKeyMaxLimit']
);
$dropdown = '<select>' . $dropdown . '</select>';
}
$dropdown = PMA_getHtmlForRelationalColumnDropdown($db, $table, $column, $curr_value);
$response = PMA_Response::getInstance();
$response->addJSON('dropdown', $dropdown);
exit;
}
/**
* Just like above, find possible values for enum fields during grid edit.
*
* Logic taken from libraries/DisplayResults.class.php
*/
// Just like above, find possible values for enum fields during grid edit.
if (isset($_REQUEST['get_enum_values']) && $_REQUEST['get_enum_values'] == true) {
$field_info_query = PMA_DBI_getColumnsSql($db, $table, $_REQUEST['column']);
$field_info_result = PMA_DBI_fetchResult(
$field_info_query, null, null, null, PMA_DBI_QUERY_STORE
);
$values = PMA_Util::parseEnumSetValues($field_info_result[0]['Type']);
$dropdown = '<option value="">&nbsp;</option>';
foreach ($values as $value) {
$dropdown .= '<option value="' . $value . '"';
if ($value == $_REQUEST['curr_value']) {
$dropdown .= ' selected="selected"';
}
$dropdown .= '>' . $value . '</option>';
}
$dropdown = '<select>' . $dropdown . '</select>';
$column = $_REQUEST['column'];
$curr_value = $_REQUEST['curr_value'];
$dropdown = PMA_getHtmlForEnumColumnDropdown($db, $table, $column, $curr_value);
$response = PMA_Response::getInstance();
$response->addJSON('dropdown', $dropdown);
exit;
}
/**
* Find possible values for set fields during grid edit.
*/
// Find possible values for set fields during grid edit.
if (isset($_REQUEST['get_set_values']) && $_REQUEST['get_set_values'] == true) {
$field_info_query = PMA_DBI_getColumnsSql($db, $table, $_REQUEST['column']);
$field_info_result = PMA_DBI_fetchResult(
$field_info_query, null, null, null, PMA_DBI_QUERY_STORE
);
$values = PMA_Util::parseEnumSetValues($field_info_result[0]['Type']);
$select = '';
//converts characters of $_REQUEST['curr_value'] to HTML entities
$converted_curr_value = htmlentities(
$_REQUEST['curr_value'], ENT_COMPAT, "UTF-8"
);
$selected_values = explode(',', $converted_curr_value);
foreach ($values as $value) {
$select .= '<option value="' . $value . '"';
if ($value == $converted_curr_value
|| in_array($value, $selected_values, true)
) {
$select .= ' selected="selected" ';
}
$select .= '>' . $value . '</option>';
}
$select_size = (sizeof($values) > 10) ? 10 : sizeof($values);
$select = '<select multiple="multiple" size="' . $select_size . '">'
. $select . '</select>';
$column = $_REQUEST['column'];
$curr_value = $_REQUEST['curr_value'];
$select = PMA_getHtmlForSetColumn($db, $table, $column, $curr_value);
$response = PMA_Response::getInstance();
$response->addJSON('select', $select);
exit;
@ -616,7 +526,7 @@ if (($_SESSION['tmp_user_values']['max_rows'] != 'all')
}
if (strlen($db)) {
PMA_DBI_selectDb($db);
PMA_DBI_select_db($db);
}
// E x e c u t e t h e q u e r y
@ -639,11 +549,11 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) {
// If a stored procedure was called, there may be more results that are
// queued up and waiting to be flushed from the buffer. So let's do that.
do {
PMA_DBI_storeResult();
if (! PMA_DBI_moreResults()) {
PMA_DBI_store_result();
if (! PMA_DBI_more_results()) {
break;
}
} while (PMA_DBI_nextResult());
} while (PMA_DBI_next_result());
$is_procedure = false;
if (stripos($full_sql_query, 'call') !== false) {
@ -718,9 +628,9 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) {
// mysql_affected_rows() reports about the last query done)
if (! $is_affected) {
$num_rows = ($result) ? @PMA_DBI_numRows($result) : 0;
$num_rows = ($result) ? @PMA_DBI_num_rows($result) : 0;
} elseif (! isset($num_rows)) {
$num_rows = @PMA_DBI_affectedRows();
$num_rows = @PMA_DBI_affected_rows();
}
// Grabs the profiling results
@ -905,7 +815,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
} else {
$message = PMA_Message::getMessageForInsertedRows($num_rows);
}
$insert_id = PMA_DBI_insertId();
$insert_id = PMA_DBI_insert_id();
if ($insert_id != 0) {
// insert_id is id of FIRST record inserted in one insert,
// so if we inserted multiple rows, we had to increment this
@ -1012,7 +922,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
//If we are retrieving the full value of a truncated field or the original
// value of a transformed field, show it here and exit
if ($GLOBALS['grid_edit'] == true) {
$row = PMA_DBI_fetchRow($result);
$row = PMA_DBI_fetch_row($result);
$response = PMA_Response::getInstance();
$response->addJSON('value', $row[0]);
exit;
@ -1027,7 +937,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
// Gets the list of fields properties
if (isset($result) && $result) {
$fields_meta = PMA_DBI_getFieldsMeta($result);
$fields_meta = PMA_DBI_get_fields_meta($result);
$fields_cnt = count($fields_meta);
}
@ -1153,7 +1063,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
// Gets the list of fields properties
if (isset($result) && $result) {
$fields_meta = PMA_DBI_getFieldsMeta($result);
$fields_meta = PMA_DBI_get_fields_meta($result);
$fields_cnt = count($fields_meta);
}
@ -1271,7 +1181,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
);
$html_output .= $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql);
PMA_DBI_freeResult($result);
PMA_DBI_free_result($result);
}
// BEGIN INDEX CHECK See if indexes should be checked.
@ -1358,375 +1268,4 @@ if (! isset($_REQUEST['table_maintenance'])) {
exit;
}
// These functions will need for use set the required parameters for display results
/**
* Initialize some parameters needed to display results
*
* @param string $sql_query SQL statement
* @param boolean $is_select select query or not
*
* @return array set of parameters
*
* @access public
*/
function PMA_getDisplayPropertyParams($sql_query, $is_select)
{
$is_explain = $is_count = $is_export = $is_delete = $is_insert = $is_affected = $is_show = $is_maint = $is_analyse = $is_group = $is_func = $is_replace = false;
if ($is_select) {
$is_group = preg_match('@(GROUP[[:space:]]+BY|HAVING|SELECT[[:space:]]+DISTINCT)[[:space:]]+@i', $sql_query);
$is_func = ! $is_group && (preg_match('@[[:space:]]+(SUM|AVG|STD|STDDEV|MIN|MAX|BIT_OR|BIT_AND)\s*\(@i', $sql_query));
$is_count = ! $is_group && (preg_match('@^SELECT[[:space:]]+COUNT\((.*\.+)?.*\)@i', $sql_query));
$is_export = preg_match('@[[:space:]]+INTO[[:space:]]+OUTFILE[[:space:]]+@i', $sql_query);
$is_analyse = preg_match('@[[:space:]]+PROCEDURE[[:space:]]+ANALYSE@i', $sql_query);
} elseif (preg_match('@^EXPLAIN[[:space:]]+@i', $sql_query)) {
$is_explain = true;
} elseif (preg_match('@^DELETE[[:space:]]+@i', $sql_query)) {
$is_delete = true;
$is_affected = true;
} elseif (preg_match('@^(INSERT|LOAD[[:space:]]+DATA|REPLACE)[[:space:]]+@i', $sql_query)) {
$is_insert = true;
$is_affected = true;
if (preg_match('@^(REPLACE)[[:space:]]+@i', $sql_query)) {
$is_replace = true;
}
} elseif (preg_match('@^UPDATE[[:space:]]+@i', $sql_query)) {
$is_affected = true;
} elseif (preg_match('@^[[:space:]]*SHOW[[:space:]]+@i', $sql_query)) {
$is_show = true;
} elseif (preg_match('@^(CHECK|ANALYZE|REPAIR|OPTIMIZE)[[:space:]]+TABLE[[:space:]]+@i', $sql_query)) {
$is_maint = true;
}
return array(
$is_group, $is_func, $is_count, $is_export, $is_analyse, $is_explain,
$is_delete, $is_affected, $is_insert, $is_replace,$is_show, $is_maint
);
}
/**
* Get the database name inside a USE query
*
* @param string $sql SQL query
* @param array $databases array with all databases
*
* @return strin $db new database name
*/
function PMA_getNewDatabase($sql, $databases)
{
$db = '';
// loop through all the databases
foreach ($databases as $database) {
if (strpos($sql, $database['SCHEMA_NAME']) !== false) {
$db = $database;
break;
}
}
return $db;
}
/**
* Get the table name in a sql query
* If there are several tables in the SQL query,
* first table wil lreturn
*
* @param string $sql SQL query
* @param array $tables array of names in current database
*
* @return string $table table name
*/
function PMA_getTableNameBySQL($sql, $tables)
{
$table = '';
// loop through all the tables in the database
foreach ($tables as $tbl) {
if (strpos($sql, $tbl)) {
$table .= ' ' . $tbl;
}
}
if (count(explode(' ', trim($table))) > 1) {
$tmp_array = explode(' ', trim($table));
return $tmp_array[0];
}
return trim($table);
}
/**
* Generate table html when SQL statement have multiple queries
* which return displayable results
*
* @param PMA_DisplayResults $displayResultsObject object
* @param string $db database name
* @param array $sql_data information about
* SQL statement
* @param string $goto URL to go back in case
* of errors
* @param string $pmaThemeImage path for theme images
* directory
* @param string $text_dir text direction
* @param string $printview whether printview is enabled
* @param string $url_query URL query
* @param array $disp_mode the display mode
* @param string $sql_limit_to_append limit clause
* @param bool $resultSetContainsUniqueKey result contains a unique key
*
* @return string $table_html html content
*/
function getTableHtmlForMultipleQueries(
$displayResultsObject, $db, $sql_data, $goto, $pmaThemeImage,
$text_dir, $printview, $url_query, $disp_mode, $sql_limit_to_append,
$resultSetContainsUniqueKey
) {
$table_html = '';
$tables_array = PMA_DBI_getTables($db);
$databases_array = PMA_DBI_getDatabasesFull();
$multi_sql = implode(";", $sql_data['valid_sql']);
$querytime_before = array_sum(explode(' ', microtime()));
// Assignment for variable is not needed since the results are
// looiping using the connection
@PMA_DBI_tryMultiQuery($multi_sql);
$querytime_after = array_sum(explode(' ', microtime()));
$querytime = $querytime_after - $querytime_before;
$sql_no = 0;
do {
$analyzed_sql = array();
$is_affected = false;
$result = PMA_DBI_storeResult();
$fields_meta = ($result !== false)
? PMA_DBI_getFieldsMeta($result)
: array();
$fields_cnt = count($fields_meta);
// Initialize needed params related to each query in multiquery statement
if (isset($sql_data['valid_sql'][$sql_no])) {
// 'Use' query can change the database
if (stripos($sql_data['valid_sql'][$sql_no], "use ")) {
$db = PMA_getNewDatabase(
$sql_data['valid_sql'][$sql_no],
$databases_array
);
}
$parsed_sql = PMA_SQP_parse($sql_data['valid_sql'][$sql_no]);
$table = PMA_getTableNameBySQL(
$sql_data['valid_sql'][$sql_no],
$tables_array
);
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
$is_select = isset($analyzed_sql[0]['queryflags']['select_from']);
$unlim_num_rows = PMA_Table::countRecords($db, $table, true);
$showtable = PMA_Table::sGetStatusInfo($db, $table, null, true);
$url_query = PMA_generate_common_url($db, $table);
list($is_group, $is_func, $is_count, $is_export, $is_analyse,
$is_explain, $is_delete, $is_affected, $is_insert, $is_replace,
$is_show, $is_maint)
= PMA_getDisplayPropertyParams(
$sql_data['valid_sql'][$sql_no], $is_select
);
// Handle remembered sorting order, only for single table query
if ($GLOBALS['cfg']['RememberSorting']
&& ! ($is_count || $is_export || $is_func || $is_analyse)
&& isset($analyzed_sql[0]['select_expr'])
&& (count($analyzed_sql[0]['select_expr']) == 0)
&& isset($analyzed_sql[0]['queryflags']['select_from'])
&& count($analyzed_sql[0]['table_ref']) == 1
) {
PMA_handleSortOrder(
$db,
$table,
$analyzed_sql,
$sql_data['valid_sql'][$sql_no]
);
}
// Do append a "LIMIT" clause?
if (($_SESSION['tmp_user_values']['max_rows'] != 'all')
&& ! ($is_count || $is_export || $is_func || $is_analyse)
&& isset($analyzed_sql[0]['queryflags']['select_from'])
&& ! isset($analyzed_sql[0]['queryflags']['offset'])
&& empty($analyzed_sql[0]['limit_clause'])
) {
$sql_limit_to_append = ' LIMIT '
. $_SESSION['tmp_user_values']['pos']
. ', ' . $_SESSION['tmp_user_values']['max_rows'] . " ";
$sql_data['valid_sql'][$sql_no] = PMA_getSqlWithLimitClause(
$sql_data['valid_sql'][$sql_no],
$analyzed_sql,
$sql_limit_to_append
);
}
// Set the needed properties related to executing sql query
$displayResultsObject->__set('db', $db);
$displayResultsObject->__set('table', $table);
$displayResultsObject->__set('goto', $goto);
}
if (! $is_affected) {
$num_rows = ($result) ? @PMA_DBI_numRows($result) : 0;
} elseif (! isset($num_rows)) {
$num_rows = @PMA_DBI_affectedRows();
}
if (isset($sql_data['valid_sql'][$sql_no])) {
$displayResultsObject->__set(
'sql_query',
$sql_data['valid_sql'][$sql_no]
);
$displayResultsObject->setProperties(
$unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func,
$is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage,
$text_dir, $is_maint, $is_explain, $is_show, $showtable,
$printview, $url_query, $resultSetContainsUniqueKey
);
}
if ($num_rows == 0) {
continue;
}
// With multiple results, operations are limied
$disp_mode = 'nnnn000000';
$is_limited_display = true;
// Collect the tables
$table_html .= $displayResultsObject->getTable(
$result, $disp_mode, $analyzed_sql, $is_limited_display
);
// Free the result to save the memory
PMA_DBI_freeResult($result);
$sql_no++;
} while (PMA_DBI_moreResults() && PMA_DBI_nextResult());
return $table_html;
}
/**
* Handle remembered sorting order, only for single table query
*
* @param string $db database name
* @param string $table table name
* @param array &$analyzed_sql the analyzed query
* @param string &$full_sql_query SQL query
*
* @return void
*/
function PMA_handleSortOrder($db, $table, &$analyzed_sql, &$full_sql_query)
{
$pmatable = new PMA_Table($table, $db);
if (empty($analyzed_sql[0]['order_by_clause'])) {
$sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN);
if ($sorted_col) {
// retrieve the remembered sorting order for current table
$sql_order_to_append = ' ORDER BY ' . $sorted_col . ' ';
$full_sql_query = $analyzed_sql[0]['section_before_limit']
. $sql_order_to_append . $analyzed_sql[0]['limit_clause']
. ' ' . $analyzed_sql[0]['section_after_limit'];
// update the $analyzed_sql
$analyzed_sql[0]['section_before_limit'] .= $sql_order_to_append;
$analyzed_sql[0]['order_by_clause'] = $sorted_col;
}
} else {
// store the remembered table into session
$pmatable->setUiProp(
PMA_Table::PROP_SORTED_COLUMN,
$analyzed_sql[0]['order_by_clause']
);
}
}
/**
* Append limit clause to SQL query
*
* @param string $full_sql_query SQL query
* @param array $analyzed_sql the analyzed query
* @param string $sql_limit_to_append clause to append
*
* @return string limit clause appended SQL query
*/
function PMA_getSqlWithLimitClause($full_sql_query, $analyzed_sql,
$sql_limit_to_append
) {
return $analyzed_sql[0]['section_before_limit'] . "\n"
. $sql_limit_to_append . $analyzed_sql[0]['section_after_limit'];
}
/**
* Get column name from a drop SQL statement
*
* @param string $sql SQL query
*
* @return string $drop_column Name of the column
*/
function PMA_getColumnNameInColumnDropSql($sql)
{
$tmpArray1 = explode('DROP', $sql);
$str_to_check = trim($tmpArray1[1]);
if (stripos($str_to_check, 'COLUMN') !== false) {
$tmpArray2 = explode('COLUMN', $str_to_check);
$str_to_check = trim($tmpArray2[1]);
}
$tmpArray3 = explode(' ', $str_to_check);
$str_to_check = trim($tmpArray3[0]);
$drop_column = str_replace(';', '', trim($str_to_check));
$drop_column = str_replace('`', '', $drop_column);
return $drop_column;
}
/**
* Verify whether the result set contains all the columns
* of at least one unique key
*
* @param string $db database name
* @param string $table table name
* @param string $fields_meta meta fields
*
* @return boolean whether the result set contains a unique key
*/
function PMA_resultSetContainsUniqueKey($db, $table, $fields_meta)
{
$resultSetColumnNames = array();
foreach ($fields_meta as $oneMeta) {
$resultSetColumnNames[] = $oneMeta->name;
}
foreach (PMA_Index::getFromTable($table, $db) as $index) {
if ($index->isUnique()) {
$indexColumns = $index->getColumns();
$numberFound = 0;
foreach ($indexColumns as $indexColumnName => $dummy) {
if (in_array($indexColumnName, $resultSetColumnNames)) {
$numberFound++;
}
}
if ($numberFound == count($indexColumns)) {
return true;
}
}
}
return false;
}
?>

View File

@ -142,224 +142,6 @@ if (isset($_REQUEST['do_save_data'])) {
/**
* Display the form to edit/create an index
*/
// Displays headers (if needed)
$response = PMA_Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('indexes.js');
require_once 'libraries/tbl_info.inc.php';
if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) {
// coming already from form
$add_fields
= count($_REQUEST['index']['columns']['names']) - $index->getColumnCount();
if (isset($_REQUEST['add_fields'])) {
$add_fields += $_REQUEST['added_fields'];
}
} elseif (isset($_REQUEST['create_index'])) {
$add_fields = $_REQUEST['added_fields'];
} else {
$add_fields = 1;
}
// end preparing form values
require_once 'libraries/display_indexes.lib.php';
?>
<form action="tbl_indexes.php" method="post" name="index_frm" id="index_frm" class="ajax"
onsubmit="if (typeof(this.elements['index[Key_name]'].disabled) != 'undefined') {
this.elements['index[Key_name]'].disabled = false}">
<?php
$form_params = array(
'db' => $db,
'table' => $table,
);
if (isset($_REQUEST['create_index'])) {
$form_params['create_index'] = 1;
} elseif (isset($_REQUEST['old_index'])) {
$form_params['old_index'] = $_REQUEST['old_index'];
} elseif (isset($_REQUEST['index'])) {
$form_params['old_index'] = $_REQUEST['index'];
}
echo PMA_generate_common_hidden_inputs($form_params);
?>
<fieldset id="index_edit_fields">
<?php
if ($GLOBALS['is_ajax_request'] != true) {
?>
<legend>
<?php
if (isset($_REQUEST['create_index'])) {
echo __('Add index');
} else {
echo __('Edit index');
}
?>
</legend>
<?php
}
?>
<div class='index_info'>
<div>
<div class="label">
<strong>
<label for="input_index_name">
<?php echo __('Index name:'); ?>
<?php
echo PMA_Util::showHint(
PMA_Message::notice(
__(
'("PRIMARY" <b>must</b> be the name of'
. ' and <b>only of</b> a primary key!)'
)
)
);
?>
</label>
</strong>
</div>
<input type="text" name="index[Key_name]" id="input_index_name" size="25"
value="<?php echo htmlspecialchars($index->getName()); ?>"
onfocus="this.select()" />
</div>
<?php
if (PMA_MYSQL_INT_VERSION > 50500) {
?>
<div>
<div class="label">
<strong>
<label for="input_index_comment">
<?php echo __('Comment:'); ?>
</label>
</strong>
</div>
<input type="text" name="index[Index_comment]" id="input_index_comment" size="30"
value="<?php echo htmlspecialchars($index->getComment()); ?>"
onfocus="this.select()" />
</div>
<?php
}
?>
<div>
<div class="label">
<strong>
<label for="select_index_type">
<?php echo __('Index type:'); ?>
<?php echo PMA_Util::showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?>
</label>
</strong>
</div>
<select name="index[Index_type]" id="select_index_type" >
<?php echo $index->generateIndexSelector(); ?>
</select>
</div>
<div class="clearfloat"></div>
</div>
<table id="index_columns">
<thead>
<tr><th><?php echo __('Column'); ?></th>
<th><?php echo __('Size'); ?></th>
</tr>
</thead>
<tbody>
<?php
$odd_row = true;
$spatial_types = array(
'geometry', 'point', 'linestring', 'polygon', 'multipoint',
'multilinestring', 'multipolygon', 'geomtrycollection'
);
foreach ($index->getColumns() as $column) {
?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?> noclick">
<td>
<select name="index[columns][names][]">
<option value="">-- <?php echo __('Ignore'); ?> --</option>
<?php
foreach ($fields as $field_name => $field_type) {
if (($index->getType() != 'FULLTEXT'
|| preg_match('/(char|text)/i', $field_type))
&& ($index->getType() != 'SPATIAL'
|| in_array($field_type, $spatial_types))
) {
echo '<option value="' . htmlspecialchars($field_name) . '"'
. (($field_name == $column->getName())
? ' selected="selected"'
: '') . '>'
. htmlspecialchars($field_name) . ' ['
. htmlspecialchars($field_type) . ']'
. '</option>' . "\n";
}
} // end foreach $fields
?>
</select>
</td>
<td>
<input type="text" size="5" onfocus="this.select()"
name="index[columns][sub_parts][]"
value="<?php
if ($index->getType() != 'SPATIAL') {
echo $column->getSubPart();
}
?>"/>
</td>
</tr>
<?php
$odd_row = !$odd_row;
} // end foreach $edited_index_info['Sequences']
for ($i = 0; $i < $add_fields; $i++) {
?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?> noclick">
<td>
<select name="index[columns][names][]">
<option value="">-- <?php echo __('Ignore'); ?> --</option>
<?php
foreach ($fields as $field_name => $field_type) {
echo '<option value="' . htmlspecialchars($field_name) . '">'
. htmlspecialchars($field_name) . ' ['
. htmlspecialchars($field_type) . ']'
. '</option>' . "\n";
} // end foreach $fields
?>
</select>
</td>
<td>
<input type="text" size="5" onfocus="this.select()"
name="index[columns][sub_parts][]" value="" />
</td>
</tr>
<?php
$odd_row = !$odd_row;
} // end foreach $edited_index_info['Sequences']
?>
</tbody>
</table>
</fieldset>
<fieldset class="tblFooters">
<?php
if ($GLOBALS['is_ajax_request'] != true || ! empty($_REQUEST['ajax_page_request'])) {
?>
<input type="submit" name="do_save_data" value="<?php echo __('Save'); ?>" />
<span id="addMoreColumns">
<?php
echo __('Or') . ' ';
printf(
__('Add %s column(s) to index') . "\n",
'<input type="text" name="added_fields" size="2" value="1" />'
);
echo '<input type="submit" name="add_fields" value="' . __('Go') . '" />' . "\n";
?>
</span>
<?php
} else {
$btn_value = sprintf(__('Add %s column(s) to index'), 1);
echo '<div class="slider"></div>';
echo '<div class="add_fields">';
echo '<input type="submit" value="' . $btn_value . '" />';
echo '</div>';
}
?>
</fieldset>
</form>

View File

@ -285,7 +285,8 @@ canvas.pmd * {
border-left: #999 solid 1px;
height: 28px;
z-index: 101;
width: 100%
width: 100%;
position: fixed;
}
.pmd_header a {