Merge remote-tracking branch 'chanaka/master'

This commit is contained in:
Michal Čihař 2012-05-23 11:37:44 +02:00
commit 3d8c3b2d5f
41 changed files with 3246 additions and 2054 deletions

View File

@ -85,7 +85,7 @@ if (! $result) {
* @global array $GLOBALS['extra_data']
* @name $extra_data
*/
$extra_data['sql_query'] = PMA_showMessage(null, $sql_query, 'success');
$extra_data['sql_query'] = PMA_getMessage(null, $sql_query, 'success');
//Construct the html for the new database, so that it can be appended to
// the list of databases on server_databases.php

View File

@ -341,7 +341,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
*/
if ( $GLOBALS['is_ajax_request'] == true) {
$extra_data['newname'] = $newname;
$extra_data['sql_query'] = PMA_showMessage(null, $sql_query);
$extra_data['sql_query'] = PMA_getMessage(null, $sql_query);
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
};
}
@ -375,7 +375,7 @@ if (empty($is_info)) {
echo "\n";
if (isset($message)) {
PMA_showMessage($message, $sql_query);
echo PMA_getMessage($message, $sql_query);
unset($message);
}
}
@ -523,7 +523,7 @@ echo __('Remove database');
'structure' => __('Structure only'),
'data' => __('Structure and data'),
'dataonly' => __('Data only'));
PMA_displayHtmlRadio('what', $choices, 'data', true);
echo PMA_getRadioFields('what', $choices, 'data', true);
unset($choices);
?>
<input type="checkbox" name="create_database_before_copying" value="1"

View File

