Convert PMA_URL_getCommon calls to new style

Rewritten tests need validation
Signed-Off-By: Ann + J.M. <phpMyAdmin@ZweiSteinSoft.de>
This commit is contained in:
Ann + J.M 2014-10-17 22:07:22 +02:00
parent aaa2116b01
commit b1a7039ae3
46 changed files with 108 additions and 131 deletions

View File

@ -20,7 +20,7 @@ require 'libraries/build_html_for_db.lib.php';
/**
* Defines the url to return to in case of error in a sql statement
*/
$err_url = 'index.php?' . PMA_URL_getCommon();
$err_url = 'index.php' . PMA_URL_getCommon();
/**
* Builds and executes the db creation sql query
@ -80,7 +80,7 @@ if (! $result) {
$is_superuser = $GLOBALS['dbi']->isSuperuser();
$column_order = PMA_getColumnOrder();
$url_query = PMA_URL_getCommon($_POST['new_db']);
$url_query = PMA_URL_getCommon(array('db' => $_POST['new_db']));
/**
* String that will contain the output HTML

View File

@ -36,7 +36,7 @@ PMA_Util::checkParameters(array('db'));
/**
* Defines the url to return to in case of error in a sql statement
*/
$err_url = 'db_sql.php?' . PMA_URL_getCommon($db);
$err_url = 'db_sql.php' . PMA_URL_getCommon(array('db' => $db));
if ($cfgRelation['commwork']) {
$comment = PMA_getDbComment($db);

View File

@ -21,7 +21,7 @@ PMA_Util::checkParameters(array('db'));
/**
* Defines the url to return to in case of error in a sql statement
*/
$err_url = 'db_sql.php?' . PMA_URL_getCommon($db);
$err_url = 'db_sql.php' . PMA_URL_getCommon($db);
/**
* Settings for relations stuff

View File

@ -34,7 +34,7 @@ if ((!empty($_POST['submit_mult']) && isset($_POST['selected_tbl']))
|| isset($_POST['mult_btn'])
) {
$action = 'db_structure.php';
$err_url = 'db_structure.php?' . PMA_URL_getCommon($db);
$err_url = 'db_structure.php' . PMA_URL_getCommon(array('db' => $db));
// see bug #2794840; in this case, code path is:
// db_structure.php -> libraries/mult_submits.inc.php -> sql.php

View File

@ -241,11 +241,11 @@ if (!defined('TESTSUITE')) {
/** @var PMA_String $pmaString */
$pmaString = $GLOBALS['PMA_String'];
if ($export_type == 'server') {
$err_url = 'server_export.php?' . PMA_URL_getCommon();
$err_url = 'server_export.php' . PMA_URL_getCommon();
} elseif ($export_type == 'database'
&& $pmaString->strlen($db)
) {
$err_url = 'db_export.php?' . PMA_URL_getCommon($db);
$err_url = 'db_export.php' . PMA_URL_getCommon(array('db' => $db));
// Check if we have something to export
if (isset($table_select)) {
$tables = $table_select;
@ -255,7 +255,9 @@ if (!defined('TESTSUITE')) {
} elseif ($export_type == 'table' && $pmaString->strlen($db)
&& $pmaString->strlen($table)
) {
$err_url = 'tbl_export.php?' . PMA_URL_getCommon($db, $table);
$err_url = 'tbl_export.php' . PMA_URL_getCommon(array(
'db' => $db, 'table' => $table
));
} else {
PMA_fatalError(__('Bad parameters!'));
}

View File

@ -227,15 +227,17 @@ $pmaString = $GLOBALS['PMA_String'];
// Create error and goto url
if ($import_type == 'table') {
$err_url = 'tbl_import.php?' . PMA_URL_getCommon($db, $table);
$err_url = 'tbl_import.php' . PMA_URL_getCommon(array(
'db' => $db, 'table' => $table
));
$_SESSION['Import_message']['go_back_url'] = $err_url;
$goto = 'tbl_import.php';
} elseif ($import_type == 'database') {
$err_url = 'db_import.php?' . PMA_URL_getCommon($db);
$err_url = 'db_import.php' . PMA_URL_getCommon(array('db' => $db));
$_SESSION['Import_message']['go_back_url'] = $err_url;
$goto = 'db_import.php';
} elseif ($import_type == 'server') {
$err_url = 'server_import.php?' . PMA_URL_getCommon();
$err_url = 'server_import.php' . PMA_URL_getCommon();
$_SESSION['Import_message']['go_back_url'] = $err_url;
$goto = 'server_import.php';
} else {
@ -249,13 +251,13 @@ if ($import_type == 'table') {
}
}
if ($pmaString->strlen($table) && $pmaString->strlen($db)) {
$common = PMA_URL_getCommon($db, $table);
$common = PMA_URL_getCommon(array('db' => $db, 'table' => $table));
} elseif ($pmaString->strlen($db)) {
$common = PMA_URL_getCommon($db);
$common = PMA_URL_getCommon(array('db' => $db));
} else {
$common = PMA_URL_getCommon();
}
$err_url = $goto . '?' . $common
$err_url = $goto . $common
. (preg_match('@^tbl_[a-z]*\.php$@', $goto)
? '&amp;table=' . htmlspecialchars($table)
: '');

View File

@ -88,7 +88,7 @@ if (! empty($message)) {
unset($message);
}
$common_url_query = PMA_URL_getCommon('', '');
$common_url_query = PMA_URL_getCommon();
$mysql_cur_user_and_host = '';
// when $server > 0, a server has been chosen so we can display
@ -172,7 +172,7 @@ if ($server > 0 || count($cfg['Servers']) > 1
PMA_printListItem(
PMA_Util::getImage('s_passwd.png') . " " . __('Change password'),
'li_change_password',
'user_password.php?' . $common_url_query,
'user_password.php' . $common_url_query,
null,
null,
'change_password_anchor',
@ -240,7 +240,7 @@ if ($server > 0) {
PMA_printListItem(
PMA_Util::getImage('b_tblops.png') . " " . __('More settings'),
'li_user_preferences',
'prefs_manage.php?' . $common_url_query,
'prefs_manage.php' . $common_url_query,
null,
null,
null,
@ -335,7 +335,7 @@ if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) {
PMA_printListItem(
__('Show PHP information'),
'li_phpinfo',
'phpinfo.php?' . $common_url_query,
'phpinfo.php' . $common_url_query,
null,
'_blank'
);
@ -530,7 +530,7 @@ if ($server > 0) {
}
$msg = PMA_Message::notice($msg_text);
$msg->addParam(
'<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php?'
'<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php'
. $common_url_query . '">',
false
);

View File

@ -241,7 +241,7 @@ class Advisor
// linking to server_variables.php
$rule['recommendation'] = preg_replace(
'/\{([a-z_0-9]+)\}/Ui',
'<a href="server_variables.php?' . PMA_URL_getCommon()
'<a href="server_variables.php' . PMA_URL_getCommon()
. '&filter=\1">\1</a>',
$this->translate($rule['recommendation'])
);

View File

@ -347,7 +347,9 @@ class PMA_DbSearch
$html_output .= '<td><a name="browse_search" class="ajax" href="'
. $browse_result_path . '" onclick="loadResult(\''
. $browse_result_path . '\',\'' . $each_table . '\',\''
. PMA_URL_getCommon($GLOBALS['db'], $each_table) . '\''
. PMA_URL_getCommon(array(
'db' => $GLOBALS['db'], 'table' => $each_table
)) . '\''
. ');return false;" >'
. __('Browse') . '</a></td>';
$this_url_params['sql_query'] = $newsearchsqls['delete'];

View File

@ -221,7 +221,7 @@ class PMA_Header
$pftext = ! empty($_SESSION['tmpval']['pftext'])
? $_SESSION['tmpval']['pftext'] : '';
return array(
'common_query' => PMA_URL_getCommon('', '', '&'),
'common_query' => PMA_URL_getCommon(array(), 'text', '&'),
'opendb_url' => $GLOBALS['cfg']['DefaultTabDatabase'],
'safari_browser' => PMA_USR_BROWSER_AGENT == 'SAFARI' ? 1 : 0,
'collation_connection' => $GLOBALS['collation_connection'],

View File

@ -218,7 +218,7 @@ class PMA_Menu
$retval .= sprintf(
$item,
$GLOBALS['cfg']['DefaultTabDatabase'],
PMA_URL_getCommon($this->_db),
PMA_URL_getCommon(array('db' => $this->_db)),
htmlspecialchars($this->_db),
__('Database')
);
@ -241,7 +241,9 @@ class PMA_Menu
$retval .= sprintf(
$item,
$GLOBALS['cfg']['DefaultTabTable'],
PMA_URL_getCommon($this->_db, $this->_table),
PMA_URL_getCommon(array(
'db' => $this->_db, 'table' => $this->_table
)),
str_replace(' ', '&nbsp;', htmlspecialchars($this->_table)),
$tbl_is_view ? __('View') : __('Table')
);

View File

@ -259,7 +259,8 @@ class PMA_ServerStatusData
$links['Slow_queries']['doc'] = 'slow_query_log';
$links['innodb'][__('Variables')]
= 'server_engines.php?engine=InnoDB&amp;' . PMA_URL_getCommon();
= 'server_engines.php?engine=InnoDB&amp;'
. PMA_URL_getCommon(array(), 'html', '');
$links['innodb'][__('InnoDB Status')]
= 'server_engines.php'
. PMA_URL_getCommon(

View File

@ -236,7 +236,7 @@ class PMA_TableSearch
. ' size="40" class="textfield" id="field_' . $column_index . '" />';
if ($in_fbs) {
$edit_url = 'gis_data_editor.php?' . PMA_URL_getCommon();
$edit_url = 'gis_data_editor.php' . PMA_URL_getCommon();
$edit_str = PMA_Util::getIcon('b_edit.png', __('Edit/Insert'));
$html_output .= '<span class="open_search_gis_editor">';
$html_output .= PMA_Util::linkOrButton(
@ -285,10 +285,9 @@ class PMA_TableSearch
: '')
. ' />';
$html_output .= <<<EOT
<a class="ajax browse_foreign" href="browse_foreigners.php?
EOT;
$html_output .= '' . PMA_URL_getCommon($this->_db, $this->_table)
$html_output .= '<a class="ajax browse_foreign" href="'
. 'browse_foreigners.php'
. PMA_URL_getCommon(array('db' => $this->_db, 'table' => $this->_table))
. '&amp;field=' . urlencode($column_name) . '&amp;fieldkey='
. $column_index . '&amp;fromsearch=1"';
$html_output .= '>' . str_replace("'", "\'", $titles['Browse']) . '</a>';

View File

@ -26,8 +26,9 @@ if ($db_is_system_schema) {
/**
* Defines the urls to return to in case of error in a sql statement
*/
$err_url_0 = 'index.php?' . PMA_URL_getCommon();
$err_url = $cfg['DefaultTabDatabase'] . '?' . PMA_URL_getCommon($db);
$err_url_0 = 'index.php' . PMA_URL_getCommon();
$err_url = $cfg['DefaultTabDatabase']
. PMA_URL_getCommon(array('db' => $db));
/** @var PMA_String $pmaString */
$pmaString = $GLOBALS['PMA_String'];
@ -50,8 +51,8 @@ if (! isset($is_db) || ! $is_db) {
$is_db = false;
}
// Not a valid db name -> back to the welcome page
$uri = $cfg['PmaAbsoluteUri'] . 'index.php?'
. PMA_URL_getCommon('', '', '&')
$uri = $cfg['PmaAbsoluteUri'] . 'index.php'
. PMA_URL_getCommon(array(), 'text', '&')
. (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1';
if (!$pmaString->strlen($db) || ! $is_db) {
$response = PMA_Response::getInstance();
@ -99,6 +100,6 @@ if (isset($_REQUEST['submitcollation'])
/**
* Set parameters for links
*/
$url_query = PMA_URL_getCommon($db);
$url_query = PMA_URL_getCommon(array('db' => $db));
?>

View File

@ -42,7 +42,7 @@ if (empty($is_db)) {
}
PMA_sendHeaderLocation(
$cfg['PmaAbsoluteUri'] . 'index.php'
. PMA_URL_getCommon($url_params, '&')
. PMA_URL_getCommon($url_params, 'text', '&')
);
}
exit;

View File

@ -442,7 +442,7 @@ function PMA_getHtmlForImportWithPlugin($upload_id)
{
//some variable for javascript
$ajax_url = "import_status.php?id=" . $upload_id . "&"
. PMA_URL_getCommon(array('import_status'=>1), '&');
. PMA_URL_getCommon(array('import_status'=>1), 'text', '&');
$promot_str = PMA_jsFormat(
__(
'The file being uploaded is probably larger than '
@ -460,7 +460,7 @@ function PMA_getHtmlForImportWithPlugin($upload_id)
__('The file is being processed, please be patient.'),
false
);
$import_url = PMA_URL_getCommon(array('import_status'=>1), '&');
$import_url = PMA_URL_getCommon(array('import_status'=>1), 'text', '&');
//start output
$html = 'var finished = false; ';

View File

@ -437,11 +437,13 @@ function PMA_getHtmlForDisplayedExportHeader($export_type, $db, $table)
*/
$back_button = '<p>[ <a href="';
if ($export_type == 'server') {
$back_button .= 'server_export.php?' . PMA_URL_getCommon();
$back_button .= 'server_export.php' . PMA_URL_getCommon();
} elseif ($export_type == 'database') {
$back_button .= 'db_export.php?' . PMA_URL_getCommon($db);
$back_button .= 'db_export.php' . PMA_URL_getCommon(array('db' => $db));
} else {
$back_button .= 'tbl_export.php?' . PMA_URL_getCommon($db, $table);
$back_button .= 'tbl_export.php' . PMA_URL_getCommon(array(
'db' => $db, 'table' => $table
));
}
// Convert the multiple select elements from an array to a string

View File

@ -198,7 +198,7 @@ class PMA_Navigation
foreach ($hidden[$t] as $hiddenItem) {
$html .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
$html .= '<td>' . htmlspecialchars($hiddenItem) . '</td>';
$html .= '<td style="width:80px"><a href="navigation.php?'
$html .= '<td style="width:80px"><a href="navigation.php'
. PMA_URL_getCommon()
. '&unhideNavItem=true'
. '&itemType=' . urlencode($t)

View File

@ -146,7 +146,7 @@ class PMA_NavigationHeader
$retval = '<!-- LINKS START -->';
$retval .= '<div id="navipanellinks">';
$retval .= PMA_Util::getNavigationLink(
'index.php?' . PMA_URL_getCommon(),
'index.php' . PMA_URL_getCommon(),
$showText,
__('Home'),
$showIcon,

View File

@ -517,7 +517,7 @@ class Node_Database extends Node
);
if ($count > 0) {
$ret = '<span class="dbItemControls">'
. '<a href="navigation.php?'
. '<a href="navigation.php'
. PMA_URL_getCommon()
. '&showUnhideDialog=true'
. '&dbName=' . urldecode($db) . '"'

View File

@ -29,7 +29,7 @@ abstract class Node_DatabaseChild extends Node
$db = $this->realParent()->real_name;
$item = $this->real_name;
$ret = '<span class="navItemControls">'
. '<a href="navigation.php?'
. '<a href="navigation.php'
. PMA_URL_getCommon()
. '&hideNavItem=true'
. '&itemType=' . urlencode($this->getItemType())

View File

@ -619,7 +619,7 @@ class AuthenticationCookie extends AuthenticationPlugin
PMA_Response::getInstance()->disable();
PMA_sendHeaderLocation(
$redirect_url . PMA_URL_getCommon($url_params, '&'),
$redirect_url . PMA_URL_getCommon($url_params, 'text', '&'),
true
);
if (! defined('TESTSUITE')) {

View File

@ -267,7 +267,8 @@ class PMA_Export_Relation_Schema
echo '<p>' . "\n";
echo ' ' . $error_message . "\n";
echo '</p>' . "\n";
echo '<a href="db_designer.php?' . PMA_URL_getCommon($GLOBALS['db'])
echo '<a href="db_designer.php'
. PMA_URL_getCommon(array('db' => $GLOBALS['db']))
. '&page=' . htmlspecialchars($pageNumber) . '">' . __('Back') . '</a>';
echo "\n";
exit;

View File

@ -953,7 +953,7 @@ function PMA_handleControlRequest()
} else {
PMA_sendHeaderLocation(
$GLOBALS['cfg']['PmaAbsoluteUri'] . 'server_replication.php'
. PMA_URL_getCommon($GLOBALS['url_params'], '&')
. PMA_URL_getCommon($GLOBALS['url_params'], 'text', '&')
);
}
}

View File

@ -38,7 +38,9 @@ if ($GLOBALS['is_ajax_request'] != true) {
if ($GLOBALS['PMA_String']->strlen($db)) {
$GLOBALS['dbi']->selectDb($db);
if (! isset($url_query)) {
$url_query = PMA_URL_getCommon($db, $table);
$url_query = PMA_URL_getCommon(array(
'db' => $db, 'table' => $table
));
}
}
}

View File

@ -22,7 +22,7 @@ if (empty($viewing_mode)) {
/**
* Set parameters for links
*/
$GLOBALS['url_query'] = PMA_URL_getCommon($db);
$GLOBALS['url_query'] = PMA_URL_getCommon(array('db' => $db));
/**
* Defines the urls to return to in case of error in a sql statement

View File

@ -461,7 +461,7 @@ function PMA_dropMultiDatabases()
} else {
$action = 'server_databases.php';
$submit_mult = 'drop_db';
$err_url = 'server_databases.php?' . PMA_URL_getCommon();
$err_url = 'server_databases.php' . PMA_URL_getCommon();
if (isset($_REQUEST['selected_dbs'])
&& !isset($_REQUEST['is_js_confirmed'])
) {

View File

@ -1880,8 +1880,8 @@ function PMA_getHtmlForSpecificDbPrivileges($db)
. ' '
. sprintf(
__('Users having access to "%s"'),
'<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?'
. PMA_URL_getCommon($db) . '">'
'<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
. PMA_URL_getCommon(array('db' => $db)) . '">'
. htmlspecialchars($db)
. '</a>'
)

View File

@ -37,7 +37,7 @@ function PMA_getHtmlForFilter($ServerStatusData)
$retval = '';
$retval .= '<fieldset id="tableFilter">';
$retval .= '<legend>' . __('Filters') . '</legend>';
$retval .= '<form action="server_status_variables.php?'
$retval .= '<form action="server_status_variables.php'
. PMA_URL_getCommon() . '">';
$retval .= '<input type="submit" value="' . __('Refresh') . '" />';
$retval .= '<div class="formelement">';

View File

@ -149,7 +149,7 @@ function PMA_formatVariable($name, $value, $variable_doc_links)
*/
function PMA_getHtmlForLinkTemplates()
{
$url = 'server_variables.php' . PMA_URL_getCommon(array());
$url = 'server_variables.php' . PMA_URL_getCommon();
$output = '<a style="display: none;" href="#" class="editLink">';
$output .= PMA_Util::getIcon('b_edit.png', __('Edit')) . '</a>';
$output .= '<a style="display: none;" href="'

View File

@ -135,7 +135,7 @@ function PMA_getTableHtmlForMultipleQueries(
$unlim_num_rows = PMA_Table::countRecords($db, $table, true);
$showtable = PMA_Table::sGetStatusInfo($db, $table, null, true);
$url_query = PMA_URL_getCommon($db, $table);
$url_query = PMA_URL_getCommon(array('db' => $db, 'table' => $table));
// Handle remembered sorting order, only for single table query
if ($GLOBALS['cfg']['RememberSorting']
@ -479,7 +479,9 @@ function PMA_getHtmlForProfilingChart($url_query, $db, $profiling_results)
{
if (isset($profiling_results)) {
$pma_token = $_SESSION[' PMA_token '];
$url_query = (isset($url_query) ? $url_query : PMA_URL_getCommon($db));
$url_query = isset($url_query)
? $url_query
: PMA_URL_getCommon(array('db' => $db));
$profiling_table = '';
$profiling_table .= '<fieldset><legend>' . __('Profiling')

View File

@ -170,7 +170,7 @@ function PMA_getHtmlForSqlQueryFormInsert(
$db = $GLOBALS['db'];
// if you want navigation:
$tmp_db_link = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
. '?' . PMA_URL_getCommon($db) . '"';
. PMA_URL_getCommon(array('db' => $db)) . '"';
$tmp_db_link .= '>'
. htmlspecialchars($db) . '</a>';
// else use
@ -192,7 +192,7 @@ function PMA_getHtmlForSqlQueryFormInsert(
);
$tmp_db_link = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase']
. '?' . PMA_URL_getCommon($db) . '"';
. PMA_URL_getCommon(array('db' => $db)) . '"';
$tmp_db_link .= '>'
. htmlspecialchars($db) . '</a>';
// else use

View File

@ -2475,7 +2475,9 @@ function PMA_columnNeedsAlterTable($i)
*/
function PMA_updateColumns($db, $table)
{
$err_url = 'tbl_structure.php?' . PMA_URL_getCommon($db, $table);
$err_url = 'tbl_structure.php' . PMA_URL_getCommon(array(
'db' => $db, 'table' => $table
));
$regenerate = false;
$field_cnt = count($_REQUEST['field_name']);
$key_fields = array();

View File

@ -316,8 +316,8 @@ function PMA_getHeaderCells($is_backup, $columnMeta, $mimework, $db, $table)
if ($mimework && $GLOBALS['cfg']['BrowseMIME']) {
$header_cells[] = __('MIME type');
$header_link = '<a href="transformation_overview.php?'
. PMA_URL_getCommon($db, $table)
$header_link = '<a href="transformation_overview.php'
. PMA_URL_getCommon(array('db' => $db, 'table' => $table))
. '#%s" title="' . __(
'List of available transformations and their options'
)

View File

@ -23,7 +23,7 @@ $db_is_system_schema = $GLOBALS['dbi']->isSystemSchema($db);
* Set parameters for links
* @deprecated
*/
$url_query = PMA_URL_getCommon($db, $table);
$url_query = PMA_URL_getCommon(array('db' => $db, 'table' => $table));
/**
* Set parameters for links
@ -36,7 +36,7 @@ $url_params['table'] = $table;
* Defines the urls to return to in case of error in a sql statement
*/
$err_url_0 = $cfg['DefaultTabDatabase']
. PMA_URL_getCommon(array('db' => $db,));
. PMA_URL_getCommon(array('db' => $db));
$err_url = $cfg['DefaultTabTable'] . PMA_URL_getCommon($url_params);

View File

@ -673,7 +673,7 @@ function PMA_getHtmlForDataManipulationStatement($entry, $filter_users,
$html .= '<td><small>'
. htmlspecialchars($entry['username']) . '</small></td>';
$html .= '<td>' . $statement . '</td>';
$html .= '<td class="nowrap"><a href="tbl_tracking.php?'
$html .= '<td class="nowrap"><a href="tbl_tracking.php'
. PMA_URL_getCommon(
$url_params + array(
'report' => 'true',

View File

@ -45,7 +45,7 @@ if (isset($_POST['revert'])) {
$url_params = array('form' => $form_param);
PMA_sendHeaderLocation(
$cfg['PmaAbsoluteUri'] . 'prefs_forms.php'
. PMA_URL_getCommon($url_params, '&')
. PMA_URL_getCommon($url_params, 'text', '&')
);
exit;
}

View File

@ -61,7 +61,7 @@ if (! empty($goto)) {
$pmaString = $GLOBALS['PMA_String'];
if (! isset($err_url)) {
$err_url = (! empty($back) ? $back : $goto)
. '?' . PMA_URL_getCommon($GLOBALS['db'])
. PMA_URL_getCommon(array('db' => $GLOBALS['db']))
. (($pmaString->strpos(' ' . $goto, 'db_') != 1
&& $pmaString->strlen($table))
? '&amp;table=' . urlencode($table)

View File

@ -23,7 +23,9 @@ PMA_Util::checkParameters(array('db', 'table'));
/**
* Defines the url to return to in case of error in a sql statement
*/
$err_url = 'tbl_sql.php?' . PMA_URL_getCommon($db, $table);
$err_url = 'tbl_sql.php' . PMA_URL_getCommon(array(
'db' => $db, 'table' => $table
));
/**
* The form used to define the field to add has been submitted

View File

@ -43,7 +43,7 @@ if ($GLOBALS['dbi']->getColumns($db, $table)) {
sprintf(__('Table %s already exists!'), htmlspecialchars($table)),
'',
false,
'db_structure.php?' . PMA_URL_getCommon($db)
'db_structure.php' . PMA_URL_getCommon(array('db' => $db))
);
}

View File

@ -38,9 +38,11 @@ $pmaString = $GLOBALS['PMA_String'];
* Defines the url to return to in case of error in a sql statement
*/
if ($pmaString->strlen($table)) {
$err_url = 'tbl_sql.php?' . PMA_URL_getCommon($db, $table);
$err_url = 'tbl_sql.php' . PMA_URL_getCommon(array(
'db' => $db, 'table' => $table
));
} else {
$err_url = 'db_sql.php?' . PMA_URL_getCommon($db);
$err_url = 'db_sql.php' . PMA_URL_getCommon(array('db' => $db));
}

View File

@ -56,7 +56,7 @@ if (! isset($_POST['columnsToDisplay']) && ! isset($_POST['displayAllColumns']))
$goto = $GLOBALS['cfg']['DefaultTabTable'];
}
// Defines the url to return to in case of error in the next sql statement
$err_url = $goto . '?' . PMA_URL_getCommon($db, $table);
$err_url = $goto . PMA_URL_getCommon(array('db' => $db, 'table' => table));
// Displays the table search form
$response->addHTML($table_search->getSecondaryTabs());
$response->addHTML($table_search->getSelectionForm($goto));

View File

@ -99,7 +99,7 @@ if (! isset($goto)) {
$goto = $GLOBALS['cfg']['DefaultTabTable'];
}
// Defines the url to return to in case of error in the next sql statement
$err_url = $goto . '?' . PMA_URL_getCommon($db, $table);
$err_url = $goto . PMA_URL_getCommon(array('db' => $db, 'table' => $table));
//Set default datalabel if not selected
if ( !isset($_POST['zoom_submit']) || $_POST['dataLabel'] == '') {

View File

@ -149,7 +149,7 @@ class PMA_NavigationTest extends PHPUnit_Framework_TestCase
$html
);
$this->assertContains(
'<a href="navigation.php?' . PMA_URL_getCommon()
'<a href="navigation.php' . PMA_URL_getCommon()
. '&unhideNavItem=true&itemType=table&itemName=tableName&dbName=db"'
. ' class="unhideNavItem ajax">',
$html

View File

@ -82,7 +82,7 @@ class Node_DatabaseChildTest extends PHPUnit_Framework_TestCase
$html
);
$this->assertContains(
'<a href="navigation.php?' . PMA_URL_getCommon()
'<a href="navigation.php' . PMA_URL_getCommon()
. '&hideNavItem=true&itemType=itemType&itemName=child'
. '&dbName=parent" class="hideNavItem ajax">',
$html

View File

@ -33,11 +33,11 @@ class PMA_GenerateCommonURL_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for PMA_URL_getCommon with old style
* Test for PMA_URL_getCommon for DB only
*
* @return void
*/
public function testOldStyle()
public function testDbOnly()
{
$GLOBALS['server'] = 'x';
$GLOBALS['collation_connection'] = 'x';
@ -50,35 +50,10 @@ class PMA_GenerateCommonURL_Test extends PHPUnit_Framework_TestCase
. 'token=token'
;
$expected = 'db=db'
. htmlentities($separator) . 'table=table'
$expected = '?db=db'
. htmlentities($separator) . $expected;
$this->assertEquals($expected, PMA_URL_getCommon('db', 'table'));
}
/**
* Test for PMA_URL_getCommon with old style for DB only
*
* @return void
*/
public function testOldStyleDbOnly()
{
$GLOBALS['server'] = 'x';
$GLOBALS['collation_connection'] = 'x';
$GLOBALS['cfg']['ServerDefault'] = 'y';
$separator = PMA_URL_getArgSeparator();
$expected = 'server=x' . htmlentities($separator)
. 'lang=en' . htmlentities($separator)
. 'collation_connection=x' . htmlentities($separator)
. 'token=token'
;
$expected = 'db=db'
. htmlentities($separator) . $expected;
$this->assertEquals($expected, PMA_URL_getCommon('db'));
$this->assertEquals($expected, PMA_URL_getCommon(array('db' => 'db')));
}
/**
@ -107,11 +82,11 @@ class PMA_GenerateCommonURL_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for PMA_URL_getCommon with old style and alternate separator
* Test for PMA_URL_getCommon with alternate divider
*
* @return void
*/
public function testOldStyleWithAlternateSeparator()
public function testWithAlternateDivider()
{
$GLOBALS['server'] = 'x';
$GLOBALS['collation_connection'] = 'x';
@ -124,30 +99,10 @@ class PMA_GenerateCommonURL_Test extends PHPUnit_Framework_TestCase
. 'token=token'
;
$expected = 'db=db' . $separator . 'table=table' . $separator . $expected;
$this->assertEquals($expected, PMA_URL_getCommon('db', 'table', '&'));
}
/**
* Test for PMA_URL_getCommon with old style and alternate separator for DB only
*
* @return void
*/
public function testOldStyleWithAlternateSeparatorDbOnly()
{
$GLOBALS['server'] = 'x';
$GLOBALS['collation_connection'] = 'x';
$GLOBALS['cfg']['ServerDefault'] = 'y';
$separator = PMA_URL_getArgSeparator();
$expected = 'server=x' . $separator
. 'lang=en' . $separator
. 'collation_connection=x' . $separator
. 'token=token'
;
$expected = 'db=db' . $separator . $expected;
$this->assertEquals($expected, PMA_URL_getCommon('db', '', '&'));
$expected = '#ABC#db=db' . $separator . 'table=table' . $separator . $expected;
$this->assertEquals($expected, PMA_URL_getCommon(
array('db' => 'db', 'table' => 'table'), 'text', '#ABC#'
));
}
/**
@ -162,7 +117,7 @@ class PMA_GenerateCommonURL_Test extends PHPUnit_Framework_TestCase
$GLOBALS['cfg']['ServerDefault'] = 'y';
$separator = PMA_URL_getArgSeparator();
$expected = 'server=x' . htmlentities($separator)
$expected = '?server=x' . htmlentities($separator)
. 'lang=en' . htmlentities($separator)
. 'collation_connection=x' . htmlentities($separator)
. 'token=token'