Skip to content

Commit

Permalink
Merge branch 'QA_5_1'
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Mar 5, 2021
2 parents cfcb5c9 + e00c957 commit 7943c8a
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 20 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Expand Up @@ -16,6 +16,12 @@ phpMyAdmin - ChangeLog
- issue Fixed adding an event shows an empty row
- issue #16706 Fixed a PHP error when visualizing a nullable geometry column
- issue Fixed a PHP type error when exporting triggers to ODF
- issue #16659 Fixed the Column Drop arrow to make it responsive
- issue #16677 Improved the Font size of an executed SQL query
- issue #16677 Fixed Metro theme DB tree background
- issue #16713 Fixed "PhpMyAdmin\Url::getFromRoute" PHP error for old config values
- issue #16713 Add a legacy fallback for the old config value of "$cfg['DefaultTabDatabase']" and others
- issue #16698 Fix relative fallback URL to './' instead of '/'

5.1.0 (2021-02-24)
- issue #15350 Change Media (MIME) type references to Media type
Expand Down
7 changes: 4 additions & 3 deletions js/src/makegrid.js
Expand Up @@ -1780,9 +1780,10 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid
g.hideColList();
});

// attach to global div
$(g.gDiv).append(g.cDrop);
$(g.gDiv).append(g.cList);
// attach to first row first col of the grid
var thFirst = $(g.t).find('th.print_ignore');
$(thFirst).append(g.cDrop);
$(thFirst).append(g.cList);

// some adjustment
g.reposDrop();
Expand Down
6 changes: 3 additions & 3 deletions libraries/classes/Menu.php
Expand Up @@ -201,20 +201,20 @@ private function getBreadcrumbs(): string
$server['url'] = Util::getUrlForOption(
$cfg['DefaultTabServer'],
'server'
);
) ?? '/';

if (strlen($this->db) > 0) {
$database['name'] = $this->db;
$database['url'] = Util::getUrlForOption(
$cfg['DefaultTabDatabase'],
'database'
);
) ?? '/';
if (strlen((string) $this->table) > 0) {
$table['name'] = $this->table;
$table['url'] = Util::getUrlForOption(
$cfg['DefaultTabTable'],
'table'
);
) ?? '/';
/** @var Table $tableObj */
$tableObj = $dbi->getTable($this->db, $this->table);
$table['is_view'] = $tableObj->isView();
Expand Down
16 changes: 15 additions & 1 deletion libraries/classes/Util.php
Expand Up @@ -1739,7 +1739,7 @@ public static function getScriptNameForOption($target, string $location): string
{
$url = self::getUrlForOption($target, $location);
if ($url === null) {
return '/';
return './';
}

return Url::getFromRoute($url);
Expand All @@ -1764,26 +1764,35 @@ public static function getUrlForOption($target, string $location): ?string
// Values for $cfg['DefaultTabServer']
switch ($target) {
case 'welcome':
case 'index.php':
return '/';
case 'databases':
case 'server_databases.php':
return '/server/databases';
case 'status':
case 'server_status.php':
return '/server/status';
case 'variables':
case 'server_variables.php':
return '/server/variables';
case 'privileges':
case 'server_privileges.php':
return '/server/privileges';
}
} elseif ($location === 'database') {
// Values for $cfg['DefaultTabDatabase']
switch ($target) {
case 'structure':
case 'db_structure.php':
return '/database/structure';
case 'sql':
case 'db_sql.php':
return '/database/sql';
case 'search':
case 'db_search.php':
return '/database/search';
case 'operations':
case 'db_operations.php':
return '/database/operations';
}
} elseif ($location === 'table') {
Expand All @@ -1792,14 +1801,19 @@ public static function getUrlForOption($target, string $location): ?string
// $cfg['NavigationTreeDefaultTabTable2']
switch ($target) {
case 'structure':
case 'tbl_structure.php':
return '/table/structure';
case 'sql':
case 'tbl_sql.php':
return '/table/sql';
case 'search':
case 'tbl_select.php':
return '/table/search';
case 'insert':
case 'tbl_change.php':
return '/table/change';
case 'browse':
case 'sql.php':
return '/sql';
}
}
Expand Down
173 changes: 173 additions & 0 deletions test/classes/UtilTest.php
Expand Up @@ -2556,4 +2556,177 @@ public function testCurrentUserHasNotUserPrivilegeAndNotDbPrivilegeAndNotTablePr
$this->assertFalse(Util::currentUserHasPrivilege('EVENT', 'my_data_base', 'my_data_table'));
$GLOBALS['dbi'] = $oldDbi;
}