@ -306,7 +306,7 @@ $choices = array(
// 4th parameter set to true to add line breaks
// 5th parameter set to false to avoid htmlspecialchars() escaping in the label
// since we have some HTML in some labels
PMA_displayHtmlRadio('search_option', $choices, $search_option, true, false);
echo PMA_getRadioFields('search_option', $choices, $search_option, true, false);
unset($choices);
?>
</td>

View File

@ -225,7 +225,7 @@ if (count($data['ddlog']) > 0) {
foreach ($data['ddlog'] as $entry) {
$log .= '# ' . $entry['date'] . ' ' . $entry['username'] . "\n" . $entry['statement'] . "\n";
}
PMA_showMessage(__('Database Log'), $log);
echo PMA_getMessage(__('Database Log'), $log);
}
/**

View File

@ -60,7 +60,7 @@ $(function() {
.end()
.after(data.sql_query);
//Remove the empty notice div generated due to a NULL query passed to PMA_showMessage()
//Remove the empty notice div generated due to a NULL query passed to PMA_getMessage()
var $notice_class = $("#floating_menubar").next("div").find('.notice');
if ($notice_class.text() == '') {
$notice_class.remove();

View File

@ -188,7 +188,7 @@ $(function() {
.end()
.after(data.sql_query);
//Remove the empty notice div generated due to a NULL query passed to PMA_showMessage()
//Remove the empty notice div generated due to a NULL query passed to PMA_getMessage()
var $notice_class = $("#floating_menubar").next("div").find('.notice');
if ($notice_class.text() == '') {
$notice_class.remove();

View File

@ -345,7 +345,7 @@ $(function() {
.end()
.after(data.sql_query);
//Remove the empty notice div generated due to a NULL query passed to PMA_showMessage()
//Remove the empty notice div generated due to a NULL query passed to PMA_getMessage()
var $notice_class = $("#floating_menubar").next("div").find('.notice');
if ($notice_class.text() == '') {
$notice_class.remove();

View File

@ -89,7 +89,7 @@ class PMA_Menu
echo $this->_getBreadcrumbs();
echo $this->_getMenu();
if (! empty($GLOBALS['message'])) {
PMA_showMessage($GLOBALS['message']);
echo PMA_getMessage($GLOBALS['message']);
unset($GLOBALS['message']);
}
}

View File

@ -972,7 +972,7 @@ function PMA_reloadNavigation($jsonly = false)
}
/**
* displays the message and the query
* Prepare the message and the query
* usually the message is the result of the query executed
*
* @param string $message the message to display
@ -984,7 +984,7 @@ function PMA_reloadNavigation($jsonly = false)
*
* @access public
*/
function PMA_showMessage(
function PMA_getMessage(
$message,
$sql_query = null,
$type = 'notice',
@ -1331,17 +1331,9 @@ function PMA_showMessage(
$retval .= '<br class="clearfloat" />';
}
// If we are in an Ajax request, we have most probably been called in
// PMA_ajaxResponse(). Hence, collect the buffer contents and return it
// to PMA_ajaxResponse(), which will encode it for JSON.
if ($GLOBALS['is_ajax_request'] == true
&& ! isset($GLOBALS['buffer_message'])
) {
return $retval;
} else {
echo $retval;
}
} // end of the 'PMA_showMessage()' function
return $retval;
} // end of the 'PMA_getMessage()' function
/**
* Verifies if current MySQL server supports profiling
@ -1382,12 +1374,14 @@ function PMA_getProfilingForm($sql_query)
{
$retval = '';
if (PMA_profilingSupported()) {
$retval .= '<form action="sql.php" method="post">' . "\n";
$retval .= PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']);
$retval .= '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
$retval .= '<input type="hidden" name="profiling_form" value="1" />' . "\n";
$retval .= PMA_getCheckbox('profiling', __('Profiling'), isset($_SESSION['profiling']), true);
$retval .= ' </form>' . "\n";
}
return $retval;
}
@ -2262,33 +2256,32 @@ function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row,
* @param string $image image to display
* @param string $value value
*
* @return void
* @return string html content
*
* @access public
*/
function PMA_buttonOrImage($button_name, $button_class, $image_name, $text,
function PMA_getButtonOrImage($button_name, $button_class, $image_name, $text,
$image, $value = ''
) {
if ($value == '') {
$value = $text;
}
if (false === $GLOBALS['cfg']['PropertiesIconic']) {
echo ' <input type="submit" name="' . $button_name . '"'
.' value="' . htmlspecialchars($value) . '"'
.' title="' . htmlspecialchars($text) . '" />' . "\n";
return;
return ' <input type="submit" name="' . $button_name . '"'
.' value="' . htmlspecialchars($value) . '"'
.' title="' . htmlspecialchars($text) . '" />' . "\n";
}
/* Opera has trouble with <input type="image"> */
/* IE has trouble with <button> */
if (PMA_USR_BROWSER_AGENT != 'IE') {
echo '<button class="' . $button_class . '" type="submit"'
return '<button class="' . $button_class . '" type="submit"'
.' name="' . $button_name . '" value="' . htmlspecialchars($value) . '"'
.' title="' . htmlspecialchars($text) . '">' . "\n"
. PMA_getIcon($image, $text)
.'</button>' . "\n";
} else {
echo '<input type="image" name="' . $image_name
return '<input type="image" name="' . $image_name
. '" value="' . htmlspecialchars($value)
. '" title="' . htmlspecialchars($text)
. '" src="' . $GLOBALS['pmaThemeImage']. $image . '" />'
@ -2599,14 +2592,14 @@ function PMA_externalBug($functionality, $component, $minimum_version, $bugref)
}
/**
* Returns an HTML checkbox
* Returns a HTML checkbox
*
* @param string $html_field_name the checkbox HTML field
* @param string $label label for checkbox
* @param boolean $checked is it initially checked?
* @param boolean $onclick should it submit the form on click?
*
* @return string HTML for the checkbox
* @return string HTML for the checkbox
*/
function PMA_getCheckbox($html_field_name, $label, $checked, $onclick)
{
@ -2615,10 +2608,11 @@ function PMA_getCheckbox($html_field_name, $label, $checked, $onclick)
. $html_field_name . '"' . ($checked ? ' checked="checked"' : '')
. ($onclick ? ' class="autosubmit"' : '') . ' /><label for="'
. $html_field_name . '">' . $label . '</label>';
}
/**
* Generates and echoes a set of radio HTML fields
* Generates a set of radio HTML fields
*
* @param string $html_field_name the radio HTML field
* @param array $choices the choices values and labels
@ -2627,33 +2621,39 @@ function PMA_getCheckbox($html_field_name, $label, $checked, $onclick)
* @param boolean $escape_label whether to use htmlspecialchars() on label
* @param string $class enclose each choice with a div of this class
*
* @return void
* @return string set of html radio fiels
*/
function PMA_displayHtmlRadio($html_field_name, $choices, $checked_choice = '',
function PMA_getRadioFields($html_field_name, $choices, $checked_choice = '',
$line_break = true, $escape_label = true, $class=''
) {
$radio_html = '';
foreach ($choices as $choice_value => $choice_label) {
if (! empty($class)) {
echo '<div class="' . $class . '">';
$radio_html .= '<div class="' . $class . '">';
}
$html_field_id = $html_field_name . '_' . $choice_value;
echo '<input type="radio" name="' . $html_field_name . '" id="'
. $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
$radio_html .= '<input type="radio" name="' . $html_field_name . '" id="'
. $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
if ($choice_value == $checked_choice) {
echo ' checked="checked"';
$radio_html .= ' checked="checked"';
}
echo ' />' . "\n";
echo '<label for="' . $html_field_id . '">'
. ($escape_label ? htmlspecialchars($choice_label) : $choice_label)
. '</label>';
$radio_html .= ' />' . "\n"
. '<label for="' . $html_field_id . '">'
. ($escape_label ? htmlspecialchars($choice_label) : $choice_label)
. '</label>';
if ($line_break) {
echo '<br />';
$radio_html .= '<br />';
}
if (! empty($class)) {
echo '</div>';
$radio_html .= '</div>';
}
echo "\n";
$radio_html .= "\n";
}
return $radio_html;
}
/**
@ -2666,11 +2666,11 @@ function PMA_displayHtmlRadio($html_field_name, $choices, $checked_choice = '',
* case the dropdown is present more than once
* on the page
*
* @return string
* @return string html content
*
* @todo support titles
*/
function PMA_generateHtmlDropdown($select_name, $choices, $active_choice, $id)
function PMA_getDropdown($select_name, $choices, $active_choice, $id)
{
$result = '<select name="' . htmlspecialchars($select_name) . '" id="'
. htmlspecialchars($id) . '">';
@ -2693,14 +2693,14 @@ function PMA_generateHtmlDropdown($select_name, $choices, $active_choice, $id)
*
* @param string $id the id of the <div> on which to apply the effect
* @param string $message the message to show as a link
*
* @return void
*
* @return string html div element
*
*/
function PMA_generateSliderEffect($id, $message)
function PMA_getDivForSliderEffect($id, $message)
{
if ($GLOBALS['cfg']['InitialSlidersState'] == 'disabled') {
echo '<div id="' . $id . '">';
return;
return '<div id="' . $id . '">';
}
/**
* Bad hack on the next line. document.write() conflicts with jQuery,
@ -2710,11 +2710,13 @@ function PMA_generateSliderEffect($id, $message)
* method maybe by using an additional param, the id of the div to
* append to
*/
echo '<div id="' . $id . '"';
echo $GLOBALS['cfg']['InitialSlidersState'] == 'closed'
? ' style="display: none; overflow:auto;"'
: '';
echo ' class="pma_auto_slider" title="' . htmlspecialchars($message) . '">';
return '<div id="' . $id . '"'
. (($GLOBALS['cfg']['InitialSlidersState'] == 'closed')
? ' style="display: none; overflow:auto;"'
: '')
. ' class="pma_auto_slider" title="' . htmlspecialchars($message) . '">';
}
/**

File diff suppressed because it is too large Load Diff

View File

@ -146,7 +146,7 @@ function PMA_EVN_handleEditor()
$message->addString('</ul>');
}
$output = PMA_showMessage($message, $sql_query);
$output = PMA_getMessage($message, $sql_query);
if ($GLOBALS['is_ajax_request']) {
$extra_data = array();
if ($message->isSuccess()) {

View File

@ -299,7 +299,7 @@ function PMA_RTN_handleEditor()
$message->addString('</ul>');
}
$output = PMA_showMessage($message, $sql_query);
$output = PMA_getMessage($message, $sql_query);
if ($GLOBALS['is_ajax_request']) {
$extra_data = array();
if ($message->isSuccess()) {

View File

@ -119,7 +119,7 @@ function PMA_TRI_handleEditor()
$message->addString('</ul>');
}
$output = PMA_showMessage($message, $sql_query);
$output = PMA_getMessage($message, $sql_query);
if ($GLOBALS['is_ajax_request']) {
$extra_data = array();
if ($message->isSuccess()) {

View File

@ -199,7 +199,7 @@ class PMA_User_Schema
'0' => __('Edit'),
'1' => __('Delete')
);
PMA_displayHtmlRadio('action_choose', $choices, '0', false);
echo PMA_getRadioFields('action_choose', $choices, '0', false);
unset($choices);
?>
</fieldset>

View File

@ -30,7 +30,7 @@ require_once 'libraries/header.inc.php';
// Any message to display?
if (! empty($message)) {
PMA_showMessage($message);
echo PMA_getMessage($message);
unset($message);
}

View File

@ -123,7 +123,7 @@ if (1 == count($choices)) {
echo $choices['create_export'];
echo '<input type="hidden" name="mode" value="create_export" />';
} else {
PMA_displayHtmlRadio('mode', $choices, $checked_choice = '', $line_break = true, $escape_label = false, $class = '');
echo PMA_getRadioFields('mode', $choices, $checked_choice = '', $line_break = true, $escape_label = false, $class = '');
}
echo '<br />';
echo '<label for="newpage">' . __('New page name: ') . '</label>';

View File

@ -106,7 +106,7 @@ if (count($binary_logs) > 1) {
echo '</form>';
}
PMA_showMessage(PMA_Message::success());
echo PMA_getMessage(PMA_Message::success());
/**
* Displays the page

View File

@ -293,7 +293,7 @@ if ($databases_count > 0) {
. '<a href="server_databases.php' . $common_url_query . '" onclick="if (unMarkAllRows(\'tabledatabases\')) return false;">' . "\n"
. ' ' . __('Uncheck All') . '</a>' . "\n"
. '<i>' . __('With selected:') . '</i>' . "\n";
PMA_buttonOrImage('drop_selected_dbs', 'mult_submit' . ($cfg['AjaxEnable'] ? ' ajax' : ''), 'drop_selected_dbs', __('Drop'), 'b_deltbl.png');
echo PMA_getButtonOrImage('drop_selected_dbs', 'mult_submit' . ($cfg['AjaxEnable'] ? ' ajax' : ''), 'drop_selected_dbs', __('Drop'), 'b_deltbl.png');
}
if (empty($dbstats)) {

View File

@ -1580,7 +1580,7 @@ $link_export_all = '<a class="export_user_anchor ' . $conditional_class . '" hre
if ($GLOBALS['is_ajax_request'] && ! isset($_REQUEST['export']) && (! isset($_REQUEST['submit_mult']) || $_REQUEST['submit_mult'] != 'export') && (! isset($_REQUEST['adduser']) || $_add_user_error) && (! isset($_REQUEST['initial']) || empty($_REQUEST['initial'])) && ! isset($_REQUEST['showall']) && ! isset($_REQUEST['edit_user_dialog']) && ! isset($_REQUEST['db_specific'])) {
if (isset($sql_query)) {
$extra_data['sql_query'] = PMA_showMessage(null, $sql_query);
$extra_data['sql_query'] = PMA_getMessage(null, $sql_query);
}
if (isset($_REQUEST['adduser_submit']) || isset($_REQUEST['change_copy'])) {
@ -1657,7 +1657,7 @@ if (isset($viewing_mode) && $viewing_mode == 'db') {
echo "\n";
} else {
if (! empty($GLOBALS['message'])) {
PMA_showMessage($GLOBALS['message']);
echo PMA_getMessage($GLOBALS['message']);
unset($GLOBALS['message']);
}
}
@ -1927,10 +1927,10 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
. __('Uncheck All') . '</a>' . "\n"
.'<i>' . __('With selected:') . '</i>' . "\n";
PMA_buttonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_export',
__('Export'), 'b_tblexport.png', 'export'
);
echo PMA_getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_export',
__('Export'), 'b_tblexport.png', 'export'
);
echo '<input type="hidden" name="initial" value="' . (isset($initial) ? $initial : '') . '" />';
echo '</div>'
. '<div class="clear_both" style="clear:both"></div>'
@ -2364,7 +2364,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
'1' => __('... delete the old one from the user tables.'),
'2' => __('... revoke all active privileges from the old one and delete it afterwards.'),
'3' => __('... delete the old one from the user tables and reload the privileges afterwards.'));
PMA_displayHtmlRadio('mode', $choices, '4', true);
echo PMA_getRadioFields('mode', $choices, '4', true);
unset($choices);
echo ' </fieldset>' . "\n"

14
sql.php
View File

@ -293,7 +293,7 @@ if (! defined('PMA_CHK_DROP')
} // end if
require_once 'libraries/display_tbl.lib.php';
PMA_displayTable_checkConfigParams();
PMA_setConfigParamsForDisplayTable();
/**
* Need to find the real end of rows?
@ -817,7 +817,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
if ($GLOBALS['is_ajax_request'] == true) {
if ($cfg['ShowSQL']) {
$extra_data['sql_query'] = PMA_showMessage($message, $GLOBALS['sql_query'], 'success');
$extra_data['sql_query'] = PMA_getMessage($message, $GLOBALS['sql_query'], 'success');
}
if (isset($GLOBALS['reload']) && $GLOBALS['reload'] == 1) {
$extra_data['reload'] = 1;
@ -898,9 +898,9 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
if (isset($message)) {
$message = PMA_Message::success($message);
echo PMA_showMessage($message, $GLOBALS['sql_query'], 'success');
echo PMA_getMessage($message, $GLOBALS['sql_query'], 'success');
}
PMA_displayTable($result, $disp_mode, $analyzed_sql);
echo PMA_getTable($result, $disp_mode, $analyzed_sql);
exit();
}
@ -960,7 +960,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
}
} else {
include_once 'libraries/header.inc.php';
//we don't need to buffer the output in PMA_showMessage here.
//we don't need to buffer the output in PMA_getMessage here.
//set a global variable and check against it in the function
$GLOBALS['buffer_message'] = false;
}
@ -987,7 +987,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
// Display previous update query (from tbl_replace)
if (isset($disp_query) && $cfg['ShowSQL'] == true) {
PMA_showMessage($disp_message, $disp_query, 'success');
echo PMA_getMessage($disp_message, $disp_query, 'success');
}
if (isset($profiling_results)) {
@ -1047,7 +1047,7 @@ $(makeProfilingChart);
$message->display();
}
PMA_displayTable($result, $disp_mode, $analyzed_sql);
echo PMA_getTable($result, $disp_mode, $analyzed_sql);
PMA_DBI_free_result($result);
// BEGIN INDEX CHECK See if indexes should be checked.

View File

@ -191,7 +191,7 @@ if (isset($_REQUEST['do_save_data'])) {
$message->addParam($table);
if ( $GLOBALS['is_ajax_request'] == true) {
$extra_data['sql_query'] = PMA_showMessage(null, $sql_query);
$extra_data['sql_query'] = PMA_getMessage(null, $sql_query);
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
}

View File

@ -252,7 +252,7 @@ if (isset($_REQUEST['do_save_data'])) {
}
if ( $_REQUEST['ajax_request'] == true) {
$extra_data['sql_query'] = PMA_showMessage(null, $sql_query);
$extra_data['sql_query'] = PMA_getMessage(null, $sql_query);
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
}

View File

@ -133,7 +133,7 @@ if (! empty($disp_message)) {
if (! isset($disp_query)) {
$disp_query = null;
}
PMA_showMessage($disp_message, $disp_query);
echo PMA_getMessage($disp_message, $disp_query);
}
/**
@ -176,7 +176,7 @@ if (isset($where_clause)) {
// No row returned
if (! $rows[$key_id]) {
unset($rows[$key_id], $where_clause_array[$key_id]);
PMA_showMessage(__('MySQL returned an empty result set (i.e. zero rows).'), $local_query);
echo PMA_getMessage(__('MySQL returned an empty result set (i.e. zero rows).'), $local_query);
echo "\n";
include 'libraries/footer.inc.php';
} else { // end if (no row returned)

View File

@ -76,7 +76,7 @@ if (! empty($sql_query)) {
// Just crop LIMIT clause
$sql_query = $analyzed_sql[0]['section_before_limit'] . $analyzed_sql[0]['section_after_limit'];
}
PMA_showMessage(PMA_Message::success());
echo PMA_getMessage(PMA_Message::success());
}
$export_type = 'table';

View File

@ -107,7 +107,7 @@ if (isset($_REQUEST['do_save_data'])) {
if ( $GLOBALS['is_ajax_request'] == true) {
$extra_data['index_table'] = PMA_Index::getView($table, $db);
$extra_data['sql_query'] = PMA_showMessage(null, $sql_query);
$extra_data['sql_query'] = PMA_getMessage(null, $sql_query);
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
}

View File

@ -69,7 +69,7 @@ if (PMA_isValid($_REQUEST['new_name'])) {
}
if ( $_REQUEST['ajax_request'] == true) {
$extra_data['sql_query'] = PMA_showMessage(null, $sql_query);
$extra_data['sql_query'] = PMA_getMessage(null, $sql_query);
$extra_data['db'] = $GLOBALS['db'];
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
}

View File

@ -232,7 +232,7 @@ if (isset($result) && empty($message_to_show)) {
// $result should exist, regardless of $_message
$_type = $result ? 'success' : 'error';
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
$extra_data['sql_query'] = PMA_showMessage(null, $sql_query);
$extra_data['sql_query'] = PMA_getMessage(null, $sql_query);
PMA_ajaxResponse($_message, $_message->isSuccess(), $extra_data);
}
}
@ -246,7 +246,7 @@ if (isset($result) && empty($message_to_show)) {
unset($warning_messages);
}
PMA_showMessage($_message, $sql_query, $_type);
echo PMA_getMessage($_message, $sql_query, $_type);
unset($_message, $_type);
}
@ -520,7 +520,7 @@ if (isset($possible_row_formats[$tbl_storage_engine])) {
$current_row_format = strtoupper($showtable['Row_format']);
echo '<tr><td><label for="new_row_format">ROW_FORMAT</label></td>';
echo '<td>';
echo PMA_generateHtmlDropdown('new_row_format', $possible_row_formats[$tbl_storage_engine], $current_row_format, 'new_row_format');
echo PMA_getDropdown('new_row_format', $possible_row_formats[$tbl_storage_engine], $current_row_format, 'new_row_format');
unset($possible_row_formats, $current_row_format);
echo '</td>';
echo '</tr>';
@ -561,7 +561,7 @@ if (isset($possible_row_formats[$tbl_storage_engine])) {
'structure' => __('Structure only'),
'data' => __('Structure and data'),
'dataonly' => __('Data only'));
PMA_displayHtmlRadio('what', $choices, 'data', true);
echo PMA_getRadioFields('what', $choices, 'data', true);
unset($choices);
?>
@ -779,7 +779,7 @@ if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
'OPTIMIZE' => __('Optimize'),
'REBUILD' => __('Rebuild'),
'REPAIR' => __('Repair'));
PMA_displayHtmlRadio('partition_operation', $choices, '', false);
echo PMA_getRadioFields('partition_operation', $choices, '', false);
unset($choices);
echo PMA_showMySQLDocu('partitioning_maintenance', 'partitioning_maintenance');
// I'm not sure of the best way to display that; this link does

View File

@ -181,7 +181,7 @@ if (isset($destination) && $cfgRelation['relwork']) {
// (for now, one index name only; we keep the definitions if the
// foreign db is not the same)
// I use $sql_query to be able to display directly the query via
// PMA_showMessage()
// PMA_getMessage()
if (isset($_REQUEST['destination_foreign'])) {
$display_query = '';
@ -285,9 +285,9 @@ if (isset($_REQUEST['destination_foreign'])) {
} // end foreach
if (!empty($display_query)) {
if ($seen_error) {
PMA_showMessage(__('Error'), null, 'error');
echo PMA_getMessage(__('Error'), null, 'error');
} else {
PMA_showMessage(__('Your SQL query has been executed successfully'), null, 'success');
echo PMA_getMessage(__('Your SQL query has been executed successfully'), null, 'success');
}
}
} // end if isset($destination_foreign)

View File

@ -544,7 +544,7 @@ if ($GLOBALS['is_ajax_request'] == true) {
/**Get the total row count of the table*/
$extra_data['row_count'] = PMA_Table::countRecords($_REQUEST['db'], $_REQUEST['table']);
$extra_data['sql_query'] = PMA_showMessage($message, $GLOBALS['display_query']);
$extra_data['sql_query'] = PMA_getMessage($message, $GLOBALS['display_query']);
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
}

View File

@ -173,7 +173,7 @@ echo PMA_generateHtmlTabs(PMA_tbl_getSubTabs(), $url_params, 'topmenu2');
<div id="gis_editor"></div><div id="popup_background"></div>
</fieldset>
<?php
PMA_generateSliderEffect('searchoptions', __('Options'));
echo PMA_getDivForSliderEffect('searchoptions', __('Options'));
?>
<fieldset id="fieldset_select_fields">
<legend><?php echo __('Select columns (at least one):'); ?></legend>
@ -223,7 +223,7 @@ echo PMA_generateHtmlTabs(PMA_tbl_getSubTabs(), $url_params, 'topmenu2');
'ASC' => __('Ascending'),
'DESC' => __('Descending')
);
PMA_displayHtmlRadio('order', $choices, 'ASC', false, true, "formelement");
echo PMA_getRadioFields('order', $choices, 'ASC', false, true, "formelement");
unset($choices);
?>
</fieldset>

View File

@ -568,37 +568,37 @@ $checkall_url = 'tbl_structure.php?' . PMA_generate_common_url($db, $table);
<i><?php echo __('With selected:'); ?></i>
<?php
PMA_buttonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_browse',
__('Browse'), 'b_browse.png', 'browse'
);
echo PMA_getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_browse',
__('Browse'), 'b_browse.png', 'browse'
);
if (! $tbl_is_view && ! $db_is_information_schema) {
PMA_buttonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_change',
__('Change'), 'b_edit.png', 'change'
);
PMA_buttonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_drop',
__('Drop'), 'b_drop.png', 'drop'
);
echo PMA_getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_change',
__('Change'), 'b_edit.png', 'change'
);
echo PMA_getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_drop',
__('Drop'), 'b_drop.png', 'drop'
);
if ('ARCHIVE' != $tbl_storage_engine) {
PMA_buttonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_primary',
__('Primary'), 'b_primary.png', 'primary'
);
PMA_buttonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_unique',
__('Unique'), 'b_unique.png', 'unique'
);
PMA_buttonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_index',
__('Index'), 'b_index.png', 'index'
);
echo PMA_getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_primary',
__('Primary'), 'b_primary.png', 'primary'
);
echo PMA_getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_unique',
__('Unique'), 'b_unique.png', 'unique'
);
echo PMA_getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_index',
__('Index'), 'b_index.png', 'index'
);
}
if (! empty($tbl_storage_engine) && $tbl_storage_engine == 'MYISAM') {
PMA_buttonOrImage(
echo PMA_getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_spatial',
__('Spatial'), 'b_spatial.png', 'spatial'
);
@ -608,10 +608,10 @@ if (! $tbl_is_view && ! $db_is_information_schema) {
|| $tbl_storage_engine == 'ARIA'
|| $tbl_storage_engine == 'MARIA')
) {
PMA_buttonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_fulltext',
__('Fulltext'), 'b_ftext.png', 'ftext'
);
echo PMA_getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_fulltext',
__('Fulltext'), 'b_ftext.png', 'ftext'
);
}
}
?>
@ -710,7 +710,7 @@ if (! $tbl_is_view && ! $db_is_information_schema) {
'first' => __('At Beginning of Table'),
'after' => sprintf(__('After %s'), '')
);
PMA_displayHtmlRadio('field_where', $choices, 'last', false);
echo PMA_getRadioFields('field_where', $choices, 'last', false);
echo $column_selector;
unset($column_selector, $choices);
?>
@ -730,7 +730,7 @@ if (! $tbl_is_view
&& ! $db_is_information_schema
&& 'ARCHIVE' != $tbl_storage_engine
) {
PMA_generateSliderEffect('indexes', __('Indexes'));
echo PMA_getDivForSliderEffect('indexes', __('Indexes'));
/**
* Display indexes
*/

View File

@ -289,7 +289,7 @@ if (isset($_REQUEST['snapshot'])) {
$drop_create_statements .= $data['ddlog'][1]['statement'];
}
// Print SQL code
PMA_showMessage(sprintf(__('Version %s snapshot (SQL code)'), htmlspecialchars($_REQUEST['version'])), $drop_create_statements);
echo PMA_getMessage(sprintf(__('Version %s snapshot (SQL code)'), htmlspecialchars($_REQUEST['version'])), $drop_create_statements);
// Unserialize snapshot
$temp = unserialize($data['schema_snapshot']);

View File

@ -1,52 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA_generateSliderEffect from common.lib.php
*
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
/*
* Include to test.
*/
require_once 'libraries/common.lib.php';
class PMA_GenerateSliderEffectTest extends PHPUnit_Framework_TestCase
{
function testGenerateSliderEffectTest()
{
global $cfg;
$cfg['InitialSlidersState'] = 'undefined';
$id = "test_id";
$message = "test_message";
$this->expectOutputString('<div id="' . $id . '" class="pma_auto_slider" title="' . htmlspecialchars($message) . '">');
PMA_generateSliderEffect($id, $message);
}
function testGenerateSliderEffectTestClosed()
{
global $cfg;
$cfg['InitialSlidersState'] = 'closed';
$id = "test_id";
$message = "test_message";
$this->expectOutputString('<div id="' . $id . '" style="display: none; overflow:auto;" class="pma_auto_slider" title="' . htmlspecialchars($message) . '">');
PMA_generateSliderEffect($id, $message);
}
function testGenerateSliderEffectTestDisabled()
{
global $cfg;
$cfg['InitialSlidersState'] = 'disabled';
$id = "test_id";
$message = "test_message";
$this->expectOutputString('<div id="' . $id . '">');
PMA_generateSliderEffect($id, $message);
}
}

View File

@ -1,7 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA_display_html_checkbox from common.lib.php
* Test for PMA_getCheckbox from common.lib.php
*
* @package PhpMyAdmin-test
* @group common.lib-tests
@ -12,7 +12,7 @@
*/
require_once 'libraries/common.lib.php';
class PMA_display_html_checkbox_test extends PHPUnit_Framework_TestCase
class PMA_GetCheckboxTest extends PHPUnit_Framework_TestCase
{
function testGetCheckbox()
{
@ -59,4 +59,4 @@ class PMA_display_html_checkbox_test extends PHPUnit_Framework_TestCase
}
}
//PMA_display_html_checkbox
//PMA_getCheckbox

View File

@ -0,0 +1,59 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA_getDivForSliderEffect from common.lib.php
*
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
/*
* Include to test.
*/
require_once 'libraries/common.lib.php';
class PMA_GetDivForSliderEffectTest extends PHPUnit_Framework_TestCase
{
function testGetDivForSliderEffectTest()
{
global $cfg;
$cfg['InitialSlidersState'] = 'undefined';
$id = "test_id";
$message = "test_message";
$this->assertEquals(
PMA_getDivForSliderEffect($id, $message),
'<div id="' . $id . '" class="pma_auto_slider" title="' . htmlspecialchars($message) . '">'
);
}
function testGetDivForSliderEffectTestClosed()
{
global $cfg;
$cfg['InitialSlidersState'] = 'closed';
$id = "test_id";
$message = "test_message";
$this->assertEquals(
PMA_getDivForSliderEffect($id, $message),
'<div id="' . $id . '" style="display: none; overflow:auto;" class="pma_auto_slider" title="' . htmlspecialchars($message) . '">'
);
}
function testGetDivForSliderEffectTestDisabled()
{
global $cfg;
$cfg['InitialSlidersState'] = 'disabled';
$id = "test_id";
$message = "test_message";
$this->assertEquals(
PMA_getDivForSliderEffect($id, $message),
'<div id="' . $id . '">'
);
}
}

View File

@ -1,7 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA_generateHtmlDropdown from common.lib.php
* Test for PMA_getDropdown from common.lib.php
*
* @package PhpMyAdmin-test
* @group common.lib-tests
@ -12,9 +12,9 @@
*/
require_once 'libraries/common.lib.php';
class PMA_GenerateHtmlDropdownTest extends PHPUnit_Framework_TestCase
class PMA_GetDropdownTest extends PHPUnit_Framework_TestCase
{
function testGenerateHtmlDropdownEmpty()
function testGetDropdownEmpty()
{
$name = "test_dropdown_name";
$choices = array();
@ -23,10 +23,10 @@ class PMA_GenerateHtmlDropdownTest extends PHPUnit_Framework_TestCase
$result = '<select name="' . htmlspecialchars($name) . '" id="' . htmlspecialchars($id) . '"></select>';
$this->assertEquals($result, PMA_generateHtmlDropdown($name, $choices, $active_choice, $id));
$this->assertEquals($result, PMA_getDropdown($name, $choices, $active_choice, $id));
}
function testGenerateHtmlDropdown()
function testGetDropdown()
{
$name = "&test_dropdown_name";
$choices = array("value_1" => "label_1", "value&_2\"" => "label_2");
@ -43,10 +43,10 @@ class PMA_GenerateHtmlDropdownTest extends PHPUnit_Framework_TestCase
}
$result .= '</select>';
$this->assertEquals($result, PMA_generateHtmlDropdown($name, $choices, $active_choice, $id));
$this->assertEquals($result, PMA_getDropdown($name, $choices, $active_choice, $id));
}
function testGenerateHtmlDropdownWithActive()
function testGetDropdownWithActive()
{
$name = "&test_dropdown_name";
$choices = array("value_1" => "label_1", "value&_2\"" => "label_2");
@ -63,6 +63,6 @@ class PMA_GenerateHtmlDropdownTest extends PHPUnit_Framework_TestCase
}
$result .= '</select>';
$this->assertEquals($result, PMA_generateHtmlDropdown($name, $choices, $active_choice, $id));
$this->assertEquals($result, PMA_getDropdown($name, $choices, $active_choice, $id));
}
}

