Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2012-09-05 18:19:03 +02:00
commit fff80e7bf4
2 changed files with 166 additions and 123 deletions

View File

@ -150,37 +150,32 @@ EOC;
$header->getScripts()->addCode($code);
?>
<form action="browse_foreigners.php" method="post">
<fieldset>
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="field" value="<?php echo htmlspecialchars($field); ?>" />
<input type="hidden" name="fieldkey"
value="<?php echo isset($fieldkey) ? htmlspecialchars($fieldkey) : ''; ?>" />
<?php
if (isset($rownumber)) {
?>
<input type="hidden" name="rownumber" value="<?php echo htmlspecialchars($rownumber); ?>" />
<?php
}
?>
<span class="formelement">
<label for="input_foreign_filter"><?php echo __('Search') . ':'; ?></label>
<input type="text" name="foreign_filter" id="input_foreign_filter"
value="<?php echo isset($foreign_filter) ? htmlspecialchars($foreign_filter) : ''; ?>" />
<input type="submit" name="submit_foreign_filter" value="<?php echo __('Go');?>" />
</span>
<span class="formelement">
<?php echo $gotopage; ?>
</span>
<span class="formelement">
<?php echo $showall; ?>
</span>
</fieldset>
</form>
// HTML output
$output = '<form action="browse_foreigners.php" method="post">'
. '<fieldset>'
. PMA_generate_common_hidden_inputs($db, $table)
. '<input type="hidden" name="field" value="' . htmlspecialchars($field) . '" />'
. '<input type="hidden" name="fieldkey" value="'
. (isset($fieldkey) ? htmlspecialchars($fieldkey) : '') . '" />';
if (isset($rownumber)) {
$output .= '<input type="hidden" name="rownumber" value="'
. htmlspecialchars($rownumber) . '" />';
}
$output .= '<span class="formelement">'
. '<label for="input_foreign_filter">' . __('Search') . ':' . '</label>'
. '<input type="text" name="foreign_filter" id="input_foreign_filter" value="'
. (isset($foreign_filter) ? htmlspecialchars($foreign_filter) : '') . '" />'
. '<input type="submit" name="submit_foreign_filter" value="'
. __('Go') . '" />'
. '</span>'
. '<span class="formelement">' . $gotopage . '</span>'
. '<span class="formelement">' . $showall . '</span>'
. '</fieldset>'
. '</form>';
$output .= '<table width="100%">';
<table width="100%">
<?php
if (is_array($foreignData['disp_row'])) {
$header = '<tr>
<th>' . __('Keyname') . '</th>
@ -190,9 +185,9 @@ if (is_array($foreignData['disp_row'])) {
<th>' . __('Keyname') . '</th>
</tr>';
echo '<thead>' . $header . '</thead>' . "\n"
.'<tfoot>' . $header . '</tfoot>' . "\n"
.'<tbody>' . "\n";
$output .= '<thead>' . $header . '</thead>' . "\n"
. '<tfoot>' . $header . '</tfoot>' . "\n"
. '<tbody>' . "\n";
$values = array();
$keys = array();
@ -217,7 +212,7 @@ if (is_array($foreignData['disp_row'])) {
$hcount++;
if ($cfg['RepeatCells'] > 0 && $hcount > $cfg['RepeatCells']) {
echo $header;
$output .= $header;
$hcount = 0;
$odd_row = true;
}
@ -265,21 +260,23 @@ if (is_array($foreignData['disp_row'])) {
$key_ordered_current_equals_data = $key_ordered_current_key == $data;
}
?>
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
<td class="nowrap">
<?php
echo ($key_ordered_current_equals_data ? '<strong>' : '')
$output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$odd_row = ! $odd_row;
$output .= '<td class="nowrap">'
. ($key_ordered_current_equals_data ? '<strong>' : '')
. '<a href="#" title="' . __('Use this value')
. ($key_ordered_current_val_title != '' ? ': ' . $key_ordered_current_val_title : '') . '"'
. ($key_ordered_current_val_title != ''
? ': ' . $key_ordered_current_val_title
: '') . '"'
. ' onclick="formupdate(\'' . md5($field) . '\', \''
. PMA_jsFormat($key_ordered_current_key, false) . '\'); return false;">'
. htmlspecialchars($key_ordered_current_key)
. '</a>' . ($key_ordered_current_equals_data ? '</strong>' : '');
?></td>
<td>
<?php
echo ($key_ordered_current_equals_data ? '<strong>' : '')
. '</a>' . ($key_ordered_current_equals_data ? '</strong>' : '')
. '</td>';
$output .= '<td>'
. ($key_ordered_current_equals_data ? '<strong>' : '')
. '<a href="#" title="' . __('Use this value')
. ($key_ordered_current_val_title != '' ? ': '
. $key_ordered_current_val_title : '') . '" onclick="formupdate(\''
@ -287,15 +284,15 @@ if (is_array($foreignData['disp_row'])) {
. PMA_jsFormat($key_ordered_current_key, false)
. '\'); return false;">'
. $key_ordered_current_val . '</a>'
. ($key_ordered_current_equals_data ? '</strong>' : '');
?></td>
<td width="20%">
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>"
alt="" width="1" height="1" /></td>
. ($key_ordered_current_equals_data ? '</strong>' : '')
. '</td>';
<td>
<?php
echo ($val_ordered_current_equals_data ? '<strong>' : '')
$output .= '<td width="20%">'
. '<img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png" alt=""'
. ' width="1" height="1" /></td>';
$output .= '<td>'
. ($val_ordered_current_equals_data ? '<strong>' : '')
. '<a href="#" title="' . __('Use this value')
. ($val_ordered_current_val_title != '' ? ': '
. $val_ordered_current_val_title : '') . '" onclick="formupdate(\''
@ -303,21 +300,25 @@ if (is_array($foreignData['disp_row'])) {
. PMA_jsFormat($val_ordered_current_key, false)
. '\'); return false;">'
. $val_ordered_current_val . '</a>'
. ($val_ordered_current_equals_data ? '</strong>' : '');
?></td>
<td class="nowrap">
<?php
echo ($val_ordered_current_equals_data ? '<strong>' : '') . '<a href="#" title="'
. __('Use this value') . ($val_ordered_current_val_title != '' ? ': ' . $val_ordered_current_val_title : '')
. '" onclick="formupdate(\'' . md5($field) . '\', \''
. PMA_jsFormat($val_ordered_current_key, false) . '\'); return false;">'
. htmlspecialchars($val_ordered_current_key)
. '</a>' . ($val_ordered_current_equals_data ? '</strong>' : '');
?></td>
</tr>
<?php
. ($val_ordered_current_equals_data ? '</strong>' : '')
. '</td>';
$output .= '<td class="nowrap">'
. ($val_ordered_current_equals_data ? '<strong>' : '')
. '<a href="#" title="' . __('Use this value')
. ($val_ordered_current_val_title != ''
? ': ' . $val_ordered_current_val_title : '')
. '" onclick="formupdate(\'' . md5($field) . '\', \''
. PMA_jsFormat($val_ordered_current_key, false) . '\'); return false;">'
. htmlspecialchars($val_ordered_current_key)
. '</a>' . ($val_ordered_current_equals_data ? '</strong>' : '')
. '</td>';
$output .= '</tr>';
} // end while
}
$output .= '</tbody>'
. '</table>';
$response->addHtml($output);
?>
</tbody>
</table>

View File

@ -1,6 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Server variables
*
* @package PhpMyAdmin
*/
@ -46,7 +47,11 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
&& $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte'
) {
exit(implode(' ', $common_functions->formatByteDown($varValue[1], 3, 3)));
exit(
implode(
' ', $common_functions->formatByteDown($varValue[1], 3, 3)
)
);
}
exit($varValue[1]);
break;
@ -56,10 +61,24 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
&& $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte'
&& preg_match('/^\s*(\d+(\.\d+)?)\s*(mb|kb|mib|kib|gb|gib)\s*$/i', $value, $matches)
&& preg_match(
'/^\s*(\d+(\.\d+)?)\s*(mb|kb|mib|kib|gb|gib)\s*$/i',
$value,
$matches
)
) {
$exp = array('kb' => 1, 'kib' => 1, 'mb' => 2, 'mib' => 2, 'gb' => 3, 'gib' => 3);
$value = floatval($matches[1]) * $common_functions->pow(1024, $exp[strtolower($matches[3])]);
$exp = array(
'kb' => 1,
'kib' => 1,
'mb' => 2,
'mib' => 2,
'gb' => 3,
'gib' => 3
);
$value = floatval($matches[1]) * $common_functions->pow(
1024,
$exp[strtolower($matches[3])]
);
} else {
$value = $common_functions->sqlAddSlashes($value);
}
@ -70,12 +89,15 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
$response = PMA_Response::getInstance();
if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName'])
&& PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value)
&& PMA_DBI_query(
'SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value
)
) {
// Some values are rounded down etc.
$varValue = PMA_DBI_fetch_single_row(
'SHOW GLOBAL VARIABLES WHERE Variable_name="'
. $common_functions->sqlAddSlashes($_REQUEST['varName']) . '";', 'NUM'
. $common_functions->sqlAddSlashes($_REQUEST['varName'])
. '";', 'NUM'
);
$response->addJSON(
'variable',
@ -97,10 +119,12 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
/**
* Displays the sub-page heading
*/
echo '<h2>' . $common_functions->getImage('s_vars.png')
. '' . __('Server variables and settings') . "\n"
. $common_functions->showMySQLDocu('server_system_variables', 'server_system_variables')
. '</h2>' . "\n";
$output = '<h2>' . $common_functions->getImage('s_vars.png')
. '' . __('Server variables and settings') . "\n"
. $common_functions->showMySQLDocu(
'server_system_variables', 'server_system_variables'
)
. '</h2>' . "\n";
/**
* Sends the queries and buffers the results
@ -112,59 +136,76 @@ $serverVars = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES;', 0, 1);
/**
* Displays the page
*/
?>
<fieldset id="tableFilter" style="display:none;">
<legend><?php echo __('Filters'); ?></legend>
<div class="formelement">
<label for="filterText"><?php echo __('Containing the word:'); ?></label>
<input name="filterText" type="text" id="filterText" style="vertical-align: baseline;" />
</div>
</fieldset>
<table id="serverVariables" class="data filteredData noclick">
<thead>
<tr><th><?php echo __('Variable'); ?></th>
<th class="valueHeader">
<?php
echo __('Session value') . ' / ' . __('Global value');
?>
</th>
<th><?php echo __('Documentation'); ?></th>
</tr>
</thead>
<tbody>
<?php
$output .= '<fieldset id="tableFilter" style="display:none;">'
. '<legend>' . __('Filters') . '</legend>'
. '<div class="formelement">'
. '<label for="filterText">' . __('Containing the word:') . '</label>'
. '<input name="filterText" type="text" id="filterText"'
. ' style="vertical-align: baseline;" />'
. '</div>'
. '</fieldset>';
$output .= '<table id="serverVariables" class="data filteredData noclick">'
. '<thead>'
. '<tr><th>' . __('Variable') . '</th>'
. '<th class="valueHeader">'
. __('Session value') . ' / ' . __('Global value')
. '</th>'
. '<th>' . __('Documentation') . '</th>'
. '</tr>'
. '</thead>'
. '<tbody>';
$odd_row = true;
foreach ($serverVars as $name => $value) {
$has_session_value = isset($serverVarsSession[$name]) && $serverVarsSession[$name] != $value;
$row_class = ($odd_row ? 'odd' : 'even') . ' ' . ($has_session_value ? 'diffSession' : '');
?>
<tr class="<?php echo $row_class; ?>">
<th class="nowrap"><?php echo htmlspecialchars(str_replace('_', ' ', $name)); ?></th>
<td class="value"><?php echo formatVariable($name, $value); ?></td>
<td class="value"><?php
$has_session_value = isset($serverVarsSession[$name])
&& $serverVarsSession[$name] != $value;
$row_class = ($odd_row ? 'odd' : 'even') . ' '
. ($has_session_value ? 'diffSession' : '');
$output .= '<tr class="' . $row_class . '">'
. '<th class="nowrap">' . htmlspecialchars(str_replace('_', ' ', $name))
. '</th>'
. '<td class="value">' . formatVariable($name, $value) . '</td>'
. '<td class="value">';
// To display variable documentation link
if (isset($VARIABLE_DOC_LINKS[$name])) {
echo $common_functions->showMySQLDocu($VARIABLE_DOC_LINKS[$name][1], $VARIABLE_DOC_LINKS[$name][1], false, $VARIABLE_DOC_LINKS[$name][2] . '_' . $VARIABLE_DOC_LINKS[$name][0]);
$output .= $common_functions->showMySQLDocu(
$VARIABLE_DOC_LINKS[$name][1],
$VARIABLE_DOC_LINKS[$name][1],
false,
$VARIABLE_DOC_LINKS[$name][2] . '_' . $VARIABLE_DOC_LINKS[$name][0]
);
}
?></td>
<?php
$output .= '</td>';
if ($has_session_value) {
?>
</tr>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?> ">
<td>(<?php echo __('Session value'); ?>)</td>
<td class="value"><?php echo formatVariable($name, $serverVarsSession[$name]); ?></td>
<td class="value"></td>
<?php } ?>
</tr>
<?php
$output .= '</tr>'
. '<tr class="' . ($odd_row ? 'odd' : 'even') . '">'
. '<td>(' . __('Session value') . ')</td>'
. '<td class="value">' . formatVariable($name, $serverVarsSession[$name])
. '</td>'
. '<td class="value"></td>';
}
$output .= '</tr>';
$odd_row = ! $odd_row;
}
?>
</tbody>
</table>
<?php
$output .= '</tbody>'
. '</table>';
$response->addHtml($output);
/**
* Format Variable
*
* @param string $name variable name
* @param numeric $value variable value
*
* @return formatted string
*/
function formatVariable($name, $value)
{
global $VARIABLE_DOC_LINKS;
@ -175,7 +216,8 @@ function formatVariable($name, $value)
if (isset($VARIABLE_DOC_LINKS[$name][3])
&& $VARIABLE_DOC_LINKS[$name][3]=='byte'
) {
return '<abbr title="' . $common_functions->formatNumber($value, 0) . '">'
return '<abbr title="'
. $common_functions->formatNumber($value, 0) . '">'
. implode(' ', $common_functions->formatByteDown($value, 3, 3))
. '</abbr>';
} else {