/**
* @return array[]
*/
public function dataProviderScriptNames(): array
{
// target
// location
// function output
return [
[
'structure', // Notice the typo on db_structure.php
'databasesss',
'./',// Fallback to a relative path, impossible to build a valid route link
],
[
'db_structures.php', // Notice the typo on databases
'database',
'./',// Fallback to a relative path, impossible to build a valid route link
],
[
'tbl_structure.php', // Support the legacy value
'table',
'index.php?route=/table/structure&amp;lang=en',
],
[
'structure',
'table',
'index.php?route=/table/structure&amp;lang=en',
],
[
'tbl_sql.php', // Support the legacy value
'table',
'index.php?route=/table/sql&amp;lang=en',
],
[
'sql',
'table',
'index.php?route=/table/sql&amp;lang=en',
],
[
'tbl_select.php', // Support the legacy value
'table',
'index.php?route=/table/search&amp;lang=en',
],
[
'search',
'table',
'index.php?route=/table/search&amp;lang=en',
],
[
'tbl_change.php', // Support the legacy value
'table',
'index.php?route=/table/change&amp;lang=en',
],
[
'insert',
'table',
'index.php?route=/table/change&amp;lang=en',
],
[
'sql.php', // Support the legacy value
'table',
'index.php?route=/sql&amp;lang=en',
],
[
'browse',
'table',
'index.php?route=/sql&amp;lang=en',
],
[
'db_structure.php', // Support the legacy value
'database',
'index.php?route=/database/structure&amp;lang=en',
],
[
'structure',
'database',
'index.php?route=/database/structure&amp;lang=en',
],
[
'db_sql.php', // Support the legacy value
'database',
'index.php?route=/database/sql&amp;lang=en',
],
[
'sql',
'database',
'index.php?route=/database/sql&amp;lang=en',
],
[
'db_search.php', // Support the legacy value
'database',
'index.php?route=/database/search&amp;lang=en',
],
[
'search',
'database',
'index.php?route=/database/search&amp;lang=en',
],
[
'db_operations.php', // Support the legacy value
'database',
'index.php?route=/database/operations&amp;lang=en',
],
[
'operations',
'database',
'index.php?route=/database/operations&amp;lang=en',
],
[
'index.php', // Support the legacy value
'server',
'index.php?route=/&amp;lang=en',
],
[
'welcome',
'server',
'index.php?route=/&amp;lang=en',
],
[
'server_databases.php', // Support the legacy value
'server',
'index.php?route=/server/databases&amp;lang=en',
],
[
'databases',
'server',
'index.php?route=/server/databases&amp;lang=en',
],
[
'server_status.php', // Support the legacy value
'server',
'index.php?route=/server/status&amp;lang=en',
],
[
'status',
'server',
'index.php?route=/server/status&amp;lang=en',
],
[
'server_variables.php', // Support the legacy value
'server',
'index.php?route=/server/variables&amp;lang=en',
],
[
'variables',
'server',
'index.php?route=/server/variables&amp;lang=en',
],
[
'server_privileges.php', // Support the legacy value
'server',
'index.php?route=/server/privileges&amp;lang=en',
],
[
'privileges',
'server',
'index.php?route=/server/privileges&amp;lang=en',
],
];
}

/**
* @dataProvider dataProviderScriptNames
*/
public function testGetScriptNameForOption(string $target, string $location, string $finalLink): void
{
$this->assertSame(
$finalLink,
Util::getScriptNameForOption($target, $location)
);
}
}
8 changes: 5 additions & 3 deletions themes/bootstrap/scss/_common.scss
Expand Up @@ -1038,6 +1038,8 @@ label.desc {
}

code {
font-size: 1em;

&.php {
display: block;
padding-left: 1em;
Expand Down Expand Up @@ -1954,7 +1956,7 @@ input#auto_increment_opt {
}

.cDrop {
left: 0;
right: 0;
position: absolute;
top: 0;
}
Expand All @@ -1963,9 +1965,7 @@ input#auto_increment_opt {
background: url("../img/col_drop.png");
cursor: pointer;
height: 16px;
margin-left: 0.3em;
margin-top: 0.3em;
position: absolute;
width: 16px;

&:hover {
Expand All @@ -1982,6 +1982,8 @@ input#auto_increment_opt {
border: solid 1px #999;
position: absolute;
box-shadow: 0 0.2em 0.5em #333;
margin-left: 75%;
right: 0;

.lDiv div {
padding: 0.2em 0.5em 0.2em;
Expand Down
9 changes: 5 additions & 4 deletions themes/metro/scss/_common.scss
Expand Up @@ -1225,6 +1225,7 @@ kbd {
}

code {
font-size: 1em;
color: $main-color;

&.php {
Expand Down Expand Up @@ -2149,7 +2150,7 @@ form.append_fields_form .tblFooters {
}

.cDrop {
left: 0;
right: 0;
position: absolute;
top: 0;
}
Expand All @@ -2158,9 +2159,7 @@ form.append_fields_form .tblFooters {
background: url("../img/col_drop.png");
cursor: pointer;
height: 16px;
margin-left: 0.3em;
margin-top: 0.3em;
position: absolute;
width: 16px;

&:hover {
Expand All @@ -2176,7 +2175,9 @@ form.append_fields_form .tblFooters {
background: #fff;
border: solid 1px #ccc;
position: absolute;

margin-left: 75%;
right: 0;

.lDiv div {
padding: 0.2em 0.5em 0.2em;
padding-left: 0.2em;
Expand Down

0 comments on commit 7943c8a

Please sign in to comment.