Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tyron Madlener 2011-08-20 20:33:24 +03:00
commit 5b5344dca7
56 changed files with 3334 additions and 2190 deletions

View File

@ -57,6 +57,7 @@ phpMyAdmin - ChangeLog
- [core] Remove library PHPExcel, due to license issues
- [export] Remove native Excel export modules (xls and xlsx formats)
- [import] Remove native Excel import modules (xls and xlsx formats)
- bug #3392920 [edit] BLOB emptied after editing another column
3.4.4.0 (not yet released)
- bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes

View File

@ -4409,6 +4409,44 @@ chmod o+rwx tmp
</li>
</ul>
<h4 id="faq6_31">
<a href="#faq6_31">6.31 How do I create a relation in designer?</a></h4>
<p>To select relation, click :</p>
<img src="pmd/images/help_relation.png"></p>
<p>The display column is shown in pink. To set/unset a column as the display column, click the "Choose column to display" icon, then click on the appropriate column name.</p>
<h4 id="faq6_32">
<a href="#faq6_32">6.32 How can I use the zoom search feature?</a></h4>
<p> The Zoom search feature is an alternative to table search feature. It allows you to explore
a table by representing its data in a scatter plot. You can locate this feature by selecting
a table and clicking the 'Search' tab. One of the sub-tabs in the 'Table Search' page is
'Zoom Search'. <br/><br/>
Consider the table REL_persons in <a href="#faq6_6"><abbr title="Frequently Asked Questions">
FAQ</abbr> 6.6</a> for an example. To use zoom search, two columns need to be selected,
for example, id and town_code. The id values will be represented on one axis and town_code
values on the other axis. Each row will be represented as a point in a scatter plot based
on its id and town_code. You can include two additional search criteria apart from the two
fields to display.<br/><br/>
You can choose which field should be displayed as label for each point. If a display
column has been set for the table (see <a href="#faqdisplay"><abbr title="Frequently Asked
Questions">FAQ</abbr> 6.7</a>), it is taken as the label unless you specify otherwise.
You can also select the maximum number of rows you want to be displayed in the plot by
specifing it in the 'Max rows to plot' field. Once you have decided over your criteria,
click 'Go' to display the plot.<br/><br/>
After the plot is generated, you can use the mousewheel to zoom in and out of the plot.
In addition, panning feature is enabled to navigate through the plot. You can zoom-in to
a certail level of detail and use panning to locate your area of interest. Clicking on a
point opens a dialogue box, displaying field values of the data row represented by the point.
You can edit the values if required and click on submit to issue an update query. Basic
instructions on how to use can be viewed by clicking the 'How to use?' link located just above
the plot.</p>
<h3 id="faqproject">phpMyAdmin project</h3>
<h4 id="faq7_1">

View File

@ -11,7 +11,8 @@
require_once './libraries/common.inc.php';
if (! isset($selected_tbl)) {
require_once './libraries/header.inc.php';
require './libraries/db_common.inc.php';
require './libraries/db_info.inc.php';
}
@ -55,16 +56,15 @@ if ($cfgRelation['commwork']) {
* Selects the database and gets tables names
*/
PMA_DBI_select_db($db);
$rowset = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
$tables = PMA_DBI_get_tables($db);
$count = 0;
while ($row = PMA_DBI_fetch_row($rowset)) {
$table = $row[0];
foreach($tables as $table) {
$comments = PMA_getComments($db, $table);
echo '<div>' . "\n";
echo '<h2>' . $table . '</h2>' . "\n";
echo '<h2>' . htmlspecialchars($table) . '</h2>' . "\n";
/**
* Gets table informations
@ -204,7 +204,7 @@ while ($row = PMA_DBI_fetch_row($rowset)) {
} else {
$row['Default'] = htmlspecialchars($row['Default']);
}
$field_name = htmlspecialchars($row['Field']);
$field_name = $row['Field'];
if (PMA_MYSQL_INT_VERSION < 50025
&& ! empty($analyzed_sql[0]['create_table_fields'][$field_name]['type'])
@ -226,9 +226,9 @@ while ($row = PMA_DBI_fetch_row($rowset)) {
<td nowrap="nowrap">
<?php
if (isset($pk_array[$row['Field']])) {
echo '<u>' . $field_name . '</u>';
echo '<u>' . htmlspecialchars($field_name) . '</u>';
} else {
echo $field_name;
echo htmlspecialchars($field_name);
}
?>
</td>

View File

@ -128,8 +128,7 @@ if (isset($_REQUEST['submit_search'])) {
$sqlstr_delete = 'DELETE';
// Fields to select
$tblfields = PMA_DBI_fetch_result('SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($GLOBALS['db']),
null, 'Field');
$tblfields = PMA_DBI_get_columns($GLOBALS['db'], $table);
// Table to use
$sqlstr_from = ' FROM ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($table);
@ -148,8 +147,8 @@ if (isset($_REQUEST['submit_search'])) {
$thefieldlikevalue = array();
foreach ($tblfields as $tblfield) {
if (! isset($field) || strlen($field) == 0 || $tblfield == $field) {
$thefieldlikevalue[] = 'CONVERT(' . PMA_backquote($tblfield) . ' USING utf8)'
if (! isset($field) || strlen($field) == 0 || $tblfield['Field'] == $field) {
$thefieldlikevalue[] = 'CONVERT(' . PMA_backquote($tblfield['Field']) . ' USING utf8)'
. ' ' . $like_or_regex . ' '
. "'" . $automatic_wildcard
. $search_word

View File

@ -3307,8 +3307,6 @@ function PMA_getCellValue(td) {
return '';
} else if (! $(td).is('.to_be_saved') && $(td).data('original_data')) {
return $(td).data('original_data');
} else if ($(td).is(':not(.transformed, .relation, .enum, .set, .null)')) {
return unescape($(td).find('span').html()).replace(/<br>/g, "\n");
} else {
return $(td).text();
}

View File

@ -564,7 +564,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
!g.colRsz && !g.colReorder)
{
if (!g.isCellEditActive) {
$cell = $(cell);
var $cell = $(cell);
// remove all edit area and hide it
$(g.cEdit).find('.edit_area').empty().hide();
// reposition the cEdit element
@ -573,24 +573,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
left: $cell.position().left
})
.show()
.find('input')
.find('.edit_box')
.css({
width: $cell.outerWidth(),
height: $cell.outerHeight()
});
// fill the cell edit with text from <td>, if it is not null
var value = $cell.is(':not(.null)') ? PMA_getCellValue(cell) : '';
$(g.cEdit).find('input')
.val(value);
// fill the cell edit with text from <td>
var value = PMA_getCellValue(cell);
$(g.cEdit).find('.edit_box').val(value);
g.currentEditCell = cell;
$(g.cEdit).find('input[type=text]').focus();
$(g.cEdit).find('.edit_box').focus();
$(g.cEdit).find('*').removeAttr('disabled');
}
} else {
if (g.isCellEditActive) {
g.hideEditCell();
}
}
},
@ -605,7 +600,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
*/
hideEditCell: function(force, data, field) {
if (g.isCellEditActive && !force) {
// cell is being edited, post the edited data
// cell is being edited, save or post the edited data
g.saveOrPostEditedCell();
return;
}
@ -620,21 +615,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if (g.currentEditCell) { // save value of currently edited cell
// replace current edited field with the new value
var $this_field = $(g.currentEditCell);
var new_html = $this_field.data('value');
var is_null = $this_field.data('value') == null;
if (is_null) {
$this_field.find('span').html('NULL');
$this_field.addClass('null');
} else {
$this_field.removeClass('null');
var new_html = $this_field.data('value');
if ($this_field.is('.truncated')) {
if (new_html.length > g.maxTruncatedLen) {
new_html = new_html.substring(0, g.maxTruncatedLen) + '...';
}
}
// replace '\n' with <br>
new_html = new_html.replace(/\n/g, '<br />');
$this_field.find('span').html(new_html);
$this_field.find('span').text(new_html);
}
}
if (data.transformations != undefined) {
@ -657,7 +650,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// hide the cell editing area
$(g.cEdit).hide();
$(g.cEdit).find('input[type=text]').blur();
$(g.cEdit).find('.edit_box').blur();
g.isCellEditActive = false;
g.currentEditCell = null;
// destroy datepicker in edit area, if exist
@ -671,8 +664,17 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if (!g.isCellEditActive) { // make sure the edit area has not been shown
g.isCellEditActive = true;
g.isEditCellTextEditable = false;
/**
* @var $td current edited cell
*/
var $td = $(g.currentEditCell);
/**
* @var $editArea the editing area
*/
var $editArea = $(g.cEdit).find('.edit_area');
/**
* @var where_clause WHERE clause for the edited cell
*/
var where_clause = $td.parent('tr').find('.where_clause').val();
/**
* @var field_name String containing the name of this field.
@ -720,24 +722,24 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if ($td.is('.enum, .set')) {
$editArea.find('select').live('change', function(e) {
$checkbox.attr('checked', false);
})
});
} else if ($td.is('.relation')) {
$editArea.find('select').live('change', function(e) {
$checkbox.attr('checked', false);
})
});
$editArea.find('.browse_foreign').live('click', function(e) {
$checkbox.attr('checked', false);
})
});
} else {
$(g.cEdit).find('input[type=text]').live('keypress change', function(e) {
$(g.cEdit).find('.edit_box').live('keypress change', function(e) {
$checkbox.attr('checked', false);
})
});
$editArea.find('textarea').live('keydown', function(e) {
$checkbox.attr('checked', false);
})
});
}
// if 'checkbox_null_<field_name>_<row_index>' is clicked empty the corresponding select/editor.
// if null checkbox is clicked empty the corresponding select/editor.
$checkbox.click(function(e) {
if ($td.is('.enum')) {
$editArea.find('select').attr('value', '');
@ -745,7 +747,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$editArea.find('select').find('option').each(function() {
var $option = $(this);
$option.attr('selected', false);
})
});
} else if ($td.is('.relation')) {
// if the dropdown is there to select the foreign value
if ($editArea.find('select').length > 0) {
@ -754,12 +756,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
} else {
$editArea.find('textarea').val('');
}
$(g.cEdit).find('input[type=text]').val('');
})
$(g.cEdit).find('.edit_box').val('');
});
}
if($td.is('.relation')) {
/** @lends jQuery */
if ($td.is('.relation')) {
//handle relations
$editArea.addClass('edit_area_loading');
@ -770,15 +771,15 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* @var post_params Object containing parameters for the POST request
*/
var post_params = {
'ajax_request' : true,
'get_relational_values' : true,
'server' : g.server,
'db' : g.db,
'table' : g.table,
'column' : field_name,
'token' : g.token,
'curr_value' : relation_curr_value,
'relation_key_or_display_column' : relation_key_or_display_column
'ajax_request' : true,
'get_relational_values' : true,
'server' : g.server,
'db' : g.db,
'table' : g.table,
'column' : field_name,
'token' : g.token,
'curr_value' : relation_curr_value,
'relation_key_or_display_column' : relation_key_or_display_column
}
g.lastXHR = $.post('sql.php', post_params, function(data) {
@ -788,18 +789,18 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
var value = $(data.dropdown).val();
$td.data('original_data', value);
// update the text input field, in case where the "Relational display column" is checked
$(g.cEdit).find('input[type=text]').val(value);
$(g.cEdit).find('.edit_box').val(value);
$editArea.append(data.dropdown);
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
}) // end $.post()
$editArea.find('select').live('change', function(e) {
$(g.cEdit).find('input[type=text]').val($(this).val());
$(g.cEdit).find('.edit_box').val($(this).val());
})
$editArea.show();
}
else if($td.is('.enum')) {
/** @lends jQuery */
//handle enum fields
$editArea.addClass('edit_area_loading');
@ -824,11 +825,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}) // end $.post()
$editArea.find('select').live('change', function(e) {
$(g.cEdit).find('input[type=text]').val($(this).val());
$(g.cEdit).find('.edit_box').val($(this).val());
})
$editArea.show();
}
else if($td.is('.set')) {
/** @lends jQuery */
//handle set fields
$editArea.addClass('edit_area_loading');
@ -854,23 +855,25 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}) // end $.post()
$editArea.find('select').live('change', function(e) {
$(g.cEdit).find('input[type=text]').val($(this).val());
$(g.cEdit).find('.edit_box').val($(this).val());
})
$editArea.show();
}
else if($td.is('.truncated, .transformed')) {
if ($td.is('.to_be_saved')) { // cell has been edited
var value = $td.data('value');
$(g.cEdit).find('input[type=text]').val(value);
$editArea.append('<textarea>'+value+'</textarea>');
$editArea.find('textarea').live('keyup', function(e) {
$(g.cEdit).find('input[type=text]').val($(this).val());
});
$(g.cEdit).find('input[type=text]').live('keyup', function(e) {
$(g.cEdit).find('.edit_box').val(value);
$editArea.append('<textarea></textarea>');
$editArea.find('textarea')
.val(value)
.live('keyup', function(e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});
$(g.cEdit).find('.edit_box').live('keyup', function(e) {
$editArea.find('textarea').val($(this).val());
});
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
} else {
/** @lends jQuery */
//handle truncated/transformed values values
$editArea.addClass('edit_area_loading');
@ -900,12 +903,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}
$td.data('original_data', data.value);
$(g.cEdit).find('input[type=text]').val(data.value);
$editArea.append('<textarea>'+data.value+'</textarea>');
$editArea.find('textarea').live('keyup', function(e) {
$(g.cEdit).find('input[type=text]').val($(this).val());
});
$(g.cEdit).find('input[type=text]').live('keyup', function(e) {
$(g.cEdit).find('.edit_box').val(data.value);
$editArea.append('<textarea></textarea>');
$editArea.find('textarea')
.val(data.value)
.live('keyup', function(e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});
$(g.cEdit).find('.edit_box').live('keyup', function(e) {
$editArea.find('textarea').val($(this).val());
});
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
@ -916,8 +921,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}) // end $.post()
}
g.isEditCellTextEditable = true;
$editArea.show();
} else if ($td.is('.datefield, .datetimefield, .timestampfield')) {
var $input_field = $(g.cEdit).find('input[type=text]');
var $input_field = $(g.cEdit).find('.edit_box');
// remember current datetime value in $input_field, if it is not null
var is_null = $td.is('.null');
@ -943,19 +949,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
} else {
$input_field.val('');
}
$editArea.show();
} else {
$editArea.append('<textarea>' + PMA_getCellValue(g.currentEditCell) + '</textarea>');
$editArea.find('textarea').live('keyup', function(e) {
$(g.cEdit).find('input[type=text]').val($(this).val());
});
$(g.cEdit).find('input[type=text]').live('keyup', function(e) {
$editArea.find('textarea').val($(this).val());
});
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
g.isEditCellTextEditable = true;
}
$editArea.show();
}
},
@ -1138,7 +1135,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if (!g.saveCellsAtOnce) {
$(g.cEdit).find('*').attr('disabled', 'disabled');
var $editArea = $(g.cEdit).find('.edit_area');
$editArea.addClass('edit_area_posting');
$(g.cEdit).find('.edit_box').addClass('edit_box_posting');
} else {
$('.save_edited').addClass('saving_edited_data')
.find('input').attr('disabled', 'disabled'); // disable the save button
@ -1153,52 +1150,52 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
g.isSaving = false;
if (!g.saveCellsAtOnce) {
$(g.cEdit).find('*').removeAttr('disabled');
$editArea.removeClass('edit_area_posting');
$(g.cEdit).find('.edit_box').removeClass('edit_box_posting');
} else {
$('.save_edited').removeClass('saving_edited_data')
.find('input').removeAttr('disabled'); // enable the save button back
}
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
$('.to_be_saved').each(function() {
var new_clause = $(this).parent('tr').data('new_clause');
if (new_clause != '') {
var $where_clause = $(this).parent('tr').find('.where_clause');
var old_clause = $where_clause.attr('value');
var decoded_old_clause = PMA_urldecode(old_clause);
var decoded_new_clause = PMA_urldecode(new_clause);
// update where_clause related data in each edited row
$('.to_be_saved').parents('tr').each(function() {
var new_clause = $(this).data('new_clause');
var $where_clause = $(this).find('.where_clause');
var old_clause = $where_clause.attr('value');
var decoded_old_clause = PMA_urldecode(old_clause);
var decoded_new_clause = PMA_urldecode(new_clause);
$where_clause.attr('value', new_clause);
// update Edit, Copy, and Delete links also
$(this).parent('tr').find('a').each(function() {
$(this).attr('href', $(this).attr('href').replace(old_clause, new_clause));
// update delete confirmation in Delete link
if ($(this).attr('href').indexOf('DELETE') > -1) {
$(this).removeAttr('onclick')
.unbind('click')
.bind('click', function() {
return confirmLink(this, 'DELETE FROM `' + g.db + '`.`' + g.table + '` WHERE ' +
decoded_new_clause + (is_unique ? '' : ' LIMIT 1'));
});
}
});
// update the multi edit checkboxes
$(this).parent('tr').find('input[type=checkbox]').each(function() {
var $checkbox = $(this);
var checkbox_name = $checkbox.attr('name');
var checkbox_value = $checkbox.attr('value');
$where_clause.attr('value', new_clause);
// update Edit, Copy, and Delete links also
$(this).find('a').each(function() {
$(this).attr('href', $(this).attr('href').replace(old_clause, new_clause));
// update delete confirmation in Delete link
if ($(this).attr('href').indexOf('DELETE') > -1) {
$(this).removeAttr('onclick')
.unbind('click')
.bind('click', function() {
return confirmLink(this, 'DELETE FROM `' + g.db + '`.`' + g.table + '` WHERE ' +
decoded_new_clause + (is_unique ? '' : ' LIMIT 1'));
});
}
});
// update the multi edit checkboxes
$(this).find('input[type=checkbox]').each(function() {
var $checkbox = $(this);
var checkbox_name = $checkbox.attr('name');
var checkbox_value = $checkbox.attr('value');
$checkbox.attr('name', checkbox_name.replace(old_clause, new_clause));
$checkbox.attr('value', checkbox_value.replace(decoded_old_clause, decoded_new_clause));
});
}
$checkbox.attr('name', checkbox_name.replace(old_clause, new_clause));
$checkbox.attr('value', checkbox_value.replace(decoded_old_clause, decoded_new_clause));
});
});
// remove possible previous feedback message
// update the display of executed SQL query command
$('#result_query').remove();
if (typeof data.sql_query != 'undefined') {
// display feedback
$('#sqlqueryresults').prepend(data.sql_query);
}
// hide and/or update the successfully saved cells
g.hideEditCell(true, data);
// remove the "Save edited cells" button
@ -1247,6 +1244,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
var value;
if ($(g.cEdit).find('.edit_area').is('.edit_area_loading')) {
// the edit area is still loading (retrieving cell data), no need to post
need_to_post = false;
} else if (is_null) {
if (!g.wasEditedCellNull) {
@ -1255,7 +1253,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
}
} else {
if ($this_field.is('.bit')) {
this_field_params[field_name] = '0b' + $(g.cEdit).find('textarea').val();
this_field_params[field_name] = '0b' + $(g.cEdit).find('.edit_box').val();
} else if ($this_field.is('.set')) {
$test_element = $(g.cEdit).find('select');
this_field_params[field_name] = $test_element.map(function(){
@ -1273,10 +1271,8 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
if ($test_element.length != 0) {
this_field_params[field_name] = $test_element.text();
}
} else if ($this_field.is('.datefield, .datetimefield, .timestampfield')) {
this_field_params[field_name] = $(g.cEdit).find('input[type=text]').val();
} else {
this_field_params[field_name] = $(g.cEdit).find('textarea').val();
this_field_params[field_name] = $(g.cEdit).find('.edit_box').val();
}
if (g.wasEditedCellNull || this_field_params[field_name] != PMA_getCellValue(g.currentEditCell)) {
need_to_post = true;
@ -1533,7 +1529,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// adjust g.cEdit
g.cEdit.className = 'cEdit';
$(g.cEdit).html('<input type="text" /><div class="edit_area" />');
$(g.cEdit).html('<textarea class="edit_box" rows="1" ></textarea><div class="edit_area" />');
$(g.cEdit).hide();
// assign cell editing hint
@ -1560,10 +1556,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
e.preventDefault();
}
});
$(g.cEdit).find('input[type=text]').focus(function(e) {
$(g.cEdit).find('.edit_box').focus(function(e) {
g.showEditArea();
});
$(g.cEdit).find('input[type=text], select').live('keydown', function(e) {
$(g.cEdit).find('.edit_box, select').live('keydown', function(e) {
if (e.which == 13) {
// post on pressing "Enter"
e.preventDefault();
@ -1614,9 +1610,6 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
* Initialize grid
******************/
// add relative position to table so that resize handlers are correctly positioned
$(t).css('position', 'relative');
// wrap all data cells, except actions cell, with span
$(t).find('th, td:not(:has(span))')
.wrapInner('<span />');
@ -1658,6 +1651,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
// add table class
$(t).addClass('pma_table');
// add relative position to global div so that resize handlers are correctly positioned
$(g.gDiv).css('position', 'relative');
// link the global div
$(t).before(g.gDiv);
$(g.gDiv).append(t);

View File

@ -265,7 +265,9 @@ $js_messages['strDisplayHelp'] = '<ul><li>'
. '</li><li>'
. __('Hovering over a point will show its label.')
. '</li><li>'
. __('Drag and select an area in the plot to zoom into it.')
. __('Use mousewheel to zoom in or out of the plot.')
. '</li><li>'
. __('Click and drag the mouse to navigate the plot.')
. '</li><li>'
. __('Click reset zoom link to come back to original state.')
. '</li><li>'

View File

@ -113,7 +113,7 @@ function MouseDown(e)
dx = offsetx - parseInt(cur_click.style.left);
dy = offsety - parseInt(cur_click.style.top);
//alert(" dx = " + dx + " dy = " +dy);
document.getElementById("canvas").style.visibility = 'hidden';
document.getElementById("canvas").style.display = 'none';
/*
var left = parseInt(cur_click.style.left);
var top = parseInt(cur_click.style.top);
@ -159,8 +159,8 @@ function MouseMove(e)
}
if (ON_relation || ON_display_field) {
document.getElementById('hint').style.left = (Glob_X + 20) + 'px';
document.getElementById('hint').style.top = (Glob_Y + 20) + 'px';
document.getElementById('pmd_hint').style.left = (Glob_X + 20) + 'px';
document.getElementById('pmd_hint').style.top = (Glob_Y + 20) + 'px';
}
if (layer_menu_cur_click) {
@ -173,7 +173,7 @@ function MouseMove(e)
function MouseUp(e)
{
if (cur_click != null) {
document.getElementById("canvas").style.visibility = 'visible';
document.getElementById("canvas").style.display = 'inline-block';
Re_load();
cur_click.style.zIndex = 1;
cur_click = null;
@ -225,7 +225,7 @@ function Main()
Canvas_pos();
Small_tab_refresh();
Re_load();
id_hint = document.getElementById('hint');
id_hint = document.getElementById('pmd_hint');
if (isIE) {
General_scroll();
}
@ -535,12 +535,12 @@ function Start_relation()
if (!ON_relation) {
document.getElementById('foreign_relation').style.display = '';
ON_relation = 1;
document.getElementById('hint').innerHTML = PMA_messages['strSelectReferencedKey'];
document.getElementById('hint').style.visibility = "visible";
document.getElementById('pmd_hint').innerHTML = PMA_messages['strSelectReferencedKey'];
document.getElementById('pmd_hint').style.display = 'block';
document.getElementById('rel_button').className = 'M_butt_Selected_down';
} else {
document.getElementById('hint').innerHTML = "";
document.getElementById('hint').style.visibility = "hidden";
document.getElementById('pmd_hint').innerHTML = "";
document.getElementById('pmd_hint').style.display = 'none';
document.getElementById('rel_button').className = 'M_butt';
click_field = 0;
ON_relation = 0;
@ -551,7 +551,7 @@ function Click_field(T, f, PK) // table field
{
if (ON_relation) {
if (!click_field) {
//.style.display=='none' .style.visibility = "hidden"
//.style.display=='none' .style.display = 'none'
if (!PK) {
alert(PMA_messages['strPleaseSelectPrimaryOrUniqueKey']);
return;// 0;
@ -561,7 +561,7 @@ function Click_field(T, f, PK) // table field
}
click_field = 1;
link_relation = "T1=" + T + "&F1=" + f;
document.getElementById('hint').innerHTML = PMA_messages['strSelectForeignKey'];
document.getElementById('pmd_hint').innerHTML = PMA_messages['strSelectForeignKey'];
} else {
Start_relation(); // hidden hint...
if (j_tabs[db + '.' + T] != '1' || !PK) {
@ -571,7 +571,7 @@ function Click_field(T, f, PK) // table field
document.getElementById('layer_new_relation').style.left = left + 'px';
var top = Glob_Y - document.getElementById('layer_new_relation').offsetHeight + 40;
document.getElementById('layer_new_relation').style.top = top + 'px';
document.getElementById('layer_new_relation').style.visibility = "visible";
document.getElementById('layer_new_relation').style.display = 'block';
link_relation += '&T2=' + T + '&F2=' + f;
}
}
@ -596,8 +596,8 @@ function Click_field(T, f, PK) // table field
display_field[T] = f;
}
ON_display_field = 0;
document.getElementById('hint').innerHTML = "";
document.getElementById('hint').style.visibility = "hidden";
document.getElementById('pmd_hint').innerHTML = "";
document.getElementById('pmd_hint').style.display = 'none';
document.getElementById('display_field_button').className = 'M_butt';
makeRequest('pmd_display_field.php', 'T=' + T + '&F=' + f + '&server=' + server + '&db=' + db + '&token=' + token);
}
@ -605,7 +605,7 @@ function Click_field(T, f, PK) // table field
function New_relation()
{
document.getElementById('layer_new_relation').style.visibility = 'hidden';
document.getElementById('layer_new_relation').style.display = 'none';
link_relation += '&server=' + server + '&db=' + db + '&token=' + token + '&die_save_pos=0';
link_relation += '&on_delete=' + document.getElementById('on_delete').value + '&on_update=' + document.getElementById('on_update').value;
link_relation += Get_url_pos();
@ -776,14 +776,14 @@ function Canvas_click(id)
document.getElementById('layer_upd_relation').style.left = left + 'px';
var top = Glob_Y - document.getElementById('layer_upd_relation').offsetHeight - 10;
document.getElementById('layer_upd_relation').style.top = top + 'px';
document.getElementById('layer_upd_relation').style.visibility = 'visible';
document.getElementById('layer_upd_relation').style.display = 'block';
link_relation = 'T1=' + Key0 + '&F1=' + Key1 + '&T2=' + Key2 + '&F2=' + Key3 + '&K=' + Key;
}
}
function Upd_relation()
{
document.getElementById('layer_upd_relation').style.visibility = 'hidden';
document.getElementById('layer_upd_relation').style.display = 'none';
link_relation += '&server=' + server + '&db=' + db + '&token=' + token + '&die_save_pos=0';
link_relation += Get_url_pos();
makeRequest('pmd_relation_upd.php', link_relation);
@ -792,9 +792,9 @@ function Upd_relation()
function VisibleTab(id, t_n)
{
if (id.checked) {
document.getElementById(t_n).style.visibility = 'visible';
document.getElementById(t_n).style.display = 'block';
} else {
document.getElementById(t_n).style.visibility = 'hidden';
document.getElementById(t_n).style.display = 'none';
}
Re_load();
}
@ -813,10 +813,10 @@ function Hide_tab_all(id_this) // max/min all tables
if (E.elements[i].type == "checkbox" && E.elements[i].id.substring(0, 10) == 'check_vis_') {
if (id_this.alt == 'v') {
E.elements[i].checked = true;
document.getElementById(E.elements[i].value).style.visibility = 'visible';
document.getElementById(E.elements[i].value).style.display = 'block';
} else {
E.elements[i].checked = false;
document.getElementById(E.elements[i].value).style.visibility = 'hidden';
document.getElementById(E.elements[i].value).style.display = 'none';
}
}
}
@ -859,20 +859,15 @@ function No_have_constr(id_this)
if (!in_array_k(E.elements[i].value, a))
if (id_this.alt == 'v') {
E.elements[i].checked = true;
document.getElementById(E.elements[i].value).style.visibility = 'visible';
document.getElementById(E.elements[i].value).style.display = 'block';
} else {
E.elements[i].checked = false;
document.getElementById(E.elements[i].value).style.visibility = 'hidden';
document.getElementById(E.elements[i].value).style.display = 'none';
}
}
}
}
function Help()
{
var WinHelp = window.open("pmd_help.php", "wind1", "top=200,left=400,width=300,height=200,resizable=yes,scrollbars=yes,menubar=no");
}
function PDF_save()
{
// var WinPDF =
@ -884,7 +879,7 @@ function General_scroll()
{
/*
if (!document.getElementById('show_relation_olways').checked) {
document.getElementById("canvas").style.visibility = 'hidden';
document.getElementById("canvas").style.display = 'none';
clearTimeout(timeoutID);
timeoutID = setTimeout(General_scroll_end, 500);
}
@ -913,15 +908,18 @@ function General_scroll_end()
document.getElementById('layer_menu').style.left = document.body.scrollLeft;
document.getElementById('layer_menu').style.top = document.body.scrollTop + document.getElementById('top_menu').offsetHeight;
}
document.getElementById("canvas").style.visibility = 'visible';
document.getElementById("canvas").style.display = 'block';
}
*/
function Show_left_menu(id_this) // max/min all tables
{
if (id_this.alt == "v") {
document.getElementById("layer_menu").style.top = document.getElementById('top_menu').offsetHeight + 'px';
document.getElementById("layer_menu").style.visibility = 'visible';
var pos = $("#top_menu").offset();
var height = $("#top_menu").height();
document.getElementById("layer_menu").style.top = (pos.top + height) + 'px';
document.getElementById("layer_menu").style.left = pos.left + 'px';
document.getElementById("layer_menu").style.display = 'block';
id_this.alt = ">";
id_this.src = "pmd/images/uparrow2_m.png";
if (isIE) {
@ -929,7 +927,7 @@ function Show_left_menu(id_this) // max/min all tables
}
} else {
document.getElementById("layer_menu").style.top = -1000 + 'px'; //fast scroll
document.getElementById("layer_menu").style.visibility = 'hidden';
document.getElementById("layer_menu").style.display = 'none';
id_this.alt = "v";
id_this.src = "pmd/images/downarrow2_m.png";
}
@ -955,16 +953,16 @@ function Start_display_field()
}
if (!ON_display_field) {
ON_display_field = 1;
document.getElementById('hint').innerHTML = PMA_messages['strChangeDisplay'];
document.getElementById('hint').style.visibility = "visible";
document.getElementById('pmd_hint').innerHTML = PMA_messages['strChangeDisplay'];
document.getElementById('pmd_hint').style.display = 'block';
document.getElementById('display_field_button').className = 'M_butt_Selected_down';//'#FFEE99';gray #AAAAAA
if (isIE) { // correct for IE
document.getElementById('display_field_button').className = 'M_butt_Selected_down_IE';
}
} else {
document.getElementById('hint').innerHTML = "";
document.getElementById('hint').style.visibility = "hidden";
document.getElementById('pmd_hint').innerHTML = "";
document.getElementById('pmd_hint').style.display = 'none';
document.getElementById('display_field_button').className = 'M_butt';
ON_display_field = 0;
}
@ -1021,7 +1019,7 @@ function Click_option(id_this,column_name,table_name)
document.getElementById(id_this).style.left = left + 'px';
// var top = Glob_Y - document.getElementById(id_this).offsetHeight - 10;
document.getElementById(id_this).style.top = (screen.height / 4) + 'px';
document.getElementById(id_this).style.visibility = "visible";
document.getElementById(id_this).style.display = 'block';
document.getElementById('option_col_name').innerHTML = '<strong>' + PMA_messages['strAddOption'] +'"' +column_name+ '"</strong>';
col_name = column_name;
tab_name = table_name;
@ -1029,7 +1027,7 @@ function Click_option(id_this,column_name,table_name)
function Close_option()
{
document.getElementById('pmd_optionse').style.visibility = "hidden";
document.getElementById('pmd_optionse').style.display = 'none';
}
function Select_all(id_this,owner)
@ -1136,8 +1134,8 @@ function add_object()
var init = history_array.length;
if (rel.value != '--') {
if (document.getElementById('Query').value == "") {
document.getElementById('hint').innerHTML = "value/subQuery is empty" ;
document.getElementById('hint').style.visibility = "visible";
document.getElementById('pmd_hint').innerHTML = "value/subQuery is empty" ;
document.getElementById('pmd_hint').style.display = 'block';
return;
}
var p = document.getElementById('Query');
@ -1168,8 +1166,8 @@ function add_object()
}
if (document.getElementById('h_rel_opt').value != '--') {
if (document.getElementById('having').value == "") {
document.getElementById('hint').innerHTML = "value/subQuery is empty" ;
document.getElementById('hint').style.visibility = "visible";
document.getElementById('pmd_hint').innerHTML = "value/subQuery is empty" ;
document.getElementById('pmd_hint').style.display = 'block';
return;
}
var p = document.getElementById('having');
@ -1186,8 +1184,8 @@ function add_object()
document.getElementById('orderby').checked = false;
//make orderby
}
document.getElementById('hint').innerHTML = sum + "object created" ;
document.getElementById('hint').style.visibility = "visible";
document.getElementById('pmd_hint').innerHTML = sum + "object created" ;
document.getElementById('pmd_hint').style.display = 'block';
//output sum new objects created
var existingDiv = document.getElementById('ab');
existingDiv.innerHTML = display(init,history_array.length);

View File

@ -7,36 +7,35 @@ function PMA_queryAutoCommit()
function PMA_querywindowCommit(tab)
{
document.getElementById('hiddenqueryform').querydisplay_tab.value = tab;
document.getElementById('hiddenqueryform').submit();
$('#hiddenqueryform').find("input[name='querydisplay_tab']").attr("value" ,tab);
$('#hiddenqueryform').submit();
return false;
}
function PMA_querywindowSetFocus()
{
document.getElementById('sqlquery').focus();
$('#sqlquery').focus();
}
function PMA_querywindowResize()
{
// for Gecko
if (typeof(self.sizeToContent) == 'function') {
self.sizeToContent();
if (typeof($(this)[0].sizeToContent) == 'function') {
$(this)[0].sizeToContent();
//self.scrollbars.visible = false;
// give some more space ... to prevent 'fli(pp/ck)ing'
self.resizeBy(10, 50);
$(this)[0].resizeBy(10, 50);
return;
}
// for IE, Opera
if (document.getElementById && typeof(document.getElementById('querywindowcontainer')) != 'undefined') {
if ($('#querywindowcontainer') != 'undefined') {
// get content size
var newWidth = document.getElementById('querywindowcontainer').offsetWidth;
var newHeight = document.getElementById('querywindowcontainer').offsetHeight;
var newWidth = $("#querywindowcontainer")[0].offsetWidth;
var newHeight = $("#querywindowcontainer")[0].offsetHeight;
// set size to contentsize
// plus some offset for scrollbars, borders, statusbar, menus ...
self.resizeTo(newWidth + 45, newHeight + 75);
$(this)[0].resizeTo(newWidth + 45, newHeight + 75);
}
}

View File

@ -35,7 +35,7 @@ Array.min = function (array) {
/**
** Checks if a string contains only numeric value
** @param n: String (to be checked)
** @param n: String (to be checked)
**/
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
@ -43,7 +43,7 @@ function isNumeric(n) {
/**
** Checks if an object is empty
** @param n: Object (to be checked)
** @param n: Object (to be checked)
**/
function isEmpty(obj) {
var name;
@ -59,15 +59,15 @@ function isEmpty(obj) {
** @param type String Field type(datetime/timestamp/time/date)
**/
function getDate(val,type) {
if (type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
return Highcharts.dateFormat('%Y-%m-%e %H:%M:%S', val)
}
else if (type.toString().search(/time/i) != -1) {
return Highcharts.dateFormat('%H:%M:%S', val + 19800000)
}
if(type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
return Highcharts.dateFormat('%Y-%m-%e %H:%M:%S', val)
}
else if(type.toString().search(/time/i) != -1) {
return Highcharts.dateFormat('%H:%M:%S', val)
}
else if (type.toString().search(/date/i) != -1) {
return Highcharts.dateFormat('%Y-%m-%e', val)
}
}
}
/**
@ -76,30 +76,30 @@ function getDate(val,type) {
** @param type Sring Field type(datetime/timestamp/time/date)
**/
function getTimeStamp(val,type) {
if (type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
return getDateFromFormat(val,'yyyy-MM-dd HH:mm:ss', val)
}
else if (type.toString().search(/time/i) != -1) {
return getDateFromFormat('1970-01-01 ' + val,'yyyy-MM-dd HH:mm:ss')
}
if(type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
return getDateFromFormat(val,'yyyy-MM-dd HH:mm:ss', val)
}
else if(type.toString().search(/time/i) != -1) {
return getDateFromFormat('1970-01-01 ' + val,'yyyy-MM-dd HH:mm:ss')
}
else if (type.toString().search(/date/i) != -1) {
return getDateFromFormat(val,'yyyy-MM-dd')
}
return getDateFromFormat(val,'yyyy-MM-dd')
}
}
/**
** Classifies the field type into numeric,timeseries or text
** @param field: field type (as in database structure)
**/
**/
function getType(field) {
if (field.toString().search(/int/i) != -1 || field.toString().search(/decimal/i) != -1 || field.toString().search(/year/i) != -1)
return 'numeric';
else if (field.toString().search(/time/i) != -1 || field.toString().search(/date/i) != -1)
return 'time';
else
return 'text';
if(field.toString().search(/int/i) != -1 || field.toString().search(/decimal/i) != -1 || field.toString().search(/year/i) != -1)
return 'numeric';
else if(field.toString().search(/time/i) != -1 || field.toString().search(/date/i) != -1)
return 'time';
else
return 'text';
}
/**
/**
** Converts a categorical array into numeric array
** @param array categorical values array
**/
@ -121,6 +121,51 @@ function scrollToChart() {
$('html,body').animate({scrollTop: x}, 500);
}
/**
** Handlers for panning feature
**/
function includePan(currentChart) {
var mouseDown;
var lastX;
var lastY;
var chartWidth = $('#resizer').width() - 3;
var chartHeight = $('#resizer').height() - 20;
$('#querychart').mousedown(function() {
mouseDown = 1;
});
$('#querychart').mouseup(function() {
mouseDown = 0;
});
$('#querychart').mousemove(function(e) {
if (mouseDown == 1) {
if (e.pageX > lastX) {
var xExtremes = currentChart.xAxis[0].getExtremes();
var diff = (e.pageX - lastX) * (xExtremes.max - xExtremes.min) / chartWidth;
currentChart.xAxis[0].setExtremes(xExtremes.min - diff, xExtremes.max - diff);
}
else if (e.pageX < lastX) {
var xExtremes = currentChart.xAxis[0].getExtremes();
var diff = (lastX - e.pageX) * (xExtremes.max - xExtremes.min) / chartWidth;
currentChart.xAxis[0].setExtremes(xExtremes.min + diff, xExtremes.max + diff);
}
if (e.pageY > lastY) {
var yExtremes = currentChart.yAxis[0].getExtremes();
var ydiff = 1.0 * (e.pageY - lastY) * (yExtremes.max - yExtremes.min) / chartHeight;
currentChart.yAxis[0].setExtremes(yExtremes.min + ydiff, yExtremes.max + ydiff);
}
else if (e.pageY < lastY) {
var yExtremes = currentChart.yAxis[0].getExtremes();
var ydiff = 1.0 * (lastY - e.pageY) * (yExtremes.max - yExtremes.min) / chartHeight;
currentChart.yAxis[0].setExtremes(yExtremes.min - ydiff, yExtremes.max - ydiff);
}
}
lastX = e.pageX;
lastY = e.pageY;
});
}
$(document).ready(function() {
/**
@ -131,7 +176,7 @@ $(document).ready(function() {
cache: 'false'
});
var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer';
var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer';
var currentChart = null;
var currentData = null;
var xLabel = $('#tableid_0').val();
@ -139,8 +184,12 @@ $(document).ready(function() {
var xType = $('#types_0').val();
var yType = $('#types_1').val();
var dataLabel = $('#dataLabel').val();
var lastX;
var lastY;
var zoomRatio = 1;
// Get query result
// Get query result
var data = jQuery.parseJSON($('#querydata').html());
/**
@ -164,16 +213,16 @@ $(document).ready(function() {
/**
* Input form validation
**/
**/
$('#inputFormSubmitId').click(function() {
if ($('#tableid_0').get(0).selectedIndex == 0 || $('#tableid_1').get(0).selectedIndex == 0)
PMA_ajaxShowMessage(PMA_messages['strInputNull']);
else if (xLabel == yLabel)
if ($('#tableid_0').get(0).selectedIndex == 0 || $('#tableid_1').get(0).selectedIndex == 0)
PMA_ajaxShowMessage(PMA_messages['strInputNull']);
else if (xLabel == yLabel)
PMA_ajaxShowMessage(PMA_messages['strSameInputs']);
});
/**
** Prepare a div containing a link, otherwise it's incorrectly displayed
** Prepare a div containing a link, otherwise it's incorrectly displayed
** after a couple of clicks
**/
$('<div id="togglesearchformdiv"><a id="togglesearchformlink"></a></div>')
@ -191,177 +240,177 @@ $(document).ready(function() {
} else {
$link.text(PMA_messages['strHideSearchCriteria']);
}
// avoid default click action
return false;
});
/**
// avoid default click action
return false;
});
/**
** Set dialog properties for the data display form
**/
$("#dataDisplay").dialog({
autoOpen: false,
title: 'Data point content',
title: 'Data point content',
modal: false, //false otherwise other dialogues like timepicker may not function properly
height: $('#dataDisplay').height() + 80,
width: $('#dataDisplay').width() + 80
});
/*
* Handle submit of zoom_display_form
* Handle submit of zoom_display_form
*/
$("#submitForm").click(function(event) {
//Prevent default submission of form
event.preventDefault();
//Find changed values by comparing form values with selectedRow Object
var newValues = new Array();//Stores the values changed from original
//Find changed values by comparing form values with selectedRow Object
var newValues = new Array();//Stores the values changed from original
var it = 4;
var xChange = false;
var yChange = false;
for (key in selectedRow) {
if (key != 'where_clause'){
var oldVal = selectedRow[key];
var newVal = ($('#fields_null_id_' + it).attr('checked')) ? null : $('#fieldID_' + it).val();
if (oldVal != newVal){
selectedRow[key] = newVal;
newValues[key] = newVal;
if (key == xLabel) {
xChange = true;
data[currentData][xLabel] = newVal;
}
else if (key == yLabel) {
yChange = true;
data[currentData][yLabel] = newVal;
}
}
}
it++
}//End data update
//Update the chart series and replot
for (key in selectedRow) {
if (key != 'where_clause'){
var oldVal = selectedRow[key];
var newVal = ($('#fields_null_id_' + it).attr('checked')) ? null : $('#fieldID_' + it).val();
if (oldVal != newVal){
selectedRow[key] = newVal;
newValues[key] = newVal;
if(key == xLabel) {
xChange = true;
data[currentData][xLabel] = newVal;
}
else if(key == yLabel) {
yChange = true;
data[currentData][yLabel] = newVal;
}
}
}
it++
}//End data update
//Update the chart series and replot
if (xChange || yChange) {
var newSeries = new Array();
newSeries[0] = new Object();
var newSeries = new Array();
newSeries[0] = new Object();
newSeries[0].marker = {
symbol: 'circle'
};
//Logic similar to plot generation, replot only if xAxis changes or yAxis changes. Code includes a lot of checks so as to replot only when necessary
if (xChange) {
xCord[currentData] = selectedRow[xLabel];
if (xType == 'numeric') {
currentChart.series[0].data[currentData].update({ x : selectedRow[xLabel] });
currentChart.xAxis[0].setExtremes(Array.min(xCord) - 6,Array.max(xCord) + 6);
//Logic similar to plot generation, replot only if xAxis changes or yAxis changes. Code includes a lot of checks so as to replot only when necessary
if(xChange) {
xCord[currentData] = selectedRow[xLabel];
if(xType == 'numeric') {
currentChart.series[0].data[currentData].update({ x : selectedRow[xLabel] });
currentChart.xAxis[0].setExtremes(Array.min(xCord) - 6,Array.max(xCord) + 6);
}
else if (xType == 'time') {
currentChart.series[0].data[currentData].update({ x : getTimeStamp(selectedRow[xLabel],$('#types_0').val())});
}
else {
var tempX = getCord(xCord);
var tempY = getCord(yCord);
var i = 0;
newSeries[0].data = new Array();
xCord = tempX[2];
yCord = tempY[2];
else if(xType == 'time') {
currentChart.series[0].data[currentData].update({ x : getTimeStamp(selectedRow[xLabel],$('#types_0').val())});
}
else {
var tempX = getCord(xCord);
var tempY = getCord(yCord);
var i = 0;
newSeries[0].data = new Array();
xCord = tempX[2];
yCord = tempY[2];
$.each(data,function(key,value) {
if (yType != 'text')
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: value[yLabel], marker: {fillColor: colorCodes[i % 8]} , id: i } );
else
$.each(data,function(key,value) {
if(yType != 'text')
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: value[yLabel], marker: {fillColor: colorCodes[i % 8]} , id: i } );
else
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } );
i++;
i++;
});
currentSettings.xAxis.labels = { formatter : function() {
if (tempX[1][this.value] && tempX[1][this.value].length > 10)
return tempX[1][this.value].substring(0,10)
else
return tempX[1][this.value];
currentSettings.xAxis.labels = { formatter : function() {
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
return tempX[1][this.value].substring(0,10)
else
return tempX[1][this.value];
}
}
currentSettings.series = newSeries;
currentSettings.series = newSeries;
currentChart = PMA_createChart(currentSettings);
}
}
}
if (yChange) {
}
if(yChange) {
yCord[currentData] = selectedRow[yLabel];
if (yType == 'numeric') {
currentChart.series[0].data[currentData].update({ y : selectedRow[yLabel] });
currentChart.yAxis[0].setExtremes(Array.min(yCord) - 6,Array.max(yCord) + 6);
yCord[currentData] = selectedRow[yLabel];
if(yType == 'numeric') {
currentChart.series[0].data[currentData].update({ y : selectedRow[yLabel] });
currentChart.yAxis[0].setExtremes(Array.min(yCord) - 6,Array.max(yCord) + 6);
}
else if (yType =='time') {
currentChart.series[0].data[currentData].update({ y : getTimeStamp(selectedRow[yLabel],$('#types_1').val())});
}
else {
var tempX = getCord(xCord);
var tempY = getCord(yCord);
var i = 0;
newSeries[0].data = new Array();
xCord = tempX[2];
yCord = tempY[2];
else if(yType =='time') {
currentChart.series[0].data[currentData].update({ y : getTimeStamp(selectedRow[yLabel],$('#types_1').val())});
}
else {
var tempX = getCord(xCord);
var tempY = getCord(yCord);
var i = 0;
newSeries[0].data = new Array();
xCord = tempX[2];
yCord = tempY[2];
$.each(data,function(key,value) {
if (xType != 'text' )
$.each(data,function(key,value) {
if(xType != 'text' )
newSeries[0].data.push({ name: value[dataLabel], x: value[xLabel], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } );
else
else
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } );
i++;
i++;
});
currentSettings.yAxis.labels = { formatter : function() {
if (tempY[1][this.value] && tempY[1][this.value].length > 10)
return tempY[1][this.value].substring(0,10)
else
return tempY[1][this.value];
currentSettings.yAxis.labels = { formatter : function() {
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
return tempY[1][this.value].substring(0,10)
else
return tempY[1][this.value];
}
}
currentSettings.series = newSeries;
currentChart = PMA_createChart(currentSettings);
}
}
currentChart.series[0].data[currentData].select();
currentSettings.series = newSeries;
currentChart = PMA_createChart(currentSettings);
}
}
currentChart.series[0].data[currentData].select();
}
//End plot update
//End plot update
//Generate SQL query for update
if (!isEmpty(newValues)) {
//Generate SQL query for update
if (!isEmpty(newValues)) {
var sql_query = 'UPDATE `' + window.parent.table + '` SET ';
for (key in newValues) {
if (key != 'where_clause') {
sql_query += '`' + key + '`=' ;
var value = newValues[key];
if (!isNumeric(value) && value != null)
sql_query += '\'' + value + '\' ,';
else
sql_query += value + ' ,';
}
}
sql_query = sql_query.substring(0, sql_query.length - 1);
sql_query += ' WHERE ' + PMA_urldecode(data[currentData]['where_clause']);
//Post SQL query to sql.php
$.post('sql.php', {
for (key in newValues) {
if(key != 'where_clause') {
sql_query += '`' + key + '`=' ;
var value = newValues[key];
if(!isNumeric(value) && value != null)
sql_query += '\'' + value + '\' ,';
else
sql_query += value + ' ,';
}
}
sql_query = sql_query.substring(0, sql_query.length - 1);
sql_query += ' WHERE ' + PMA_urldecode(data[currentData]['where_clause']);
//Post SQL query to sql.php
$.post('sql.php', {
'token' : window.parent.token,
'db' : window.parent.db,
'ajax_request' : true,
'sql_query' : sql_query,
'inline_edit' : false
}, function(data) {
if (data.success == true) {
$('#sqlqueryresults').html(data.sql_query);
$("#sqlqueryresults").trigger('appendAnchor');
}
else
PMA_ajaxShowMessage(data.error);
})//End $.post
}//End database update
$("#dataDisplay").dialog("close");
});//End submit handler
'inline_edit' : false
}, function(data) {
if(data.success == true) {
$('#sqlqueryresults').html(data.sql_query);
$("#sqlqueryresults").trigger('appendAnchor');
}
else
PMA_ajaxShowMessage(data.error);
})//End $.post
}//End database update
$("#dataDisplay").dialog("close");
});//End submit handler
/*
* Generate plot using Highcharts
*/
*/
if (data != null) {
$('#zoom_search_form')
@ -369,87 +418,101 @@ $(document).ready(function() {
.hide();
$('#togglesearchformlink')
.text(PMA_messages['strShowSearchCriteria'])
$('#togglesearchformdiv').show();
$('#togglesearchformdiv').show();
var selectedRow;
var columnNames = new Array();
var colorCodes = ['#FF0000','#00FFFF','#0000FF','#0000A0','#FF0080','#800080','#FFFF00','#00FF00','#FF00FF'];
var series = new Array();
var xCord = new Array();
var yCord = new Array();
var xCat = new Array();
var yCat = new Array();
var tempX, tempY;
var it = 0;
var colorCodes = ['#FF0000','#00FFFF','#0000FF','#0000A0','#FF0080','#800080','#FFFF00','#00FF00','#FF00FF'];
var series = new Array();
var xCord = new Array();
var yCord = new Array();
var tempX, tempY;
var it = 0;
var xMax; // xAxis extreme max
var xMin; // xAxis extreme min
var yMax; // yAxis extreme max
var yMin; // yAxis extreme min
// Set the basic plot settings
var currentSettings = {
chart: {
renderTo: 'querychart',
type: 'scatter',
zoomType: 'xy',
width:$('#resizer').width() -3,
height:$('#resizer').height()-20
renderTo: 'querychart',
type: 'scatter',
//zoomType: 'xy',
width:$('#resizer').width() -3,
height:$('#resizer').height()-20
},
credits: {
enabled: false
},
credits: {
enabled: false
},
exporting: { enabled: false },
exporting: { enabled: false },
label: { text: $('#dataLabel').val() },
plotOptions: {
series: {
allowPointSelect: true,
plotOptions: {
series: {
allowPointSelect: true,
cursor: 'pointer',
showInLegend: false,
showInLegend: false,
dataLabels: {
enabled: false
enabled: false,
},
point: {
point: {
events: {
click: function() {
var id = this.id;
var fid = 4;
currentData = id;
// Make AJAX request to tbl_zoom_select.php for getting the complete row info
var post_params = {
var id = this.id;
var fid = 4;
currentData = id;
// Make AJAX request to tbl_zoom_select.php for getting the complete row info
var post_params = {
'ajax_request' : true,
'get_data_row' : true,
'db' : window.parent.db,
'table' : window.parent.table,
'where_clause' : data[id]['where_clause'],
'token' : window.parent.token
'token' : window.parent.token,
}
$.post('tbl_zoom_select.php', post_params, function(data) {
// Row is contained in data.row_info, now fill the displayResultForm with row values
for ( key in data.row_info) {
if (data.row_info[key] == null)
$('#fields_null_id_' + fid).attr('checked', true);
else
$('#fieldID_' + fid).val(data.row_info[key]);
fid++;
}
selectedRow = new Object();
selectedRow = data.row_info;
// Row is contained in data.row_info, now fill the displayResultForm with row values
for ( key in data.row_info) {
if (data.row_info[key] == null)
$('#fields_null_id_' + fid).attr('checked', true);
else
$('#fieldID_' + fid).val(data.row_info[key]);
fid++;
}
selectedRow = new Object();
selectedRow = data.row_info;
});
$("#dataDisplay").dialog("open");
}
$("#dataDisplay").dialog("open");
},
}
}
}
},
tooltip: {
formatter: function() {
return this.point.name;
}
},
title: { text: 'Query Results' },
xAxis: {
title: { text: $('#tableid_0').val() },
events: {
setExtremes: function(e){
this.resetZoom.show();
}
}
},
tooltip: {
formatter: function() {
return this.point.name;
}
},
title: { text: 'Query Results' },
xAxis: {
title: { text: $('#tableid_0').val() }
},
yAxis: {
min: null,
title: { text: $('#tableid_1').val() }
}
min: null,
title: { text: $('#tableid_1').val() },
endOnTick: false,
startOnTick: false,
events: {
setExtremes: function(e){
this.resetZoom.show();
}
}
},
}
$('#resizer').resizable({
@ -461,145 +524,185 @@ $(document).ready(function() {
);
}
});
// Classify types as either numeric,time,text
xType = getType(xType);
yType = getType(yType);
// Classify types as either numeric,time,text
xType = getType(xType);
yType = getType(yType);
//Set the axis type based on the field
currentSettings.xAxis.type = (xType == 'time') ? 'datetime' : 'linear';
currentSettings.yAxis.type = (yType == 'time') ? 'datetime' : 'linear';
//Set the axis type based on the field
currentSettings.xAxis.type = (xType == 'time') ? 'datetime' : 'linear';
currentSettings.yAxis.type = (yType == 'time') ? 'datetime' : 'linear';
// Formulate series data for plot
series[0] = new Object();
series[0].data = new Array();
series[0].marker = {
series[0].marker = {
symbol: 'circle'
};
if (xType != 'text' && yType != 'text') {
$.each(data,function(key,value) {
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
if (xType != 'text' && yType != 'text') {
$.each(data,function(key,value) {
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
series[0].data.push({ name: value[dataLabel], x: xVal, y: yVal, marker: {fillColor: colorCodes[it % 8]} , id: it } );
xCord.push(value[xLabel]);
yCord.push(value[yLabel]);
it++;
xCord.push(value[xLabel]);
yCord.push(value[yLabel]);
it++;
});
if (xType == 'numeric') {
currentSettings.xAxis.max = Array.max(xCord) + 6
currentSettings.xAxis.min = Array.min(xCord) - 6
if(xType == 'numeric') {
currentSettings.xAxis.max = Array.max(xCord) + 6
currentSettings.xAxis.min = Array.min(xCord) - 6
}
else {
currentSettings.xAxis.labels = { formatter : function() {
return getDate(this.value, $('#types_0').val());
}}
}
else {
currentSettings.xAxis.labels = { formatter : function() {
return getDate(this.value, $('#types_0').val());
}}
}
if (yType == 'numeric') {
currentSettings.yAxis.max = Array.max(yCord) + 6
currentSettings.yAxis.min = Array.min(yCord) - 6
}
else {
currentSettings.yAxis.labels = { formatter : function() {
return getDate(this.value, $('#types_1').val());
}}
if(yType == 'numeric') {
currentSettings.yAxis.max = Array.max(yCord) + 6
currentSettings.yAxis.min = Array.min(yCord) - 6
}
else {
currentSettings.yAxis.labels = { formatter : function() {
return getDate(this.value, $('#types_1').val());
}}
}
}
else if (xType =='text' && yType !='text') {
$.each(data,function(key,value) {
xCord.push(value[xLabel]);
yCord.push(value[yLabel]);
});
tempX = getCord(xCord);
$.each(data,function(key,value) {
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
else if (xType =='text' && yType !='text') {
$.each(data,function(key,value) {
xCord.push(value[xLabel]);
yCord.push(value[yLabel]);
});
tempX = getCord(xCord);
$.each(data,function(key,value) {
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
series[0].data.push({ name: value[dataLabel], x: tempX[0][it], y: yVal, marker: {fillColor: colorCodes[it % 8]} , id: it } );
it++;
it++;
});
currentSettings.xAxis.labels = { formatter : function() {
if (tempX[1][this.value] && tempX[1][this.value].length > 10)
return tempX[1][this.value].substring(0,10)
else
return tempX[1][this.value];
}
currentSettings.xAxis.labels = { formatter : function() {
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
return tempX[1][this.value].substring(0,10)
else
return tempX[1][this.value];
}
}
if (yType == 'numeric') {
currentSettings.yAxis.max = Array.max(yCord) + 6
currentSettings.yAxis.min = Array.min(yCord) - 6
if(yType == 'numeric') {
currentSettings.yAxis.max = Array.max(yCord) + 6
currentSettings.yAxis.min = Array.min(yCord) - 6
}
else {
currentSettings.yAxis.labels = { formatter : function() {
return getDate(this.value, $('#types_1').val());
}}
}
else {
currentSettings.yAxis.labels = { formatter : function() {
return getDate(this.value, $('#types_1').val());
}}
}
xCord = tempX[2];
}
else if (xType !='text' && yType =='text') {
$.each(data,function(key,value) {
xCord.push(value[xLabel]);
yCord.push(value[yLabel]);
});
tempY = getCord(yCord);
$.each(data,function(key,value) {
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
xCord = tempX[2];
}
else if (xType !='text' && yType =='text') {
$.each(data,function(key,value) {
xCord.push(value[xLabel]);
yCord.push(value[yLabel]);
});
tempY = getCord(yCord);
$.each(data,function(key,value) {
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
series[0].data.push({ name: value[dataLabel], y: tempY[0][it], x: xVal, marker: {fillColor: colorCodes[it % 8]} , id: it } );
it++;
it++;
});
if (xType == 'numeric') {
currentSettings.xAxis.max = Array.max(xCord) + 6
currentSettings.xAxis.min = Array.min(xCord) - 6
if(xType == 'numeric') {
currentSettings.xAxis.max = Array.max(xCord) + 6
currentSettings.xAxis.min = Array.min(xCord) - 6
}
else {
currentSettings.xAxis.labels = { formatter : function() {
return getDate(this.value, $('#types_0').val());
}}
}
else {
currentSettings.xAxis.labels = { formatter : function() {
return getDate(this.value, $('#types_0').val());
}}
currentSettings.yAxis.labels = { formatter : function() {
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
return tempY[1][this.value].substring(0,10)
else
return tempY[1][this.value];
}
}
currentSettings.yAxis.labels = { formatter : function() {
if (tempY[1][this.value] && tempY[1][this.value].length > 10)
return tempY[1][this.value].substring(0,10)
else
return tempY[1][this.value];
}
}
yCord = tempY[2];
}
else if (xType =='text' && yType =='text') {
$.each(data,function(key,value) {
xCord.push(value[xLabel]);
yCord.push(value[yLabel]);
});
tempX = getCord(xCord);
tempY = getCord(yCord);
$.each(data,function(key,value) {
yCord = tempY[2];
}
else if (xType =='text' && yType =='text') {
$.each(data,function(key,value) {
xCord.push(value[xLabel]);
yCord.push(value[yLabel]);
});
tempX = getCord(xCord);
tempY = getCord(yCord);
$.each(data,function(key,value) {
series[0].data.push({ name: value[dataLabel], x: tempX[0][it], y: tempY[0][it], marker: {fillColor: colorCodes[it % 8]} , id: it } );
it++;
it++;
});
currentSettings.xAxis.labels = { formatter : function() {
if (tempX[1][this.value] && tempX[1][this.value].length > 10) {
return tempX[1][this.value].substring(0,10)
} else {
return tempX[1][this.value];
}
}};
currentSettings.yAxis.labels = { formatter : function() {
if (tempY[1][this.value] && tempY[1][this.value].length > 10) {
return tempY[1][this.value].substring(0,10);
} else {
return tempY[1][this.value];
}
}};
xCord = tempX[2];
yCord = tempY[2];
currentSettings.xAxis.labels = { formatter : function() {
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
return tempX[1][this.value].substring(0,10)
else
return tempX[1][this.value];
}
}
currentSettings.yAxis.labels = { formatter : function() {
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
return tempY[1][this.value].substring(0,10)
else
return tempY[1][this.value];
}
}
xCord = tempX[2];
yCord = tempY[2];
}
}
currentSettings.series = series;
currentSettings.series = series;
currentChart = PMA_createChart(currentSettings);
scrollToChart();
xMin = currentChart.xAxis[0].getExtremes().min;
xMax = currentChart.xAxis[0].getExtremes().max;
yMin = currentChart.yAxis[0].getExtremes().min;
yMax = currentChart.yAxis[0].getExtremes().max;
includePan(currentChart); //Enable panning feature
var setZoom = function() {
var newxm = xMin + (xMax - xMin) * (1 - zoomRatio) / 2;
var newxM = xMax - (xMax - xMin) * (1 - zoomRatio) / 2;
var newym = yMin + (yMax - yMin) * (1 - zoomRatio) / 2;
var newyM = yMax - (yMax - yMin) * (1 - zoomRatio) / 2;
currentChart.xAxis[0].setExtremes(newxm,newxM);
currentChart.yAxis[0].setExtremes(newym,newyM);
};
//Enable zoom feature
$("#querychart").mousewheel(function(objEvent, intDelta) {
if (intDelta > 0) {
if (zoomRatio > 0.1) {
zoomRatio = zoomRatio - 0.1;
setZoom();
}
}
else if (intDelta < 0) {
zoomRatio = zoomRatio + 0.1;
setZoom();
}
});
//Add reset zoom feature
currentChart.yAxis[0].resetZoom = currentChart.xAxis[0].resetZoom = $('<a href="#">Reset zoom</a>')
.appendTo(currentChart.container)
.css({
position: 'absolute',
top: 10,
right: 20,
display: 'none'
})
.click(function(){
currentChart.xAxis[0].setExtremes(null, null)
currentChart.yAxis[0].setExtremes(null, null)
this.style.display = 'none'
});
scrollToChart();
}
});

View File

@ -174,6 +174,22 @@ class Advisor
$this->runResult[$type][] = $rule;
}
private function ruleExprEvaluate_var1($matches)
{
// '/fired\s*\(\s*(\'|")(.*)\1\s*\)/Uie'
return '1'; //isset($this->runResult[\'fired\']
}
private function ruleExprEvaluate_var2($matches)
{
// '/\b(\w+)\b/e'
return isset($this->variables[$matches[1]])
? (is_numeric($this->variables[$matches[1]])
? $this->variables[$matches[1]]
: '"'.$this->variables[$matches[1]].'"')
: $matches[1];
}
// Runs a code expression, replacing variable names with their respective values
// ignoreUntil: if > 0, it doesn't replace any variables until that string position, but still evaluates the whole expr
function ruleExprEvaluate($expr, $ignoreUntil = 0)
@ -182,13 +198,14 @@ class Advisor
$exprIgnore = substr($expr,0,$ignoreUntil);
$expr = substr($expr,$ignoreUntil);
}
$expr = preg_replace('/fired\s*\(\s*(\'|")(.*)\1\s*\)/Uie','1',$expr); //isset($this->runResult[\'fired\']
$expr = preg_replace('/\b(\w+)\b/e','isset($this->variables[\'\1\']) ? (!is_numeric($this->variables[\'\1\']) ? \'"\'.$this->variables[\'\1\'].\'"\' : $this->variables[\'\1\']) : \'\1\'', $expr);
$expr = preg_replace_callback('/fired\s*\(\s*(\'|")(.*)\1\s*\)/Ui', array($this, 'ruleExprEvaluate_var1'), $expr);
$expr = preg_replace_callback('/\b(\w+)\b/', array($this, 'ruleExprEvaluate_var2'), $expr);
if ($ignoreUntil > 0) {
$expr = $exprIgnore . $expr;
}
$value = 0;
$err = 0;
ob_start();
eval('$value = '.$expr.';');
$err = ob_get_contents();

View File

@ -63,8 +63,8 @@ class PMA_Table
/**
* Constructor
*
* @param string $table_name table name
* @param string $db_name database name
* @param string $table_name table name
* @param string $db_name database name
*/
function __construct($table_name, $db_name)
{
@ -83,11 +83,21 @@ class PMA_Table
return $this->getName();
}
/**
* return the last error
*
* @return the last error
*/
function getLastError()
{
return end($this->errors);
}
/**
* return the last message
*
* @return the last message
*/
function getLastMessage()
{
return end($this->messages);
@ -96,7 +106,9 @@ class PMA_Table
/**
* sets table name
*
* @param string $table_name new table name
* @param string $table_name new table name
*
* @return nothing
*/
function setName($table_name)
{
@ -107,6 +119,7 @@ class PMA_Table
* returns table name
*
* @param boolean $backquoted whether to quote name with backticks ``
*
* @return string table name
*/
function getName($backquoted = false)
@ -120,7 +133,9 @@ class PMA_Table
/**
* sets database name for this table
*
* @param string $db_name
* @param string $db_name database name
*
* @return nothing
*/
function setDbName($db_name)
{
@ -131,6 +146,7 @@ class PMA_Table
* returns database name for this table
*
* @param boolean $backquoted whether to quote name with backticks ``
*
* @return string database name for this table
*/
function getDbName($backquoted = false)
@ -145,6 +161,7 @@ class PMA_Table
* returns full name for table, including database name
*
* @param boolean $backquoted whether to quote name with backticks ``
*
* @return string
*/
function getFullName($backquoted = false)
@ -152,6 +169,14 @@ class PMA_Table
return $this->getDbName($backquoted) . '.' . $this->getName($backquoted);
}
/**
* returns whether the table is actually a view
*
* @param string $db database
* @param string $table table
*
* @return whether the given is a view
*/
static public function isView($db = null, $table = null)
{
if (strlen($db) && strlen($table)) {
@ -166,6 +191,8 @@ class PMA_Table
*
* @param string $param name
* @param mixed $value value
*
* @return nothing
*/
function set($param, $value)
{
@ -176,6 +203,7 @@ class PMA_Table
* returns value for given setting/param
*
* @param string $param name for value to return
*
* @return mixed value for $param
*/
function get($param)
@ -204,8 +232,10 @@ class PMA_Table
$this->settings = $table_info;
if ($this->get('TABLE_ROWS') === null) {
$this->set('TABLE_ROWS', PMA_Table::countRecords($this->getDbName(),
$this->getName(), true));
$this->set(
'TABLE_ROWS',
PMA_Table::countRecords($this->getDbName(), $this->getName(), true)
);
}
$create_options = explode(' ', $this->get('TABLE_ROWS'));
@ -224,10 +254,12 @@ class PMA_Table
/**
* Checks if this "table" is a view
*
* @param string $db the database name
* @param string $table the table name
*
* @deprecated
* @todo see what we could do with the possible existence of $table_is_view
* @param string $db the database name
* @param string $table the table name
*
* @return boolean whether this is a view
*/
static protected function _isView($db, $table)
@ -237,7 +269,8 @@ class PMA_Table
return true;
}
// Since phpMyAdmin 3.2 the field TABLE_TYPE is properly filled by PMA_DBI_get_tables_full()
// Since phpMyAdmin 3.2 the field TABLE_TYPE is properly filled by
// PMA_DBI_get_tables_full()
$type = PMA_Table::sGetStatusInfo($db, $table, 'TABLE_TYPE');
return $type == 'VIEW';
}
@ -245,10 +278,12 @@ class PMA_Table
/**
* Checks if this is a merge table
*
* If the ENGINE of the table is MERGE or MRG_MYISAM (alias), this is a merge table.
* If the ENGINE of the table is MERGE or MRG_MYISAM (alias),
* this is a merge table.
*
* @param string $db the database name
* @param string $table the table name
*
* @param string $db the database name
* @param string $table the table name
* @return boolean true if it is a merge table
*/
static public function isMerge($db = null, $table = null)
@ -270,15 +305,17 @@ class PMA_Table
/**
* Returns full table status info, or specific if $info provided
*
* this info is collected from information_schema
*
* @todo PMA_DBI_get_tables_full needs to be merged somehow into this class or at least better documented
* @param string $db
* @param string $table
* @param string $info
* @param boolean $force_read
* @param string $db database name
* @param string $table table name
* @param string $info
* @param boolean $force_read read new rather than serving from cache
* @param boolean $disable_error if true, disables error message
*
* @todo PMA_DBI_get_tables_full needs to be merged somehow into this class
* or at least better documented
*
* @return mixed
*/
static public function sGetStatusInfo($db, $table, $info = null, $force_read = false, $disable_error = false)
@ -311,21 +348,24 @@ class PMA_Table
/**
* generates column specification for ALTER or CREATE TABLE syntax
*
* @param string $name name
* @param string $type type ('INT', 'VARCHAR', 'BIT', ...)
* @param string $length length ('2', '5,2', '', ...)
* @param string $attribute attribute
* @param string $collation collation
* @param bool|string $null with 'NULL' or 'NOT NULL'
* @param string $default_type whether default is CURRENT_TIMESTAMP,
* NULL, NONE, USER_DEFINED
* @param string $default_value default value for USER_DEFINED default type
* @param string $extra 'AUTO_INCREMENT'
* @param string $comment field comment
* @param array &$field_primary list of fields for PRIMARY KEY
* @param string $index
*
* @todo move into class PMA_Column
* @todo on the interface, some js to clear the default value when the default current_timestamp is checked
* @param string $name name
* @param string $type type ('INT', 'VARCHAR', 'BIT', ...)
* @param string $length length ('2', '5,2', '', ...)
* @param string $attribute
* @param string $collation
* @param bool|string $null with 'NULL' or 'NOT NULL'
* @param string $default_type whether default is CURRENT_TIMESTAMP,
* NULL, NONE, USER_DEFINED
* @param string $default_value default value for USER_DEFINED default type
* @param string $extra 'AUTO_INCREMENT'
* @param string $comment field comment
* @param array &$field_primary list of fields for PRIMARY KEY
* @param string $index
* @todo on the interface, some js to clear the default value when the default
* current_timestamp is checked
*
* @return string field specification
*/
static function generateFieldSpec($name, $type, $length = '', $attribute = '',
@ -339,8 +379,9 @@ class PMA_Table
$query = PMA_backquote($name) . ' ' . $type;
if ($length != ''
&& !preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT'
. '|SERIAL|BOOLEAN)$@i', $type)) {
&& ! preg_match('@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|'
. 'MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN)$@i', $type)
) {
$query .= '(' . $length . ')';
}
@ -348,8 +389,9 @@ class PMA_Table
$query .= ' ' . $attribute;
}
if (!empty($collation) && $collation != 'NULL'
&& preg_match('@^(TINYTEXT|TEXT|MEDIUMTEXT|LONGTEXT|VARCHAR|CHAR|ENUM|SET)$@i', $type)) {
if (! empty($collation) && $collation != 'NULL'
&& preg_match('@^(TINYTEXT|TEXT|MEDIUMTEXT|LONGTEXT|VARCHAR|CHAR|ENUM|SET)$@i', $type)
) {
$query .= PMA_generateCharsetQueryPart($collation);
}
@ -362,24 +404,26 @@ class PMA_Table
}
switch ($default_type) {
case 'USER_DEFINED' :
if ($is_timestamp && $default_value === '0') {
// a TIMESTAMP does not accept DEFAULT '0'
// but DEFAULT 0 works
$query .= ' DEFAULT 0';
} elseif ($type == 'BIT') {
$query .= ' DEFAULT b\'' . preg_replace('/[^01]/', '0', $default_value) . '\'';
} else {
$query .= ' DEFAULT \'' . PMA_sqlAddSlashes($default_value) . '\'';
}
break;
case 'NULL' :
case 'CURRENT_TIMESTAMP' :
$query .= ' DEFAULT ' . $default_type;
break;
case 'NONE' :
default :
break;
case 'USER_DEFINED' :
if ($is_timestamp && $default_value === '0') {
// a TIMESTAMP does not accept DEFAULT '0'
// but DEFAULT 0 works
$query .= ' DEFAULT 0';
} elseif ($type == 'BIT') {
$query .= ' DEFAULT b\''
. preg_replace('/[^01]/', '0', $default_value)
. '\'';
} else {
$query .= ' DEFAULT \'' . PMA_sqlAddSlashes($default_value) . '\'';
}
break;
case 'NULL' :
case 'CURRENT_TIMESTAMP' :
$query .= ' DEFAULT ' . $default_type;
break;
case 'NONE' :
default :
break;
}
if (!empty($extra)) {
@ -389,16 +433,18 @@ class PMA_Table
if ($extra == 'AUTO_INCREMENT') {
$primary_cnt = count($field_primary);
if (1 == $primary_cnt) {
for ($j = 0; $j < $primary_cnt && $field_primary[$j] != $index; $j++) {
//void
for ($j = 0; $j < $primary_cnt; $j++) {
if ($field_primary[$j] == $index) {
break;
}
}
if (isset($field_primary[$j]) && $field_primary[$j] == $index) {
$query .= ' PRIMARY KEY';
unset($field_primary[$j]);
}
// but the PK could contain other columns so do not append
// a PRIMARY KEY clause, just add a member to $field_primary
} else {
// but the PK could contain other columns so do not append
// a PRIMARY KEY clause, just add a member to $field_primary
$found_in_pk = false;
for ($j = 0; $j < $primary_cnt; $j++) {
if ($field_primary[$j] == $index) {
@ -424,13 +470,13 @@ class PMA_Table
* Revision 13 July 2001: Patch for limiting dump size from
* vinay@sanisoft.com & girish@sanisoft.com
*
* @param string $db the current database name
* @param string $table the current table name
* @param bool $force_exact whether to force an exact count
* @param bool $is_view
* @param string $db the current database name
* @param string $table the current table name
* @param bool $force_exact whether to force an exact count
* @param bool $is_view whether the table is a view
*
* @return mixed the number of records if "retain" param is true,
* otherwise true
* @return mixed the number of records if "retain" param is true,
* otherwise true
*/
static public function countRecords($db, $table, $force_exact = false, $is_view = null)
{
@ -462,7 +508,8 @@ class PMA_Table
if (! $is_view) {
$row_count = PMA_DBI_fetch_value(
'SELECT COUNT(*) FROM ' . PMA_backquote($db) . '.'
. PMA_backquote($table));
. PMA_backquote($table)
);
} else {
// For complex views, even trying to get a partial record
// count could bring down a server, so we offer an
@ -478,9 +525,11 @@ class PMA_Table
// based on a table that no longer exists)
$result = PMA_DBI_try_query(
'SELECT 1 FROM ' . PMA_backquote($db) . '.'
. PMA_backquote($table) . ' LIMIT '
. $GLOBALS['cfg']['MaxExactCountViews'],
null, PMA_DBI_QUERY_STORE);
. PMA_backquote($table) . ' LIMIT '
. $GLOBALS['cfg']['MaxExactCountViews'],
null,
PMA_DBI_QUERY_STORE
);
if (!PMA_DBI_getError()) {
$row_count = PMA_DBI_num_rows($result);
PMA_DBI_free_result($result);
@ -497,22 +546,24 @@ class PMA_Table
/**
* Generates column specification for ALTER syntax
*
* @param string $oldcol old column name
* @param string $newcol new column name
* @param string $type type ('INT', 'VARCHAR', 'BIT', ...)
* @param string $length length ('2', '5,2', '', ...)
* @param string $attribute attribute
* @param string $collation collation
* @param bool|string $null with 'NULL' or 'NOT NULL'
* @param string $default_type whether default is CURRENT_TIMESTAMP,
* NULL, NONE, USER_DEFINED
* @param string $default_value default value for USER_DEFINED default type
* @param string $extra 'AUTO_INCREMENT'
* @param string $comment field comment
* @param array &$field_primary list of fields for PRIMARY KEY
* @param string $index
* @param mixed $default_orig
*
* @see PMA_Table::generateFieldSpec()
* @param string $oldcol old column name
* @param string $newcol new column name
* @param string $type type ('INT', 'VARCHAR', 'BIT', ...)
* @param string $length length ('2', '5,2', '', ...)
* @param string $attribute
* @param string $collation
* @param bool|string $null with 'NULL' or 'NOT NULL'
* @param string $default_type whether default is CURRENT_TIMESTAMP,
* NULL, NONE, USER_DEFINED
* @param string $default_value default value for USER_DEFINED default type
* @param string $extra 'AUTO_INCREMENT'
* @param string $comment field comment
* @param array &$field_primary list of fields for PRIMARY KEY
* @param string $index
* @param mixed $default_orig
*
* @return string field specification
*/
static public function generateAlter($oldcol, $newcol, $type, $length,
@ -520,26 +571,32 @@ class PMA_Table
$extra, $comment = '', &$field_primary, $index, $default_orig)
{
return PMA_backquote($oldcol) . ' '
. PMA_Table::generateFieldSpec($newcol, $type, $length, $attribute,
. PMA_Table::generateFieldSpec(
$newcol, $type, $length, $attribute,
$collation, $null, $default_type, $default_value, $extra,
$comment, $field_primary, $index, $default_orig);
$comment, $field_primary, $index, $default_orig
);
} // end function
/**
* Inserts existing entries in a PMA_* table by reading a value from an old entry
*
* @param string $work The array index, which Relation feature to check
* ('relwork', 'commwork', ...)
* @param string $pma_table The array index, which PMA-table to update
* ('bookmark', 'relation', ...)
* @param array $get_fields Which fields will be SELECT'ed from the old entry
* @param array $where_fields Which fields will be used for the WHERE query
* (array('FIELDNAME' => 'FIELDVALUE'))
* @param array $new_fields Which fields will be used as new VALUES. These are
* the important keys which differ from the old entry
* (array('FIELDNAME' => 'NEW FIELDVALUE'))
*
* @global relation variable
* @param string $work The array index, which Relation feature to check ('relwork', 'commwork', ...)
* @param string $pma_table The array index, which PMA-table to update ('bookmark', 'relation', ...)
* @param array $get_fields Which fields will be SELECT'ed from the old entry
* @param array $where_fields Which fields will be used for the WHERE query (array('FIELDNAME' => 'FIELDVALUE'))
* @param array $new_fields Which fields will be used as new VALUES. These are the important
* keys which differ from the old entry.
* (array('FIELDNAME' => 'NEW FIELDVALUE'))
*
* @return int|true
*/
static public function duplicateInfo($work, $pma_table, $get_fields, $where_fields,
$new_fields)
static public function duplicateInfo($work, $pma_table, $get_fields, $where_fields, $new_fields)
{
$last_id = -1;
@ -572,8 +629,9 @@ class PMA_Table
// must use PMA_DBI_QUERY_STORE here, since we execute another
// query inside the loop
$table_copy_rs = PMA_query_as_controluser($table_copy_query, true,
PMA_DBI_QUERY_STORE);
$table_copy_rs = PMA_query_as_controluser(
$table_copy_query, true, PMA_DBI_QUERY_STORE
);
while ($table_copy_row = @PMA_DBI_fetch_assoc($table_copy_rs)) {
$value_parts = array();
@ -583,9 +641,9 @@ class PMA_Table
}
}
$new_table_query = '
INSERT IGNORE INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db'])
. '.' . PMA_backquote($GLOBALS['cfgRelation'][$pma_table]) . '
$new_table_query = 'INSERT IGNORE INTO '
. PMA_backquote($GLOBALS['cfgRelation']['db'])
. '.' . PMA_backquote($GLOBALS['cfgRelation'][$pma_table]) . '
(' . implode(', ', $select_parts) . ',
' . implode(', ', $new_parts) . ')
VALUES
@ -608,14 +666,15 @@ class PMA_Table
/**
* Copies or renames table
*
* @param $source_db
* @param $source_table
* @param $target_db
* @param $target_table
* @param $what
* @param $move
* @param $mode
* @return bool
* @param string $source_db source database
* @param string $source_table source table
* @param string $target_db target database
* @param string $target_table target table
* @param string $what what to be moved or copied (data, dataonly)
* @param bool $move whether to move
* @param string $mode mode
*
* @return bool true if success, false otherwise
*/
static public function moveCopy($source_db, $source_table, $target_db, $target_table, $what, $move, $mode)
{
@ -624,7 +683,10 @@ class PMA_Table
/* Try moving table directly */
if ($move && $what == 'data') {
$tbl = new PMA_Table($source_table, $source_db);
$result = $tbl->rename($target_table, $target_db, PMA_Table::isView($source_db, $source_table));
$result = $tbl->rename(
$target_table, $target_db,
PMA_Table::isView($source_db, $source_table)
);
if ($result) {
$GLOBALS['message'] = $tbl->getLastMessage();
return true;
@ -638,12 +700,14 @@ class PMA_Table
// Ensure the target is valid
if (! $GLOBALS['pma']->databases->exists($source_db, $target_db)) {
if (! $GLOBALS['pma']->databases->exists($source_db)) {
$GLOBALS['message'] = PMA_Message::rawError('source database `'
. htmlspecialchars($source_db) . '` not found');
$GLOBALS['message'] = PMA_Message::rawError(
'source database `' . htmlspecialchars($source_db) . '` not found'
);
}
if (! $GLOBALS['pma']->databases->exists($target_db)) {
$GLOBALS['message'] = PMA_Message::rawError('target database `'
. htmlspecialchars($target_db) . '` not found');
$GLOBALS['message'] = PMA_Message::rawError(
'target database `' . htmlspecialchars($target_db) . '` not found'
);
}
return false;
}
@ -661,21 +725,25 @@ class PMA_Table
// do not create the table if dataonly
if ($what != 'dataonly') {
require_once './libraries/export/sql.php';
include_once './libraries/export/sql.php';
$no_constraints_comments = true;
$GLOBALS['sql_constraints_query'] = '';
$sql_structure = PMA_getTableDef($source_db, $source_table, "\n", $err_url, false, false);
$sql_structure = PMA_getTableDef(
$source_db, $source_table, "\n", $err_url, false, false
);
unset($no_constraints_comments);
$parsed_sql = PMA_SQP_parse($sql_structure);
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
$i = 0;
if (empty($analyzed_sql[0]['create_table_fields'])) {
// this is not a CREATE TABLE, so find the first VIEW
// this is not a CREATE TABLE, so find the first VIEW
$target_for_view = PMA_backquote($target_db);
while (true) {
if ($parsed_sql[$i]['type'] == 'alpha_reservedWord' && $parsed_sql[$i]['data'] == 'VIEW') {
if ($parsed_sql[$i]['type'] == 'alpha_reservedWord'
&& $parsed_sql[$i]['data'] == 'VIEW'
) {
break;
}
$i++;
@ -709,8 +777,10 @@ class PMA_Table
$last = $parsed_sql['len'] - 1;
$backquoted_source_db = PMA_backquote($source_db);
for (++$i; $i <= $last; $i++) {
if ($parsed_sql[$i]['type'] == $table_delimiter && $parsed_sql[$i]['data'] == $backquoted_source_db) {
$parsed_sql[$i]['data'] = $target_for_view;
if ($parsed_sql[$i]['type'] == $table_delimiter
&& $parsed_sql[$i]['data'] == $backquoted_source_db
) {
$parsed_sql[$i]['data'] = $target_for_view;
}
}
unset($last,$backquoted_source_db);
@ -723,8 +793,9 @@ class PMA_Table
// If table exists, and 'add drop table' is selected: Drop it!
$drop_query = '';
if (isset($GLOBALS['drop_if_exists'])
&& $GLOBALS['drop_if_exists'] == 'true') {
if (PMA_Table::_isView($target_db,$target_table)) {
&& $GLOBALS['drop_if_exists'] == 'true'
) {
if (PMA_Table::_isView($target_db, $target_table)) {
$drop_query = 'DROP VIEW';
} else {
$drop_query = 'DROP TABLE';
@ -745,7 +816,8 @@ class PMA_Table
$GLOBALS['sql_query'] .= "\n" . $sql_structure . ';';
if (($move || isset($GLOBALS['add_constraints']))
&& !empty($GLOBALS['sql_constraints_query'])) {
&& !empty($GLOBALS['sql_constraints_query'])
) {
$parsed_sql = PMA_SQP_parse($GLOBALS['sql_constraints_query']);
$i = 0;
@ -768,7 +840,8 @@ class PMA_Table
for ($j = $i; $j < $cnt; $j++) {
if ($parsed_sql[$j]['type'] == 'alpha_reservedWord'
&& strtoupper($parsed_sql[$j]['data']) == 'CONSTRAINT') {
&& strtoupper($parsed_sql[$j]['data']) == 'CONSTRAINT'
) {
if ($parsed_sql[$j+1]['type'] == $table_delimiter) {
$parsed_sql[$j+1]['data'] = '';
}
@ -776,8 +849,9 @@ class PMA_Table
}
// Generate query back
$GLOBALS['sql_constraints_query'] = PMA_SQP_formatHtml($parsed_sql,
'query_only');
$GLOBALS['sql_constraints_query'] = PMA_SQP_formatHtml(
$parsed_sql, 'query_only'
);
if ($mode == 'one_table') {
PMA_DBI_query($GLOBALS['sql_constraints_query']);
}
@ -791,9 +865,10 @@ class PMA_Table
}
// Copy the data unless this is a VIEW
if (($what == 'data' || $what == 'dataonly') && ! PMA_Table::_isView($target_db,$target_table)) {
$sql_insert_data =
'INSERT INTO ' . $target . ' SELECT * FROM ' . $source;
if (($what == 'data' || $what == 'dataonly')
&& ! PMA_Table::_isView($target_db, $target_table)
) {
$sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . $source;
PMA_DBI_query($sql_insert_data);
$GLOBALS['sql_query'] .= "\n\n" . $sql_insert_data . ';';
}
@ -807,7 +882,7 @@ class PMA_Table
// moving table from replicated one to not replicated one
PMA_DBI_select_db($source_db);
if (PMA_Table::_isView($source_db,$source_table)) {
if (PMA_Table::_isView($source_db, $source_table)) {
$sql_drop_query = 'DROP VIEW';
} else {
$sql_drop_query = 'DROP TABLE';
@ -902,7 +977,7 @@ class PMA_Table
}
$GLOBALS['sql_query'] .= "\n\n" . $sql_drop_query . ';';
// end if ($move)
// end if ($move)
} else {
// we are copying
// Create new entries as duplicates from old PMA DBs
@ -993,9 +1068,11 @@ class PMA_Table
* checks if given name is a valid table name,
* currently if not empty, trailing spaces, '.', '/' and '\'
*
* @todo add check for valid chars in filename on current system/os
* @see http://dev.mysql.com/doc/refman/5.0/en/legal-names.html
* @param string $table_name name to check
* @param string $table_name name to check
*
* @todo add check for valid chars in filename on current system/os
* @see http://dev.mysql.com/doc/refman/5.0/en/legal-names.html
*
* @return boolean whether the string is valid or not
*/
function isValidName($table_name)
@ -1021,10 +1098,11 @@ class PMA_Table
/**
* renames table
*
* @param string $new_name new table name
* @param string $new_db new database name
* @param bool $is_view is this for a VIEW rename?
* @return bool success
* @param string $new_name new table name
* @param string $new_db new database name
* @param bool $is_view is this for a VIEW rename?
*
* @return bool success
*/
function rename($new_name, $new_db = null, $is_view = false)
{
@ -1060,7 +1138,11 @@ class PMA_Table
}
// I don't think a specific error message for views is necessary
if (! PMA_DBI_query($GLOBALS['sql_query'])) {
$this->errors[] = sprintf(__('Error renaming table %1$s to %2$s'), $this->getFullName(), $new_table->getFullName());
$this->errors[] = sprintf(
__('Error renaming table %1$s to %2$s'),
$this->getFullName(),
$new_table->getFullName()
);
return false;
}
@ -1143,8 +1225,11 @@ class PMA_Table
unset($table_query);
}
$this->messages[] = sprintf(__('Table %s has been renamed to %s'),
htmlspecialchars($old_name), htmlspecialchars($new_name));
$this->messages[] = sprintf(
__('Table %s has been renamed to %s'),
htmlspecialchars($old_name),
htmlspecialchars($new_name)
);
return true;
}
@ -1160,8 +1245,8 @@ class PMA_Table
* - PRIMARY(fk_id1, fk_id2) // NONE
* - UNIQUE(x,y) // NONE
*
* @param bool $backquoted whether to quote name with backticks ``
*
* @param bool $backquoted whether to quote name with backticks ``
* @return array
*/
public function getUniqueColumns($backquoted = true)
@ -1174,7 +1259,8 @@ class PMA_Table
if (count($index) > 1) {
continue;
}
$return[] = $this->getFullName($backquoted) . '.' . ($backquoted ? PMA_backquote($index[0]) : $index[0]);
$return[] = $this->getFullName($backquoted) . '.'
. ($backquoted ? PMA_backquote($index[0]) : $index[0]);
}
return $return;
@ -1188,7 +1274,8 @@ class PMA_Table
*
* e.g. index(col1, col2) would only return col1
*
* @param bool $backquoted whether to quote name with backticks ``
* @param bool $backquoted whether to quote name with backticks ``
*
* @return array
*/
public function getIndexedColumns($backquoted = true)
@ -1198,7 +1285,8 @@ class PMA_Table
$return = array();
foreach ($indexed as $column) {
$return[] = $this->getFullName($backquoted) . '.' . ($backquoted ? PMA_backquote($column) : $column);
$return[] = $this->getFullName($backquoted) . '.'
. ($backquoted ? PMA_backquote($column) : $column);
}
return $return;
@ -1209,7 +1297,8 @@ class PMA_Table
*
* returns an array with all columns
*
* @param bool $backquoted whether to quote name with backticks ``
* @param bool $backquoted whether to quote name with backticks ``
*
* @return array
*/
public function getColumns($backquoted = true)
@ -1219,7 +1308,8 @@ class PMA_Table
$return = array();
foreach ($indexed as $column) {
$return[] = $this->getFullName($backquoted) . '.' . ($backquoted ? PMA_backquote($column) : $column);
$return[] = $this->getFullName($backquoted) . '.'
. ($backquoted ? PMA_backquote($column) : $column);
}
return $return;
@ -1228,7 +1318,6 @@ class PMA_Table
/**
* Return UI preferences for this table from phpMyAdmin database.
*
*
* @return array
*/
protected function getUiPrefsFromDb()
@ -1237,11 +1326,10 @@ class PMA_Table
PMA_backquote($GLOBALS['cfg']['Server']['table_uiprefs']);
// Read from phpMyAdmin database
$sql_query =
" SELECT `prefs` FROM " . $pma_table .
" WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'" .
" AND `db_name` = '" . PMA_sqlAddSlashes($this->db_name) . "'" .
" AND `table_name` = '" . PMA_sqlAddSlashes($this->name) . "'";
$sql_query = " SELECT `prefs` FROM " . $pma_table
. " WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'"
. " AND `db_name` = '" . PMA_sqlAddSlashes($this->db_name) . "'"
. " AND `table_name` = '" . PMA_sqlAddSlashes($this->name) . "'";
$row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
if (isset($row[0])) {
@ -1258,22 +1346,23 @@ class PMA_Table
*/
protected function saveUiPrefsToDb()
{
$pma_table = PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) .".".
PMA_backquote($GLOBALS['cfg']['Server']['table_uiprefs']);
$pma_table = PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) . "."
. PMA_backquote($GLOBALS['cfg']['Server']['table_uiprefs']);
$username = $GLOBALS['cfg']['Server']['user'];
$sql_query =
" REPLACE INTO " . $pma_table .
" VALUES ('" . $username . "', '" . PMA_sqlAddSlashes($this->db_name) . "', '" .
PMA_sqlAddSlashes($this->name) . "', '" .
PMA_sqlAddSlashes(json_encode($this->uiprefs)) . "', NULL)";
$sql_query = " REPLACE INTO " . $pma_table
. " VALUES ('" . $username . "', '" . PMA_sqlAddSlashes($this->db_name)
. "', '" . PMA_sqlAddSlashes($this->name) . "', '"
. PMA_sqlAddSlashes(json_encode($this->uiprefs)) . "', NULL)";
$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
if (!$success) {
$message = PMA_Message::error(__('Could not save table UI preferences'));
$message->addMessage('<br /><br />');
$message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
$message->addMessage(
PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink']))
);
return $message;
}
@ -1290,13 +1379,15 @@ class PMA_Table
$success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']);
if (!$success) {
$message = PMA_Message::error(sprintf(
__('Failed to cleanup table UI preferences (see $cfg[\'Servers\'][$i][\'MaxTableUiprefs\'] %s)'),
PMA_showDocu('cfg_Servers_MaxTableUiprefs')
));
$message = PMA_Message::error(
sprintf(
__('Failed to cleanup table UI preferences (see $cfg[\'Servers\'][$i][\'MaxTableUiprefs\'] %s)'),
PMA_showDocu('cfg_Servers_MaxTableUiprefs')
)
);
$message->addMessage('<br /><br />');
$message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
print_r($message);
print_r($message);
return $message;
}
}
@ -1309,6 +1400,7 @@ class PMA_Table
* If pmadb and table_uiprefs is set, it will load the UI preferences from
* phpMyAdmin database.
*
* @return nothing
*/
protected function loadUiPrefs()
{
@ -1316,10 +1408,11 @@ class PMA_Table
// set session variable if it's still undefined
if (! isset($_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name])) {
$_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name] =
// check whether we can get from pmadb
(strlen($GLOBALS['cfg']['Server']['pmadb'])
&& strlen($GLOBALS['cfg']['Server']['table_uiprefs'])) ?
$this->getUiPrefsFromDb() : array();
// check whether we can get from pmadb
(strlen($GLOBALS['cfg']['Server']['pmadb'])
&& strlen($GLOBALS['cfg']['Server']['table_uiprefs']))
? $this->getUiPrefsFromDb()
: array();
}
$this->uiprefs =& $_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name];
}
@ -1332,8 +1425,8 @@ class PMA_Table
* - PROP_COLUMN_ORDER
* - PROP_COLUMN_VISIB
*
* @param string $property property
*
* @param string $property
* @return mixed
*/
public function getUiProp($property)
@ -1350,8 +1443,7 @@ class PMA_Table
$avail_columns = $this->getColumns();
foreach ($avail_columns as $each_col) {
// check if $each_col ends with $colname
if (substr_compare($each_col, $colname,
strlen($each_col) - strlen($colname)) === 0) {
if (substr_compare($each_col, $colname, strlen($each_col) - strlen($colname)) === 0) {
return $this->uiprefs[$property];
}
}
@ -1361,12 +1453,12 @@ class PMA_Table
} else {
return false;
}
} else if ($property == self::PROP_COLUMN_ORDER ||
$property == self::PROP_COLUMN_VISIB) {
} elseif ($property == self::PROP_COLUMN_ORDER
|| $property == self::PROP_COLUMN_VISIB
) {
if (! PMA_Table::isView($this->db_name, $this->name) && isset($this->uiprefs[$property])) {
// check if the table has not been modified
if (self::sGetStatusInfo($this->db_name, $this->name, 'Create_time') ==
$this->uiprefs['CREATE_TIME']) {
if (self::sGetStatusInfo($this->db_name, $this->name, 'Create_time') == $this->uiprefs['CREATE_TIME']) {
return $this->uiprefs[$property];
} else {
// remove the property, since the table has been modified
@ -1390,9 +1482,10 @@ class PMA_Table
* - PROP_COLUMN_ORDER
* - PROP_COLUMN_VISIB
*
* @param string $property
* @param mixed $value
* @param string $property Property
* @param mixed $value Value for the property
* @param string $table_create_time Needed for PROP_COLUMN_ORDER and PROP_COLUMN_VISIB
*
* @return boolean|PMA_Message
*/
public function setUiProp($property, $value, $table_create_time = null)
@ -1401,12 +1494,13 @@ class PMA_Table
$this->loadUiPrefs();
}
// we want to save the create time if the property is PROP_COLUMN_ORDER
if (! PMA_Table::isView($this->db_name, $this->name) && ($property == self::PROP_COLUMN_ORDER ||
$property == self::PROP_COLUMN_VISIB)) {
if (! PMA_Table::isView($this->db_name, $this->name)
&& ($property == self::PROP_COLUMN_ORDER || $property == self::PROP_COLUMN_VISIB)
) {
$curr_create_time = self::sGetStatusInfo($this->db_name, $this->name, 'CREATE_TIME');
if (isset($table_create_time) &&
$table_create_time == $curr_create_time) {
if (isset($table_create_time)
&& $table_create_time == $curr_create_time
) {
$this->uiprefs['CREATE_TIME'] = $curr_create_time;
} else {
// there is no $table_create_time, or
@ -1419,7 +1513,8 @@ class PMA_Table
$this->uiprefs[$property] = $value;
// check if pmadb is set
if (strlen($GLOBALS['cfg']['Server']['pmadb'])
&& strlen($GLOBALS['cfg']['Server']['table_uiprefs'])) {
&& strlen($GLOBALS['cfg']['Server']['table_uiprefs'])
) {
return $this->saveUiprefsToDb();
}
return true;
@ -1428,7 +1523,8 @@ class PMA_Table
/**
* Remove a property from UI preferences.
*
* @param string $property
* @param string $property the property
*
* @return true|PMA_Message
*/
public function removeUiProp($property)
@ -1440,7 +1536,8 @@ class PMA_Table
unset($this->uiprefs[$property]);
// check if pmadb is set
if (strlen($GLOBALS['cfg']['Server']['pmadb'])
&& strlen($GLOBALS['cfg']['Server']['table_uiprefs'])) {
&& strlen($GLOBALS['cfg']['Server']['table_uiprefs'])
) {
return $this->saveUiprefsToDb();
}
}

View File

@ -71,6 +71,7 @@ class PMA_Tracker
*
* @static
*
* @return nothing
*/
static public function init()
{
@ -86,15 +87,15 @@ class PMA_Tracker
self::$default_tracking_set = $GLOBALS['cfg']['Server']['tracking_default_statements'];
self::$version_auto_create = $GLOBALS['cfg']['Server']['tracking_version_auto_create'];
}
/**
* Actually enables tracking. This needs to be done after all
* Actually enables tracking. This needs to be done after all
* underlaying code is initialized.
*
* @static
*
* @return nothing
*/
static public function enable()
{
@ -133,9 +134,9 @@ class PMA_Tracker
/**
* Parses the name of a table from a SQL statement substring.
*
* @static
* @param string $string part of SQL statement
*
* @param string $string part of SQL statement
* @static
*
* @return string the name of table
*/
@ -144,8 +145,7 @@ class PMA_Tracker
if (strstr($string, '.')) {
$temp = explode('.', $string);
$tablename = $temp[1];
}
else {
} else {
$tablename = $string;
}
@ -163,10 +163,10 @@ class PMA_Tracker
/**
* Gets the tracking status of a table, is it active or deactive ?
*
* @static
* @param string $dbname name of database
* @param string $tablename name of table
*
* @param string $dbname name of database
* @param string $tablename name of table
* @static
*
* @return boolean true or false
*/
@ -184,8 +184,7 @@ class PMA_Tracker
return false;
}
$sql_query =
" SELECT tracking_active FROM " . self::$pma_table .
$sql_query = " SELECT tracking_active FROM " . self::$pma_table .
" WHERE db_name = '" . PMA_sqlAddSlashes($dbname) . "' " .
" AND table_name = '" . PMA_sqlAddSlashes($tablename) . "' " .
" ORDER BY version DESC";
@ -215,14 +214,14 @@ class PMA_Tracker
* Creates tracking version of a table / view
* (in other words: create a job to track future changes on the table).
*
* @static
*
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version
* @param string $tracking_set set of tracking statements
* @param bool $is_view if table is a view
*
* @static
*
* @return int result of version insertion
*/
static public function createVersion($dbname, $tablename, $version, $tracking_set = '', $is_view = false)
@ -233,7 +232,7 @@ class PMA_Tracker
$tracking_set = self::$default_tracking_set;
}
require_once './libraries/export/sql.php';
include_once './libraries/export/sql.php';
$sql_backquotes = true;
@ -256,7 +255,7 @@ class PMA_Tracker
$indexes = array();
while($row = PMA_DBI_fetch_assoc($sql_result)) {
while ($row = PMA_DBI_fetch_assoc($sql_result)) {
$indexes[] = $row;
}
@ -284,8 +283,7 @@ class PMA_Tracker
// Save version
$sql_query =
"/*NOTRACK*/\n" .
$sql_query = "/*NOTRACK*/\n" .
"INSERT INTO" . self::$pma_table . " (" .
"db_name, " .
"table_name, " .
@ -320,19 +318,18 @@ class PMA_Tracker
/**
* Removes all tracking data for a table
* Removes all tracking data for a table
*
* @param string $dbname name of database
* @param string $tablename name of table
*
* @static
*
* @param string $dbname name of database
* @param string $tablename name of table
*
* @return int result of version insertion
*/
static public function deleteTracking($dbname, $tablename)
{
$sql_query =
"/*NOTRACK*/\n" .
$sql_query = "/*NOTRACK*/\n" .
"DELETE FROM " . self::$pma_table . " WHERE `db_name` = '" . PMA_sqlAddSlashes($dbname) . "' AND `table_name` = '" . PMA_sqlAddSlashes($tablename) . "'";
$result = PMA_query_as_controluser($sql_query);
@ -343,13 +340,13 @@ class PMA_Tracker
* Creates tracking version of a database
* (in other words: create a job to track future changes on the database).
*
* @static
*
* @param string $dbname name of database
* @param string $version version
* @param string $query query
* @param string $tracking_set set of tracking statements
*
* @static
*
* @return int result of version insertion
*/
static public function createDatabaseVersion($dbname, $version, $query, $tracking_set = 'CREATE DATABASE,ALTER DATABASE,DROP DATABASE')
@ -360,7 +357,7 @@ class PMA_Tracker
$tracking_set = self::$default_tracking_set;
}
require_once './libraries/export/sql.php';
include_once './libraries/export/sql.php';
$create_sql = "";
@ -372,8 +369,7 @@ class PMA_Tracker
$create_sql .= self::getLogComment() . $query;
// Save version
$sql_query =
"/*NOTRACK*/\n" .
$sql_query = "/*NOTRACK*/\n" .
"INSERT INTO" . self::$pma_table . " (" .
"db_name, " .
"table_name, " .
@ -406,19 +402,18 @@ class PMA_Tracker
/**
* Changes tracking of a table.
*
* @static
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version
* @param integer $new_state the new state of tracking
*
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version
* @param integer $new_state the new state of tracking
* @static
*
* @return int result of SQL query
*/
static private function changeTracking($dbname, $tablename, $version, $new_state)
static private function _changeTracking($dbname, $tablename, $version, $new_state)
{
$sql_query =
" UPDATE " . self::$pma_table .
$sql_query = " UPDATE " . self::$pma_table .
" SET `tracking_active` = '" . $new_state . "' " .
" WHERE `db_name` = '" . PMA_sqlAddSlashes($dbname) . "' " .
" AND `table_name` = '" . PMA_sqlAddSlashes($tablename) . "' " .
@ -432,38 +427,38 @@ class PMA_Tracker
/**
* Changes tracking data of a table.
*
* @static
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version
* @param string $type type of data(DDL || DML)
* @param string|array $new_data the new tracking data
*
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version
* @param string $type type of data(DDL || DML)
* @param string|array $new_data the new tracking data
* @static
*
* @return bool result of change
*/
static public function changeTrackingData($dbname, $tablename, $version, $type, $new_data)
{
if ($type == 'DDL')
if ($type == 'DDL') {
$save_to = 'schema_sql';
elseif ($type == 'DML')
} elseif ($type == 'DML') {
$save_to = 'data_sql';
else
} else {
return false;
}
$date = date('Y-m-d H:i:s');
$new_data_processed = '';
if (is_array($new_data)) {
foreach ($new_data as $data) {
$new_data_processed .= '# log ' . $date . ' ' . $data['username'] . PMA_sqlAddSlashes($data['statement']) . "\n";
$new_data_processed .= '# log ' . $date . ' ' . $data['username']
. PMA_sqlAddSlashes($data['statement']) . "\n";
}
} else {
$new_data_processed = $new_data;
}
$sql_query =
" UPDATE " . self::$pma_table .
$sql_query = " UPDATE " . self::$pma_table .
" SET `" . $save_to . "` = '" . $new_data_processed . "' " .
" WHERE `db_name` = '" . PMA_sqlAddSlashes($dbname) . "' " .
" AND `table_name` = '" . PMA_sqlAddSlashes($tablename) . "' " .
@ -477,34 +472,34 @@ class PMA_Tracker
/**
* Activates tracking of a table.
*
* @static
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version
*
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version
* @static
*
* @return int result of SQL query
*/
static public function activateTracking($dbname, $tablename, $version)
{
return self::changeTracking($dbname, $tablename, $version, 1);
return self::_changeTracking($dbname, $tablename, $version, 1);
}
/**
* Deactivates tracking of a table.
*
* @static
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version
*
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version
* @static
*
* @return int result of SQL query
*/
static public function deactivateTracking($dbname, $tablename, $version)
{
return self::changeTracking($dbname, $tablename, $version, 0);
return self::_changeTracking($dbname, $tablename, $version, 0);
}
@ -512,18 +507,17 @@ class PMA_Tracker
* Gets the newest version of a tracking job
* (in other words: gets the HEAD version).
*
* @static
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $statement tracked statement
*
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $statement tracked statement
* @static
*
* @return int (-1 if no version exists | > 0 if a version exists)
*/
static public function getVersion($dbname, $tablename, $statement = null)
{
$sql_query =
" SELECT MAX(version) FROM " . self::$pma_table .
$sql_query = " SELECT MAX(version) FROM " . self::$pma_table .
" WHERE `db_name` = '" . PMA_sqlAddSlashes($dbname) . "' " .
" AND `table_name` = '" . PMA_sqlAddSlashes($tablename) . "' ";
@ -540,11 +534,11 @@ class PMA_Tracker
/**
* Gets the record of a tracking job.
*
* @static
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version number
*
* @param string $dbname name of database
* @param string $tablename name of table
* @param string $version version number
* @static
*
* @return mixed record DDM log, DDL log, structure snapshot, tracked statements.
*/
@ -644,12 +638,12 @@ class PMA_Tracker
* - type of statement, is it part of DDL or DML ?
* - tablename
*
* @param string $query query
*
* @static
* @todo: using PMA SQL Parser when possible
* @todo: support multi-table/view drops
*
* @param string $query
*
* @return mixed Array containing identifier, type and tablename.
*
*/
@ -684,9 +678,10 @@ class PMA_Tracker
$result['type'] = 'DDL';
// Parse CREATE VIEW statement
if (in_array('CREATE', $tokens) == true &&
in_array('VIEW', $tokens) == true &&
in_array('AS', $tokens) == true) {
if (in_array('CREATE', $tokens) == true
&& in_array('VIEW', $tokens) == true
&& in_array('AS', $tokens) == true
) {
$result['identifier'] = 'CREATE VIEW';
$index = array_search('VIEW', $tokens);
@ -695,10 +690,11 @@ class PMA_Tracker
}
// Parse ALTER VIEW statement
if (in_array('ALTER', $tokens) == true &&
in_array('VIEW', $tokens) == true &&
in_array('AS', $tokens) == true &&
! isset($result['identifier'])) {
if (in_array('ALTER', $tokens) == true
&& in_array('VIEW', $tokens) == true
&& in_array('AS', $tokens) == true
&& ! isset($result['identifier'])
) {
$result['identifier'] = 'ALTER VIEW';
$index = array_search('VIEW', $tokens);
@ -778,11 +774,10 @@ class PMA_Tracker
}
// Parse CREATE INDEX statement
if (! isset($result['identifier']) &&
( substr($query, 0, 12) == 'CREATE INDEX' ||
substr($query, 0, 19) == 'CREATE UNIQUE INDEX' ||
substr($query, 0, 20) == 'CREATE SPATIAL INDEX'
)
if (! isset($result['identifier'])
&& (substr($query, 0, 12) == 'CREATE INDEX'
|| substr($query, 0, 19) == 'CREATE UNIQUE INDEX'
|| substr($query, 0, 20) == 'CREATE SPATIAL INDEX')
) {
$result['identifier'] = 'CREATE INDEX';
$prefix = explode('ON ', $query);
@ -822,7 +817,7 @@ class PMA_Tracker
}
// Parse INSERT INTO statement
if (! isset($result['identifier']) && substr($query, 0, 11 ) == 'INSERT INTO') {
if (! isset($result['identifier']) && substr($query, 0, 11) == 'INSERT INTO') {
$result['identifier'] = 'INSERT';
$prefix = explode('INSERT INTO', $query);
$suffix = explode('(', $prefix[1]);
@ -830,7 +825,7 @@ class PMA_Tracker
}
// Parse DELETE statement
if (! isset($result['identifier']) && substr($query, 0, 6 ) == 'DELETE') {
if (! isset($result['identifier']) && substr($query, 0, 6) == 'DELETE') {
$result['identifier'] = 'DELETE';
$prefix = explode('FROM ', $query);
$suffix = explode(' ', $prefix[1]);
@ -838,7 +833,7 @@ class PMA_Tracker
}
// Parse TRUNCATE statement
if (! isset($result['identifier']) && substr($query, 0, 8 ) == 'TRUNCATE') {
if (! isset($result['identifier']) && substr($query, 0, 8) == 'TRUNCATE') {
$result['identifier'] = 'TRUNCATE';
$prefix = explode('TRUNCATE', $query);
$result['tablename'] = self::getTableName($prefix[1]);
@ -851,8 +846,11 @@ class PMA_Tracker
/**
* Analyzes a given SQL statement and saves tracking data.
*
* @static
* @param string $query a SQL query
*
* @static
*
* @return nothing
*/
static public function handleQuery($query)
{
@ -881,8 +879,9 @@ class PMA_Tracker
// If version not exists and auto-creation is enabled
if (self::$version_auto_create == true
&& self::isTracked($dbname, $result['tablename']) == false
&& $version == -1) {
&& self::isTracked($dbname, $result['tablename']) == false
&& $version == -1
) {
// Create the version
switch ($result['identifier']) {
@ -916,11 +915,10 @@ class PMA_Tracker
$query = self::getLogComment() . $query ;
// Mark it as untouchable
$sql_query =
" /*NOTRACK*/\n" .
$sql_query = " /*NOTRACK*/\n" .
" UPDATE " . self::$pma_table .
" SET " . PMA_backquote($save_to) ." = CONCAT( " . PMA_backquote($save_to) . ",'\n" . PMA_sqlAddSlashes($query) . "') ," .
" `date_updated` = '" . $date . "' ";
" SET " . PMA_backquote($save_to) ." = CONCAT( " . PMA_backquote($save_to) . ",'\n"
. PMA_sqlAddSlashes($query) . "') ," . " `date_updated` = '" . $date . "' ";
// If table was renamed we have to change the tablename attribute in pma_tracking too
if ($result['identifier'] == 'RENAME TABLE') {

View File

@ -74,9 +74,9 @@ rule 'Slow query logging'
#
# versions
rule 'Release Series'
rule 'Release Series' [!PMA_DRIZZLE]
version
!PMA_DRIZZLE && substr(value,0,1) <= 5 && substr(value,2,1) < 1
substr(value,0,1) <= 5 && substr(value,2,1) < 1
The MySQL server version less then 5.1.
You should upgrade, as MySQL 5.1 has improved performance, and MySQL 5.5 even more so.
Current version: %s | value
@ -111,7 +111,7 @@ rule 'Distribution'
rule 'MySQL Architecture'
system_memory
value > 3072*1024 && !preg_match('/64/',version_compile_machine)
value > 3072*1024 && !preg_match('/64/',version_compile_machine) && !preg_match('/64/',version_compile_os)
MySQL is not compiled as a 64-bit package.
Your memory capacity is above 3 GiB (assuming the Server is on localhost), so MySQL might not be able to access all of your memory. You might want to consider installing the 64-bit version of MySQL.
Available memory on this host: %s | implode(' ',PMA_formatByteDown(value*1024, 2, 2))
@ -131,7 +131,7 @@ rule 'Query caching method' [!fired('Query cache disabled')]
Questions / Uptime
value > 100
Suboptimal caching method.
You are using the MySQL Query cache with a fairly high traffic database. It might be worth considering to use <a href="http://dev.mysql.com/doc/refman/5.1/en/ha-memcached.html">memcached</a> instead of the MySQL Query cache, especially if you have multiple slaves.
You are using the MySQL Query cache with a fairly high traffic database. It might be worth considering to use <a href="http://dev.mysql.com/doc/refman/5.5/en/ha-memcached.html">memcached</a> instead of the MySQL Query cache, especially if you have multiple slaves.
The query cache is enabled and the server receives %d queries per second. This rule fires if there is more than 100 queries per second. | round(value,1)
rule 'Query cache efficiency (%)' [Com_select + Qcache_hits > 0 && !fired('Query cache disabled')]
@ -247,19 +247,19 @@ rule 'Temp disk rate'
Created_tmp_disk_tables / Uptime
value * 60 * 60 > 1
Many temporary tables are being written to disk instead of being kept in memory.
Increasing {max_heap_table_size} and {tmp_table_size} might help. However some temporary tables are always being written to disk, independent of the value of these variables. To eliminate these you will have to rewrite your queries to avoid those conditions (Within a temprorary table: Presence of a BLOB or TEXT column or presence of a column bigger than 512 bytes) as mentioned in in the <a href="http://dev.mysql.com/doc/refman/5.0/en/internal-temporary-tables.html">MySQL Documentation</a>
Increasing {max_heap_table_size} and {tmp_table_size} might help. However some temporary tables are always being written to disk, independent of the value of these variables. To eliminate these you will have to rewrite your queries to avoid those conditions (Within a temprorary table: Presence of a BLOB or TEXT column or presence of a column bigger than 512 bytes) as mentioned in in the <a href="http://dev.mysql.com/doc/refman/5.5/en/internal-temporary-tables.html">MySQL Documentation</a>
Rate of temporay tables being written to disk: %s, this value should be less than 1 per hour | PMA_bytime(value,2)
# I couldn't find any source on the internet that suggests a direct relation between high counts of temporary tables and any of these variables.
# Several independent Blog entries suggest (http://ronaldbradford.com/blog/more-on-understanding-sort_buffer_size-2010-05-10/ and http://www.xaprb.com/blog/2010/05/09/how-to-tune-mysqls-sort_buffer_size/)
# that sort_buffer_size should be left as it is. And increasing read_buffer_size is only suggested when there are a lot of
# table scans (http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_read_buffer_size and other sources) though
# table scans (http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_read_buffer_size and other sources) though
# setting it too high is bad too (http://www.mysqlperformanceblog.com/2007/09/17/mysql-what-read_buffer_size-value-is-optimal/).
#rule 'Temp table rate'
# Created_tmp_tables / Uptime
# value * 60 * 60 > 1
# Many intermediate temporary tables are being created.
# This may be caused by queries under certain conditions as mentioned in the <a href="http://dev.mysql.com/doc/refman/5.0/en/internal-temporary-tables.html">MySQL Documentation</a>. Consider increasing {sort_buffer_size} (sorting), {read_rnd_buffer_size} (random read buffer, ie, post-sort), {read_buffer_size} (sequential scan).
# This may be caused by queries under certain conditions as mentioned in the <a href="http://dev.mysql.com/doc/refman/5.5/en/internal-temporary-tables.html">MySQL Documentation</a>. Consider increasing {sort_buffer_size} (sorting), {read_rnd_buffer_size} (random read buffer, ie, post-sort), {read_buffer_size} (sequential scan).
#
# MyISAM index cache
@ -428,9 +428,9 @@ rule 'InnoDB buffer pool size' [system_memory > 0]
# other
rule 'MyISAM concurrent inserts'
concurrent_insert
value == 0
value === 0 || value === 'NEVER'
Enable concurrent_insert by setting it to 1
Setting {concurrent_insert} to 1 reduces contention between readers and writers for a given table. See also <a href="http://dev.mysql.com/doc/refman/5.0/en/concurrent-inserts.html">MySQL Documentation</a>
Setting {concurrent_insert} to 1 reduces contention between readers and writers for a given table. See also <a href="http://dev.mysql.com/doc/refman/5.5/en/concurrent-inserts.html">MySQL Documentation</a>
concurrent_insert is set to 0
# INSERT DELAYED USAGE

View File

@ -708,13 +708,27 @@ function PMA_includeJS($url)
}
/**
* Adds JS code snippets to be displayed by header.inc.php. Adds a newline to each snippet.
* Adds JS code snippets to be displayed by header.inc.php. Adds a
* newline to each snippet.
*
* @param string $str Js code to be added (e.g. "token=1234;")
*
*/
function PMA_AddJSCode($str) {
function PMA_AddJSCode($str)
{
$GLOBALS['js_script'][] = $str;
}
/**
* Adds JS code snippet for variable assignment to be displayed by header.inc.php.
*
* @param string $key Name of value to set
* @param mixed $value Value to set, can be either string or array of strings
*
*/
function PMA_AddJSVar($key, $value)
{
PMA_AddJsCode(PMA_getJsValue($key, $value));
}
?>

View File

@ -578,8 +578,10 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
echo '<input id="col_visib" type="hidden" value="' . implode(',', $col_visib) . '" />';
}
// generate table create time
echo '<input id="table_create_time" type="hidden" value="' .
PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Create_time') . '" />';
if (! PMA_Table::isView($GLOBALS['table'], $GLOBALS['db'])) {
echo '<input id="table_create_time" type="hidden" value="' .
PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Create_time') . '" />';
}
}

View File

@ -56,25 +56,64 @@ function PMA_escapeJsString($string)
"\r" => '\r')));
}
/**
* Formats a value for javascript code.
*
* @param string $value String to be formatted.
*
* @retrun string formatted value.
*/
function PMA_formatJsVal($value)
{
if (is_bool($value)) {
if ($value) {
return 'true';
} else {
return 'false';
}
} elseif (is_int($value)) {
return (int)$value;
} else {
return '"' . PMA_escapeJsString($value) . '"';
}
}
/**
* Formats an javascript assignment with proper escaping of a value
* and support for assigning array of strings.
*
* @param string $key Name of value to set
* @param mixed $value Value to set, can be either string or array of strings
*
* @return string Javascript code.
*/
function PMA_getJsValue($key, $value)
{
$result = $key . ' = ';
if (is_array($value)) {
$result .= '[';
foreach ($value as $id => $val) {
$result .= PMA_formatJsVal($value) . ",";
}
$result .= "];\n";
} else {
$result .= PMA_formatJsVal($value) . ";\n";
}
return $result;
}
/**
* Prints an javascript assignment with proper escaping of a value
* and support for assigning array of strings.
*
* @param string $key Name of value to set
* @param mixed $value Value to set, can be either string or array of strings
*
* @return nothing
*/
function PMA_printJsValue($key, $value)
{
echo $key . ' = ';
if (is_array($value)) {
echo '[';
foreach ($value as $id => $val) {
echo "'" . PMA_escapeJsString($val) . "',";
}
echo "];\n";
} else {
echo "'" . PMA_escapeJsString($value) . "';\n";
}
echo PMA_getJsValue($key, $value);
}
?>

View File

@ -298,21 +298,14 @@ function PMA_replication_synchronize_db($db, $src_link, $trg_link, $data = true)
{
$src_db = $trg_db = $db;
$src_connection = PMA_DBI_select_db($src_db, $src_link);
$trg_connection = PMA_DBI_select_db($trg_db, $trg_link);
$src_tables = PMA_DBI_get_tables($src_db, $src_link);
$source_tables_num = sizeof($src_tables);
$trg_tables = PMA_DBI_get_tables($trg_db, $trg_link);
$target_tables_num = sizeof($trg_tables);
/**
* initializing arrays to save table names
*/
$unmatched_num_src = 0;
$source_tables_uncommon = array();
$unmatched_num_trg = 0;
$target_tables_uncommon = array();
$matching_tables = array();
$matching_tables_num = 0;
@ -367,6 +360,7 @@ function PMA_replication_synchronize_db($db, $src_link, $trg_link, $data = true)
$source_indexes = array();
$target_indexes = array();
$add_indexes_array = array();
$alter_indexes_array = array();
$remove_indexes_array = array();
$criteria = array('Field', 'Type', 'Null', 'Collation', 'Key', 'Default', 'Comment');
@ -378,17 +372,11 @@ function PMA_replication_synchronize_db($db, $src_link, $trg_link, $data = true)
$add_indexes_array, $alter_indexes_array,$remove_indexes_array, $counter);
}
$matching_table_data_diff = array();
$matching_table_structure_diff = array();
$uncommon_table_structure_diff = array();
$uncommon_table_data_diff = array();
$uncommon_tables = $source_tables_uncommon;
/**
* Generating Create Table query for all the non-matching tables present in Source but not in Target and populating tables.
*/
for ($q = 0; $q < sizeof($source_tables_uncommon); $q++) {
if (isset($uncommon_tables[$q])) {
if (isset($source_tables_uncommon[$q])) {
PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link, $source_tables_uncommon, $q, $uncommon_tables_fields, false);
}
if (isset($row_count[$q]) && $data) {

View File

@ -5,7 +5,7 @@
* @package phpMyAdmin
*/
include_once("Export_Relation_Schema.class.php");
include_once "Export_Relation_Schema.class.php";
/**
* This Class inherits the XMLwriter class and
@ -14,7 +14,6 @@ include_once("Export_Relation_Schema.class.php");
* @access public
* @see http://php.net/manual/en/book.xmlwriter.php
*/
class PMA_DIA extends XMLWriter
{
public $title;
@ -44,7 +43,7 @@ class PMA_DIA extends XMLWriter
* Create the XML document
*/
$this->startDocument('1.0','UTF-8');
$this->startDocument('1.0', 'UTF-8');
}
/**
@ -55,27 +54,29 @@ class PMA_DIA extends XMLWriter
* to define the document, then finally a Layer starts which
* holds all the objects.
*
* @param string paper The size of the paper/document
* @param float topMargin top margin of the paper/document in cm
* @param float bottomMargin bottom margin of the paper/document in cm
* @param float leftMargin left margin of the paper/document in cm
* @param float rightMargin right margin of the paper/document in cm
* @param string portrait document will be portrait or landscape
* @param string $paper the size of the paper/document
* @param float $topMargin top margin of the paper/document in cm
* @param float $bottomMargin bottom margin of the paper/document in cm
* @param float $leftMargin left margin of the paper/document in cm
* @param float $rightMargin right margin of the paper/document in cm
* @param string $portrait document will be portrait or landscape
*
* @return void
*
* @access public
* @see XMLWriter::startElement(),XMLWriter::writeAttribute(),XMLWriter::writeRaw()
*/
function startDiaDoc($paper,$topMargin,$bottomMargin,$leftMargin,$rightMargin,$portrait)
{
if($portrait == 'P'){
if ($portrait == 'P') {
$isPortrait='true';
}else{
} else {
$isPortrait='false';
}
$this->startElement('dia:diagram');
$this->writeAttribute('xmlns:dia', 'http://www.lysator.liu.se/~alla/dia/');
$this->startElement('dia:diagramdata');
$this->writeRaw (
$this->writeRaw(
'<dia:attribute name="background">
<dia:color val="#ffffff"/>
</dia:attribute>
@ -85,22 +86,22 @@ class PMA_DIA extends XMLWriter
<dia:attribute name="paper">
<dia:composite type="paper">
<dia:attribute name="name">
<dia:string>#'.$paper.'#</dia:string>
<dia:string>#' . $paper . '#</dia:string>
</dia:attribute>
<dia:attribute name="tmargin">
<dia:real val="'.$topMargin.'"/>
<dia:real val="' . $topMargin . '"/>
</dia:attribute>
<dia:attribute name="bmargin">
<dia:real val="'.$bottomMargin.'"/>
<dia:real val="' . $bottomMargin . '"/>
</dia:attribute>
<dia:attribute name="lmargin">
<dia:real val="'.$leftMargin.'"/>
<dia:real val="' . $leftMargin . '"/>
</dia:attribute>
<dia:attribute name="rmargin">
<dia:real val="'.$rightMargin.'"/>
<dia:real val="' . $rightMargin . '"/>
</dia:attribute>
<dia:attribute name="is_portrait">
<dia:boolean val="'.$isPortrait.'"/>
<dia:boolean val="' . $isPortrait . '"/>
</dia:attribute>
<dia:attribute name="scaling">
<dia:real val="1"/>
@ -160,18 +161,21 @@ class PMA_DIA extends XMLWriter
/**
* Output Dia Document for download
*
* @param string fileName name of the dia document
* @param string $fileName name of the dia document
*
* @return void
* @access public
* @see XMLWriter::flush()
*/
function showOutput($fileName)
{
if(ob_get_clean()){
if (ob_get_clean()) {
ob_end_clean();
}
$output = $this->flush();
PMA_download_header($fileName . '.dia', 'application/x-dia-diagram', strlen($output));
PMA_download_header(
$fileName . '.dia', 'application/x-dia-diagram', strlen($output)
);
print $output;
}
}
@ -200,14 +204,17 @@ class Table_Stats
/**
* The "Table_Stats" constructor
*
* @param string table_name The table name
* @param integer pageNumber The current page number (from the
* $cfg['Servers'][$i]['table_coords'] table)
* @param boolean showKeys Whether to display ONLY keys or not
* @param string $tableName The table name
* @param integer $pageNumber The current page number (from the
* $cfg['Servers'][$i]['table_coords'] table)
* @param boolean $showKeys Whether to display ONLY keys or not
*
* @return void
*
* @global object The current dia document
* @global array The relations settings
* @global string The current db name
*
* @see PMA_DIA
*/
function __construct($tableName, $pageNumber, $showKeys = false)
@ -218,7 +225,10 @@ class Table_Stats
$sql = 'DESCRIBE ' . PMA_backquote($tableName);
$result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
$dia->dieSchema($pageNumber,"DIA",sprintf(__('The %s table doesn\'t exist!'), $tableName));
$dia->dieSchema(
$pageNumber, "DIA",
sprintf(__('The %s table doesn\'t exist!'), $tableName)
);
}
/*
* load fields
@ -228,7 +238,10 @@ class Table_Stats
$indexes = PMA_Index::getFromTable($this->tableName, $db);
$all_columns = array();
foreach ($indexes as $index) {
$all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
$all_columns = array_merge(
$all_columns,
array_flip(array_keys($index->getColumns()))
);
}
$this->fields = array_keys($all_columns);
} else {
@ -238,13 +251,21 @@ class Table_Stats
}
$sql = 'SELECT x, y FROM '
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.'
. PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddSlashes($tableName) . '\''
. ' AND pdf_page_number = ' . $pageNumber;
$result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
$dia->dieSchema($pageNumber,"DIA",sprintf(__('Please configure the coordinates for table %s'), $tableName));
if (! $result || ! PMA_DBI_num_rows($result)) {
$dia->dieSchema(
$pageNumber,
"DIA",
sprintf(
__('Please configure the coordinates for table %s'),
$tableName
)
);
}
list($this->x, $this->y) = PMA_DBI_fetch_row($result);
$this->x = (double) $this->x;
@ -256,7 +277,11 @@ class Table_Stats
/*
* index
*/
$result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query(
'SHOW INDEX FROM ' . PMA_backquote($tableName) . ';',
null,
PMA_DBI_QUERY_STORE
);
if (PMA_DBI_num_rows($result) > 0) {
while ($row = PMA_DBI_fetch_assoc($result)) {
if ($row['Key_name'] == 'PRIMARY') {
@ -280,13 +305,15 @@ class Table_Stats
* is used to generate the XML of Dia Document. Database Table
* Object and their attributes are involved in the combination
* of displaing Database - Table on Dia Document.
* @param boolean changeColor Whether to show color for tables text or not
if changeColor is true then an array of $listOfColors
will be used to choose the random colors for tables text
we can change/add more colors to this array
@return void
* @global object The current Dia document
*
* @param boolean $changeColor Whether to show color for tables text or not
* if changeColor is true then an array of $listOfColors will be used to choose
* the random colors for tables text we can change/add more colors to this array
*
* @return void
*
* @global object The current Dia document
*
* @access public
* @see PMA_DIA
*/
@ -301,7 +328,7 @@ class Table_Stats
'00FF00'
);
shuffle($listOfColors);
$this->tableColor = '#'.$listOfColors[0].'';
$this->tableColor = '#' . $listOfColors[0] . '';
} else {
$this->tableColor = '#000000';
}
@ -311,19 +338,22 @@ class Table_Stats
$dia->startElement('dia:object');
$dia->writeAttribute('type', 'Database - Table');
$dia->writeAttribute('version', '0');
$dia->writeAttribute('id', ''.$this->tableId.'');
$dia->writeAttribute('id', '' . $this->tableId . '');
$dia->writeRaw(
'<dia:attribute name="obj_pos">
<dia:point val="'.($this->x * $factor).','.($this->y * $factor).'"/>
<dia:point val="'
. ($this->x * $factor) . ',' . ($this->y * $factor) . '"/>
</dia:attribute>
<dia:attribute name="obj_bb">
<dia:rectangle val="'.($this->x * $factor).','.($this->y * $factor).';9.97,9.2"/>
<dia:rectangle val="'
.($this->x * $factor) . ',' . ($this->y * $factor) . ';9.97,9.2"/>
</dia:attribute>
<dia:attribute name="meta">
<dia:composite type="dict"/>
</dia:attribute>
<dia:attribute name="elem_corner">
<dia:point val="'.($this->x * $factor).','.($this->y * $factor).'"/>
<dia:point val="'
. ($this->x * $factor) . ',' . ($this->y * $factor) . '"/>
</dia:attribute>
<dia:attribute name="elem_width">
<dia:real val="5.9199999999999999"/>
@ -332,7 +362,7 @@ class Table_Stats
<dia:real val="3.5"/>
</dia:attribute>
<dia:attribute name="text_colour">
<dia:color val="'.$this->tableColor.'"/>
<dia:color val="' . $this->tableColor . '"/>
</dia:attribute>
<dia:attribute name="line_colour">
<dia:color val="#000000"/>
@ -344,7 +374,7 @@ class Table_Stats
<dia:real val="0.10000000000000001"/>
</dia:attribute>
<dia:attribute name="name">
<dia:string>#'.$this->tableName.'#</dia:string>
<dia:string>#' . $this->tableName . '#</dia:string>
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
@ -379,44 +409,44 @@ class Table_Stats
<dia:attribute name="comment_font_height">
<dia:real val="0.69999999999999996"/>
</dia:attribute>'
);
);
$dia->startElement('dia:attribute');
$dia->writeAttribute('name', 'attributes');
foreach ($this->fields as $field) {
$dia->writeRaw(
'<dia:composite type="table_attribute">
<dia:attribute name="name">
<dia:string>#'.$field.'#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>##</dia:string>
</dia:attribute>
<dia:attribute name="comment">
$dia->writeRaw(
'<dia:composite type="table_attribute">
<dia:attribute name="name">
<dia:string>#' . $field . '#</dia:string>
</dia:attribute>
<dia:attribute name="type">
<dia:string>##</dia:string>
</dia:attribute>'
);
unset($pm);
$pm = 'false';
if (in_array($field, $this->primary)) {
$pm = 'true';
}
if ($field == $this->displayfield) {
$pm = 'false';
}
$dia->writeRaw(
'<dia:attribute name="primary_key">
<dia:boolean val="'.$pm.'"/>
</dia:attribute>
<dia:attribute name="nullable">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="unique">
<dia:boolean val="'.$pm.'"/>
</dia:attribute>
</dia:composite>'
);
</dia:attribute>
<dia:attribute name="comment">
<dia:string>##</dia:string>
</dia:attribute>'
);
unset($pm);
$pm = 'false';
if (in_array($field, $this->primary)) {
$pm = 'true';
}
if ($field == $this->displayfield) {
$pm = 'false';
}
$dia->writeRaw(
'<dia:attribute name="primary_key">
<dia:boolean val="' . $pm . '"/>
</dia:attribute>
<dia:attribute name="nullable">
<dia:boolean val="false"/>
</dia:attribute>
<dia:attribute name="unique">
<dia:boolean val="' . $pm . '"/>
</dia:attribute>
</dia:composite>'
);
}
$dia->endElement();
$dia->endElement();
@ -452,11 +482,13 @@ class Relation_Stats
/**
* The "Relation_Stats" constructor
*
* @param string master_table The master table name
* @param string master_field The relation field in the master table
* @param string foreign_table The foreign table name
* @param string foreigh_field The relation field in the foreign table
* @param string $master_table The master table name
* @param string $master_field The relation field in the master table
* @param string $foreign_table The foreign table name
* @param string $foreign_field The relation field in the foreign table
*
* @return void
*
* @see Relation_Stats::_getXy
*/
function __construct($master_table, $master_field, $foreign_table, $foreign_field)
@ -480,9 +512,11 @@ class Relation_Stats
* then determines its left and right connection
* points.
*
* @param string table The current table name
* @param string column The relation column name
* @param string $table The current table name
* @param string $column The relation column name
*
* @return array Table right,left connection points and key position
*
* @access private
*/
private function _getXy($table, $column)
@ -490,8 +524,7 @@ class Relation_Stats
$pos = array_search($column, $table->fields);
// left, right, position
$value = 12;
if($pos != 0)
{
if ($pos != 0) {
return array($pos + $value + $pos, $pos + $value + $pos + 1, $pos);
}
return array($pos + $value , $pos + $value + 1, $pos);
@ -506,12 +539,14 @@ class Relation_Stats
* Database reference Object and their attributes are involved
* in the combination of displaing Database - reference on Dia Document.
*
* @param boolean changeColor Whether to use one color per relation or not
if changeColor is true then an array of $listOfColors
will be used to choose the random colors for references
lines. we can change/add more colors to this array
* @param boolean $changeColor Whether to use one color per relation or not
* if changeColor is true then an array of $listOfColors will be used to choose
* the random colors for references lines. we can change/add more colors to this
*
* @return void
* @global object The current Dia document
*
* @global object The current Dia document
*
* @access public
* @see PMA_PDF
*/
@ -525,8 +560,8 @@ class Relation_Stats
* points are same then return it false and don't draw that
* relation
*/
if ( $this->srcConnPointsRight == $this->destConnPointsRight ){
if ( $this->srcConnPointsLeft == $this->destConnPointsLeft ){
if ( $this->srcConnPointsRight == $this->destConnPointsRight) {
if ( $this->srcConnPointsLeft == $this->destConnPointsLeft) {
return false;
}
}
@ -538,13 +573,14 @@ class Relation_Stats
'00FF00'
);
shuffle($listOfColors);
$this->referenceColor = '#'.$listOfColors[0].'';
$this->referenceColor = '#' . $listOfColors[0] . '';
} else {
$this->referenceColor = '#000000';
}
$dia->writeRaw(
'<dia:object type="Database - Reference" version="0" id="'.PMA_Dia_Relation_Schema::$objectId.'">
'<dia:object type="Database - Reference" version="0" id="'
. PMA_Dia_Relation_Schema::$objectId . '">
<dia:attribute name="obj_pos">
<dia:point val="3.27,18.9198"/>
</dia:attribute>
@ -576,7 +612,7 @@ class Relation_Stats
<dia:color val="#000000"/>
</dia:attribute>
<dia:attribute name="line_colour">
<dia:color val="'.$this->referenceColor.'"/>
<dia:color val="' . $this->referenceColor . '"/>
</dia:attribute>
<dia:attribute name="line_width">
<dia:real val="0.10000000000000001"/>
@ -610,11 +646,15 @@ class Relation_Stats
<dia:real val="0.59999999999999998"/>
</dia:attribute>
<dia:connections>
<dia:connection handle="0" to="'.$this->masterTableId.'" connection="'.$this->srcConnPointsRight.'"/>
<dia:connection handle="1" to="'.$this->foreignTableId.'" connection="'.$this->destConnPointsRight.'"/>
<dia:connection handle="0" to="'
. $this->masterTableId . '" connection="'
. $this->srcConnPointsRight . '"/>
<dia:connection handle="1" to="'
. $this->foreignTableId . '" connection="'
. $this->destConnPointsRight . '"/>
</dia:connections>
</dia:object>'
);
);
}
}
@ -667,11 +707,16 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
$this->setExportType($_POST['export_type']);
$dia = new PMA_DIA();
$dia->startDiaDoc($this->paper,$this->_topMargin,$this->_bottomMargin,$this->_leftMargin,$this->_rightMargin,$this->orientation);
$alltables = $this->getAllTables($db,$this->pageNumber);
$dia->startDiaDoc(
$this->paper, $this->_topMargin, $this->_bottomMargin,
$this->_leftMargin, $this->_rightMargin, $this->orientation
);
$alltables = $this->getAllTables($db, $this->pageNumber);
foreach ($alltables as $table) {
if (! isset($this->tables[$table])) {
$this->tables[$table] = new Table_Stats($table, $this->pageNumber, $this->showKeys);
$this->tables[$table] = new Table_Stats(
$table, $this->pageNumber, $this->showKeys
);
}
}
@ -682,12 +727,15 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
$seen_a_relation = true;
foreach ($exist_rel as $master_field => $rel) {
/* put the foreign table on the schema only if selected
* by the user
* (do not use array_search() because we would have to
* to do a === false and this is not PHP3 compatible)
*/
* by the user
* (do not use array_search() because we would have to
* to do a === false and this is not PHP3 compatible)
*/
if (in_array($rel['foreign_table'], $alltables)) {
$this->_addRelation($one_table, $master_field, $rel['foreign_table'], $rel['foreign_field'],$this->showKeys);
$this->_addRelation(
$one_table, $master_field, $rel['foreign_table'],
$rel['foreign_field'], $this->showKeys
);
}
}
}
@ -698,30 +746,40 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
$this->_drawRelations($this->showColor);
}
$dia->endDiaDoc();
$dia->showOutput($db.'-'.$this->pageNumber);
$dia->showOutput($db . '-' . $this->pageNumber);
exit();
}
/**
* Defines relation objects
*
* @param string masterTable The master table name
* @param string masterField The relation field in the master table
* @param string foreignTable The foreign table name
* @param string foreignField The relation field in the foreign table
* @param string $masterTable The master table name
* @param string $masterField The relation field in the master table
* @param string $foreignTable The foreign table name
* @param string $foreignField The relation field in the foreign table
* @param bool $showKeys Whether to display ONLY keys or not
*
* @return void
*
* @access private
* @see Table_Stats::__construct(),Relation_Stats::__construct()
*/
private function _addRelation($masterTable, $masterField, $foreignTable, $foreignField, $showKeys)
{
if (! isset($this->tables[$masterTable])) {
$this->tables[$masterTable] = new Table_Stats($masterTable, $this->pageNumber, $showKeys);
$this->tables[$masterTable] = new Table_Stats(
$masterTable, $this->pageNumber, $showKeys
);
}
if (! isset($this->tables[$foreignTable])) {
$this->tables[$foreignTable] = new Table_Stats($foreignTable, $this->pageNumber, $showKeys);
$this->tables[$foreignTable] = new Table_Stats(
$foreignTable, $this->pageNumber, $showKeys
);
}
$this->_relations[] = new Relation_Stats($this->tables[$masterTable], $masterField, $this->tables[$foreignTable], $foreignField);
$this->_relations[] = new Relation_Stats(
$this->tables[$masterTable], $masterField,
$this->tables[$foreignTable], $foreignField
);
}
/**
@ -731,8 +789,10 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
* foreign table's forein field using Dia object
* type Database - Reference
*
* @param boolean changeColor Whether to use one color per relation or not
* @param boolean $changeColor Whether to use one color per relation or not
*
* @return void
*
* @access private
* @see Relation_Stats::relationDraw()
*/
@ -749,8 +809,10 @@ class PMA_Dia_Relation_Schema extends PMA_Export_Relation_Schema
* Tables are generated using Dia object type Database - Table
* primary fields are underlined and bold in tables
*
* @param boolean changeColor Whether to show color for tables text or not
* @param boolean $changeColor Whether to show color for tables text or not
*
* @return void
*
* @access private
* @see Table_Stats::tableDraw()
*/

View File

@ -5,7 +5,7 @@
* @package phpMyAdmin
*/
include_once("Export_Relation_Schema.class.php");
include_once "Export_Relation_Schema.class.php";
/**
* This Class is EPS Library and
@ -42,8 +42,10 @@ class PMA_EPS
/**
* Set document title
*
* @param string value sets the title text
* @param string $value sets the title text
*
* @return void
*
* @access public
*/
function setTitle($value)
@ -54,8 +56,10 @@ class PMA_EPS
/**
* Set document author
*
* @param string value sets the author
* @param string $value sets the author
*
* @return void
*
* @access public
*/
function setAuthor($value)
@ -66,8 +70,10 @@ class PMA_EPS
/**
* Set document creation date
*
* @param string value sets the date
* @param string $value sets the date
*
* @return void
*
* @access public
*/
function setDate($value)
@ -78,17 +84,19 @@ class PMA_EPS
/**
* Set document orientation
*
* @param string value sets the author
* @param string $value sets the author
*
* @return void
*
* @access public
*/
function setOrientation($value)
{
$this->stringCommands .= "%%PageOrder: Ascend \n";
if($value == "L"){
if ($value == "L") {
$value = "Landscape";
$this->stringCommands .= '%%Orientation: ' . $value . "\n";
}else{
} else {
$value = "Portrait";
$this->stringCommands .= '%%Orientation: ' . $value . "\n";
}
@ -102,17 +110,19 @@ class PMA_EPS
*
* font can be set whenever needed in EPS
*
* @param string value sets the font name e.g Arial
* @param integer value sets the size of the font e.g 10
* @param string $value sets the font name e.g Arial
* @param integer $value sets the size of the font e.g 10
*
* @return void
*
* @access public
*/
function setFont($value,$size)
{
$this->font = $value;
$this->fontSize = $size;
$this->stringCommands .= "/".$value." findfont % Get the basic font\n";
$this->stringCommands .= "".$size." scalefont % Scale the font to $size points\n";
$this->stringCommands .= "/" . $value . " findfont % Get the basic font\n";
$this->stringCommands .= "" . $size . " scalefont % Scale the font to $size points\n";
$this->stringCommands .= "setfont % Make it the current font\n";
}
@ -144,19 +154,21 @@ class PMA_EPS
* drawing the lines from x,y source to x,y destination and set the
* width of the line. lines helps in showing relationships of tables
*
* @param integer x_from The x_from attribute defines the start
left position of the element
* @param integer y_from The y_from attribute defines the start
right position of the element
* @param integer x_to The x_to attribute defines the end
left position of the element
* @param integer y_to The y_to attribute defines the end
right position of the element
* @param integer lineWidth sets the width of the line e.g 2
* @param integer $x_from The x_from attribute defines the start
* left position of the element
* @param integer $y_from The y_from attribute defines the start
* right position of the element
* @param integer $x_to The x_to attribute defines the end
* left position of the element
* @param integer $y_to The y_to attribute defines the end
* right position of the element
* @param integer $lineWidth Sets the width of the line e.g 2
*
* @return void
*
* @access public
*/
function line($x_from=0, $y_from=0, $x_to=0, $y_to=0, $lineWidth=0)
function line($x_from = 0, $y_from = 0, $x_to = 0, $y_to = 0, $lineWidth = 0)
{
$this->stringCommands .= $lineWidth . " setlinewidth \n";
$this->stringCommands .= $x_from . ' ' . $y_from . " moveto \n";
@ -170,28 +182,30 @@ class PMA_EPS
* drawing the rectangle from x,y source to x,y destination and set the
* width of the line. rectangles drawn around the text shown of fields
*
* @param integer x_from The x_from attribute defines the start
left position of the element
* @param integer y_from The y_from attribute defines the start
right position of the element
* @param integer x_to The x_to attribute defines the end
left position of the element
* @param integer y_to The y_to attribute defines the end
right position of the element
* @param integer lineWidth sets the width of the line e.g 2
* @param integer $x_from The x_from attribute defines the start
left position of the element
* @param integer $y_from The y_from attribute defines the start
right position of the element
* @param integer $x_to The x_to attribute defines the end
left position of the element
* @param integer $y_to The y_to attribute defines the end
right position of the element
* @param integer $lineWidth Sets the width of the line e.g 2
*
* @return void
*
* @access public
*/
function rect($x_from, $y_from, $x_to, $y_to, $lineWidth)
{
$this->stringCommands .= $lineWidth . " setlinewidth \n";
$this->stringCommands .= "newpath \n";
$this->stringCommands .= $x_from . " " . $y_from . " moveto \n";
$this->stringCommands .= "0 " . $y_to . " rlineto \n";
$this->stringCommands .= $x_to . " 0 rlineto \n";
$this->stringCommands .= "0 -" . $y_to . " rlineto \n";
$this->stringCommands .= "closepath \n";
$this->stringCommands .= "stroke \n";
$this->stringCommands .= $lineWidth . " setlinewidth \n";
$this->stringCommands .= "newpath \n";
$this->stringCommands .= $x_from . " " . $y_from . " moveto \n";
$this->stringCommands .= "0 " . $y_to . " rlineto \n";
$this->stringCommands .= $x_to . " 0 rlineto \n";
$this->stringCommands .= "0 -" . $y_to . " rlineto \n";
$this->stringCommands .= "closepath \n";
$this->stringCommands .= "stroke \n";
}
/**
@ -201,11 +215,11 @@ class PMA_EPS
* them as x and y coordinates to which to move. The coordinates
* specified become the current point.
*
* @param integer x The x attribute defines the
left position of the element
* @param integer y The y attribute defines the
right position of the element
* @param integer $x The x attribute defines the left position of the element
* @param integer $y The y attribute defines the right position of the element
*
* @return void
*
* @access public
*/
function moveTo($x, $y)
@ -216,31 +230,33 @@ class PMA_EPS
/**
* Output/Display the text
*
* @param string text The string to be displayed
* @param string $text The string to be displayed
*
* @return void
*
* @access public
*/
function show($text)
{
$this->stringCommands .= '(' . $text . ") show \n";
}
function show($text)
{
$this->stringCommands .= '(' . $text . ") show \n";
}
/**
* Output the text at specified co-ordinates
*
* @param string text The string to be displayed
* @param integer x The x attribute defines the
left position of the element
* @param integer y The y attribute defines the
right position of the element
* @param string $text String to be displayed
* @param integer $x X attribute defines the left position of the element
* @param integer $y Y attribute defines the right position of the element
*
* @return void
*
* @access public
*/
function showXY($text, $x, $y)
{
$this->moveTo($x, $y);
$this->show($text);
}
function showXY($text, $x, $y)
{
$this->moveTo($x, $y);
$this->show($text);
}
/**
* get width of string/text
@ -252,10 +268,12 @@ class PMA_EPS
* This is a bit hardcore method. I didn't found any other better than this.
* if someone found better than this. would love to hear that method
*
* @param string text string that width will be calculated
* @param integer font name of the font like Arial,sans-serif etc
* @param integer fontSize size of font
* @param string $text string that width will be calculated
* @param integer $font name of the font like Arial,sans-serif etc
* @param integer $fontSize size of font
*
* @return integer width of the text
*
* @access public
*/
function getStringWidth($text,$font,$fontSize)
@ -264,22 +282,22 @@ class PMA_EPS
* Start by counting the width, giving each character a modifying value
*/
$count = 0;
$count = $count + ((strlen($text) - strlen(str_replace(array("i","j","l"),"",$text)))*0.23);//ijl
$count = $count + ((strlen($text) - strlen(str_replace(array("f"),"",$text)))*0.27);//f
$count = $count + ((strlen($text) - strlen(str_replace(array("t","I"),"",$text)))*0.28);//tI
$count = $count + ((strlen($text) - strlen(str_replace(array("r"),"",$text)))*0.34);//r
$count = $count + ((strlen($text) - strlen(str_replace(array("1"),"",$text)))*0.49);//1
$count = $count + ((strlen($text) - strlen(str_replace(array("c","k","s","v","x","y","z","J"),"",$text)))*0.5);//cksvxyzJ
$count = $count + ((strlen($text) - strlen(str_replace(array("a","b","d","e","g","h","n","o","p","q","u","L","0","2","3","4","5","6","7","8","9"),"",$text)))*0.56);//abdeghnopquL023456789
$count = $count + ((strlen($text) - strlen(str_replace(array("F","T","Z"),"",$text)))*0.61);//FTZ
$count = $count + ((strlen($text) - strlen(str_replace(array("A","B","E","K","P","S","V","X","Y"),"",$text)))*0.67);//ABEKPSVXY
$count = $count + ((strlen($text) - strlen(str_replace(array("w","C","D","H","N","R","U"),"",$text)))*0.73);//wCDHNRU
$count = $count + ((strlen($text) - strlen(str_replace(array("G","O","Q"),"",$text)))*0.78);//GOQ
$count = $count + ((strlen($text) - strlen(str_replace(array("m","M"),"",$text)))*0.84);//mM
$count = $count + ((strlen($text) - strlen(str_replace("W","",$text)))*.95);//W
$count = $count + ((strlen($text) - strlen(str_replace(" ","",$text)))*.28);//" "
$text = str_replace(" ","",$text);//remove the " "'s
$count = $count + (strlen(preg_replace("/[a-z0-9]/i","",$text))*0.3); //all other chrs
$count = $count + ((strlen($text) - strlen(str_replace(array("i", "j", "l"), "", $text))) * 0.23);//ijl
$count = $count + ((strlen($text) - strlen(str_replace(array("f"), "", $text))) * 0.27);//f
$count = $count + ((strlen($text) - strlen(str_replace(array("t", "I"), "", $text))) * 0.28);//tI
$count = $count + ((strlen($text) - strlen(str_replace(array("r"), "", $text))) * 0.34);//r
$count = $count + ((strlen($text) - strlen(str_replace(array("1"), "", $text))) * 0.49);//1
$count = $count + ((strlen($text) - strlen(str_replace(array("c", "k", "s", "v", "x", "y", "z", "J"), "", $text))) * 0.5);//cksvxyzJ
$count = $count + ((strlen($text) - strlen(str_replace(array("a", "b", "d", "e", "g", "h", "n", "o", "p", "q", "u", "L", "0", "2", "3", "4", "5", "6", "7", "8", "9"), "", $text))) * 0.56);//abdeghnopquL023456789
$count = $count + ((strlen($text) - strlen(str_replace(array("F", "T", "Z"), "", $text))) * 0.61);//FTZ
$count = $count + ((strlen($text) - strlen(str_replace(array("A", "B", "E", "K", "P", "S", "V", "X", "Y"), "", $text))) * 0.67);//ABEKPSVXY
$count = $count + ((strlen($text) - strlen(str_replace(array("w", "C", "D", "H", "N", "R", "U"), "", $text))) * 0.73);//wCDHNRU
$count = $count + ((strlen($text) - strlen(str_replace(array("G", "O", "Q"), "", $text))) * 0.78);//GOQ
$count = $count + ((strlen($text) - strlen(str_replace(array("m", "M"), "", $text))) * 0.84);//mM
$count = $count + ((strlen($text) - strlen(str_replace("W", "", $text))) * .95);//W
$count = $count + ((strlen($text) - strlen(str_replace(" ", "", $text))) * .28);//" "
$text = str_replace(" ", "", $text);//remove the " "'s
$count = $count + (strlen(preg_replace("/[a-z0-9]/i", "", $text)) * 0.3); //all other chrs
$modifier = 1;
$font = strtolower($font);
@ -289,7 +307,7 @@ class PMA_EPS
*/
case 'arial':
case 'sans-serif':
break;
break;
/*
* .92 modifer for time, serif, brushscriptstd, and californian fb
*/
@ -298,13 +316,13 @@ class PMA_EPS
case 'brushscriptstd':
case 'californian fb':
$modifier = .92;
break;
break;
/*
* 1.23 modifier for broadway
*/
case 'broadway':
$modifier = 1.23;
break;
break;
}
$textWidth = $count*$fontSize;
return ceil($textWidth*$modifier);
@ -324,8 +342,10 @@ class PMA_EPS
/**
* Output EPS Document for download
*
* @param string fileName name of the eps document
* @param string $fileName name of the eps document
*
* @return void
*
* @access public
*/
function showOutput($fileName)
@ -368,30 +388,37 @@ class Table_Stats
/**
* The "Table_Stats" constructor
*
* @param string tableName The table name
* @param string font The font name
* @param integer fontSize The font size
* @param integer same_wide_width The max width among tables
* @param boolean showKeys Whether to display keys or not
* @param boolean showInfo Whether to display table position or not
* @param string $tableName The table name
* @param string $font The font name
* @param integer $fontSize The font size
* @param integer $pageNumber Page number
* @param integer &$same_wide_width The max width among tables
* @param boolean $showKeys Whether to display keys or not
* @param boolean $showInfo Whether to display table position or not
*
* @global object The current eps document
* @global integer The current page number (from the
* $cfg['Servers'][$i]['table_coords'] table)
* @global array The relations settings
* @global string The current db name
*
* @access private
* @see PMA_EPS, Table_Stats::Table_Stats_setWidth,
Table_Stats::Table_Stats_setHeight
* Table_Stats::Table_Stats_setHeight
*/
function __construct($tableName, $font, $fontSize, $pageNumber, &$same_wide_width, $showKeys = false, $showInfo = false)
function __construct($tableName, $font, $fontSize, $pageNumber, &$same_wide_width,
$showKeys = false, $showInfo = false)
{
global $eps, $cfgRelation, $db;
$this->_tableName = $tableName;
$sql = 'DESCRIBE ' . PMA_backquote($tableName);
$result = PMA_DBI_try_query($sql, null, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
$eps->dieSchema($pageNumber,"EPS",sprintf(__('The %s table doesn\'t exist!'), $tableName));
if (! $result || ! PMA_DBI_num_rows($result)) {
$eps->dieSchema(
$pageNumber, "EPS",
sprintf(__('The %s table doesn\'t exist!'), $tableName)
);
}
/*
@ -402,7 +429,10 @@ class Table_Stats
$indexes = PMA_Index::getFromTable($this->_tableName, $db);
$all_columns = array();
foreach ($indexes as $index) {
$all_columns = array_merge($all_columns, array_flip(array_keys($index->getColumns())));
$all_columns = array_merge(
$all_columns,
array_flip(array_keys($index->getColumns()))
);
}
$this->fields = array_keys($all_columns);
} else {
@ -418,21 +448,28 @@ class Table_Stats
// setWidth must me after setHeight, because title
// can include table height which changes table width
$this->_setWidthTable($font,$fontSize);
$this->_setWidthTable($font, $fontSize);
if ($same_wide_width < $this->width) {
$same_wide_width = $this->width;
}
// x and y
$sql = 'SELECT x, y FROM '
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddSlashes($tableName) . '\''
. ' AND pdf_page_number = ' . $pageNumber;
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.'
. PMA_backquote($cfgRelation['table_coords'])
. ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
. ' AND table_name = \'' . PMA_sqlAddSlashes($tableName) . '\''
. ' AND pdf_page_number = ' . $pageNumber;
$result = PMA_query_as_controluser($sql, false, PMA_DBI_QUERY_STORE);
if (!$result || !PMA_DBI_num_rows($result)) {
$eps->dieSchema($pageNumber,"EPS",sprintf(__('Please configure the coordinates for table %s'), $tableName));
if (! $result || ! PMA_DBI_num_rows($result)) {
$eps->dieSchema(
$pageNumber, "EPS",
sprintf(
__('Please configure the coordinates for table %s'),
$tableName
)
);
}
list($this->x, $this->y) = PMA_DBI_fetch_row($result);
$this->x = (double) $this->x;
@ -440,7 +477,10 @@ class Table_Stats
// displayfield
$this->displayfield = PMA_getDisplayField($db, $tableName);
// index
$result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($tableName) . ';', null, PMA_DBI_QUERY_STORE);
$result = PMA_DBI_query(
'SHOW INDEX FROM ' . PMA_backquote($tableName) . ';',
null, PMA_DBI_QUERY_STORE
);
if (PMA_DBI_num_rows($result) > 0) {
while ($row = PMA_DBI_fetch_assoc($result)) {
if ($row['Key_name'] == 'PRIMARY') {
@ -459,16 +499,21 @@ class Table_Stats
*/
private function _getTitle()
{
return ($this->_showInfo ? sprintf('%.0f', $this->width) . 'x' . sprintf('%.0f', $this->heightCell) : '') . ' ' . $this->_tableName;
return ($this->_showInfo
? sprintf('%.0f', $this->width) . 'x' . sprintf('%.0f', $this->heightCell)
: '') . ' ' . $this->_tableName;
}
/**
* Sets the width of the table
*
* @param string font The font name
* @param integer fontSize The font size
* @param string $font The font name
* @param integer $fontSize The font size
*
* @global object The current eps document
*
* @return void
*
* @access private
* @see PMA_EPS
*/
@ -477,14 +522,17 @@ class Table_Stats
global $eps;
foreach ($this->fields as $field) {
$this->width = max($this->width, $eps->getStringWidth($field,$font,$fontSize));
$this->width = max(
$this->width,
$eps->getStringWidth($field, $font, $fontSize)
);
}
$this->width += $eps->getStringWidth(' ',$font,$fontSize);
$this->width += $eps->getStringWidth(' ', $font, $fontSize);
/*
* it is unknown what value must be added, because
* table title is affected by the tabe width value
*/
while ($this->width < $eps->getStringWidth($this->_getTitle(),$font,$fontSize)) {
while ($this->width < $eps->getStringWidth($this->_getTitle(), $font, $fontSize)) {
$this->width += 7;
}
}
@ -492,7 +540,8 @@ class Table_Stats
/**
* Sets the height of the table
*
* @param integer fontSize The font size
* @param integer $fontSize The font size
*
* @return void
* @access private
*/
@ -505,9 +554,12 @@ class Table_Stats
/**
* Draw the table
*
* @param boolean showColor Whether to display color
* @param boolean $showColor Whether to display color
*
* @global object The current eps document
*
* @return void
*
* @access public
* @see PMA_EPS,PMA_EPS::line,PMA_EPS::rect
*/
@ -515,25 +567,24 @@ class Table_Stats
{
global $eps;
//echo $this->_tableName.'<br />';
$eps->rect($this->x,$this->y + 12,
$this->width,$this->heightCell,
1
);
$eps->showXY($this->_getTitle(),$this->x + 5,$this->y + 14);
$eps->rect($this->x, $this->y + 12, $this->width, $this->heightCell, 1);
$eps->showXY($this->_getTitle(), $this->x + 5, $this->y + 14);
foreach ($this->fields as $field) {
$this->currentCell += $this->heightCell;
$showColor = 'none';
if ($showColor) {
if (in_array($field, $this->primary)) {
$showColor = '#0c0';
}
if ($field == $this->displayfield) {
$showColor = 'none';
}
$this->currentCell += $this->heightCell;
$showColor = 'none';
if ($showColor) {
if (in_array($field, $this->primary)) {
$showColor = '#0c0';
}
$eps->rect($this->x,$this->y + 12 + $this->currentCell,
$this->width, $this->heightCell,1);
$eps->showXY($field, $this->x + 5, $this->y + 14 + $this->currentCell);
if ($field == $this->displayfield) {
$showColor = 'none';
}
}
$eps->rect(
$this->x, $this->y + 12 + $this->currentCell,
$this->width, $this->heightCell, 1
);
$eps->showXY($field, $this->x + 5, $this->y + 14 + $this->currentCell);
}
}
}
@ -563,10 +614,11 @@ class Relation_Stats
/**
* The "Relation_Stats" constructor
*
* @param string master_table The master table name
* @param string master_field The relation field in the master table
* @param string foreign_table The foreign table name
* @param string foreigh_field The relation field in the foreign table
* @param string $master_table The master table name
* @param string $master_field The relation field in the master table
* @param string $foreign_table The foreign table name
* @param string $foreign_field The relation field in the foreign table
*
* @see Relation_Stats::_getXy
*/
function __construct($master_table, $master_field, $foreign_table, $foreign_field)
@ -617,26 +669,36 @@ class Relation_Stats
/**
* Gets arrows coordinates
*
* @param string table The current table name
* @param string column The relation column name
* @param string $table The current table name
* @param string $column The relation column name
*
* @return array Arrows coordinates
*
* @access private
*/
private function _getXy($table, $column)
{
$pos = array_search($column, $table->fields);
// x_left, x_right, y
return array($table->x, $table->x + $table->width, $table->y + ($pos + 1.5) * $table->heightCell);
return array(
$table->x,
$table->x + $table->width,
$table->y + ($pos + 1.5) * $table->heightCell
);
}
/**
* draws relation links and arrows
* shows foreign key relations
*
* @param boolean changeColor Whether to use one color per relation or not
* @global object The current EPS document
* @param boolean $changeColor Whether to use one color per relation or not
*
* @global object The current EPS document
*
* @access public
* @see PMA_EPS
*
* @return void
*/
public function relationDraw($changeColor)
{
@ -658,40 +720,58 @@ class Relation_Stats
$color = 'black';
}
// draw a line like -- to foreign field
$eps->line($this->xSrc,$this->ySrc,
$this->xSrc + $this->srcDir * $this->wTick,$this->ySrc,
$eps->line(
$this->xSrc,
$this->ySrc,
$this->xSrc + $this->srcDir * $this->wTick,
$this->ySrc,
1
);
);
// draw a line like -- to master field
$eps->line($this->xDest + $this->destDir * $this->wTick, $this->yDest,
$this->xDest, $this->yDest,
$eps->line(
$this->xDest + $this->destDir * $this->wTick,
$this->yDest,
$this->xDest,
$this->yDest,
1
);
);
// draw a line that connects to master field line and foreign field line
$eps->line($this->xSrc + $this->srcDir * $this->wTick,$this->ySrc,
$this->xDest + $this->destDir * $this->wTick, $this->yDest,
$eps->line(
$this->xSrc + $this->srcDir * $this->wTick,
$this->ySrc,
$this->xDest + $this->destDir * $this->wTick,
$this->yDest,
1
);
);
$root2 = 2 * sqrt(2);
$eps->line($this->xSrc + $this->srcDir * $this->wTick * 0.75, $this->ySrc,
$this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick ,
$this->ySrc + $this->wTick / $root2 ,
$eps->line(
$this->xSrc + $this->srcDir * $this->wTick * 0.75,
$this->ySrc,
$this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick,
$this->ySrc + $this->wTick / $root2,
1
);
$eps->line($this->xSrc + $this->srcDir * $this->wTick * 0.75, $this->ySrc,
$this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick ,
$this->ySrc - $this->wTick / $root2 ,
);
$eps->line(
$this->xSrc + $this->srcDir * $this->wTick * 0.75,
$this->ySrc,
$this->xSrc + $this->srcDir * (0.75 - 1 / $root2) * $this->wTick,
$this->ySrc - $this->wTick / $root2,
1
);
$eps->line($this->xDest + $this->destDir * $this->wTick / 2 , $this->yDest ,
);
$eps->line(
$this->xDest + $this->destDir * $this->wTick / 2,
$this->yDest,
$this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick,
$this->yDest + $this->wTick / $root2 ,
1);
$eps->line($this->xDest + $this->destDir * $this->wTick / 2 ,
$this->yDest , $this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick ,
$this->yDest - $this->wTick / $root2 ,
$this->yDest + $this->wTick / $root2,
1
);
);
$eps->line(
$this->xDest + $this->destDir * $this->wTick / 2,
$this->yDest,
$this->xDest + $this->destDir * (0.5 + 1 / $root2) * $this->wTick,
$this->yDest - $this->wTick / $root2,
1
);
}
}
/*
@ -738,19 +818,26 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
$this->setExportType($_POST['export_type']);
$eps = new PMA_EPS();
$eps->setTitle(sprintf(__('Schema of the %s database - Page %s'), $db, $this->pageNumber));
$eps->setTitle(
sprintf(
__('Schema of the %s database - Page %s'),
$db,
$this->pageNumber
)
);
$eps->setAuthor('phpMyAdmin ' . PMA_VERSION);
$eps->setDate(date("j F Y, g:i a"));
$eps->setOrientation($this->orientation);
$eps->setFont('Verdana','10');
$eps->setFont('Verdana', '10');
$alltables = $this->getAllTables($db,$this->pageNumber);
$alltables = $this->getAllTables($db, $this->pageNumber);
foreach ($alltables AS $table) {
if (! isset($this->tables[$table])) {
$this->tables[$table] = new Table_Stats($table,$eps->getFont(),$eps->getFontSize(), $this->pageNumber, $this->_tablewidth, $this->showKeys, $this->tableDimension);
$this->tables[$table] = new Table_Stats(
$table, $eps->getFont(), $eps->getFontSize(), $this->pageNumber,
$this->_tablewidth, $this->showKeys, $this->tableDimension
);
}
if ($this->sameWide) {
@ -770,7 +857,11 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
* to do a === false and this is not PHP3 compatible)
*/
if (in_array($rel['foreign_table'], $alltables)) {
$this->_addRelation($one_table,$eps->getFont(),$eps->getFontSize(), $master_field, $rel['foreign_table'], $rel['foreign_field'], $this->tableDimension);
$this->_addRelation(
$one_table, $eps->getFont(), $eps->getFontSize(),
$master_field, $rel['foreign_table'],
$rel['foreign_field'], $this->tableDimension
);
}
}
}
@ -788,33 +879,48 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
/**
* Defines relation objects
*
* @param string masterTable The master table name
* @param string masterField The relation field in the master table
* @param string foreignTable The foreign table name
* @param string foreignField The relation field in the foreign table
* @param boolean showInfo Whether to display table position or not
* @param string $masterTable The master table name
* @param string $font The font
* @param int $fontSize The font size
* @param string $masterField The relation field in the master table
* @param string $foreignTable The foreign table name
* @param string $foreignField The relation field in the foreign table
* @param boolean $showInfo Whether to display table position or not
*
* @return void
*
* @access private
* @see _setMinMax,Table_Stats::__construct(),Relation_Stats::__construct()
*/
private function _addRelation($masterTable,$font,$fontSize, $masterField, $foreignTable, $foreignField, $showInfo)
private function _addRelation($masterTable, $font, $fontSize, $masterField,
$foreignTable, $foreignField, $showInfo)
{
if (! isset($this->tables[$masterTable])) {
$this->tables[$masterTable] = new Table_Stats($masterTable, $font, $fontSize, $this->pageNumber, $this->_tablewidth, false, $showInfo);
$this->tables[$masterTable] = new Table_Stats(
$masterTable, $font, $fontSize, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
}
if (! isset($this->tables[$foreignTable])) {
$this->tables[$foreignTable] = new Table_Stats($foreignTable,$font,$fontSize,$this->pageNumber, $this->_tablewidth, false, $showInfo);
$this->tables[$foreignTable] = new Table_Stats(
$foreignTable, $font, $fontSize, $this->pageNumber,
$this->_tablewidth, false, $showInfo
);
}
$this->_relations[] = new Relation_Stats($this->tables[$masterTable], $masterField, $this->tables[$foreignTable], $foreignField);
$this->_relations[] = new Relation_Stats(
$this->tables[$masterTable], $masterField,
$this->tables[$foreignTable], $foreignField
);
}
/**
* Draws relation arrows and lines
* connects master table's master field to
* Draws relation arrows and lines connects master table's master field to
* foreign table's forein field
*
* @param boolean changeColor Whether to use one color per relation or not
* @param boolean $changeColor Whether to use one color per relation or not
*
* @return void
*
* @access private
* @see Relation_Stats::relationDraw()
*/
@ -828,8 +934,10 @@ class PMA_Eps_Relation_Schema extends PMA_Export_Relation_Schema
/**
* Draws tables
*
* @param boolean changeColor Whether to show color for primary fields or not
* @param boolean $changeColor Whether to show color for primary fields or not
*
* @return void
*
* @access private
* @see Table_Stats::Table_Stats_tableDraw()
*/

View File

@ -923,8 +923,8 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
$pdf->SetX(10);
$pdf->Cell(0, 6, $i . ' ' . $table, 0, 1, 'L', 0, $pdf->PMA_links['doc'][$table]['-']);
// $pdf->Ln(1);
$result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';');
while ($row = PMA_DBI_fetch_assoc($result)) {
$fields = PMA_DBI_get_columns($GLOBALS['db'], $table);
foreach($fields as $row) {
$pdf->SetX(20);
$field_name = $row['Field'];
$pdf->PMA_links['doc'][$table][$field_name] = $pdf->AddLink();

View File

@ -38,7 +38,7 @@ class PMA_User_Schema
public function processUserChoice()
{
global $action_choose,$db,$cfgRelation,$cfg;
global $action_choose, $db, $cfgRelation;
if (isset($this->action)) {
switch ($this->action) {
@ -207,7 +207,7 @@ class PMA_User_Schema
*/
public function showTableDashBoard()
{
global $db,$cfgRelation,$table,$cfg,$with_field_names;
global $db, $cfgRelation, $table, $with_field_names;
/*
* We will need an array of all tables in this db
*/
@ -479,7 +479,7 @@ class PMA_User_Schema
*/
private function _displayScratchboardTables($array_sh_page)
{
global $with_field_names,$cfg,$db;
global $with_field_names, $db;
?>
<script type="text/javascript" src="./js/dom-drag.js"></script>
<form method="post" action="schema_edit.php" name="dragdrop">
@ -505,22 +505,14 @@ class PMA_User_Schema
$reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[x]"].value = "2"' . "\n";
$reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n";
$local_query = 'SHOW FIELDS FROM '
. PMA_backquote($temp_sh_page['table_name'])
. ' FROM ' . PMA_backquote($db);
$fields_rs = PMA_DBI_query($local_query);
unset($local_query);
$fields_cnt = PMA_DBI_num_rows($fields_rs);
echo '<div id="table_' . $i . '" class="pdflayout_table"><u>' . $temp_sh_page['table_name'] . '</u>';
if (isset($with_field_names)) {
while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
echo '<br />' . htmlspecialchars($row['Field']) . "\n";
$fields = PMA_DBI_get_columns($db, $temp_sh_page['table_name']);
foreach ($fields as $row) {
echo '<br />' . htmlspecialchars($row['Field']) . "\n";
}
}
echo '</div>' . "\n";
PMA_DBI_free_result($fields_rs);
unset($fields_rs);
$i++;
}
?>

View File

@ -213,9 +213,7 @@ function PMA_sqlQueryFormInsert($query = '', $is_querywindow = false, $delimiter
// Get the list and number of fields
// we do a try_query here, because we could be in the query window,
// trying to synchonize and the table has not yet been created
$fields_list = PMA_DBI_fetch_result(
'SHOW FULL COLUMNS FROM ' . PMA_backquote($db)
. '.' . PMA_backquote($GLOBALS['table']));
$fields_list = PMA_DBI_get_columns($db, $GLOBALS['table'], true);
$tmp_db_link = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
. '?' . PMA_generate_common_url($db) . '"';

View File

@ -101,7 +101,7 @@ if (false !== $possibly_uploaded_val) {
}
// The Null checkbox was unchecked for this field
if (empty($val) && isset($me_fields_null_prev[$key]) && ! isset($me_fields_null[$key])) {
if (empty($val) && ! empty($me_fields_null_prev[$key]) && ! isset($me_fields_null[$key])) {
$val = "''";
}
} // end else (field value in the form)

View File

@ -11,72 +11,64 @@
require_once 'url_generating.lib.php';
/**
* PMA_tbl_setTitle() sets the title for foreign keys display link
/**
* Sets the title for foreign keys display link.
*
* @param $propertiesIconic Type of icon property
* @param $themeImage Icon Image
* @return string $str Value of the Title
* @param mixed $propertiesIconic Type of icon property
* @param string $pmaThemeImage Icon Image
*
* @return string $str Value of the Title
*/
function PMA_tbl_setTitle($propertiesIconic,$pmaThemeImage){
function PMA_tbl_setTitle($propertiesIconic, $pmaThemeImage)
{
if ($propertiesIconic == true) {
$str = '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
.'b_browse.png" alt="' . __('Browse foreign values') . '" title="'
. __('Browse foreign values') . '" />';
.'b_browse.png" alt="' . __('Browse foreign values') . '" title="'
. __('Browse foreign values') . '" />';
if ($propertiesIconic === 'both') {
$str .= __('Browse foreign values');
return $str;
}
} else {
return __('Browse foreign values');
}
if ($propertiesIconic === 'both') {
$str .= __('Browse foreign values');
}
return $str;
} else {
return __('Browse foreign values');
}
}
/**
* PMA_tbl_getFields() gets all the fields of a table along with their types,collations and whether null or not.
/**
* Gets all the fields of a table along with their types, collations
* and whether null or not.
*
* @uses PMA_DBI_query()
* @uses PMA_backquote()
* @uses PMA_DBI_num_rows()
* @uses PMA_DBI_fetch_assoc()
* @uses PMA_DBI_free_result()
* @uses preg_replace()
* @uses str_replace()
* @uses strncasecmp()
* @uses empty()
*
* @param $db Selected database
* @param $table Selected table
*
* @return array($fields_list,$fields_type,$fields_collation,$fields_null) Array containing the field list, field types, collations and null constatint
* @param string $table Selected table
* @param string $db Selected database
*
* @return array Array containing the field list, field types, collations
* and null constraint
*/
function PMA_tbl_getFields($table,$db) {
function PMA_tbl_getFields($table,$db)
{
// Gets the list and number of fields
$result = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
$fields_cnt = PMA_DBI_num_rows($result);
$fields = PMA_DBI_get_columns($db, $table, true);
$fields_list = $fields_null = $fields_type = $fields_collation = array();
$geom_column_present = false;
$geom_types = PMA_getGISDatatypes();
while ($row = PMA_DBI_fetch_assoc($result)) {
foreach ($fields as $row) {
$fields_list[] = $row['Field'];
$type = $row['Type'];
// check whether table contains geometric columns
if (in_array($type, $geom_types)) {
$geom_column_present = true;
}
// reformat mysql query output
if (strncasecmp($type, 'set', 3) == 0
|| strncasecmp($type, 'enum', 4) == 0) {
|| strncasecmp($type, 'enum', 4) == 0
) {
$type = str_replace(',', ', ', $type);
} else {
// strip the "BINARY" attribute, except if we find "BINARY(" because
// this would be a BINARY or VARBINARY field type
if (!preg_match('@BINARY[\(]@i', $type)) {
@ -92,53 +84,49 @@ function PMA_tbl_getFields($table,$db) {
}
$fields_null[] = $row['Null'];
$fields_type[] = $type;
$fields_collation[] = !empty($row['Collation']) && $row['Collation'] != 'NULL'
? $row['Collation']
: '';
$fields_collation[] = ! empty($row['Collation']) && $row['Collation'] != 'NULL'
? $row['Collation']
: '';
} // end while
PMA_DBI_free_result($result);
unset($result, $type);
return array($fields_list,$fields_type,$fields_collation,$fields_null, $geom_column_present);
return array($fields_list, $fields_type, $fields_collation, $fields_null, $geom_column_present);
}
/* PMA_tbl_setTableHeader() sets the table header for displaying a table in query-by-example format
/**
* Sets the table header for displaying a table in query-by-example format.
*
* @return HTML content, the tags and content for table header
* @param bool $geom_column_present whether a geometry column is present
*
* @return HTML content, the tags and content for table header
*/
function PMA_tbl_setTableHeader($geom_column_present = false){
function PMA_tbl_setTableHeader($geom_column_present = false)
{
// Display the Function column only if there is alteast one geomety colum
$func = '';
if ($geom_column_present) {
$func = '<th>' . __('Function') . '</th>';
}
return '<thead>
return '<thead>
<tr>' . $func . '<th>' . __('Column') . '</th>
<th>' . __('Type') . '</th>
<th>' . __('Collation') . '</th>
<th>' . __('Operator') . '</th>
<th>' . __('Value') . '</th>
</tr>
</tr>
</thead>';
}
/* PMA_tbl_getSubTabs() returns an array with necessary configrations to create sub-tabs(Table Search and Zoom Search) in the table_select page
*
* @return array $subtabs Array containing configuration (icon,text,link,id,args) of sub-tabs for Table Search and Zoom search
/**
* Returns an array with necessary configrations to create
* sub-tabs(Table Search and Zoom Search) in the table_select page.
*
* @return array Array containing configuration (icon, text, link, id, args)
* of sub-tabs for Table Search and Zoom search
*/
function PMA_tbl_getSubTabs(){
function PMA_tbl_getSubTabs()
{
$subtabs = array();
$subtabs['search']['icon'] = 'b_search.png';
$subtabs['search']['text'] = __('Table Search');
$subtabs['search']['link'] = 'tbl_select.php';
@ -151,74 +139,65 @@ function PMA_tbl_getSubTabs(){
$subtabs['zoom']['id'] = 'zoom_search_id';
return $subtabs;
}
/* PMA_tbl_getForeignFields_Values() creates the HTML content for: 1) Browsing foreign data for a field. 2) Creating elements for search criteria input on fields.
/**
* Creates the HTML content for:
* 1) Browsing foreign data for a field.
* 2) Creating elements for search criteria input on fields.
*
* @uses PMA_foreignDropdown
* @uses PMA_generate_common_url
* @uses isset()
* @uses is_array()
* @uses in_array()
* @uses urlencode()
* @uses str_replace()
* @uses stbstr()
*
* @param $foreigners Array of foreign keys
* @param $foreignData Foreign keys data
* @param $field Column name
* @param $tbl_fields_type Column type
* @param $i Column index
* @param $db Selected database
* @param $table Selected table
* @param $titles Selected title
* @param $foreignMaxLimit Max limit of displaying foreign elements
* @param $fields Array of search criteria inputs
* @param $in_fbs In function based search
*
* @return string $str HTML content for viewing foreing data and elements for search criteria input.
* @param array $foreigners Array of foreign keys
* @param array $foreignData Foreign keys data
* @param string $field Column name
* @param string $tbl_fields_type Column type
* @param int $i Column index
* @param string $db Selected database
* @param string $table Selected table
* @param array $titles Selected title
* @param int $foreignMaxLimit Max limit of displaying foreign elements
* @param array $fields Array of search criteria inputs
* @param bool $in_fbs Whether we are in 'function based search'
*
* @return string HTML content for viewing foreing data and elements
* for search criteria input.
*/
function PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i, $db, $table, $titles, $foreignMaxLimit, $fields, $in_fbs = false){
function PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i, $db, $table, $titles, $foreignMaxLimit, $fields, $in_fbs = false)
{
$str = '';
if ($foreigners && isset($foreigners[$field]) && is_array($foreignData['disp_row'])) {
// f o r e i g n k e y s
$str .= ' <select name="fields[' . $i . ']" id="fieldID_' . $i .'">' . "\n";
$str .= '<select name="fields[' . $i . ']" id="fieldID_' . $i .'">' . "\n";
// go back to first row
// here, the 4th parameter is empty because there is no current
// value of data for the dropdown (the search page initial values
// are displayed empty)
$str .= PMA_foreignDropdown($foreignData['disp_row'],
$foreignData['foreign_field'],
$foreignData['foreign_display'],
'', $foreignMaxLimit);
$str .= ' </select>' . "\n";
}
elseif ($foreignData['foreign_link'] == true) {
$str .= PMA_foreignDropdown(
$foreignData['disp_row'], $foreignData['foreign_field'],
$foreignData['foreign_display'], '', $foreignMaxLimit
);
$str .= '</select>' . "\n";
} elseif ($foreignData['foreign_link'] == true) {
if(isset($fields[$i]) && is_string($fields[$i])){
$str .= '<input type="text" id="fieldID_' . $i .'"name="fields[' . $i . '] " value="' . $fields[$i] . '"';
'id="field_' . md5($field) . '[' . $i .']"
class="textfield"/>' ;
$str .= '<input type="text" id="fieldID_' . $i .'"name="fields[' . $i . '] " value="' . $fields[$i] . '"';
'id="field_' . md5($field) . '[' . $i .']"
class="textfield"/>' ;
}
else{
$str .= '<input type="text" id="fieldID_' . $i .'"name="fields[' . $i . '] "';
'id="field_' . md5($field) . '[' . $i .']"
class="textfield" />' ;
$str .= '<input type="text" id="fieldID_' . $i .'"name="fields[' . $i . '] "';
'id="field_' . md5($field) . '[' . $i .']"
class="textfield" />' ;
}
?>
<?php $str .= '<script type="text/javascript">';
<?php $str .= '<script type="text/javascript">';
// <![CDATA[
$str .= <<<EOT
$str .= <<<EOT
<a target="_blank" onclick="window.open(this.href, 'foreigners', 'width=640,height=240,scrollbars=yes'); return false" href="browse_foreigners.php?
EOT;
$str .= '' . PMA_generate_common_url($db, $table) . '&amp;field=' . urlencode($field) . '&amp;fieldkey=' . $i . '">' . str_replace("'", "\'", $titles['Browse']) . '</a>';
// ]]
$str .= '</script>';
} elseif (in_array($tbl_fields_type[$i], PMA_getGISDatatypes())) {
// g e o m e t r y
$str .= '<input type="text" name="fields[' . $i . ']"'
@ -231,72 +210,68 @@ EOT;
$str .= PMA_linkOrButton($edit_url, $edit_str, array(), false, false, '_blank');
$str .= '</span>';
}
} elseif (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0) {
// e n u m s
$enum_value=explode(', ', str_replace("'", '', substr($tbl_fields_type[$i], 5, -1)));
$cnt_enum_value = count($enum_value);
$str .= '<select name="fields[' . ($i) . '][]" id="fieldID_' . $i .'"'
.' multiple="multiple" size="' . min(3, $cnt_enum_value) . '">' . "\n";
for ($j = 0; $j < $cnt_enum_value; $j++) {
if(isset($fields[$i]) && is_array($fields[$i]) && in_array($enum_value[$j],$fields[$i])){
$str .= ' <option value="' . $enum_value[$j] . '" Selected>'
. $enum_value[$j] . '</option>';
}
else{
$str .= ' <option value="' . $enum_value[$j] . '">'
. $enum_value[$j] . '</option>';
}
} // end for
$str .= ' </select>' . "\n";
}
else {
.' multiple="multiple" size="' . min(3, $cnt_enum_value) . '">' . "\n";
for ($j = 0; $j < $cnt_enum_value; $j++) {
if (isset($fields[$i])
&& is_array($fields[$i])
&& in_array($enum_value[$j], $fields[$i])
) {
$str .= '<option value="' . $enum_value[$j] . '" Selected>'
. $enum_value[$j] . '</option>';
} else {
$str .= '<option value="' . $enum_value[$j] . '">'
. $enum_value[$j] . '</option>';
}
} // end for
$str .= '</select>' . "\n";
} else {
// o t h e r c a s e s
$the_class = 'textfield';
$type = $tbl_fields_type[$i];
if ($type == 'date') {
$the_class .= ' datefield';
} elseif ($type == 'datetime' || substr($type, 0, 9) == 'timestamp') {
$the_class .= ' datetimefield';
}
if(isset($fields[$i]) && is_string($fields[$i])){
$str .= ' <input type="text" name="fields[' . $i . ']" '
.' size="40" class="' . $the_class . '" id="fieldID_' . $i .'" value = "' . $fields[$i] . '"/>' . "\n";
}
else{
$str .= ' <input type="text" name="fields[' . $i . ']"'
.' size="40" class="' . $the_class . '" id="fieldID_' . $i .'" />' . "\n";
}
};
return $str;
if (isset($fields[$i]) && is_string($fields[$i])) {
$str .= '<input type="text" name="fields[' . $i . ']"'
.' size="40" class="' . $the_class . '" id="fieldID_'
. $i .'" value = "' . $fields[$i] . '"/>' . "\n";
} else {
$str .= '<input type="text" name="fields[' . $i . ']"'
.' size="40" class="' . $the_class . '" id="fieldID_'
. $i .'" />' . "\n";
}
}
return $str;
}
/* PMA_tbl_search_getWhereClause() Return the where clause for query generation based on the inputs provided.
/**
* Return the where clause for query generation based on the inputs provided.
*
* @uses PMA_backquote
* @uses PMA_sqlAddslashes
* @uses preg_match
* @uses isset()
* @uses in_array()
* @uses str_replace()
* @uses strpos()
* @uses explode()
* @uses trim()
*
* @param $fields Search criteria input
* @param $names Name of the field(column) on which search criteria is submitted
* @param $types Type of the field
* @param $collations Field collation
* @param $func_type Search fucntion/operator
* @param $unaryFlag Whether operator unary or not
*
* @return string $str HTML content for viewing foreing data and elements for search criteria input.
* @param mixed $fields Search criteria input
* @param string $names Name of the column on which search is submitted
* @param string $types Type of the field
* @param string $collations Field collation
* @param string $func_type Search fucntion/operator
* @param bool $unaryFlag Whether operator unary or not
* @param bool $geom_func Whether geometry functions should be applied
*
* @return string HTML content for viewing foreing data and elements
* for search criteria input.
*/
function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $func_type, $unaryFlag, $geom_func = null){
function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $func_type, $unaryFlag, $geom_func = null)
{
/**
* @todo move this to a more apropriate place
*/
@ -308,7 +283,6 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $fu
);
$w = '';
// If geometry function is set apply it to the field name
if ($geom_func != null && trim($geom_func) != '') {
// Get details about the geometry fucntions
@ -317,8 +291,8 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $fu
// If the function takes a single parameter
if ($geom_funcs[$geom_func]['params'] == 1) {
$backquoted_name = $geom_func . '(' . PMA_backquote($names) . ')';
// If the function takes two parameters
} else {
// If the function takes two parameters
// create gis data from the string
$gis_data = PMA_createGISData($fields);
@ -329,7 +303,7 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $fu
// New output type is the output type of the function being applied
$types = $geom_funcs[$geom_func]['type'];
// If the intended where clause is something like 'IsEmpty(`spatial_col_name`)'
// If the where clause is something like 'IsEmpty(`spatial_col_name`)'
if (isset($geom_unary_functions[$geom_func]) && trim($fields) == '') {
$w = $backquoted_name;
return $w;
@ -338,11 +312,11 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $fu
$backquoted_name = PMA_backquote($names);
}
if($unaryFlag){
if ($unaryFlag) {
$fields = '';
$w = $backquoted_name . ' ' . $func_type;
$w = $backquoted_name . ' ' . $func_type;
} elseif (in_array($types, PMA_getGISDatatypes())) {
} elseif (in_array($types, PMA_getGISDatatypes()) && ! empty($fields)) {
// create gis data from the string
$gis_data = PMA_createGISData($fields);
$w = $backquoted_name . ' ' . $func_type . ' ' . $gis_data;
@ -363,23 +337,25 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $fu
$parens_open = '(';
$parens_close = ')';
} else {
$parens_open = '';
$parens_close = '';
}
$enum_where = '\'' . PMA_sqlAddslashes($fields[0]) . '\'';
for ($e = 1; $e < $enum_selected_count; $e++) {
$enum_where .= ', \'' . PMA_sqlAddslashes($fields[$e]) . '\'';
}
} else {
$parens_open = '';
$parens_close = '';
}
$enum_where = '\'' . PMA_sqlAddslashes($fields[0]) . '\'';
for ($e = 1; $e < $enum_selected_count; $e++) {
$enum_where .= ', \'' . PMA_sqlAddslashes($fields[$e]) . '\'';
}
$w = $backquoted_name . ' ' . $func_type . ' ' . $parens_open . $enum_where . $parens_close;
$w = $backquoted_name . ' ' . $func_type . ' ' . $parens_open . $enum_where . $parens_close;
}
} elseif ($fields != '') {
// For these types we quote the value. Even if it's another type (like INT),
// for a LIKE we always quote the value. MySQL converts strings to numbers
// and numbers to strings as necessary during the comparison
if (preg_match('@char|binary|blob|text|set|date|time|year@i', $types) || strpos(' ' . $func_type, 'LIKE')) {
if (preg_match('@char|binary|blob|text|set|date|time|year@i', $types)
|| strpos(' ' . $func_type, 'LIKE')
) {
$quot = '\'';
} else {
$quot = '';
@ -395,23 +371,28 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $fu
$fields = '^' . $fields . '$';
}
if ($func_type == 'IN (...)' || $func_type == 'NOT IN (...)' || $func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN') {
if ($func_type == 'IN (...)'
|| $func_type == 'NOT IN (...)'
|| $func_type == 'BETWEEN'
|| $func_type == 'NOT BETWEEN'
) {
$func_type = str_replace(' (...)', '', $func_type);
// quote values one by one
$values = explode(',', $fields);
foreach ($values as &$value)
$value = $quot . PMA_sqlAddslashes(trim($value)) . $quot;
// quote values one by one
$values = explode(',', $fields);
foreach ($values as &$value) {
$value = $quot . PMA_sqlAddslashes(trim($value)) . $quot;
}
if ($func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN')
$w = $backquoted_name . ' ' . $func_type . ' ' . (isset($values[0]) ? $values[0] : '') . ' AND ' . (isset($values[1]) ? $values[1] : '');
else
if ($func_type == 'BETWEEN' || $func_type == 'NOT BETWEEN') {
$w = $backquoted_name . ' ' . $func_type . ' ' . (isset($values[0]) ? $values[0] : '')
. ' AND ' . (isset($values[1]) ? $values[1] : '');
} else {
$w = $backquoted_name . ' ' . $func_type . ' (' . implode(',', $values) . ')';
}
else {
}
} else {
$w = $backquoted_name . ' ' . $func_type . ' ' . $quot . PMA_sqlAddslashes($fields) . $quot;;
}
} // end if
return $w;
@ -420,14 +401,14 @@ function PMA_tbl_search_getWhereClause($fields, $names, $types, $collations, $fu
/**
* Formats a SVG plot for the query results.
*
* @param array $data Data for the status chart
* @param array &$settings Settings used to generate the chart
* @param array $data Data for the status chart
* @param array &$settings Settings used to generate the chart
*
* @return string HTML and JS code for the SVG plot
*/
function PMA_SVG_scatter_plot($data, &$settings)
{
require_once './libraries/svg_plot/pma_scatter_plot.php';
include_once './libraries/svg_plot/pma_scatter_plot.php';
if (empty($data)) {
// empty data
@ -444,15 +425,5 @@ function PMA_SVG_scatter_plot($data, &$settings)
}
return $scatter_plot->asSVG();
}
}
?>

View File

@ -19,23 +19,26 @@
* // }
* </code>
*
* @param string $option_string comma separated options
* @return array options
* @param string $option_string comma separated options
*
* @return array options
*/
function PMA_transformation_getOptions($option_string)
{
$result = array();
if (! strlen($option_string)
|| ! $transform_options = preg_split('/,/', $option_string)) {
|| ! $transform_options = preg_split('/,/', $option_string)
) {
return $result;
}
while (($option = array_shift($transform_options)) !== null) {
$trimmed = trim($option);
if (strlen($trimmed) > 1
&& $trimmed[0] == "'"
&& $trimmed[strlen($trimmed) - 1] == "'") {
&& $trimmed[0] == "'"
&& $trimmed[strlen($trimmed) - 1] == "'"
) {
// '...'
$option = substr($trimmed, 1, -1);
} elseif (isset($trimmed[0]) && $trimmed[0] == "'") {
@ -117,11 +120,13 @@ function PMA_getAvailableMIMEtypes()
/**
* Gets the mimetypes for all columns of a table
*
* @param string $db the name of the db to check for
* @param string $table the name of the table to check for
* @param string $strict whether to include only results having a mimetype set
*
* @access public
* @param string $db the name of the db to check for
* @param string $table the name of the table to check for
* @param string $strict whether to include only results having a mimetype set
* @return array [field_name][field_key] = field_value
*
* @return array [field_name][field_key] = field_value
*/
function PMA_getMIME($db, $table, $strict = false)
{
@ -136,7 +141,7 @@ function PMA_getMIME($db, $table, $strict = false)
`mimetype`,
`transformation`,
`transformation_options`
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
WHERE `db_name` = \'' . PMA_sqlAddSlashes($db) . '\'
AND `table_name` = \'' . PMA_sqlAddSlashes($table) . '\'
AND ( `mimetype` != \'\'' . (!$strict ? '
@ -148,14 +153,17 @@ function PMA_getMIME($db, $table, $strict = false)
/**
* Set a single mimetype to a certain value.
*
* @param string $db the name of the db
* @param string $table the name of the table
* @param string $key the name of the column
* @param string $mimetype the mimetype of the column
* @param string $transformation the transformation of the column
* @param string $transformation_options the transformation options of the column
* @param string $forcedelete force delete, will erase any existing
* comments for this column
*
* @access public
* @param string $db the name of the db
* @param string $table the name of the table
* @param string $key the name of the column
* @param string $mimetype the mimetype of the column
* @param string $transformation the transformation of the column
* @param string $transformation_options the transformation options of the column
* @param string $forcedelete force delete, will erase any existing comments for this column
*
* @return boolean true, if comment-query was made.
*/
function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
@ -181,8 +189,9 @@ function PMA_setMIME($db, $table, $key, $mimetype, $transformation,
PMA_DBI_free_result($test_rs);
if (! $forcedelete
&& (strlen($mimetype) || strlen($transformation)
|| strlen($transformation_options) || strlen($row['comment']))) {
&& (strlen($mimetype) || strlen($transformation)
|| strlen($transformation_options) || strlen($row['comment']))
) {
$upd_query = '
UPDATE ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['column_info']) . '
SET `mimetype` = \'' . PMA_sqlAddSlashes($mimetype) . '\',

View File

@ -9,13 +9,14 @@
/**
* Generates text with hidden inputs.
*
* @see PMA_generate_common_url()
* @param string optional database name
* (can also be an array of parameters)
* @param string optional table name
* @param int indenting level
* @param string do not generate a hidden field for this parameter
* (can be an array of strings)
* @param string $db optional database name
* (can also be an array of parameters)
* @param string $table optional table name
* @param int $indent indenting level
* @param string $skip do not generate a hidden field for this parameter
* (can be an array of strings)
*
* @see PMA_generate_common_url()
*
* @return string string with input fields
*
@ -27,7 +28,6 @@
* @global boolean whether recoding is allowed or not
*
* @access public
*
*/
function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $skip = array())
{
@ -48,15 +48,16 @@ function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $
}
if (! empty($GLOBALS['server'])
&& $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']) {
&& $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']
) {
$params['server'] = $GLOBALS['server'];
}
if (empty($_COOKIE['pma_lang'])
&& ! empty($GLOBALS['lang'])) {
if (empty($_COOKIE['pma_lang']) && ! empty($GLOBALS['lang'])) {
$params['lang'] = $GLOBALS['lang'];
}
if (empty($_COOKIE['pma_collation_connection'])
&& ! empty($GLOBALS['collation_connection'])) {
&& ! empty($GLOBALS['collation_connection'])
) {
$params['collation_connection'] = $GLOBALS['collation_connection'];
}
@ -102,8 +103,9 @@ function PMA_generate_common_hidden_inputs($db = '', $table = '', $indent = 0, $
* <input type="hidden" name="ccc[b]" Value="ccc_b" />
* </code>
*
* @param array $values
* @param string $pre
* @param array $values hidden values
* @param string $pre prefix
*
* @return string form fields of type hidden
*/
function PMA_getHiddenFields($values, $pre = '')
@ -160,19 +162,20 @@ function PMA_getHiddenFields($values, $pre = '')
* // script.php?server=1&amp;lang=en
* </code>
*
* @param mixed assoc. array with url params or optional string with database name
* if first param is an array there is also an ? prefixed to the url
* @param mixed assoc. array with url params or optional string with database name
* if first param is an array there is also an ? prefixed to the url
*
* @param string - if first param is array: 'html' to use htmlspecialchars()
* on the resulting URL (for a normal URL displayed in HTML)
* or something else to avoid using htmlspecialchars() (for
* a URL sent via a header); if not set,'html' is assumed
* - if first param is not array: optional table name
* @param string - if first param is array: 'html' to use htmlspecialchars()
* on the resulting URL (for a normal URL displayed in HTML)
* or something else to avoid using htmlspecialchars() (for
* a URL sent via a header); if not set,'html' is assumed
* - if first param is not array: optional table name
*
* @param string - if first param is array: optional character to
* use instead of '?'
* - if first param is not array: optional character to use
* instead of '&amp;' for dividing URL parameters
*
* @param string - if first param is array: optional character to
* use instead of '?'
* - if first param is not array: optional character to use
* instead of '&amp;' for dividing URL parameters
* @return string string with URL parameters
* @access public
*/
@ -219,17 +222,18 @@ function PMA_generate_common_url()
if (isset($GLOBALS['server'])
&& $GLOBALS['server'] != $GLOBALS['cfg']['ServerDefault']
// avoid overwriting when creating navi panel links to servers
&& ! isset($params['server'])) {
// avoid overwriting when creating navi panel links to servers
&& ! isset($params['server'])
) {
$params['server'] = $GLOBALS['server'];
}
if (empty($_COOKIE['pma_lang'])
&& ! empty($GLOBALS['lang'])) {
if (empty($_COOKIE['pma_lang']) && ! empty($GLOBALS['lang'])) {
$params['lang'] = $GLOBALS['lang'];
}
if (empty($_COOKIE['pma_collation_connection'])
&& ! empty($GLOBALS['collation_connection'])) {
&& ! empty($GLOBALS['collation_connection'])
) {
$params['collation_connection'] = $GLOBALS['collation_connection'];
}
@ -256,7 +260,9 @@ function PMA_generate_common_url()
* extracted from arg_separator.input as set in php.ini
* we do not use arg_separator.output to avoid problems with &amp; and &
*
* @param string whether to encode separator or not, currently 'none' or 'html'
* @param string $encode whether to encode separator or not,
* currently 'none' or 'html'
*
* @return string character used for separating url parts usally ; or &
* @access public
*/
@ -278,13 +284,13 @@ function PMA_get_arg_separator($encode = 'none')
}
switch ($encode) {
case 'html':
return htmlentities($separator);
break;
case 'text' :
case 'none' :
default :
return $separator;
case 'html':
return htmlentities($separator);
break;
case 'text' :
case 'none' :
default :
return $separator;
}
}

View File

@ -27,9 +27,12 @@ $tabs_icons = array(
'Import' => 'ic_b_import',
'Export' => 'ic_b_export');
echo '<ul id="topmenu2">';
echo PMA_generate_html_tab(array(
'link' => 'prefs_manage.php',
'text' => __('Manage your settings'))) . "\n";
echo PMA_generate_html_tab(
array(
'link' => 'prefs_manage.php',
'text' => __('Manage your settings')
)
) . "\n";
echo '<li>&nbsp; &nbsp;</li>' . "\n";
$script_name = basename($GLOBALS['PMA_PHP_SELF']);
foreach (array_keys($forms) as $formset) {

View File

@ -16,9 +16,12 @@ function PMA_userprefs_pageinit()
$cf = ConfigFile::getInstance();
$cf->resetConfigData(); // start with a clean instance
$cf->setAllowedKeys($forms_all_keys);
$cf->setCfgUpdateReadMapping(array(
'Server/hide_db' => 'Servers/1/hide_db',
'Server/only_db' => 'Servers/1/only_db'));
$cf->setCfgUpdateReadMapping(
array(
'Server/hide_db' => 'Servers/1/hide_db',
'Server/only_db' => 'Servers/1/only_db'
)
);
$cf->updateWithGlobalConfig($GLOBALS['cfg']);
}
@ -64,7 +67,8 @@ function PMA_load_userprefs()
/**
* Saves user preferences
*
* @param array $config_data
* @param array $config_array configuration array
*
* @return true|PMA_Message
*/
function PMA_save_userprefs(array $config_array)
@ -80,7 +84,7 @@ function PMA_save_userprefs(array $config_array)
'db' => $config_array,
'ts' => time());
if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
unset($_SESSION['cache'][$cache_key]['userprefs']);
unset($_SESSION['cache'][$cache_key]['userprefs']);
}
return true;
}
@ -122,6 +126,7 @@ function PMA_save_userprefs(array $config_array)
* (blacklist) and keys from user preferences form (whitelist)
*
* @param array $config_data path => value pairs
*
* @return array
*/
function PMA_apply_userprefs(array $config_data)
@ -155,6 +160,7 @@ function PMA_apply_userprefs(array $config_data)
* Reads user preferences field names
*
* @param array|null $forms
*
* @return array
*/
function PMA_read_userprefs_fieldnames(array $forms = null)
@ -185,8 +191,10 @@ function PMA_read_userprefs_fieldnames(array $forms = null)
*
* No validation is done!
*
* @param string $cfg_name
* @param mixed $value
* @param string $path configuration
* @param mixed $value value
* @param mixed $default_value default value
*
* @return void
*/
function PMA_persist_option($path, $value, $default_value)
@ -222,12 +230,16 @@ function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name, $
? $old_settings['config_data']
: array();
$new_settings = ConfigFile::getInstance()->getConfigArray();
$diff_keys = array_keys(array_diff_assoc($old_settings, $new_settings)
+ array_diff_assoc($new_settings, $old_settings));
$diff_keys = array_keys(
array_diff_assoc($old_settings, $new_settings)
+ array_diff_assoc($new_settings, $old_settings)
);
$check_keys = array('NaturalOrder', 'MainPageIconic', 'DefaultTabDatabase',
'Server/hide_db', 'Server/only_db');
$check_keys = array_merge($check_keys, $forms['Left_frame']['Left_frame'],
$forms['Left_frame']['Left_databases']);
$check_keys = array_merge(
$check_keys, $forms['Left_frame']['Left_frame'],
$forms['Left_frame']['Left_databases']
);
$diff = array_intersect($check_keys, $diff_keys);
$reload_left_frame = !empty($diff);
}
@ -242,8 +254,10 @@ function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name, $
if ($hash) {
$hash = '#' . urlencode($hash);
}
PMA_sendHeaderLocation($GLOBALS['cfg']['PmaAbsoluteUri'] . $file_name
. PMA_generate_common_url($url_params, '&') . $hash);
PMA_sendHeaderLocation(
$GLOBALS['cfg']['PmaAbsoluteUri'] . $file_name
. PMA_generate_common_url($url_params, '&') . $hash
);
}
/**

View File

@ -62,8 +62,11 @@ class zipfile
* "echo $zipfile;" command
*
* @access public
*
* @return nothing
*/
function setDoWrite() {
function setDoWrite()
{
$this -> doWrite = true;
} // end of the 'setDoWrite()' method
@ -71,13 +74,14 @@ class zipfile
* Converts an Unix timestamp to a four byte DOS date and time format (date
* in high two bytes, time in low two bytes allowing magnitude comparison).
*
* @param integer the current Unix timestamp
* @param integer $unixtime the current Unix timestamp
*
* @return integer the current date in a four byte DOS format
* @return integer the current date in a four byte DOS format
*
* @access private
*/
function unix2DosTime($unixtime = 0) {
function unix2DosTime($unixtime = 0)
{
$timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
if ($timearray['year'] < 1980) {
@ -97,17 +101,19 @@ class zipfile
/**
* Adds "file" to archive
*
* @param string file contents
* @param string name of the file in the archive (may contains the path)
* @param integer the current timestamp
* @param string $data file contents
* @param string $name name of the file in the archive (may contains the path)
* @param integer $time the current timestamp
*
* @access public
*
* @return nothing
*/
function addFile($data, $name, $time = 0)
{
$name = str_replace('\\', '/', $name);
$dtime = substr( "00000000" . dechex($this->unix2DosTime($time)), -8);
$dtime = substr("00000000" . dechex($this->unix2DosTime($time)), -8);
$hexdtime = '\x' . $dtime[6] . $dtime[7]
. '\x' . $dtime[4] . $dtime[5]
. '\x' . $dtime[2] . $dtime[3]

View File

@ -7,13 +7,14 @@
*/
/**
* Gets zip file contents
*
* @param string $specific_entry regular expression to match a file
* @return array ($error_message, $file_data); $error_message
* is empty if no error
*/
* Gets zip file contents
*
* @param string $file zip file
* @param string $specific_entry regular expression to match a file
*
* @return array ($error_message, $file_data); $error_message
* is empty if no error
*/
function PMA_getZipContents($file, $specific_entry = null)
{
$error_message = '';
@ -77,6 +78,8 @@ function PMA_getZipContents($file, $specific_entry = null)
*
* @param string $file_regexp regular expression for the file name to match
* @param string $file zip archive
*
* @return string the file name of the first file that matches the given regexp
*/
function PMA_findFileFromZipArchive ($file_regexp, $file)
{
@ -100,7 +103,9 @@ function PMA_findFileFromZipArchive ($file_regexp, $file)
/**
* Returns the number of files in the zip archive.
*
* @param string $file
* @param string $file zip archive
*
* @return int the number of files in the zip archive
*/
function PMA_getNoOfFilesInZip($file)
{
@ -121,11 +126,14 @@ function PMA_getNoOfFilesInZip($file)
/**
* Extracts a set of files from the given zip archive to a given destinations.
*
* @param string $zip_path
* @param string $destination
* @param array $entries
* @param string $zip_path path to the zip archive
* @param string $destination destination to extract files
* @param array $entries files in archive that should be extracted
*
* @return bool true on sucess, false otherwise
*/
function PMA_zipExtract($zip_path, $destination, $entries) {
function PMA_zipExtract($zip_path, $destination, $entries)
{
$zip = new ZipArchive;
if ($zip->open($zip_path) === true) {
$zip->extractTo($destination, $entries);
@ -138,30 +146,31 @@ function PMA_zipExtract($zip_path, $destination, $entries) {
/**
* Gets zip error message
*
* @param integer error code
* @return string error message
* @param integer $code error code
*
* @return string error message
*/
function PMA_getZipError($code)
{
// I don't think this needs translation
switch ($code) {
case ZIPARCHIVE::ER_MULTIDISK:
$message = 'Multi-disk zip archives not supported';
break;
case ZIPARCHIVE::ER_READ:
$message = 'Read error';
break;
case ZIPARCHIVE::ER_CRC:
$message = 'CRC error';
break;
case ZIPARCHIVE::ER_NOZIP:
$message = 'Not a zip archive';
break;
case ZIPARCHIVE::ER_INCONS:
$message = 'Zip archive inconsistent';
break;
default:
$message = $code;
case ZIPARCHIVE::ER_MULTIDISK:
$message = 'Multi-disk zip archives not supported';
break;
case ZIPARCHIVE::ER_READ:
$message = 'Read error';
break;
case ZIPARCHIVE::ER_CRC:
$message = 'CRC error';
break;
case ZIPARCHIVE::ER_NOZIP:
$message = 'Not a zip archive';
break;
case ZIPARCHIVE::ER_INCONS:
$message = 'Zip archive inconsistent';
break;
default:
$message = $code;
}
return $message;
}

View File

@ -7,7 +7,7 @@
/**
*
*/
include_once 'pmd_common.php';
include_once './libraries/pmd_common.php';
$table = $T;

View File

@ -7,7 +7,9 @@
/**
*
*/
require_once "./pmd_common.php";
require_once './libraries/pmd_common.php';
require './libraries/db_common.inc.php';
require './libraries/db_info.inc.php';
$tab_column = get_tab_info();
$script_tabs = get_script_tabs();
@ -15,19 +17,7 @@ $script_contr = get_script_contr();
$tab_pos = get_tab_pos();
$tables_pk_or_unique_keys = get_pk_or_unique_keys();
$tables_all_keys = get_all_keys();
$hidden = "hidden";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][1]; ?>" lang="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][1]; ?>" dir="<?php echo $GLOBALS['text_dir']; ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="pmd/images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="pmd/images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="pmd/styles/<?php echo $GLOBALS['PMD']['STYLE'] ?>/style1.css" />
<title>Designer</title>
<?php
$params = array('lang' => $GLOBALS['lang']);
if (isset($GLOBALS['db'])) {
$params['db'] = $GLOBALS['db'];
@ -88,7 +78,7 @@ echo $script_tabs . $script_contr . $script_display_field;
/></a><a href="javascript:location.reload();" onmousedown="return false;"
class="M_butt" target="_self"
><img title="<?php echo __('Reload'); ?>" src="pmd/images/reload.png" alt=""
/></a><a href="javascript:Help();" onmousedown="return false;"
/></a><a href="Documentation.html#faq6_31" target="documentation"
class="M_butt" target="_self"
><img title="<?php echo __('Help'); ?>" src="pmd/images/help.png" alt=""
/></a><img class="M_bord" src="pmd/images/bord.png" alt=""
@ -125,12 +115,11 @@ echo $script_tabs . $script_contr . $script_display_field;
title="<?php echo __('Move Menu'); ?>" /></a>
</div>
<div id="osn_tab">
<CANVAS id="canvas" width="100" height="100" onclick="Canvas_click(this)"></CANVAS>
</div>
<form action="" method="post" name="form1">
<div id="layer_menu" style="visibility:<?php echo $hidden ?>;">
<div id="osn_tab">
<canvas class="pmd" id="canvas" width="100" height="100" onclick="Canvas_click(this)"></canvas>
</div>
<div id="layer_menu" style="display:none;">
<div align="center" style="padding-top:5px;">
<a href="javascript:Hide_tab_all(document.getElementById('key_HS_all'));"
onmousedown="return false;" class="M_butt" target="_self">
@ -166,8 +155,8 @@ for ($i = 0; $i < $name_cnt; $i++) {
echo 'checked="checked"';
}
?> /></td>
<td class="Tabs" onmouseover="this.className='Tabs2'"
onmouseout="this.className='Tabs'"
<td class="pmd_Tabs" onmouseover="this.className='pmd_Tabs2'"
onmouseout="this.className='pmd_Tabs'"
onclick="Select_tab('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME"][$i]; ?>');">
<?php echo $GLOBALS['PMD_OUT']["TABLE_NAME"][$i]; ?></td>
</tr>
@ -185,6 +174,8 @@ for ($i = 0; $i < $name_cnt; $i++) {
</div>
</div>
</div>
<?php
for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
$t_n = $GLOBALS['PMD']["TABLE_NAME"][$i];
@ -196,7 +187,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
<input name="t_v[<?php echo $t_n_url ?>]" type="hidden" id="t_v_<?php echo $t_n_url ?>_" />
<input name="t_h[<?php echo $t_n_url ?>]" type="hidden" id="t_h_<?php echo $t_n_url ?>_" />
<table id="<?php echo $t_n_url ?>" cellpadding="0" cellspacing="0" class="tab"
<table id="<?php echo $t_n_url ?>" cellpadding="0" cellspacing="0" class="pmd_tab"
style="position: absolute;
left: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["X"]; else echo rand(180, 800); ?>px;
top: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["Y"]; else echo rand(30, 500); ?>px;
@ -246,7 +237,10 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
</tr>
</thead>
<tbody id="id_tbody_<?php echo $t_n_url ?>"
<?php if ( isset($tab_pos[$t_n])) echo 'style="display: none;"'; ?>>
<?php
if (isset($tab_pos[$t_n]) && empty($tab_pos[$t_n]["V"])) {
echo 'style="display: none;"';
}?>>
<?php
$display_field = PMA_getDisplayField($db, $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]);
for ($j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); $j < $id_cnt; $j++) {
@ -332,10 +326,10 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
}
?>
</form>
<div id="hint"></div>
<div id='layer_action' style="visibility:<?php echo $hidden ?>;">Load...</div>
<div id="pmd_hint"></div>
<div id='layer_action' style="display:none;">Load...</div>
<table id="layer_new_relation" style="visibility:<?php echo $hidden ?>;"
<table id="layer_new_relation" style="display:none;"
width="5%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
@ -386,7 +380,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
value="<?php echo __('OK'); ?>" onclick="New_relation()" />
<input type="button" class="butt" name="Button"
value="<?php echo __('Cancel'); ?>"
onclick="document.getElementById('layer_new_relation').style.visibility = 'hidden';" />
onclick="document.getElementById('layer_new_relation').style.display = 'none';" />
</td>
</tr>
</tbody>
@ -402,7 +396,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
</tbody>
</table>
<table id="layer_upd_relation" style="visibility:<?PHP echo $hidden ?>;"
<table id="layer_upd_relation" style="display:none;"
width="5%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
@ -423,7 +417,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
onclick="Upd_relation()" value="<?php echo __('Delete'); ?>" />
<input type="button" class="butt" name="Button"
value="<?php echo __('Cancel'); ?>"
onclick="document.getElementById('layer_upd_relation').style.visibility = 'hidden'; Re_load();" />
onclick="document.getElementById('layer_upd_relation').style.display = 'none'; Re_load();" />
</td>
</tr>
</table></td>
@ -437,7 +431,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
</tbody>
</table>
<table id="pmd_optionse" style="visibility:<?php echo $hidden ?>;"
<table id="pmd_optionse" style="display:none;"
width="5%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
@ -559,7 +553,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
</tbody>
</table>
<table id="query_rename_to" style="visibility:<?php echo $hidden ?>;"
<table id="query_rename_to" style="display:none;"
width="5%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
@ -591,7 +585,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
value="<?php echo __('OK'); ?>" onclick="edit('Rename')" />
<input type="button" class="butt" name="Button"
value="<?php echo __('Cancel'); ?>"
onclick="document.getElementById('query_rename_to').style.visibility = 'hidden';" />
onclick="document.getElementById('query_rename_to').style.display = 'none';" />
</td>
</tr>
</tbody>
@ -607,7 +601,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
</tbody>
</table>
<table id="query_having" style="visibility:<?php echo $hidden ?>;"
<table id="query_having" style="display:none;"
width="5%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
@ -667,7 +661,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
value="<?php echo __('OK'); ?>" onclick="edit('Having')" />
<input type="button" class="butt" name="Button"
value="<?php echo __('Cancel'); ?>"
onclick="document.getElementById('query_having').style.visibility = 'hidden';" />
onclick="document.getElementById('query_having').style.display = 'none';" />
</td>
</tr>
</tbody>
@ -683,7 +677,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
</tbody>
</table>
<table id="query_Aggregate" style="visibility:<?php echo $hidden ?>;"
<table id="query_Aggregate" style="display:none;"
width="5%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
@ -721,7 +715,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
value="<?php echo __('OK'); ?>" onclick="edit('Aggregate')" />
<input type="button" class="butt" name="Button"
value="<?php echo __('Cancel'); ?>"
onclick="document.getElementById('query_Aggregate').style.visibility = 'hidden';" />
onclick="document.getElementById('query_Aggregate').style.display = 'none';" />
</td>
</tr>
</tbody>
@ -737,7 +731,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
</tbody>
</table>
<table id="query_where" style="visibility:<?php echo $hidden ?>;"
<table id="query_where" style="display:none;"
width="5%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
@ -784,7 +778,7 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
value="<?php echo __('OK'); ?>" onclick="edit('Where')" />
<input type="button" class="butt" name="Button"
value="<?php echo __('Cancel'); ?>"
onclick="document.getElementById('query_where').style.visibility = 'hidden';" />
onclick="document.getElementById('query_where').style.display = 'none';" />
</td>
</tr>
</tbody>

View File

@ -1,27 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @package phpMyAdmin-Designer
*/
/**
*
*/
require_once 'pmd_common.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="./libraries/pmd/styles/<?php echo $GLOBALS['PMD']['STYLE'] ?>/style1.css">
<title>Designer</title>
</head>
<body>
<?php
echo '<p>' . __('To select relation, click :') . '<br />';
echo '<img src="pmd/images/help_relation.png" border="1"></p>';
echo '<p>' . __('The display column is shown in pink. To set/unset a column as the display column, click the "Choose column to display" icon, then click on the appropriate column name.') . '</p>';
?>
</body>
</html>

View File

@ -5,7 +5,7 @@
* @package phpMyAdmin-Designer
*/
include_once 'pmd_common.php';
include_once './libraries/pmd_common.php';
/**
* If called directly from the designer, first save the positions

View File

@ -8,7 +8,7 @@
/**
*
*/
include_once 'pmd_common.php';
include_once './libraries/pmd_common.php';
$die_save_pos = 0;
include_once 'pmd_save_pos.php';
extract($_POST, EXTR_SKIP);

View File

@ -8,7 +8,7 @@
/**
*
*/
include_once 'pmd_common.php';
include_once './libraries/pmd_common.php';
extract($_POST, EXTR_SKIP);
extract($_GET, EXTR_SKIP);
$die_save_pos = 0;

View File

@ -8,7 +8,7 @@
/**
*
*/
include_once 'pmd_common.php';
include_once './libraries/pmd_common.php';
$cfgRelation = PMA_getRelationsParam();

View File

@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-08-17 16:58+0200\n"
"PO-Revision-Date: 2011-07-19 14:58+0200\n"
"PO-Revision-Date: 2011-08-18 14:54+0200\n"
"Last-Translator: <stoyanster@gmail.com>\n"
"Language-Team: bulgarian <bg@li.org>\n"
"Language: bg\n"
@ -6206,7 +6206,7 @@ msgstr ""
#: libraries/export/sql.php:174
#, php-format
msgid "Add %s statement"
msgstr "Ново заявление %s"
msgstr "Добавяне на заявление %s"
#: libraries/export/sql.php:152
msgid "Add statements:"

View File

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-08-17 16:58+0200\n"
"PO-Revision-Date: 2011-08-10 22:33+0200\n"
"PO-Revision-Date: 2011-08-18 20:10+0200\n"
"Last-Translator: Fulup <fulup.jakez@ofis-bzh.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: br\n"
@ -856,14 +856,14 @@ msgid "Dump has been saved to file %s."
msgstr "Enrollet eo bet ar restr ezporzhiañ e%s."
#: gis_data_editor.php:84
#, fuzzy, php-format
#, php-format
#| msgid "Values for the column \"%s\""
msgid "Value for the column \"%s\""
msgstr "Talvoud evit ar bann \"%s\""
msgstr "Talvoud evit ar bann \"%s\""
#: gis_data_editor.php:113 tbl_gis_visualization.php:172
msgid "Use OpenStreetMaps as Base Layer"
msgstr ""
msgstr "Ober gant OpenStreetMaps evit ar gwiskad diazez"
#: gis_data_editor.php:134
msgid "SRID"
@ -872,29 +872,28 @@ msgstr ""
#: gis_data_editor.php:151 js/messages.php:289
#: libraries/display_tbl.lib.php:663
msgid "Geometry"
msgstr ""
msgstr "Mentoniezh"
#: gis_data_editor.php:172 gis_data_editor.php:194 gis_data_editor.php:240
#: gis_data_editor.php:290 js/messages.php:286
msgid "Point"
msgstr ""
msgstr "Poent"
#: gis_data_editor.php:173 gis_data_editor.php:195 gis_data_editor.php:241
#: gis_data_editor.php:291 js/messages.php:284
msgid "X"
msgstr ""
msgstr "X"
#: gis_data_editor.php:175 gis_data_editor.php:197 gis_data_editor.php:243
#: gis_data_editor.php:293 js/messages.php:285
msgid "Y"
msgstr ""
msgstr "Y"
#: gis_data_editor.php:202 gis_data_editor.php:246 gis_data_editor.php:296
#: js/messages.php:292
#, fuzzy
#| msgid "Add constraints"
msgid "Add a point"
msgstr "Ouzhpennañ ar strishadurioù"
msgstr "Ouzhpennañ ur poent"
#: gis_data_editor.php:218 js/messages.php:287
#, fuzzy
@ -922,17 +921,16 @@ msgstr ""
#: gis_data_editor.php:262 js/messages.php:288
msgid "Polygon"
msgstr ""
msgstr "Lieskorneg"
#: gis_data_editor.php:300 js/messages.php:294
msgid "Add a polygon"
msgstr ""
msgstr "Ouzhpennañ ul lieskorneg"
#: gis_data_editor.php:304
#, fuzzy
#| msgid "Add user"
msgid "Add geometry"
msgstr "Ouzhpennañ un implijer"
msgstr "Ouzhpennañ mentoniezh"
#: gis_data_editor.php:312
msgid ""
@ -1172,7 +1170,7 @@ msgstr "Udb all"
#. l10n: Thousands separator
#: js/messages.php:75 libraries/common.lib.php:1359
msgid ","
msgstr ""
msgstr " "
#. l10n: Decimal separator
#: js/messages.php:77 libraries/common.lib.php:1361
@ -1232,18 +1230,17 @@ msgid ""
msgstr ""
#: js/messages.php:96
#, fuzzy
#| msgid "Tracking is not active."
msgid "Query cache efficiency"
msgstr "N'eo ket oberiant an heuliañ."
msgstr "Efeduster ar grubuilh rekedoù"
#: js/messages.php:97 po/advisory_rules.php:70
msgid "Query cache usage"
msgstr ""
msgstr "Implij ar grubuilh rekedoù"
#: js/messages.php:98
msgid "Query cache used"
msgstr ""
msgstr "Krubuilh rekedoù implijet"
#: js/messages.php:100
msgid "System CPU Usage"
@ -1403,45 +1400,49 @@ msgstr ""
#: js/messages.php:143
#, php-format
msgid "long_query_time is set to %d second(s)."
msgstr ""
msgstr "Reizhet eo bet long_query_time da %d eilenn."
#: js/messages.php:144
msgid ""
"Following settings will be applied globally and reset to default on server "
"restart:"
msgstr ""
"Lakaet e vo e pleustr dre-vras ar reizhadurioù da-heul hag adlakaet e vint "
"d'an talvoud dre ziouer pa adloc'ho ar servijer :"
#. l10n: %s is FILE or TABLE
#: js/messages.php:146
#, php-format
msgid "Set log_output to %s"
msgstr ""
msgstr "Reizhañ log_output da %s"
#. l10n: Enable in this context means setting a status variable to ON
#: js/messages.php:148
#, fuzzy, php-format
#, php-format
#| msgid "Enable Ajax"
msgid "Enable %s"
msgstr "Gweredekaat Ajax"
msgstr "Gweredekaat %s"
#. l10n: Disable in this context means setting a status variable to OFF
#: js/messages.php:150
#, fuzzy, php-format
#, php-format
#| msgid "Disabled"
msgid "Disable %s"
msgstr "Diweredekaet"
msgstr "Diweredekaat %s"
#. l10n: %d seconds
#: js/messages.php:152
#, php-format
msgid "Set long_query_time to %ds"
msgstr ""
msgstr "Reizhañ long_query_time da %ds"
#: js/messages.php:153
msgid ""
"You can't change these variables. Please log in as root or contact your "
"database administrator."
msgstr ""
"N'hallit ket cheñch an arventennoù-mañ. Kevreit dindan root pe kit e "
"darempred gant merour ar servijer."
#: js/messages.php:154
#, fuzzy

114
po/de.po
View File

@ -4,8 +4,8 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-08-17 16:58+0200\n"
"PO-Revision-Date: 2011-08-17 13:24+0200\n"
"Last-Translator: <franz.georg@neurieser.eu>\n"
"PO-Revision-Date: 2011-08-18 18:36+0200\n"
"Last-Translator: Sven Strickroth <email@cs-ware.de>\n"
"Language-Team: german <de@li.org>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
@ -854,65 +854,69 @@ msgid "Dump has been saved to file %s."
msgstr "Dump wurde in Datei %s gespeichert."
#: gis_data_editor.php:84
#, fuzzy, php-format
#, php-format
#| msgid "Values for the column \"%s\""
msgid "Value for the column \"%s\""
msgstr "Werte für die Spalte \"%s\""
msgstr "Wert für die Spalte \"%s\""
#: gis_data_editor.php:113 tbl_gis_visualization.php:172
msgid "Use OpenStreetMaps as Base Layer"
msgstr "Verwende OpenStreetMaps als Basis-Layer"
#: gis_data_editor.php:134
#, fuzzy
msgid "SRID"
msgstr ""
msgstr "SRID"
#: gis_data_editor.php:151 js/messages.php:289
#: libraries/display_tbl.lib.php:663
msgid "Geometry"
msgstr "Gestaltung"
msgstr "Geometrie"
#: gis_data_editor.php:172 gis_data_editor.php:194 gis_data_editor.php:240
#: gis_data_editor.php:290 js/messages.php:286
msgid "Point"
msgstr ""
msgstr "Punkt"
#: gis_data_editor.php:173 gis_data_editor.php:195 gis_data_editor.php:241
#: gis_data_editor.php:291 js/messages.php:284
msgid "X"
msgstr ""
msgstr "X"
#: gis_data_editor.php:175 gis_data_editor.php:197 gis_data_editor.php:243
#: gis_data_editor.php:293 js/messages.php:285
msgid "Y"
msgstr ""
msgstr "Y"
#: gis_data_editor.php:202 gis_data_editor.php:246 gis_data_editor.php:296
#: js/messages.php:292
#, fuzzy
#| msgid "Add routine"
msgid "Add a point"
msgstr "Prozedur hinzufügen"
msgstr "Punkt hinzufügen"
#: gis_data_editor.php:218 js/messages.php:287
#, fuzzy
#| msgid "Lines terminated by"
msgid "Linestring"
msgstr "Zeilen getrennt mit"
msgstr "Linestring"
# ist hiermit der Umkreis gemeint? http://de.wikipedia.org/wiki/Umkreis
#: gis_data_editor.php:221 gis_data_editor.php:275
#, fuzzy
msgid "Outer Ring:"
msgstr ""
msgstr "Außenring:"
# Ist hiermit der Inkreis gemeint? http://de.wikipedia.org/wiki/Inkreis
#: gis_data_editor.php:223 gis_data_editor.php:277 js/messages.php:290
#, fuzzy
msgid "Inner Ring"
msgstr ""
msgstr "Innenring:"
#: gis_data_editor.php:248
#, fuzzy
#| msgid "Add a new User"
msgid "Add a linestring"
msgstr "Neuen Benutzer hinzufügen"
msgstr "Linestring hinzufügen"
#: gis_data_editor.php:248 gis_data_editor.php:298 js/messages.php:293
#, fuzzy
@ -922,19 +926,18 @@ msgstr "Neuen Benutzer hinzufügen"
#: gis_data_editor.php:262 js/messages.php:288
msgid "Polygon"
msgstr ""
msgstr "Polygon"
#: gis_data_editor.php:300 js/messages.php:294
#, fuzzy
#| msgid "Add column"
msgid "Add a polygon"
msgstr "Spalte hinzufügen"
msgstr "Polygon hinzufügen"
#: gis_data_editor.php:304
#, fuzzy
#| msgid "Geometry"
msgid "Add geometry"
msgstr "Gestaltung"
msgstr "Geometrie hinzufügen"
#: gis_data_editor.php:312
msgid ""
@ -1785,15 +1788,15 @@ msgstr "Jeder Punkt stellt eine Datenreihe dar"
#: js/messages.php:266
msgid "Hovering over a point will show its label."
msgstr ""
msgstr "Das Überfliegen eines Punktes zeigt seine Bezeichnung."
#: js/messages.php:268
msgid "Drag and select an area in the plot to zoom into it."
msgstr ""
msgstr "Mit gedrückter Maustaste eine Fläche aufziehen um hineinzuzoomen."
#: js/messages.php:270
msgid "Click reset zoom link to come back to original state."
msgstr ""
msgstr "Auf \"Zoom zurücksetzen\" klicken um zum Original zurückzukehren."
#: js/messages.php:272
msgid "Click a data point to view and possibly edit the data row."
@ -1809,13 +1812,12 @@ msgstr ""
#: js/messages.php:276
msgid "Strings are converted into integer for plotting"
msgstr ""
msgstr "Zeichenketten werden für die Zeichnung in Integerwerte umgewandelt."
#: js/messages.php:278
#, fuzzy
#| msgid "Add/Delete columns"
msgid "Select two columns"
msgstr "Spalten hinzufügen/entfernen"
msgstr "Zwei Spalten auswählen"
#: js/messages.php:279
msgid "Select two different columns"
@ -1832,7 +1834,7 @@ msgstr "Kopieren"
#: js/messages.php:291
msgid "Outer Ring"
msgstr ""
msgstr "Aussenring"
#: js/messages.php:297
msgid "Add columns"
@ -1906,12 +1908,13 @@ msgstr ""
msgid ""
"You can also edit most columns<br />by clicking directly on their content."
msgstr ""
"Sie können die meisten Spalten bearbeiten<br/>indem Sie auf den Inhalt "
"klicken."
#: js/messages.php:319
#, fuzzy
#| msgid "Go to view"
msgid "Go to link"
msgstr "Gehe zum View"
msgstr "Gehe zur Verknüpfung"
#: js/messages.php:322
msgid "Generate password"
@ -4957,16 +4960,14 @@ msgid "Show function fields"
msgstr "Funktionsfelder anzeigen"
#: libraries/config/messages.inc.php:462
#, fuzzy
#| msgid "Where to show the table row links"
msgid "Whether to show hint or not"
msgstr "Wo die Datensatz-Links angezeigt werden sollen"
msgstr "Hinweise anzeigen"
#: libraries/config/messages.inc.php:463
#, fuzzy
#| msgid "Show indexes"
msgid "Show hint"
msgstr "Indexes anzeigen"
msgstr "Hinweis anzeigen"
#: libraries/config/messages.inc.php:464
msgid ""
@ -6788,10 +6789,9 @@ msgid "MySQL Spatial Extension does not support ESRI type \"%s\"."
msgstr ""
#: libraries/import/shp.php:350
#, fuzzy
#| msgid "This page does not contain any tables!"
msgid "The imported file does not contain any data"
msgstr "Diese Seite enthält keine Tabellen!"
msgstr "Die importierte Datei enthält keine Daten"
#: libraries/import/sql.php:33
msgid "SQL compatibility mode:"
@ -7322,7 +7322,7 @@ msgstr "Abfrage ausführen"
#| msgid "Start"
msgctxt "Start of recurring event"
msgid "Start"
msgstr "Anfang"
msgstr "Start"
#: libraries/rte/rte_events.lib.php:457
#, fuzzy
@ -8133,16 +8133,14 @@ msgid "Operator"
msgstr "Operator"
#: libraries/tbl_select.lib.php:143
#, fuzzy
#| msgid "Search"
msgid "Table Search"
msgstr "Suche"
msgstr "Tabellensuche"
#: libraries/tbl_select.lib.php:229 tbl_change.php:994
#, fuzzy
#| msgid "Insert"
msgid "Edit/Insert"
msgstr "Einfügen"
msgstr "Bearbeiten/Einfügen"
#: libraries/transformations/application_octetstream__download.inc.php:10
msgid ""
@ -9589,13 +9587,11 @@ msgid "Related links:"
msgstr "Verwandte Links:"
#: server_status.php:800
#, fuzzy
#| msgid "Query analyzer"
msgid "Run analyzer"
msgstr "Query Analyzer"
msgstr "Analyse durchführen"
#: server_status.php:801
#, fuzzy
#| msgid "Introduction"
msgid "Instructions"
msgstr "Einführung"
@ -10497,10 +10493,9 @@ msgid ""
msgstr ""
#: server_status.php:1508
#, fuzzy
#| msgid "Pause monitor"
msgid "Using the monitor:"
msgstr "Überwachung pausieren"
msgstr "Verwendung der Überwachung:"
#: server_status.php:1510
#, fuzzy
@ -10519,16 +10514,15 @@ msgid ""
"change the refresh rate under 'Settings', or remove any chart using the cog "
"icon on each respective chart."
msgstr ""
"<b>Verwendung der Überwachung:</b><br />OK, Sie sind bereit zum Starten! "
"Sobald Sie 'Überwachung starten' angeklickt haben, wird Ihr Browser in "
"regelmäßigen Intervallen alle angezeigten Diagramme aktualisieren. Unter "
"'Einstellungen' können Sie Diagramme hinzufügen und das "
"Aktualisierungsintervall ändern oder beliebige Diagramme entfernen, wenn Sie "
"das Zahnrad-Icon des entsprechenden Schaubilds verwenden.<p>Wenn Sie eine "
"plötzliche Spitze in der Aktivität feststellen, wählen Sie den "
"entsprechenden Zeitraum in einem beliebigen Diagramm, indem Sie die linke "
"Maustaste gedrückt halten und über das Schaubild ziehen. Dies wird "
"Statistiken aus den Protokollen laden um Sie bei der Auffindung der "
"OK, Sie sind bereit zum Starten! Sobald Sie 'Überwachung starten' angeklickt "
"haben, wird Ihr Browser in regelmäßigen Intervallen alle angezeigten "
"Diagramme aktualisieren. Unter 'Einstellungen' können Sie Diagramme "
"hinzufügen und das Aktualisierungsintervall ändern oder beliebige Diagramme "
"entfernen, wenn Sie das Zahnrad-Icon des entsprechenden Schaubilds "
"verwenden.<p>Wenn Sie eine plötzliche Spitze in der Aktivität feststellen, "
"wählen Sie den entsprechenden Zeitraum in einem beliebigen Diagramm, indem "
"Sie die linke Maustaste gedrückt halten und über das Schaubild ziehen. Dies "
"wird Statistiken aus den Protokollen laden um Sie bei der Auffindung der "
"Aktivitätsspitze zu unterstützen.</p>"
#: server_status.php:1512
@ -10562,10 +10556,9 @@ msgstr ""
#: server_status.php:1519
msgid "Please note:"
msgstr ""
msgstr "Bitte beachten Sie:"
#: server_status.php:1521
#, fuzzy
#| msgid ""
#| "<b>Please note:</b> Enabling the general_log may increase the server load "
#| "by 5-15%. Also be aware that generating statistics from the logs is a "
@ -10578,10 +10571,11 @@ msgid ""
"it is advisable to select only a small time span and to disable the "
"general_log and empty its table once monitoring is not required any more."
msgstr ""
"<b>Bitte beachten Sie:</b> Das Aktivieren des general_log kann die "
"Serverlast um 5-15% steigern. Seien Sie sich bewusst, dass das Erzeugen von "
"Statistiken aus den Logs ein sehr aufwändiger Prozess ist. Deshalb ist es "
"ratsam, nur einen kleinen Zeitraum auszuwählen."
"Das Aktivieren des general_log kann die Serverlast um 5-15% steigern. Seien "
"Sie sich bewusst, dass das Erzeugen von Statistiken aus den Logs ein sehr "
"aufwändiger Prozess ist. Deshalb ist es ratsam, nur einen kleinen Zeitraum "
"auszuwählen und die gerneral_log nach der Überwachung wieder zu "
"deaktivieren."
#: server_status.php:1533
#, fuzzy

View File

@ -4,8 +4,8 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-08-17 16:58+0200\n"
"PO-Revision-Date: 2011-08-04 21:47+0200\n"
"Last-Translator: Marc Delisle <marc@infomarc.info>\n"
"PO-Revision-Date: 2011-08-18 22:40+0200\n"
"Last-Translator: Robert Readman <robert_readman@hotmail.com>\n"
"Language-Team: english-gb <en_GB@li.org>\n"
"Language: en_GB\n"
"MIME-Version: 1.0\n"
@ -416,10 +416,10 @@ msgid "You have to choose at least one column to display"
msgstr "You have to choose at least one column to display"
#: db_qbe.php:186
#, fuzzy, php-format
#, php-format
#| msgid "visual builder"
msgid "Switch to %svisual builder%s"
msgstr "visual builder"
msgstr "Switch to %svisual builder%s"
#: db_qbe.php:222 libraries/db_structure.lib.php:90
#: libraries/display_tbl.lib.php:955
@ -851,10 +851,10 @@ msgid "Dump has been saved to file %s."
msgstr "Dump has been saved to file %s."
#: gis_data_editor.php:84
#, fuzzy, php-format
#, php-format
#| msgid "Values for the column \"%s\""
msgid "Value for the column \"%s\""
msgstr "Values for the column \"%s\""
msgstr "Value for the column \"%s\""
#: gis_data_editor.php:113 tbl_gis_visualization.php:172
msgid "Use OpenStreetMaps as Base Layer"
@ -862,7 +862,7 @@ msgstr "Use OpenStreetMaps as Base Layer"
#: gis_data_editor.php:134
msgid "SRID"
msgstr ""
msgstr "SRID"
#: gis_data_editor.php:151 js/messages.php:289
#: libraries/display_tbl.lib.php:663
@ -872,72 +872,68 @@ msgstr "Geometry"
#: gis_data_editor.php:172 gis_data_editor.php:194 gis_data_editor.php:240
#: gis_data_editor.php:290 js/messages.php:286
msgid "Point"
msgstr ""
msgstr "Point"
#: gis_data_editor.php:173 gis_data_editor.php:195 gis_data_editor.php:241
#: gis_data_editor.php:291 js/messages.php:284
msgid "X"
msgstr ""
msgstr "X"
#: gis_data_editor.php:175 gis_data_editor.php:197 gis_data_editor.php:243
#: gis_data_editor.php:293 js/messages.php:285
msgid "Y"
msgstr ""
msgstr "Y"
#: gis_data_editor.php:202 gis_data_editor.php:246 gis_data_editor.php:296
#: js/messages.php:292
#, fuzzy
#| msgid "Add routine"
msgid "Add a point"
msgstr "Add routine"
msgstr "Add a point"
#: gis_data_editor.php:218 js/messages.php:287
#, fuzzy
#| msgid "Lines terminated by"
msgid "Linestring"
msgstr "Lines terminated by"
msgstr "Linestring"
#: gis_data_editor.php:221 gis_data_editor.php:275
msgid "Outer Ring:"
msgstr ""
msgstr "Outer Ring:"
#: gis_data_editor.php:223 gis_data_editor.php:277 js/messages.php:290
msgid "Inner Ring"
msgstr ""
msgstr "Inner Ring"
#: gis_data_editor.php:248
#, fuzzy
#| msgid "Add a new User"
msgid "Add a linestring"
msgstr "Add a new User"
msgstr "Add a linestring"
#: gis_data_editor.php:248 gis_data_editor.php:298 js/messages.php:293
#, fuzzy
#| msgid "Add a new User"
msgid "Add an inner ring"
msgstr "Add a new User"
msgstr "Add an inner ring"
#: gis_data_editor.php:262 js/messages.php:288
msgid "Polygon"
msgstr ""
msgstr "Polygon"
#: gis_data_editor.php:300 js/messages.php:294
#, fuzzy
#| msgid "Add column"
msgid "Add a polygon"
msgstr "Add column"
msgstr "Add a polygon"
#: gis_data_editor.php:304
#, fuzzy
#| msgid "Geometry"
msgid "Add geometry"
msgstr "Geometry"
msgstr "Add geometry"
#: gis_data_editor.php:312
msgid ""
"Chose \"GeomFromText\" from the \"Function\" column and paste the below "
"string into the \"Value\" field"
msgstr ""
"Chose \"GeomFromText\" from the \"Function\" column and paste the below string "
"into the \"Value\" field"
#: import.php:57
#, php-format
@ -1211,10 +1207,9 @@ msgid "Query statistics"
msgstr "Query statistics"
#: js/messages.php:93
#, fuzzy
#| msgid "Failed to read configuration file"
msgid "Local monitor configuration incompatible"
msgstr "Failed to read configuration file"
msgstr "Local monitor configuration incompatible"
#: js/messages.php:94
msgid ""

261
po/es.po
View File

@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-08-17 16:58+0200\n"
"PO-Revision-Date: 2011-08-16 21:46+0200\n"
"PO-Revision-Date: 2011-08-19 21:45+0200\n"
"Last-Translator: Matías Bellone <matiasbellone@gmail.com>\n"
"Language-Team: spanish <es@li.org>\n"
"Language: es\n"
@ -856,10 +856,10 @@ msgid "Dump has been saved to file %s."
msgstr "El volcado ha sido guardado al archivo %s."
#: gis_data_editor.php:84
#, fuzzy, php-format
#, php-format
#| msgid "Values for the column \"%s\""
msgid "Value for the column \"%s\""
msgstr "Valores para la columna \"%s\""
msgstr "Valor para la columna \"%s\""
#: gis_data_editor.php:113 tbl_gis_visualization.php:172
msgid "Use OpenStreetMaps as Base Layer"
@ -867,7 +867,7 @@ msgstr "Utilizar OpenStreetMaps como capa base"
#: gis_data_editor.php:134
msgid "SRID"
msgstr ""
msgstr "SRID"
#: gis_data_editor.php:151 js/messages.php:289
#: libraries/display_tbl.lib.php:663
@ -877,72 +877,68 @@ msgstr "Geometría"
#: gis_data_editor.php:172 gis_data_editor.php:194 gis_data_editor.php:240
#: gis_data_editor.php:290 js/messages.php:286
msgid "Point"
msgstr ""
msgstr "Punto"
#: gis_data_editor.php:173 gis_data_editor.php:195 gis_data_editor.php:241
#: gis_data_editor.php:291 js/messages.php:284
msgid "X"
msgstr ""
msgstr "X"
#: gis_data_editor.php:175 gis_data_editor.php:197 gis_data_editor.php:243
#: gis_data_editor.php:293 js/messages.php:285
msgid "Y"
msgstr ""
msgstr "Y"
#: gis_data_editor.php:202 gis_data_editor.php:246 gis_data_editor.php:296
#: js/messages.php:292
#, fuzzy
#| msgid "Add routine"
msgid "Add a point"
msgstr "Agregar rutina"
msgstr "Agregar un punto"
#: gis_data_editor.php:218 js/messages.php:287
#, fuzzy
#| msgid "Lines terminated by"
msgid "Linestring"
msgstr "Líneas terminadas en"
msgstr "Cadena de líneas"
#: gis_data_editor.php:221 gis_data_editor.php:275
msgid "Outer Ring:"
msgstr ""
msgstr "Círculo exterior:"
#: gis_data_editor.php:223 gis_data_editor.php:277 js/messages.php:290
msgid "Inner Ring"
msgstr ""
msgstr "Círculo interior"
#: gis_data_editor.php:248
#, fuzzy
#| msgid "Add a new User"
msgid "Add a linestring"
msgstr "Agregar un nuevo usuario"
msgstr "Agregar una cadena de líneas"
#: gis_data_editor.php:248 gis_data_editor.php:298 js/messages.php:293
#, fuzzy
#| msgid "Add a new User"
msgid "Add an inner ring"
msgstr "Agregar un nuevo usuario"
msgstr "Agregar un círculo interior"
#: gis_data_editor.php:262 js/messages.php:288
msgid "Polygon"
msgstr ""
msgstr "Polígono"
#: gis_data_editor.php:300 js/messages.php:294
#, fuzzy
#| msgid "Add column"
msgid "Add a polygon"
msgstr "Añadir columna"
msgstr "Agregar un polígono"
#: gis_data_editor.php:304
#, fuzzy
#| msgid "Geometry"
msgid "Add geometry"
msgstr "Geometría"
msgstr "Agregar geometría"
#: gis_data_editor.php:312
msgid ""
"Chose \"GeomFromText\" from the \"Function\" column and paste the below "
"string into the \"Value\" field"
msgstr ""
"Selecciones «GeomFromText» de la columna \"Función\" y pague la cadena ubicada "
"debajo en el campo \"Valor\""
#: import.php:57
#, php-format
@ -1223,10 +1219,9 @@ msgid "Query statistics"
msgstr "Estadísticas de Consulta"
#: js/messages.php:93
#, fuzzy
#| msgid "Local monitor configuration icompatible"
msgid "Local monitor configuration incompatible"
msgstr "Configuración de monitorización local incompatible"
msgstr "Configuración local de monitorización incompatible"
#: js/messages.php:94
msgid ""
@ -1825,7 +1820,7 @@ msgstr "Copiar"
#: js/messages.php:291
msgid "Outer Ring"
msgstr ""
msgstr "Círculo exterior"
#: js/messages.php:297
msgid "Add columns"
@ -2191,6 +2186,8 @@ msgstr "Segundo"
#, php-format
msgid "Failed formatting string for rule '%s'. PHP threw following error: %s"
msgstr ""
"No se pudo dar formato a una cadena para la regla '%s'. PHP devolvió el "
"siguiente error: %s"
#: libraries/Config.class.php:1159
msgid "Font size"
@ -6807,29 +6804,30 @@ msgstr "Importar monedas <i>(por ejemplo: $5.00 como 5.00)</i>"
#: libraries/import/shp.php:14
msgid "ESRI Shape File"
msgstr ""
msgstr "Archivo de forma ESRI"
#: libraries/import/shp.php:254
#, php-format
msgid "There was an error importing the ESRI shape file: \"%s\"."
msgstr ""
msgstr "Hubo un error importando el archivo de forma ESRI: \"%s\"."
#: libraries/import/shp.php:310
msgid ""
"You tried to import an invalid file or the imported file contains invalid "
"data"
msgstr ""
"Intentó importar un archivo no válido o el archivo importado contiene datos "
"inválidos"
#: libraries/import/shp.php:312
#, php-format
msgid "MySQL Spatial Extension does not support ESRI type \"%s\"."
msgstr ""
msgstr "La extensión espacial MySQL no soporta el tipo ESRI \"%s\"."
#: libraries/import/shp.php:350
#, fuzzy
#| msgid "This page does not contain any tables!"
msgid "The imported file does not contain any data"
msgstr "Esta página no contiene ninguna tabla"
msgstr "El archivo importado no contiene datos"
#: libraries/import/sql.php:33
msgid "SQL compatibility mode:"
@ -8163,10 +8161,9 @@ msgid "Table Search"
msgstr "Búsqueda de tablas"
#: libraries/tbl_select.lib.php:229 tbl_change.php:994
#, fuzzy
#| msgid "Insert"
msgid "Edit/Insert"
msgstr "Insertar"
msgstr "Editar/Insertar"
#: libraries/transformations/application_octetstream__download.inc.php:10
msgid ""
@ -12274,12 +12271,13 @@ msgid "Query cache low memory prunes"
msgstr "Reducciones al caché de consultas por falta de memoria"
#: po/advisory_rules.php:91
#, fuzzy
#| msgid "The amount of free memory for query cache."
msgid ""
"Cached queries are removed due to low query cache memory from the query "
"cache."
msgstr "La cantidad de memoria libre para el cache de consultas."
msgstr ""
"Las consultas en caché son eliminadas debido a la poca cantidad de memoria "
"de caché para el caché de consultas."
#: po/advisory_rules.php:92
msgid ""
@ -12287,46 +12285,56 @@ msgid ""
"overhead of maintaining the cache is likely to increase with its size, so do "
"this in small increments and monitor the results."
msgstr ""
"Podría llegar a querer aumentar «query_cache_size». Recuerde sin embargo que "
"la sobrecarga de mantener el caché es probable que aumente con su tamaño, "
"por lo que se recomienda hacerlo en pequeñas cantidades y monitorizar los "
"resultados."
#: po/advisory_rules.php:93
msgid ""
"The ratio of removed queries to inserted queries is %s%%. The lower this "
"value is, the better (This rules firing limit: 0.1%)"
msgstr ""
"La tasa de consultas eliminadas respecto de las agregadas es %s%%. Mejor es "
"mientras menor sea este valor (el límite de disparo de la regla es: 0.1%)"
#: po/advisory_rules.php:95
#, fuzzy
#| msgid "Query cache"
msgid "Query cache max size"
msgstr "Cache de consultas"
msgstr "Tamaño máximo del caché de consultas"
#: po/advisory_rules.php:96
msgid ""
"The query cache size is above 128 MiB. Big query caches may cause "
"significant overhead that is required to maintain the cache."
msgstr ""
"El tamaño del caché de consultas es mayor a 128 MiB. Grandes cachés pueden "
"causar grandes sobrecargas para manterlo."
#: po/advisory_rules.php:97
msgid ""
"Depending on your environment, it might be performance increasing to reduce "
"this value."
msgstr ""
"Dependiendo de su entorno, podría aumentar la performance reducir este "
"valor."
#: po/advisory_rules.php:98
#, php-format
msgid "Current query cache size: %s"
msgstr ""
msgstr "Tamaño del caché de consultas: %s"
#: po/advisory_rules.php:100
#, fuzzy
#| msgid "Query results"
msgid "Query cache min result size"
msgstr "Resultados de la Consulta"
msgstr "Tamaño mínimo de resultado en caché de consultas"
#: po/advisory_rules.php:101
msgid ""
"The max size of the result set in the query cache is the default of 1 MiB."
msgstr ""
"El tamaño máximo del conjunto de resultados en el caché de consultas es el "
"valor predeterminado de 1 MiB."
#: po/advisory_rules.php:102
msgid ""
@ -12339,28 +12347,37 @@ msgid ""
"(often invalidated due to table updates) increasing {query_cache_limit} "
"might reduce efficiency."
msgstr ""
"Cambiar «query_cache_limit» (normalmente aumentarlo) puede aumentar la "
"eficiencia. Esta variable determina el tamaño máximo que puede tener el "
"resultado de una consulta para ser agregada al caché de consultas. Si hay "
"muchos resultados de consultas mayores a 1 MiB que son útiles al caché "
"(muchas lecturas, pocas escrituras) entonces aumentar «query_cache_limit» "
"aumentará la eficiencia. Sin embargo, en el caso que muchos resultados de "
"consultas mayores a 1 MiB que no sean útiles al caché (invalidados "
"frecuentemente por actualizaciones a la tabla) aumentar «query_cache_limit» "
"podría reducir la eficiencia."
#: po/advisory_rules.php:103
msgid "query_cache_limit is set to 1 MiB"
msgstr ""
msgstr "«query_cache_limit» está definido a 1 MiB"
#: po/advisory_rules.php:105
#, fuzzy
#| msgid "Allows creating temporary tables."
msgid "Percentage of sorts that cause temporary tables"
msgstr "Permite la creación de tablas temporales."
msgstr "Porcentaje de ordenaciones que causan tablas temporales"
#: po/advisory_rules.php:106 po/advisory_rules.php:111
#, fuzzy
#| msgid "Allows creating temporary tables."
msgid "Too many sorts are causing temporary tables."
msgstr "Permite la creación de tablas temporales."
msgstr "Demasiadas ordenaciones causan tablas temporales."
#: po/advisory_rules.php:107 po/advisory_rules.php:112
msgid ""
"Consider increasing sort_buffer_size and/or read_rnd_buffer_size, depending "
"on your system memory limits"
msgstr ""
"Considere aumentar «sort_buffer_size» y/o «read_rnd_buffer_size» dependiendo "
"de los límites de memoria del sistema"
#: po/advisory_rules.php:108
#, php-format
@ -12368,28 +12385,30 @@ msgid ""
"%s%% of all sorts cause temporary tables, this value should be lower than "
"10%%."
msgstr ""
"%s%% de todas las ordenaciones causan tablas temporales, este valor debería "
"de ser menor a 10%%."
#: po/advisory_rules.php:110
#, fuzzy
#| msgid "Allows creating temporary tables."
msgid "Rate of sorts that cause temporary tables"
msgstr "Permite la creación de tablas temporales."
msgstr "Tasa de ordenaciones que causan tablas temporales"
#: po/advisory_rules.php:113
#, php-format
msgid ""
"Temporary tables average: %s, this value should be less than 1 per hour."
msgstr ""
"Promedio de tablas temporales: %s, este valor debería de ser menor a 1 por "
"hora."
#: po/advisory_rules.php:115
#, fuzzy
#| msgid "Start row"
msgid "Sort rows"
msgstr "Fila de inicio"
msgstr "Filas ordenadas"
#: po/advisory_rules.php:116
msgid "There are lots of rows being sorted."
msgstr ""
msgstr "Hay demasiadas filas siendo ordenadas."
#: po/advisory_rules.php:117
msgid ""
@ -12398,42 +12417,49 @@ msgid ""
"indexed fields in the ORDER BY clause, as this will result in much faster "
"sorting"
msgstr ""
"Si bien no hay nada de malo en ordenar una gran cantidad de filas, podría "
"llegar a desea asegurarse que las consultas que requieren gran cantidad de "
"ordenación utilicen campos indexados en la cláusula «ORDER BY», lo que "
"resultará en una ordenación más rápida"
#: po/advisory_rules.php:118
#, php-format
msgid "Sorted rows average: %s"
msgstr ""
msgstr "Promedio de filas ordenadas: %s"
#: po/advisory_rules.php:120
#, fuzzy
#| msgid "There are no routines to display."
msgid "Rate of joins without indexes"
msgstr "No hay rutinas para mostrar."
msgstr "Tasa de uniones («JOIN») sin índices"
#: po/advisory_rules.php:121
#, fuzzy
#| msgid "There are no routines to display."
msgid "There are too many joins without indexes."
msgstr "No hay rutinas para mostrar."
msgstr "Hay demasiadas uniones («JOIN») sin índices."
#: po/advisory_rules.php:122
msgid ""
"This means that joins are doing full table scans. Adding indexes for the "
"fields being used in the join conditions will greatly speed up table joins"
msgstr ""
"Esto significa que las uniones («JOIN») están realizando escrutinios "
"completos sobre tablas. Agregar índices a los campos siendo utilizandos en "
"las condiciones de la unión las acelerarán en gran medida"
#: po/advisory_rules.php:123
#, php-format
msgid "Table joins average: %s, this value should be less than 1 per hour"
msgstr ""
"Promedio de uniones («JOIN») de tablas: %s, este promedio debería ser menor "
"a 1 por hora"
#: po/advisory_rules.php:125
msgid "Rate of reading first index entry"
msgstr ""
msgstr "Tasa de lectura del primer índice"
#: po/advisory_rules.php:126
msgid "The rate of reading the first index entry is high."
msgstr ""
msgstr "La tasa de lectura del primer índice es alta."
#: po/advisory_rules.php:127
msgid ""
@ -12444,19 +12470,28 @@ msgid ""
"scans. Other than that full index scans can only be reduced by rewriting "
"queries."
msgstr ""
"Esto normalmente indica escruitinios completos de índices. Éstos son más "
"rápidos que escrutinios de tablas pero requieren gran cantidad de clicos de "
"CPU en tablas grandes. Si dichas tablas tienen o han tenido una gran "
"cantidad de actualizaciones («UPDATE» o «DELETE»), ejecutar «OPTIMIZE TABLE» "
"podría reducir dicha cantidad y/o acelerar los escrutinios completos de "
"índices. De otra forma, la cantidad de escrutinios completos de índices sólo "
"puede ser reducida re-escribiendo las consultas."
#: po/advisory_rules.php:128
#, php-format
msgid "Index scans average: %s, this value should be less than 1 per hour"
msgstr ""
"Promedio de escrutinios de índices: %s, este valor debería de ser menor a 1 "
"por hora"
#: po/advisory_rules.php:130
msgid "Rate of reading fixed position"
msgstr ""
msgstr "Tasa de lectura de una posición fija"
#: po/advisory_rules.php:131
msgid "The rate of reading data from a fixed position is high."
msgstr ""
msgstr "La tasa de lecutura de datos de una posición fija es alta."
#: po/advisory_rules.php:132
msgid ""
@ -12464,6 +12499,9 @@ msgid ""
"scan, including join queries that do not use indexes. Add indexes where "
"applicable."
msgstr ""
"Esto indica que muchas consultas necesitan ordenar resultados y/o realizar "
"un escrutinio completo de tablas, incluyendo consultas con uniones («JOIN») "
"que no utilizan índices. Agregue índices donde sea aplicable."
#: po/advisory_rules.php:133
#, php-format
@ -12471,38 +12509,42 @@ msgid ""
"Rate of reading fixed position average: %s, this value should be less than 1 "
"per hour"
msgstr ""
"Tasa de lectura de una posición fija: %s, este valor debería de ser menor a "
"1 por hora"
#: po/advisory_rules.php:135
#, fuzzy
#| msgid "Where to show the table row links"
msgid "Rate of reading next table row"
msgstr "Donde mostrar los enlaces de filas de tabla"
msgstr "Tasa de lectura de la siguiente fila de una tabla"
#: po/advisory_rules.php:136
#, fuzzy
#| msgid "Where to show the table row links"
msgid "The rate of reading the next table row is high."
msgstr "Donde mostrar los enlaces de filas de tabla"
msgstr "La tasa de lecutra de la siguiente fila de una tabla es alta."
#: po/advisory_rules.php:137
msgid ""
"This indicates that many queries are doing full table scans. Add indexes "
"where applicable."
msgstr ""
"Esto indica que muchas consultas están realizando escrutinios completos de "
"tablas. Agregue índices donde sea aplicable."
#: po/advisory_rules.php:138
#, php-format
msgid ""
"Rate of reading next table row: %s, this value should be less than 1 per hour"
msgstr ""
"Tasa de lectura de la siguiente fila de una tabla: %s, este valor debería de "
"ser menor a 1 por hora"
#: po/advisory_rules.php:140
msgid "tmp_table_size vs. max_heap_table_size"
msgstr ""
msgstr "«tmp_table_size» vs. «max_heap_table_size»"
#: po/advisory_rules.php:141
msgid "tmp_table_size and max_heap_table_size are not the same."
msgstr ""
msgstr "«tmp_table_size» y «max_heap_table_size» no son iguales."
#: po/advisory_rules.php:142
msgid ""
@ -12511,23 +12553,29 @@ msgid ""
"wish to increase the in-memory table limit you will have to increase the "
"other value as well."
msgstr ""
"Si ha modificado alguno de ellos deliberadamente: el servidor utiliza el "
"valor menor de ellos para determinar el tamaño máximo de tablas en memoria. "
"Si desea aumentar el límite de tamaño de tablas en memoria deberá también "
"aumentar el otro valor."
#: po/advisory_rules.php:143
#, php-format
msgid "Current values are tmp_table_size: %s, max_heap_table_size: %s"
msgstr ""
"Los valores actuales son «tmp_table_size»: %s, «max_heap_table_size»: %s"
#: po/advisory_rules.php:145
#, fuzzy
#| msgid "Where to show the table row links"
msgid "Percentage of temp tables on disk"
msgstr "Donde mostrar los enlaces de filas de tabla"
msgstr "Porcentaje de tablas temporales en disco"
#: po/advisory_rules.php:146 po/advisory_rules.php:151
msgid ""
"Many temporary tables are being written to disk instead of being kept in "
"memory."
msgstr ""
"Muchas tablas temporales están siendo escritas la disco en lugar de ser "
"mantenidas en memoria."
#: po/advisory_rules.php:147
msgid ""
@ -12539,6 +12587,14 @@ msgid ""
"mentioned in the beginning of an <a href=\\\"http://www.facebook.com/note."
"php?note_id=10150111255065841&comments\\\">Article by the Pythian Group</a>"
msgstr ""
"Aumentar «max_heap_table_size» y «tmp_table_size» podría ayudar. Sin "
"embargo, algunas tablas temporales son siempre escritas a disco "
"independientemente del valor de estas variables. Para eliminarlas deberá re-"
"escribir las consultas para evitar estas condiciones (en una tabla temporal: "
"la presencia de una columna «BLOB» o «TEXT», o la presencia de una columna "
"mayor a 512 bytes) como se menciona al comienzo del <a href=\\\"http://www.fac"
"ebook.com/note.php?note_id=10150111255065841&comments\\\">artículo de Pythian "
"Group</a>"
#: po/advisory_rules.php:148
#, php-format
@ -12546,15 +12602,14 @@ msgid ""
"%s%% of all temporary tables are being written to disk, this value should be "
"below 25%%"
msgstr ""
"%s%% de todas las tablas temporales son escritas al disco, este valor "
"debería de ser menor a 25%%"
# singular: tabla
# plural: tablas
#: po/advisory_rules.php:150
#, fuzzy
#| msgid "%s table"
#| msgid_plural "%s tables"
msgid "Temp disk rate"
msgstr "%s tabla"
msgstr "Tasa de tablas temporales en el disco"
#: po/advisory_rules.php:152
msgid ""
@ -12566,6 +12621,14 @@ msgid ""
"mentioned in in the <a href=\\\"http://dev.mysql.com/doc/refman/5.0/en/"
"internal-temporary-tables.html\\\">MySQL Documentation</a>"
msgstr ""
"Aumentar «max_heap_table_size» y «tmp_table_size» podría ayudar. Sin "
"embargo, algunas tablas temporales son siempre escritas a disco "
"independientemente del valor de estas variables. Para eliminarlas deberá re-"
"escribir las consultas para evitar estas condiciones (en una tabla temporal: "
"la presencia de una columna «BLOB» o «TEXT», o la presencia de una columna "
"mayor a 512 bytes) como se menciona en la <a "
"href=\\\"http://dev.mysql.com/doc/refman/5.0/en/internal-temporary-"
"tables.html\\\">documentación de MySQL</a>"
#: po/advisory_rules.php:153
#, php-format
@ -12573,38 +12636,43 @@ msgid ""
"Rate of temporay tables being written to disk: %s, this value should be less "
"than 1 per hour"
msgstr ""
"La tasa de tablas temporales escritas al disco: %s, este valor debería ser "
"menor a 1 por hora"
#: po/advisory_rules.php:155
#, fuzzy
#| msgid "Sort buffer size"
msgid "MyISAM key buffer size"
msgstr "Organizar el tamaño del búfer de memoria"
msgstr "Tamaño de búfer de claves MyISAM"
#: po/advisory_rules.php:156
msgid "Key buffer is not initialized. No MyISAM indexes will be cached."
msgstr ""
"El búfer de claves no fue inicializado. No se utilizará un caché de claves "
"MyISAM."
#: po/advisory_rules.php:157
msgid ""
"Set {key_buffer_size} depending on the size of your MyISAM indexes. 64M is a "
"good start."
msgstr ""
"Defina «key_buffer_size» dependiendo del tamaño de los índices MyISAM. 64M "
"es un buen comienzo."
#: po/advisory_rules.php:158
msgid "key_buffer_size is 0"
msgstr ""
msgstr "«key_buffer_size» es 0"
#: po/advisory_rules.php:160
#, fuzzy, php-format
#, php-format
#| msgid "Sort buffer size"
msgid "Max %% MyISAM key buffer ever used"
msgstr "Organizar el tamaño del búfer de memoria"
msgstr "Porcentaje máximo del búfer de claves MyISAM usado en algún momento"
#: po/advisory_rules.php:161 po/advisory_rules.php:166
#, fuzzy, php-format
#, php-format
#| msgid "Sort buffer size"
msgid "MyISAM key buffer (index cache) %% used is low."
msgstr "Organizar el tamaño del búfer de memoria"
msgstr "El porcentaje del búfer de claves MyISAM (caché de índices) es bajo."
#: po/advisory_rules.php:162 po/advisory_rules.php:167
msgid ""
@ -12612,93 +12680,106 @@ msgid ""
"tables to see if indexes have been removed, or examine queries and "
"expectations about what indexes are being used."
msgstr ""
"Podría necesitar aumentar el valor de «key_buffer_size», examine sus tablas "
"nuevamente para ver si se han eliminado índices o sus consultas y las "
"expectativas de uso de los índices."
#: po/advisory_rules.php:163
#, php-format
msgid "max %% MyISAM key buffer ever used: %s, this value should be above 95%%"
msgstr ""
"Maxímo porcentaje de búfer de claves MyISAM utilizado en algún momento: %s, "
"este valor debería ser mayor a 95%%"
#: po/advisory_rules.php:165
#, fuzzy
#| msgid "Sort buffer size"
msgid "Percentage of MyISAM key buffer used"
msgstr "Organizar el tamaño del búfer de memoria"
msgstr "Porcentaje de búfer de claves MyISAM utilizado"
#: po/advisory_rules.php:168
#, php-format
msgid "%% MyISAM key buffer used: %s, this value should be above 95%%"
msgstr ""
"Porcentaje de búfer de claves MyISAM utilizado: %s, este valor debería ser "
"mayor a 95%%"
#: po/advisory_rules.php:170
msgid "Percentage of index reads from memory"
msgstr ""
msgstr "Porcentaje de índices leídos desde memoria"
#: po/advisory_rules.php:171
#, php-format
msgid "The %% of indexes that use the MyISAM key buffer is low."
msgstr ""
"El porcentaje de índices que utilizan el búfer de claves MyISAM es bajo."
#: po/advisory_rules.php:172
msgid "You may need to increase {key_buffer_size}."
msgstr ""
msgstr "Podría necesitar aumentar «key_buffer_size»."
#: po/advisory_rules.php:173
#, php-format
msgid "Index reads from memory: %s%%, this value should be above 95%%"
msgstr ""
msgstr "Índices leídos desde memoria: %s%%, este valor debería ser mayor a 95%%"
#: po/advisory_rules.php:175
#, fuzzy
#| msgid "Create table"
msgid "Rate of table open"
msgstr "Crear tabla"
msgstr "Tasa de apertura de tablas"
#: po/advisory_rules.php:176
#, fuzzy
#| msgid "The current number of pending writes."
msgid "The rate of opening tables is high."
msgstr "El número actual de escrituras pendientess."
msgstr "La tasa de apertura de tablas es alta."
#: po/advisory_rules.php:177
msgid ""
"Opening tables requires disk I/O which is costly. Increasing "
"{table_open_cache} might avoid this."
msgstr ""
"Abrir tablas necesita E/S en disco, lo cual es costoso. Aumentar "
"«table_open_cache» podría evitarlo."
#: po/advisory_rules.php:178
#, php-format
msgid "Opened table rate: %s, this value should be less than 10 per hour"
msgstr ""
"Tasa de apertura de tablas: %s, este valor debería ser menor a 10 por hora"
#: po/advisory_rules.php:180
#, fuzzy
#| msgid "Format of imported file"
msgid "Percentage of used open files limit"
msgstr "Formato del archivo importado"
msgstr "Porcentaje de uso del límite de archivos de abiertos"
# El mensaje de error llegará de PHP o MySQL por lo que no me parece correcto traducirlo
#: po/advisory_rules.php:181
msgid ""
"The number of open files is approaching the max number of open files. You "
"may get a \\\"Too many open files\\\" error."
msgstr ""
"La cantidad de archivos abiertos se acerca al máximo permitido. Podría "
"llegar a obtener un error al respecto («Too many open files»)."
#: po/advisory_rules.php:182 po/advisory_rules.php:187
msgid ""
"Consider increasing {open_files_limit}, and check the error log when "
"restarting after changing open_files_limit."
msgstr ""
"Considere aumentar «open_files_limit», y revise el registro de errores al "
"reiniciar luego de cambiar esta variable."
#: po/advisory_rules.php:183
#, php-format
msgid ""
"The number of opened files is at %s%% of the limit. It should be below 85%%"
msgstr ""
"La cantidad de archivos abiertos es %s%% del límite. Debería ser menor a 85%"
"%"
#: po/advisory_rules.php:185
#, fuzzy
#| msgid "Format of imported file"
msgid "Rate of open files"
msgstr "Formato del archivo importado"
msgstr "Tasa de apertura de archivos"
#: po/advisory_rules.php:186
#, fuzzy

View File

@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-08-17 16:58+0200\n"
"PO-Revision-Date: 2011-08-18 00:48+0200\n"
"PO-Revision-Date: 2011-08-19 11:26+0200\n"
"Last-Translator: Domen <dbc334@gmail.com>\n"
"Language-Team: slovenian <sl@li.org>\n"
"Language: sl\n"
@ -936,6 +936,8 @@ msgid ""
"Chose \"GeomFromText\" from the \"Function\" column and paste the below "
"string into the \"Value\" field"
msgstr ""
"Izberite \"GeomFromText\" iz stolpca \"Funkcija\" in prilepite spodnji niz v "
"polje \"Vrednost\""
#: import.php:57
#, php-format
@ -1874,6 +1876,9 @@ msgid ""
"This table does not contain a unique column. Features related to the grid "
"edit, checkbox, Edit, Copy and Delete links may not work after saving."
msgstr ""
"Tabela ne vsebuje unikatnega stolpca. Zmožnosti, povezane z urejanjem mreže, "
"potrditvenimi polji, povezavami Uredi, Kopiraj in Izbriši, po shranjevanju "
"morda ne bodo delovale."
#: js/messages.php:318
msgid ""
@ -9481,6 +9486,8 @@ msgid ""
"The Advisor system can provide recommendations on server variables by "
"analyzing the server status variables."
msgstr ""
"Svetovalni sistem lahko nudi priporočila o strežniških spremenljivkah tako, "
"da analizira spremenljivke stanja strežnika."
#: server_status.php:810
msgid ""

395
po/ta.po

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 3.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-08-17 16:58+0200\n"
"PO-Revision-Date: 2011-08-18 10:40+0200\n"
"PO-Revision-Date: 2011-08-19 21:49+0200\n"
"Last-Translator: Burak Yavuz <hitowerdigit@hotmail.com>\n"
"Language-Team: turkish <tr@li.org>\n"
"Language: tr\n"
@ -817,7 +817,8 @@ msgstr "Çıktı"
#: enum_editor.php:68
msgid "Copy and paste the joined values into the \"Length/Values\" field"
msgstr "\"Genişlik/Değerler\" alanına katılan değerleri kopyala ve yapıştır"
msgstr ""
"\"Genişlik/Değerler\" alanında birleştirilen değerleri kopyala ve yapıştır"
#: export.php:77
msgid "Selected export type has to be saved in file!"
@ -3075,7 +3076,7 @@ msgstr "Sıfırla"
#: libraries/config/messages.inc.php:17
msgid "Improves efficiency of screen refresh"
msgstr "Ekran yenilemenin etkinliğini geliştirir"
msgstr "Ekran yenileme etkinliğini geliştirir"
#: libraries/config/messages.inc.php:18
msgid "Enable Ajax"
@ -9782,8 +9783,8 @@ msgstr ""
"Sabitlenmiş konumda satır tabanlı okumak için istek sayısıdır. Eğer "
"sonuçları sıralamayı gerektiren çok fazla sorgu yapıyorsanız, bu değer "
"yüksek olur. Muhtemelen bütün tabloları taramak için MySQL gerektiren çok "
"fazla sorgulamanız vardır veya düzgün bir şekilde anahtarları "
"kullanmamaktasınız."
"fazla sorgulamalara sahipsiniz ya da anahtarları düzgün kullanılmayan "
"birleştirmelere sahipsiniz."
#: server_status.php:1209
msgid ""
@ -10245,7 +10246,7 @@ msgid ""
msgstr ""
"Yapılması zorunlu sıralama algoritması birleştirme geçişi sayısıdır. Eğer bu "
"değer büyükse, sort_buffer_size sistem değişkeninin değerini arttırmayı "
"dikkate almalısınız."
"düşünmelisiniz."
#: server_status.php:1290
msgid "The number of sorts that were done with ranges."
@ -11976,9 +11977,10 @@ msgid ""
"cache, especially if you have multiple slaves."
msgstr ""
"Oldukça yüksek trafikli veritabanı ile MySQL Sorgu önbelleği "
"kullanıyorsunuz. MySQL Sorgu önbelleği yerine <a href=\\\"http://dev.mysql."
"com/doc/refman/5.1/en/ha-memcached.html\\\">memcached</a> kullanmayı hesaba "
"katmak değebilir özelliklede çoklu slave'lere sahipseniz."
"kullanıyorsunuz. MySQL Sorgu önbelleği yerine <a "
"href=\\\"http://dev.mysql.com/doc/refman/5.1/en/ha-"
"memcached.html\\\">memcached</a> kullanmayı düşünmek değebilir özelliklede "
"çoklu slave'lere sahipseniz."
#: po/advisory_rules.php:73
#, php-format
@ -11999,7 +12001,7 @@ msgstr "Sorgu önbelleği verimli çalışmıyor, düşük tavan oranına sahip.
#: po/advisory_rules.php:77
msgid "Consider increasing {query_cache_limit}."
msgstr "Dikkate değer artış {query_cache_limit}."
msgstr "Dikkate değer {query_cache_limit} artışı."
#: po/advisory_rules.php:78
#, php-format
@ -12145,6 +12147,13 @@ msgid ""
"(often invalidated due to table updates) increasing {query_cache_limit} "
"might reduce efficiency."
msgstr ""
"{query_cache_limit} değiştirmek (genelde artarak) verimi arttırabilir. Bu "
"değişken en fazla boyutu belirler sorgu sonucu sorgu önbelleği içine "
"eklenebilmek zorundadır. Eğer 1 MiB'ın üstünde iyi önbelleklenebilir (çok "
"okuma, az yazma) birçok sorgu sonucu varsa sonrasında {query_cache_limit} "
"arttırmak etkiyi arttıracaktır. Halbuki çoğu sonucun iyi önbelleklenemeyen "
"(tablo güncellemelerinden dolayı sıkça geçersiz kılınan) 1 MiB'ın üzerinde "
"olması durumunda {query_cache_limit} arttırmak verimi azaltacaktır."
#: po/advisory_rules.php:103
msgid "query_cache_limit is set to 1 MiB"
@ -12163,6 +12172,8 @@ msgid ""
"Consider increasing sort_buffer_size and/or read_rnd_buffer_size, depending "
"on your system memory limits"
msgstr ""
"Dikkate değer sort_buffer_size ve/veya read_rnd_buffer_size artışı, sistem "
"bellek sınırlarınıza bağlıdır."
#: po/advisory_rules.php:108
#, php-format
@ -12170,6 +12181,8 @@ msgid ""
"%s%% of all sorts cause temporary tables, this value should be lower than "
"10%%."
msgstr ""
"Tüm sıralamaların %%%s'i geçici tablolara sebep olur, bu değer %%10'dan "
"düşük olmalıdır."
#: po/advisory_rules.php:110
msgid "Rate of sorts that cause temporary tables"
@ -12180,6 +12193,7 @@ msgstr "Geçici tablolara sebep olan sıralamaların oranı"
msgid ""
"Temporary tables average: %s, this value should be less than 1 per hour."
msgstr ""
"Geçici tabloların ortalaması: %s, bu değer saat başına 1'den az olmalıdır."
#: po/advisory_rules.php:115
msgid "Sort rows"
@ -12196,38 +12210,47 @@ msgid ""
"indexed fields in the ORDER BY clause, as this will result in much faster "
"sorting"
msgstr ""
"Satır sıralamanın yüksek miktarıyla hiçbir sorun yokken, ORDER BY ibaresinde "
"indekslenmiş alanları kullanan çok fazla sıralama gerektiren sorgulardan "
"emin olmak isteyebilirsiniz, ki bu çok daha hızlı sıralamayla "
"sonuçlanacaktır."
#: po/advisory_rules.php:118
#, php-format
msgid "Sorted rows average: %s"
msgstr ""
msgstr "Sıralanmış satır ortalaması: %s"
#: po/advisory_rules.php:120
msgid "Rate of joins without indexes"
msgstr "İndeksler olmaksızın katılım oranı"
msgstr "İndeksler olmaksızın birleştirme oranı"
#: po/advisory_rules.php:121
msgid "There are too many joins without indexes."
msgstr "İndeksler olmaksızın çok fazla katılım var."
msgstr "İndeksler olmaksızın çok fazla birleştirme var."
#: po/advisory_rules.php:122
msgid ""
"This means that joins are doing full table scans. Adding indexes for the "
"fields being used in the join conditions will greatly speed up table joins"
msgstr ""
"Bu, birleştirmeler tam tablo taraması yapıyor anlamına gelir. Birleştirme "
"şartlarında kullanılan alanlar için indekslerin eklenmesi tablo "
"birleştirmelerini fazlasıyla hızlandıracaktır."
#: po/advisory_rules.php:123
#, php-format
msgid "Table joins average: %s, this value should be less than 1 per hour"
msgstr ""
"Tablo birleştirmeleri ortalaması: %s, bu değer saat başına 1'den az "
"olmalıdır."
#: po/advisory_rules.php:125
msgid "Rate of reading first index entry"
msgstr ""
msgstr "Okunan ilk indeks girişi oranı"
#: po/advisory_rules.php:126
msgid "The rate of reading the first index entry is high."
msgstr ""
msgstr "Okunan ilk indeks girişi oranı yüksek."
#: po/advisory_rules.php:127
msgid ""
@ -12530,7 +12553,7 @@ msgstr "İşlem önbelleği tavan oranı %%"
#: po/advisory_rules.php:206
msgid "Thread cache is not efficient."
msgstr "İşlem önbelleği etkin değil."
msgstr "İşlem önbelleği verimli değil."
#: po/advisory_rules.php:207
msgid "Increase {thread_cache_size}."

View File

@ -1416,7 +1416,7 @@ if (isset($_REQUEST['flush_privileges'])) {
/**
* defines some standard links
*/
$link_edit = '<a class="edit_user_anchor ' . $conditional_class . '" href="server_privileges.php?' . $GLOBALS['url_query']
$link_edit = '<a class="edit_user_anchor ' . $conditional_class . '" href="server_privileges.php?' . str_replace($GLOBALS['url_query'], '%', '%%')
. '&amp;username=%s'
. '&amp;hostname=%s'
. '&amp;dbname=%s'
@ -1424,7 +1424,7 @@ $link_edit = '<a class="edit_user_anchor ' . $conditional_class . '" href="serve
. PMA_getIcon('b_usredit.png', __('Edit Privileges'))
. '</a>';
$link_revoke = '<a href="server_privileges.php?' . $GLOBALS['url_query']
$link_revoke = '<a href="server_privileges.php?' . str_replace($GLOBALS['url_query'], '%', '%%')
. '&amp;username=%s'
. '&amp;hostname=%s'
. '&amp;dbname=%s'
@ -1433,7 +1433,7 @@ $link_revoke = '<a href="server_privileges.php?' . $GLOBALS['url_query']
. PMA_getIcon('b_usrdrop.png', __('Revoke'))
. '</a>';
$link_export = '<a class="export_user_anchor ' . $conditional_class . '" href="server_privileges.php?' . $GLOBALS['url_query']
$link_export = '<a class="export_user_anchor ' . $conditional_class . '" href="server_privileges.php?' . str_replace($GLOBALS['url_query'], '%', '%%')
. '&amp;username=%s'
. '&amp;hostname=%s'
. '&amp;initial=%s'
@ -2353,7 +2353,9 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
. ' ' . ($current['Grant_priv'] == 'Y' ? __('Yes') : __('No')) . "\n"
. ' </td>' . "\n"
. ' <td>' . "\n";
$user_form .= sprintf($link_edit, urlencode($current_user),
$user_form .= sprintf(
$link_edit,
urlencode($current_user),
urlencode($current_host),
urlencode(! isset($current['Db']) || $current['Db'] == '*' ? '' : $current['Db']),
'');

View File

@ -15,8 +15,9 @@ if (! defined('PMA_NO_VARIABLES_IMPORT')) {
define('PMA_NO_VARIABLES_IMPORT', true);
}
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true)
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
$GLOBALS['is_header_sent'] = true;
}
require_once './libraries/common.inc.php';
@ -31,166 +32,173 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
// real-time charting data
if (isset($_REQUEST['chart_data'])) {
switch($_REQUEST['type']) {
// Process and Connections realtime chart
case 'proc':
$c = PMA_DBI_fetch_result("SHOW GLOBAL STATUS WHERE Variable_name = 'Connections'", 0, 1);
$result = PMA_DBI_query('SHOW PROCESSLIST');
$num_procs = PMA_DBI_num_rows($result);
// Process and Connections realtime chart
case 'proc':
$c = PMA_DBI_fetch_result("SHOW GLOBAL STATUS WHERE Variable_name = 'Connections'", 0, 1);
$result = PMA_DBI_query('SHOW PROCESSLIST');
$num_procs = PMA_DBI_num_rows($result);
$ret = array(
'x' => microtime(true)*1000,
'y_proc' => $num_procs,
'y_conn' => $c['Connections']
);
$ret = array(
'x' => microtime(true) * 1000,
'y_proc' => $num_procs,
'y_conn' => $c['Connections']
);
exit(json_encode($ret));
exit(json_encode($ret));
// Query realtime chart
case 'queries':
$queries = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE (Variable_name LIKE 'Com_%' OR Variable_name = 'Questions')
AND Value > 0'", 0, 1);
cleanDeprecated($queries);
// admin commands are not queries
unset($queries['Com_admin_commands']);
$questions = $queries['Questions'];
unset($queries['Questions']);
// Query realtime chart
case 'queries':
$queries = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE (Variable_name LIKE 'Com_%' OR Variable_name = 'Questions')
AND Value > 0'", 0, 1);
cleanDeprecated($queries);
// admin commands are not queries
unset($queries['Com_admin_commands']);
$questions = $queries['Questions'];
unset($queries['Questions']);
//$sum=array_sum($queries);
$ret = array(
'x' => microtime(true)*1000,
'y' => $questions,
'pointInfo' => $queries
);
//$sum=array_sum($queries);
$ret = array(
'x' => microtime(true) * 1000,
'y' => $questions,
'pointInfo' => $queries
);
exit(json_encode($ret));
exit(json_encode($ret));
// Traffic realtime chart
case 'traffic':
$traffic = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name = 'Bytes_received'
OR Variable_name = 'Bytes_sent'", 0, 1);
// Traffic realtime chart
case 'traffic':
$traffic = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name = 'Bytes_received'
OR Variable_name = 'Bytes_sent'", 0, 1);
$ret = array(
'x' => microtime(true)*1000,
'y_sent' => $traffic['Bytes_sent'],
'y_received' => $traffic['Bytes_received']
);
$ret = array(
'x' => microtime(true) * 1000,
'y_sent' => $traffic['Bytes_sent'],
'y_received' => $traffic['Bytes_received']
);
exit(json_encode($ret));
exit(json_encode($ret));
// Data for the monitor
case 'chartgrid':
$ret = json_decode($_REQUEST['requiredData'], true);
$statusVars = array();
$serverVars = array();
$sysinfo = $cpuload = $memory = 0;
$pName = '';
// Data for the monitor
case 'chartgrid':
$ret = json_decode($_REQUEST['requiredData'], true);
$statusVars = array();
$serverVars = array();
$sysinfo = $cpuload = $memory = 0;
$pName = '';
/* Accumulate all required variables and data */
// For each chart
foreach ($ret as $chart_id => $chartNodes) {
// For each data series
foreach ($chartNodes as $node_id => $nodeDataPoints) {
// For each data point in the series (usually just 1)
foreach ($nodeDataPoints as $point_id => $dataPoint) {
$pName = $dataPoint['name'];
/* Accumulate all required variables and data */
// For each chart
foreach ($ret as $chart_id => $chartNodes) {
// For each data series
foreach ($chartNodes as $node_id => $nodeDataPoints) {
// For each data point in the series (usually just 1)
foreach ($nodeDataPoints as $point_id => $dataPoint) {
$pName = $dataPoint['name'];
switch ($dataPoint['type']) {
/* We only collect the status and server variables here to
* read them all in one query, and only afterwards assign them.
* Also do some white list filtering on the names
*/
case 'servervar':
if (!preg_match('/[^a-zA-Z_]+/', $pName))
$serverVars[] = $pName;
break;
case 'statusvar':
if (!preg_match('/[^a-zA-Z_]+/', $pName))
$statusVars[] = $pName;
break;
case 'proc':
$result = PMA_DBI_query('SHOW PROCESSLIST');
$ret[$chart_id][$node_id][$point_id]['value'] = PMA_DBI_num_rows($result);
break;
case 'cpu':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$cpuload)
$cpuload = $sysinfo->loadavg();
if (PHP_OS == 'Linux') {
$ret[$chart_id][$node_id][$point_id]['idle'] = $cpuload['idle'];
$ret[$chart_id][$node_id][$point_id]['busy'] = $cpuload['busy'];
} else
$ret[$chart_id][$node_id][$point_id]['value'] = $cpuload['loadavg'];
break;
case 'memory':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$memory)
$memory = $sysinfo->memory();
$ret[$chart_id][$node_id][$point_id]['value'] = $memory[$pName];
break;
switch ($dataPoint['type']) {
/* We only collect the status and server variables here to
* read them all in one query, and only afterwards assign them.
* Also do some white list filtering on the names
*/
case 'servervar':
if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
$serverVars[] = $pName;
}
break;
case 'statusvar':
if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
$statusVars[] = $pName;
}
break;
case 'proc':
$result = PMA_DBI_query('SHOW PROCESSLIST');
$ret[$chart_id][$node_id][$point_id]['value'] = PMA_DBI_num_rows($result);
break;
case 'cpu':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$cpuload) {
$cpuload = $sysinfo->loadavg();
}
if (PHP_OS == 'Linux') {
$ret[$chart_id][$node_id][$point_id]['idle'] = $cpuload['idle'];
$ret[$chart_id][$node_id][$point_id]['busy'] = $cpuload['busy'];
} else
$ret[$chart_id][$node_id][$point_id]['value'] = $cpuload['loadavg'];
break;
case 'memory':
if (!$sysinfo) {
require_once('libraries/sysinfo.lib.php');
$sysinfo = getSysInfo();
}
if (!$memory) {
$memory = $sysinfo->memory();
}
$ret[$chart_id][$node_id][$point_id]['value'] = $memory[$pName];
break;
} /* switch */
} /* foreach */
} /* foreach */
} /* foreach */
// Retrieve all required status variables
if (count($statusVars)) {
$statusVarValues = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name='" . implode("' OR Variable_name='", $statusVars) . "'", 0, 1);
} else {
$statusVarValues = array();
}
// Retrieve all required server variables
if (count($serverVars)) {
$serverVarValues = PMA_DBI_fetch_result(
"SHOW GLOBAL VARIABLES
WHERE Variable_name='" . implode("' OR Variable_name='", $serverVars) . "'", 0, 1);
} else {
$serverVarValues = array();
}
// ...and now assign them
foreach ($ret as $chart_id => $chartNodes) {
foreach ($chartNodes as $node_id => $nodeDataPoints) {
foreach ($nodeDataPoints as $point_id => $dataPoint) {
switch($dataPoint['type']) {
case 'statusvar':
$ret[$chart_id][$node_id][$point_id]['value'] = $statusVarValues[$dataPoint['name']];
break;
case 'servervar':
$ret[$chart_id][$node_id][$point_id]['value'] = $serverVarValues[$dataPoint['name']];
break;
}
}
}
}
// Retrieve all required status variables
if (count($statusVars)) {
$statusVarValues = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name='" . implode("' OR Variable_name='", $statusVars) . "'", 0, 1);
} else {
$statusVarValues = array();
}
$ret['x'] = microtime(true) * 1000;
// Retrieve all required server variables
if (count($serverVars)) {
$serverVarValues = PMA_DBI_fetch_result(
"SHOW GLOBAL VARIABLES
WHERE Variable_name='" . implode("' OR Variable_name='", $serverVars) . "'", 0, 1);
} else {
$serverVarValues = array();
}
// ...and now assign them
foreach ($ret as $chart_id => $chartNodes) {
foreach ($chartNodes as $node_id => $nodeDataPoints) {
foreach ($nodeDataPoints as $point_id => $dataPoint) {
switch($dataPoint['type']) {
case 'statusvar':
$ret[$chart_id][$node_id][$point_id]['value'] = $statusVarValues[$dataPoint['name']];
break;
case 'servervar':
$ret[$chart_id][$node_id][$point_id]['value'] = $serverVarValues[$dataPoint['name']];
break;
}
}
}
}
$ret['x'] = microtime(true)*1000;
exit(json_encode($ret));
exit(json_encode($ret));
}
}
if (isset($_REQUEST['log_data'])) {
if(PMA_MYSQL_INT_VERSION < 50106) exit('""');
if (PMA_MYSQL_INT_VERSION < 50106) {
/* FIXME: why this? */
exit('""');
}
$start = intval($_REQUEST['time_start']);
$end = intval($_REQUEST['time_end']);
@ -210,19 +218,23 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
$type = strtolower(substr($row['sql_text'], 0, strpos($row['sql_text'], ' ')));
switch($type) {
case 'insert':
case 'update':
// Cut off big inserts and updates, but append byte count therefor
if(strlen($row['sql_text']) > 220)
$row['sql_text'] = substr($row['sql_text'], 0, 200) . '... [' .
implode(' ', PMA_formatByteDown(strlen($row['sql_text']), 2, 2)) . ']';
break;
default:
break;
case 'insert':
case 'update':
// Cut off big inserts and updates, but append byte count therefor
if (strlen($row['sql_text']) > 220) {
$row['sql_text'] = substr($row['sql_text'], 0, 200)
. '... ['
. implode(' ', PMA_formatByteDown(strlen($row['sql_text']), 2, 2))
. ']';
}
break;
default:
break;
}
if(!isset($return['sum'][$type])) $return['sum'][$type] = 0;
if (!isset($return['sum'][$type])) {
$return['sum'][$type] = 0;
}
$return['sum'][$type] += $row['#'];
$return['rows'][] = $row;
}
@ -235,7 +247,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($return));
}
if($_REQUEST['type'] == 'general') {
if ($_REQUEST['type'] == 'general') {
$limitTypes = (isset($_REQUEST['limitTypes']) && $_REQUEST['limitTypes'])
? 'AND argument REGEXP \'^(INSERT|SELECT|UPDATE|DELETE)\' ' : '';
@ -257,39 +269,44 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
preg_match('/^(\w+)\s/', $row['argument'], $match);
$type = strtolower($match[1]);
if(!isset($return['sum'][$type])) $return['sum'][$type] = 0;
if (!isset($return['sum'][$type])) {
$return['sum'][$type] = 0;
}
$return['sum'][$type] += $row['#'];
switch($type) {
case 'insert':
// Group inserts if selected
if($removeVars && preg_match('/^INSERT INTO (`|\'|"|)([^\s\\1]+)\\1/i', $row['argument'], $matches)) {
$insertTables[$matches[2]]++;
if ($insertTables[$matches[2]] > 1) {
$return['rows'][$insertTablesFirst]['#'] = $insertTables[$matches[2]];
case 'insert':
// Group inserts if selected
if ($removeVars && preg_match('/^INSERT INTO (`|\'|"|)([^\s\\1]+)\\1/i', $row['argument'], $matches)) {
$insertTables[$matches[2]]++;
if ($insertTables[$matches[2]] > 1) {
$return['rows'][$insertTablesFirst]['#'] = $insertTables[$matches[2]];
// Add a ... to the end of this query to indicate that there's been other queries
if($return['rows'][$insertTablesFirst]['argument'][strlen($return['rows'][$insertTablesFirst]['argument'])-1] != '.')
$return['rows'][$insertTablesFirst]['argument'] .= '<br/>...';
// Group this value, thus do not add to the result list
continue 2;
} else {
$insertTablesFirst = $i;
$insertTables[$matches[2]] += $row['#'] - 1;
// Add a ... to the end of this query to indicate that there's been other queries
if ($return['rows'][$insertTablesFirst]['argument'][strlen($return['rows'][$insertTablesFirst]['argument'])-1] != '.') {
$return['rows'][$insertTablesFirst]['argument'] .= '<br/>...';
}
// Group this value, thus do not add to the result list
continue 2;
} else {
$insertTablesFirst = $i;
$insertTables[$matches[2]] += $row['#'] - 1;
}
// No break here
}
// No break here
case 'update':
// Cut off big inserts and updates, but append byte count therefor
if(strlen($row['argument']) > 220)
$row['argument'] = substr($row['argument'], 0, 200) . '... [' .
implode(' ', PMA_formatByteDown(strlen($row['argument'])), 2, 2) . ']';
case 'update':
// Cut off big inserts and updates, but append byte count therefor
if (strlen($row['argument']) > 220) {
$row['argument'] = substr($row['argument'], 0, 200)
. '... ['
. implode(' ', PMA_formatByteDown(strlen($row['argument'])), 2, 2)
. ']';
}
break;
break;
default: break;
default: break;
}
$return['rows'][] = $row;
@ -306,12 +323,15 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
}
if (isset($_REQUEST['logging_vars'])) {
if(isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) {
if (isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) {
$value = PMA_sqlAddslashes($_REQUEST['varValue']);
if(!is_numeric($value)) $value="'" . $value . "'";
if (!is_numeric($value)) {
$value="'" . $value . "'";
}
if(! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName']))
if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName'])) {
PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value);
}
}
@ -319,14 +339,16 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($loggingVars));
}
if(isset($_REQUEST['query_analyzer'])) {
if (isset($_REQUEST['query_analyzer'])) {
$return = array();
if(strlen($_REQUEST['database']))
if (strlen($_REQUEST['database'])) {
PMA_DBI_select_db($_REQUEST['database']);
}
if ($profiling = PMA_profilingSupported())
if ($profiling = PMA_profilingSupported()) {
PMA_DBI_query('SET PROFILING=1;');
}
// Do not cache query
$query = preg_replace('/^(\s*SELECT)/i', '\\1 SQL_NO_CACHE', $_REQUEST['query']);
@ -344,7 +366,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
PMA_DBI_free_result($result);
if($profiling) {
if ($profiling) {
$return['profiling'] = array();
$result = PMA_DBI_try_query('SELECT seq,state,duration FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID=1 ORDER BY seq');
while ($row = PMA_DBI_fetch_assoc($result)) {
@ -356,7 +378,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($return));
}
if(isset($_REQUEST['advisor'])) {
if (isset($_REQUEST['advisor'])) {
include('libraries/Advisor.class.php');
$advisor = new Advisor();
exit(json_encode($advisor->run()));
@ -598,7 +620,8 @@ $links['innodb']['doc'] = 'innodb';
// Variable to contain all com_ variables
$used_queries = array();
// Variable to map variable names to their respective section name (used for js category filtering)
// Variable to map variable names to their respective section name
// (used for js category filtering)
$allocationMap = array();
// sort vars into arrays
@ -606,36 +629,43 @@ foreach ($server_status as $name => $value) {
foreach ($allocations as $filter => $section) {
if (strpos($name, $filter) !== false) {
$allocationMap[$name] = $section;
if ($section == 'com' && $value > 0) $used_queries[$name] = $value;
if ($section == 'com' && $value > 0) {
$used_queries[$name] = $value;
}
break; // Only exits inner loop
}
}
}
if(PMA_DRIZZLE) {
$used_queries = PMA_DBI_fetch_result('SELECT * FROM data_dictionary.global_statements', 0, 1);
$used_queries = PMA_DBI_fetch_result(
'SELECT * FROM data_dictionary.global_statements',
0,
1
);
unset($used_queries['admin_commands']);
} else {
// admin commands are not queries (e.g. they include COM_PING, which is excluded from $server_status['Questions'])
// admin commands are not queries (e.g. they include COM_PING,
// which is excluded from $server_status['Questions'])
unset($used_queries['Com_admin_commands']);
}
/* Ajax request refresh */
if (isset($_REQUEST['show']) && isset($_REQUEST['ajax_request'])) {
switch($_REQUEST['show']) {
case 'query_statistics':
printQueryStatistics();
exit();
case 'server_traffic':
printServerTraffic();
exit();
case 'variables_table':
// Prints the variables table
printVariablesTable();
exit();
case 'query_statistics':
printQueryStatistics();
exit();
case 'server_traffic':
printServerTraffic();
exit();
case 'variables_table':
// Prints the variables table
printVariablesTable();
exit();
default:
break;
default:
break;
}
}
@ -643,14 +673,38 @@ $server_db_isLocal = strtolower($cfg['Server']['host']) == 'localhost'
|| $cfg['Server']['host'] == '127.0.0.1'
|| $cfg['Server']['host'] == '::1';
PMA_AddJSCode('pma_token = \'' . $_SESSION[' PMA_token '] . "';\n" .
'url_query = \'' . str_replace('&amp;', '&', PMA_generate_common_url($db)) . "';\n" .
'server_time_diff = new Date().getTime() - ' . (microtime(true)*1000) . ";\n" .
'server_os = \'' . PHP_OS . "';\n" .
'is_superuser = ' . (PMA_isSuperuser() ? 'true' : 'false') . ";\n" .
'server_db_isLocal = ' . ($server_db_isLocal ? 'true' : 'false') . ";\n" .
'profiling_docu = \'' . PMA_showMySQLDocu('general-thread-states', 'general-thread-states') . "';\n" .
'explain_docu = \'' . PMA_showMySQLDocu('explain-output', 'explain-output') . ";'\n");
PMA_AddJSVar(
'pma_token',
$_SESSION[' PMA_token ']
);
PMA_AddJSVar(
'url_query',
str_replace('&amp;', '&', PMA_generate_common_url($db))
);
PMA_AddJSVar(
'server_time_diff',
'new Date().getTime() - ' . (microtime(true) * 1000)
);
PMA_AddJSVar(
'server_os',
PHP_OS
);
PMA_AddJSVar(
'is_superuser',
PMA_isSuperuser()
);
PMA_AddJSVar(
'server_db_isLocal',
$server_db_isLocal
);
PMA_AddJSVar(
'profiling_docu',
PMA_showMySQLDocu('general-thread-states', 'general-thread-states')
);
PMA_AddJSVar(
'explain_docu',
PMA_showMySQLDocu('explain-output', 'explain-output')
);
/**
* start output
@ -772,7 +826,9 @@ echo __('Runtime Information');
echo '<span class="status_' . $section_name . '"> ';
$i=0;
foreach ($section_links as $link_name => $link_url) {
if ($i > 0) echo ', ';
if ($i > 0) {
echo ', ';
}
if ('doc' == $link_name) {
echo PMA_showMySQLDocu($link_url, $link_url);
} else {
@ -894,9 +950,11 @@ function printQueryStatistics()
$name = str_replace(array('Com_', '_'), array('', ' '), $name);
// Group together values that make out less than 2% into "Other", but only if we have more than 6 fractions already
if ($value < $query_sum * 0.02 && count($chart_json)>6)
if ($value < $query_sum * 0.02 && count($chart_json)>6) {
$other_sum += $value;
else $chart_json[$name] = $value;
} else {
$chart_json[$name] = $value;
}
?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
<th class="name"><?php echo htmlspecialchars($name); ?></th>
@ -915,8 +973,9 @@ function printQueryStatistics()
<div id="serverstatusquerieschart">
<span style="display:none;">
<?php
if ($other_sum > 0)
if ($other_sum > 0) {
$chart_json[__('Other')] = $other_sum;
}
echo json_encode($chart_json);
?>
@ -971,8 +1030,7 @@ function printServerTraffic()
}
/* if the server works as master or slave in replication process, display useful information */
if ($server_master_status || $server_slave_status)
{
if ($server_master_status || $server_slave_status) {
?>
<hr class="clearfloat" />
@ -1121,7 +1179,8 @@ function printServerTraffic()
<th><?php echo __('Status'); ?></th>
<th><?php
echo __('SQL query');
if (! PMA_DRIZZLE) { ?>
if (! PMA_DRIZZLE) {
?>
<a href="<?php echo $full_text_link; ?>"
title="<?php echo empty($full) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>">
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . (empty($_REQUEST['full']) ? 'full' : 'partial'); ?>text.png"
@ -1488,7 +1547,7 @@ function printMonitor()
<div id="monitorInstructionsDialog" title="<?php echo __('Monitor Instructions'); ?>" style="display:none;">
<?php echo __('The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive queries. For the latter you will need to set log_output to \'TABLE\' and have either the slow_query_log or general_log enabled. Note however, that the general_log produces a lot of data and increases server load by up to 15%'); ?>
<?php if(PMA_MYSQL_INT_VERSION < 50106) { ?>
<?php if (PMA_MYSQL_INT_VERSION < 50106) { ?>
<p>
<img class="icon ic_s_attention" src="themes/dot.gif" alt="" />
<?php
@ -1630,7 +1689,9 @@ function printMonitor()
$i=0;
foreach ($server_status as $name=>$value) {
if (is_numeric($value)) {
if ($i++ > 0) echo ", ";
if ($i++ > 0) {
echo ", ";
}
echo "'" . $name . "'";
}
}
@ -1648,10 +1709,11 @@ function refreshList($name, $defaultRate=5, $refreshRates=Array(1, 2, 5, 10, 20,
foreach ($refreshRates as $rate) {
$selected = ($rate == $defaultRate)?' selected="selected"':'';
if ($rate<60)
if ($rate<60) {
echo '<option value="' . $rate . '"' . $selected . '>' . sprintf(_ngettext('%d second', '%d seconds', $rate), $rate) . '</option>';
else
} else {
echo '<option value="' . $rate . '"' . $selected . '>' . sprintf(_ngettext('%d minute', '%d minutes', $rate/60), $rate/60) . '</option>';
}
}
?>
</select>

View File

@ -16,9 +16,9 @@ require_once './libraries/common.inc.php';
$GLOBALS['js_include'][] = 'server_variables.js';
PMA_AddJSCode('pma_token = \'' . $_SESSION[' PMA_token '] . "';\n" .
'is_superuser = ' . (PMA_isSuperuser() ? 'true' : 'false') . ";\n" .
'url_query = \'' . str_replace('&amp;', '&', PMA_generate_common_url($db)) . "';\n");
PMA_AddJSVar('pma_token', $_SESSION[' PMA_token ']);
PMA_AddJSVar('url_query', str_replace('&amp;', '&', PMA_generate_common_url($db)));
PMA_AddJSVar('is_superuser', PMA_isSuperuser() ? true : false);
/**
@ -179,4 +179,4 @@ function formatVariable($name,$value)
*/
require './libraries/footer.inc.php';
?>
?>

View File

@ -165,8 +165,7 @@ unset($show_create_table);
* Get the list of the fields of the current table
*/
PMA_DBI_select_db($db);
$table_fields = PMA_DBI_fetch_result('SHOW FIELDS FROM ' . PMA_backquote($table) . ';',
null, null, null, PMA_DBI_QUERY_STORE);
$table_fields = array_values(PMA_DBI_get_columns($db, $table));
$rows = array();
if (isset($where_clause)) {
// when in edit mode load all selected rows from table

View File

@ -21,6 +21,7 @@ $GLOBALS['js_include'][] = 'sql.js';
$GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'tbl_zoom_plot.js';
$GLOBALS['js_include'][] = 'date.js';
$GLOBALS['js_include'][] = 'jquery/jquery.mousewheel.js';
$GLOBALS['js_include'][] = 'highcharts/highcharts.js';
/* Files required for chart exporting */
$GLOBALS['js_include'][] = 'highcharts/exporting.js';

View File

@ -0,0 +1,36 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for JS variable formatting
*
* @package phpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/js_escape.lib.php';
class PMA_JS_Escape_test extends PHPUnit_Framework_TestCase
{
/**
* @dataProvider variables
*/
public function testFormat($key, $value, $expected)
{
$this->assertEquals($expected, PMA_getJsValue($key, $value));
}
public function variables() {
return array(
array('foo', true, "foo = true;\n"),
array('foo', false, "foo = false;\n"),
array('foo', 100, "foo = 100;\n"),
array('foo', 0, "foo = 0;\n"),
array('foo', 'text', "foo = \"text\";\n"),
array('foo', 'quote"', "foo = \"quote\\\"\";\n"),
array('foo', 'apostroph\'', "foo = \"apostroph\\'\";\n"),
);
}
}
?>

View File

@ -2548,17 +2548,21 @@ span.cm-number {
margin: 0.3em 0.2em;
}
.cEdit .edit_box {
overflow: hidden;
padding: 0;
}
.cEdit .edit_box_posting {
background: #FFF url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>ajax_clock_small.gif) no-repeat right center;
padding-right: 1.5em;
}
.cEdit .edit_area_loading {
background: #FFF url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>ajax_clock_small.gif) no-repeat center;
height: 10em;
}
.cEdit .edit_area_posting {
background: #FFF url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>ajax_clock_small.gif) no-repeat center top;
padding-top: 1.5em;
}
.cEdit .goto_link {
background: #EEE;
color: #555;

View File

@ -1462,7 +1462,7 @@ div#queryAnalyzerDialog div.CodeMirror-scroll {
}
div#queryAnalyzerDialog div#queryProfiling {
height: 250px;
height: 250px;
}
div#queryAnalyzerDialog td.explain {
@ -1470,9 +1470,9 @@ div#queryAnalyzerDialog td.explain {
}
div#queryAnalyzerDialog table.queryNums {
display: none;
border:0;
text-align:left;
display: none;
border:0;
text-align:left;
}
.smallIndent {
@ -2992,16 +2992,21 @@ span.cm-number {
margin: 0.3em 0.2em;
}
.cEdit .edit_box {
overflow: hidden;
padding: 0;
}
.cEdit .edit_box_posting {
background: #FFF url(./themes/pmahomme/img/ajax_clock_small.gif) no-repeat right center;
padding-right: 1.5em;
}
.cEdit .edit_area_loading {
background: #FFF url(./themes/pmahomme/img/ajax_clock_small.gif) no-repeat center;
height: 10em;
}
.cEdit .edit_area_posting {
background: #FFF url(./themes/pmahomme/img/ajax_clock_small.gif) no-repeat center top;
padding-top: 1.5em;
}
.cEdit .goto_link {
background: #EEE;
color: #555;
@ -3019,3 +3024,523 @@ span.cm-number {
.ui-timepicker-div dl dt{ height: 25px; }
.ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; }
.ui-timepicker-div td { font-size: 90%; }
/* Designer */
.input_tab {
background-color: #A6C7E1;
color: #000000;
}
#canvas {
background-color: #FFFFFF;
color: #000000;
}
canvas.pmd {
display: inline-block;
overflow: hidden;
text-align: left;
}
canvas.pmd * {
behavior: url(#default#VML);
}
.pmd_tab {
background-color: #FFFFFF;
color: #000000;
border-collapse: collapse;
border: 1px solid #AAAAAA;
z-index: 1;
-moz-user-select: none;
}
.tab_zag {
background-image: url(images/Header.png);
background-repeat: repeat-x;
text-align: center;
cursor: move;
padding: 1px;
font-weight: bold;
}
.tab_zag_2 {
background-image: url(images/Header_Linked.png);
background-repeat: repeat-x;
text-align: center;
cursor: move;
padding: 1px;
font-weight: bold;
}
.tab_field {
background: #FFFFFF;
color: #000000;
cursor: default;
}
.tab_field_2 {
background-color: #CCFFCC;
color: #000000;
background-repeat: repeat-x;
cursor: default;
}
.tab_field_3 {
background-color: #FFE6E6; /*#DDEEFF*/
color: #000000;
cursor: default;
}
#pmd_hint {
white-space: nowrap;
position: absolute;
background-color: #99FF99;
color: #000000;
left: 200px;
top: 50px;
z-index: 3;
border: #00CC66 solid 1px;
display: none;
}
.scroll_tab {
overflow: auto;
width: 100%;
height: 500px;
}
.pmd_Tabs {
cursor: default;
color: #0055bb;
white-space: nowrap;
text-decoration: none;
text-indent: 3px;
font-weight: bold;
margin-left: 2px;
text-align: left;
background-color: #FFFFFF;
background-image: url(images/left_panel_butt.png);
border: #CCCCCC solid 1px;
}
.pmd_Tabs2 {
cursor: default;
color: #0055bb;
background: #FFEE99;
text-indent: 3px;
font-weight: bold;
white-space: nowrap;
text-decoration: none;
border: #9999FF solid 1px;
text-align: left;
}
.owner {
font-weight: normal;
color: #888888;
}
.option_tab {
padding-left: 2px;
padding-right: 2px;
width: 5px;
}
.select_all {
vertical-align: top;
padding-left: 2px;
padding-right: 2px;
cursor: default;
width: 1px;
color: #000000;
background-image: url(images/Header.png);
background-repeat: repeat-x;
}
.small_tab {
vertical-align: top;
background-color: #0064ea;
color: #FFFFFF;
background-image: url(images/small_tab.png);
cursor: default;
text-align: center;
font-weight: bold;
padding-left: 2px;
padding-right: 2px;
width: 1px;
text-decoration: none;
}
.small_tab2 {
vertical-align: top;
color: #FFFFFF;
background-color: #FF9966;
cursor: default;
padding-left: 2px;
padding-right: 2px;
text-align: center;
font-weight: bold;
width: 1px;
text-decoration: none;
}
.small_tab_pref {
background-image: url(images/Header.png);
background-repeat: repeat-x;
text-align: center;
width: 1px;
}
.small_tab_pref2 {
vertical-align: top;
color: #FFFFFF;
background-color: #FF9966;
cursor: default;
text-align: center;
font-weight: bold;
width: 1px;
text-decoration: none;
}
.butt {
border: #4477aa solid 1px;
font-weight: bold;
height: 19px;
width: 70px;
background-color: #FFFFFF;
color: #000000;
vertical-align: baseline;
}
.L_butt2_1 {
padding: 1px;
text-decoration: none;
background-color: #ffffff;
color: #000000;
vertical-align: middle;
cursor: default;
}
.L_butt2_2 {
padding: 0;
border: #0099CC solid 1px;
background: #FFEE99;
text-decoration: none;
color: #000000;
cursor: default;
}
/* ---------------------------------------------------------------------------*/
.bor {
width: 10px;
height: 10px;
}
.frams1 {
background: url(images/1.png) no-repeat right bottom;
}
.frams2 {
background: url(images/2.png) no-repeat left bottom;
}
.frams3 {
background: url(images/3.png) no-repeat left top;
}
.frams4 {
background: url(images/4.png) no-repeat right top;
}
.frams5 {
background: url(images/5.png) repeat-x center bottom;
}
.frams6 {
background: url(images/6.png) repeat-y left;
}
.frams7 {
background: url(images/7.png) repeat-x top;
}
.frams8 {
background: url(images/8.png) repeat-y right;
}
#osn_tab {
background-color: #FFFFFF;
color: #000000;
border: #A9A9A9 solid 1px;
}
.header {
background-color: #EAEEF0;
color: #000000;
text-align: center;
font-weight: bold;
margin: 0;
padding: 0;
background-image: url(images/top_panel.png);
background-position: top;
background-repeat: repeat-x;
border-right: #999999 solid 1px;
border-left: #999999 solid 1px;
height: 28px;
}
.header a {
display: block;
float: left;
margin: 3px 1px 4px 1px;
height: 20px;
border: 1px dotted #ffffff;
}
.header .M_bord {
display: block;
float: left;
margin: 4px;
height: 20px;
width: 2px;
}
.header a.first {
margin-right: 1em;
}
.header a.last {
margin-left: 1em;
}
a.M_butt_Selected_down_IE,
a.M_butt_Selected_down {
border: 1px solid #C0C0BB;
background-color: #99FF99;
color: #000000;
}
a.M_butt_Selected_down_IE:hover,
a.M_butt_Selected_down:hover,
a.M_butt:hover {
border: 1px solid #0099CC;
background-color: #FFEE99;
color: #000000;
}
#layer_menu {
z-index: 1000;
position: absolute;
left: 0;
background-color: #EAEEF0;
border: #999999 solid 1px;
}
#layer_action {
position: absolute;
left: 638px;
top: 52px;
z-index: 1000;
background-color: #CCFF99;
padding: 3px;
border: #009933 solid 1px;
white-space: nowrap;
font-weight: bold;
}
#layer_upd_relation {
position: absolute;
left: 637px;
top: 224px;
z-index: 1000;
}
#layer_new_relation {
position: absolute;
left: 636px;
top: 85px;
z-index: 1000;
width: 153px;
}
#pmd_optionse {
position: absolute;
left: 636px;
top: 85px;
z-index: 1000;
width: 153px;
}
#layer_menu_sizer {
background-image: url(../../images/resize.png);
cursor: nw-resize;
width: 16px;
height: 16px;
}
.panel {
position: fixed;
top: 50px;
right: 0;
display: none;
background: #FFF;
border:1px solid #F5F5F5;
width: 350 px;
height: auto;
padding: 30px 170px 30px 30px;
color:#FFF;
z-index:99;
}
a.trigger{
position: fixed;
text-decoration: none;
top: 60px; right: 0;
color:#fff;
padding: 10px 40px 10px 15px;
background:#333333 url(images/plus.png) 85% 55% no-repeat;
border:1px solid #444444;
display: block;
}
a.trigger:hover{
position: fixed;
text-decoration: none;
top: 60px; right: 0;
color:#080808;
padding: 10px 40px 10px 15px;
background:#fff696 url(images/plus.png) 85% 55% no-repeat;
border:1px solid #999;
display: block;
}
a.active.trigger {
background:#222222 url(images/minus.png) 85% 55% no-repeat;
z-index:999;
}
a.active.trigger:hover {
background:#fff696 url(images/minus.png) 85% 55% no-repeat;
z-index:999;
}
h2.tiger{
background-repeat: repeat-x;
padding: 1px;
font-weight: bold;
padding: 50 20 50 20px;
margin: 0 0 5px 0;
width: 250px;
float: left;
color : #333;
text-align: center;
}
h2.tiger a {
background-image: url(images/Header.png);
text-align: center;
text-decoration: none;
color : #333;
display: block;
}
h2.tiger a:hover {
color: #000;
background-image: url(images/Header_Linked.png);
}
h2.active {
background-image: url(images/Header.png);
background-repeat: repeat-x;
padding: 1px;
background-position: left bottom;
}
.toggle_container {
margin: 0 0 5px;
padding: 0;
border-top: 1px solid #d6d6d6;
background: #FFF ;
width: 250px;
overflow: hidden;
font-size: 1.2em;
clear: both;
}
.toggle_container .block {
background-color: #DBE4E8;
padding:40 15 40 15px; /*--Padding of Container--*/
border:1px solid #999;
color:#000;
}
.history_table {
text-align: center;
background-color: #9999CC;
}
.history_table2 {
text-align: center;
background-color: #DBE4E8;
}
#filter {
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: #CCA;
z-index:10;
opacity:0.5;
filter: alpha(opacity=50);
}
#box {
display: none;
position: absolute;
top: 20%;
left: 30%;
width: 500px;
height: 220px;
padding: 48px;
margin:0;
border: 1px solid black;
background-color: white;
z-index:101;
overflow: visible;
}
#boxtitle {
position:absolute;
float:center;
top:0;
left:0;
width:593px;
height:20px;
padding:0;
padding-top:4px;
left-padding:8px;
margin:0;
border-bottom:4px solid #3CF;
background-color: #D0DCE0;
color:black;
font-weight:bold;
padding-left: 2px;
text-align:left;
}
#tblfooter {
background-color: #D3DCE3;
float: right;
padding-top:10px;
color: black;
font-weight: normal;
}
input.btn {
color:#333;
background-color: #D0DCE0;
}

View File

@ -27,7 +27,6 @@ require_once './libraries/db_table_exists.lib.php';
* Get the list of the fields of the current table
*/
PMA_DBI_select_db($db);
$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table), null, PMA_DBI_QUERY_STORE);
if (isset($where_clause)) {
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';', null, PMA_DBI_QUERY_STORE);
$row = PMA_DBI_fetch_assoc($result);