View File

@ -1,7 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA_displayHtmlRadio from common.lib.php
* Test for PMA_getRadioFields from common.lib.php
*
* @package PhpMyAdmin-test
* @group common.lib-tests
@ -12,18 +12,20 @@
*/
require_once 'libraries/common.lib.php';
class PMA_DisplayHtmlRadioTest extends PHPUnit_Framework_TestCase
class PMA_GetRadioFieldsTest extends PHPUnit_Framework_TestCase
{
function testDisplayHtmlRadioEmpty()
function testGetRadioFieldsEmpty()
{
$name = "test_display_radio";
$choices = array();
$this->expectOutputString("");
PMA_displayHtmlRadio($name, $choices);
$this->assertEquals(
PMA_getRadioFields($name, $choices),
""
);
}
function testDisplayHtmlRadio()
function testGetRadioFields()
{
$name = "test_display_radio";
$choices = array('value_1'=>'choice_1', 'value_2'=>'choice_2');
@ -38,11 +40,13 @@ class PMA_DisplayHtmlRadioTest extends PHPUnit_Framework_TestCase
$out .= "\n";
}
$this->expectOutputString($out);
PMA_displayHtmlRadio($name, $choices);
$this->assertEquals(
PMA_getRadioFields($name, $choices),
$out
);
}
function testDisplayHtmlRadioWithChecked()
function testGetRadioFieldsWithChecked()
{
$name = "test_display_radio";
$choices = array('value_1'=>'choice_1', 'value_2'=>'choice_2');
@ -61,11 +65,13 @@ class PMA_DisplayHtmlRadioTest extends PHPUnit_Framework_TestCase
$out .= "\n";
}
$this->expectOutputString($out);
PMA_displayHtmlRadio($name, $choices, $checked_choice);
$this->assertEquals(
PMA_getRadioFields($name, $choices, $checked_choice),
$out
);
}
function testDisplayHtmlRadioWithCheckedWithClass()
function testGetRadioFieldsWithCheckedWithClass()
{
$name = "test_display_radio";
$choices = array('value_1'=>'choice_1', 'value_2'=>'choice_2');
@ -87,11 +93,13 @@ class PMA_DisplayHtmlRadioTest extends PHPUnit_Framework_TestCase
$out .= "\n";
}
$this->expectOutputString($out);
PMA_displayHtmlRadio($name, $choices, $checked_choice, true, false, $class);
$this->assertEquals(
PMA_getRadioFields($name, $choices, $checked_choice, true, false, $class),
$out
);
}
function testDisplayHtmlRadioWithoutBR()
function testGetRadioFieldsWithoutBR()
{
$name = "test_display_radio";
$choices = array('value_1'=>'choice_1', 'value&_&lt;2&gt;'=>'choice_2');
@ -109,11 +117,13 @@ class PMA_DisplayHtmlRadioTest extends PHPUnit_Framework_TestCase
$out .= "\n";
}
$this->expectOutputString($out);
PMA_displayHtmlRadio($name, $choices, $checked_choice, false);
$this->assertEquals(
PMA_getRadioFields($name, $choices, $checked_choice, false),
$out
);
}
function testDisplayHtmlRadioEscapeLabelEscapeLabel()
function testGetRadioFieldsEscapeLabelEscapeLabel()
{
$name = "test_display_radio";
$choices = array('value_1'=>'choice_1', 'value_&2'=>'choice&_&lt;2&gt;');
@ -132,11 +142,13 @@ class PMA_DisplayHtmlRadioTest extends PHPUnit_Framework_TestCase
$out .= "\n";
}
$this->expectOutputString($out);
PMA_displayHtmlRadio($name, $choices, $checked_choice, true, true);
$this->assertEquals(
PMA_getRadioFields($name, $choices, $checked_choice, true, true),
$out
);
}
function testDisplayHtmlRadioEscapeLabelNotEscapeLabel()
function testGetRadioFieldsEscapeLabelNotEscapeLabel()
{
$name = "test_display_radio";
$choices = array('value_1'=>'choice_1', 'value_&2'=>'choice&_&lt;2&gt;');
@ -155,11 +167,13 @@ class PMA_DisplayHtmlRadioTest extends PHPUnit_Framework_TestCase
$out .= "\n";
}
$this->expectOutputString($out);
PMA_displayHtmlRadio($name, $choices, $checked_choice, true, false);
$this->assertEquals(
PMA_getRadioFields($name, $choices, $checked_choice, true, false),
$out
);
}
function testDisplayHtmlRadioEscapeLabelEscapeLabelWithClass()
function testGetRadioFieldsEscapeLabelEscapeLabelWithClass()
{
$name = "test_display_radio";
$choices = array('value_1'=>'choice_1', 'value_&2'=>'choice&_&lt;2&gt;');
@ -181,7 +195,9 @@ class PMA_DisplayHtmlRadioTest extends PHPUnit_Framework_TestCase
$out .= "\n";
}
$this->expectOutputString($out);
PMA_displayHtmlRadio($name, $choices, $checked_choice, true, true, $class);
$this->assertEquals(
PMA_getRadioFields($name, $choices, $checked_choice, true, true, $class),
$out
);
}
}

View File

@ -1,7 +1,7 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA_showMessage from common.lib
* Test for PMA_getMessage from common.lib
*
* @package PhpMyAdmin-test
* @group common.lib-tests
@ -60,9 +60,9 @@ class PMA_showMessage_test extends PHPUnit_Framework_TestCase
]</div></div>"
);
echo PMA_showMessage("msg");
echo PMA_getMessage("msg");
//$this->assertEquals("",PMA_showMessage("msg"));
//$this->assertEquals("",PMA_getMessage("msg"));
$this->assertTrue(true);
}
}

View File

@ -82,7 +82,7 @@ function PMA_getChangePassMessage($change_password_message, $sql_query = '')
if ($change_password_message['error']) {
PMA_ajaxResponse($change_password_message['msg'], false);
} else {
$extra_data['sql_query'] = PMA_showMessage($change_password_message['msg'], $sql_query, 'success');
$extra_data['sql_query'] = PMA_getMessage($change_password_message['msg'], $sql_query, 'success');
PMA_ajaxResponse($change_password_message['msg'], true, $extra_data);
}
}
@ -205,7 +205,7 @@ function PMA_changePassDisplayPage($message, $sql_query, $_url_params)
{
include_once './libraries/header.inc.php';
echo '<h1>' . __('Change password') . '</h1>' . "\n\n";
PMA_showMessage($message, $sql_query, 'success');
echo PMA_getMessage($message, $sql_query, 'success');
echo '<a href="index.php'.PMA_generate_common_url($_url_params).' target="_parent">'. "\n"
.'<strong>'.__('Back').'</strong></a>';
include './libraries/footer.inc.php';

View File

@ -68,7 +68,7 @@ if (isset($_REQUEST['createview'])) {
include './' . $cfg['DefaultTabDatabase'];
exit();
} else {
PMA_ajaxResponse(PMA_showMessage(PMA_Message::success(), $sql_query), 1);
PMA_ajaxResponse(PMA_getMessage(PMA_Message::success(), $sql_query), 1);
}
} else {
if ($GLOBALS['is_ajax_request'] != true) {

View File

@ -62,7 +62,7 @@ if (isset($result)) {
$_message->isError(true);
unset($warning_messages);
}
PMA_showMessage($_message, $sql_query, $_type, $is_view = true);
echo PMA_getMessage($_message, $sql_query, $_type, $is_view = true);
unset($_message, $_type);
}