Skip to content

Commit eaad8d8

Browse files
committed
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2 parents 8355c0c + 519ac0a commit eaad8d8

16 files changed

Lines changed: 908 additions & 895 deletions

File tree

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ phpMyAdmin - ChangeLog
6363
- issue #18454 Fix date field calendar display when changing NULL state
6464
- issue #18481 Fix missing pagination when using SELECT DISTINCT
6565
- issue #18325 Allow hex representations for integers in the search box validation
66+
- issue #14411 Fixed double tap to edit on mobile devices
67+
- issue Update documentation to reflect that Node >= 12 is required to compile the JS and CSS files
6668

6769
5.2.1 (2023-02-07)
6870
- issue #17522 Fix case where the routes cache file is invalid

doc/setup.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ In order to install from Git, you'll need a few supporting applications:
9090

9191
* `Git <https://git-scm.com/downloads>`_ to download the source, or you can download the most recent source directly from `Github <https://codeload.github.com/phpmyadmin/phpmyadmin/zip/QA_5_2>`_
9292
* `Composer <https://getcomposer.org/download/>`__
93-
* `Node.js <https://nodejs.org/en/download/>`_ (version 10 or higher)
93+
* `Node.js <https://nodejs.org/en/download/>`_ (version 12 or higher)
9494
* `Yarn <https://classic.yarnpkg.com/en/docs/install>`_
9595

9696
You can clone current phpMyAdmin source from

js/src/makegrid.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,8 +2153,8 @@ const makeGrid = function (t, enableResize = undefined, enableReorder = undefine
21532153
}
21542154
});
21552155

2156-
$(g.t).find('td.data.click2')
2157-
.on('click', function (e) {
2156+
$(g.t)
2157+
.on('click', 'td.data.click2', function (e) {
21582158
var $cell = $(this);
21592159
// In the case of relational link, We want single click on the link
21602160
// to goto the link and double click to start grid-editing.
@@ -2188,7 +2188,7 @@ const makeGrid = function (t, enableResize = undefined, enableReorder = undefine
21882188
}
21892189
}
21902190
})
2191-
.on('dblclick', function (e) {
2191+
.on('dblclick', 'td.data.click2', function (e) {
21922192
if ($(e.target).is('.grid_edit a')) {
21932193
e.preventDefault();
21942194
} else {

js/src/modules/console.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,8 +1499,9 @@ var ConsoleDebug = {
14991499
);
15001500

15011501
if (url) {
1502+
var decodedUrl = new URLSearchParams(url.split('?')[1]);
15021503
$('#debug_console').find('.debug>.welcome').append(
1503-
$('<span class="script_name">').text(url.split('?')[0])
1504+
$('<span class="script_name">').text(decodedUrl.has('route') ? decodedUrl.get('route') : url)
15041505
);
15051506
}
15061507

js/src/modules/functions.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,14 +3153,23 @@ function onloadRecentFavoriteTables (): void {
31533153
return;
31543154
}
31553155

3156+
var favoriteTables = '';
3157+
if (isStorageSupported('localStorage')
3158+
&& typeof window.localStorage.favoriteTables !== 'undefined'
3159+
&& window.localStorage.favoriteTables !== 'undefined') {
3160+
favoriteTables = window.localStorage.favoriteTables;
3161+
if (favoriteTables === 'undefined') {
3162+
// Do not send an invalid value
3163+
return;
3164+
}
3165+
}
3166+
31563167
$.ajax({
31573168
url: $('#sync_favorite_tables').attr('href'),
31583169
cache: false,
31593170
type: 'POST',
31603171
data: {
3161-
'favoriteTables': (isStorageSupported('localStorage') && typeof window.localStorage.favoriteTables !== 'undefined')
3162-
? window.localStorage.favoriteTables
3163-
: '',
3172+
'favoriteTables': favoriteTables,
31643173
'server': CommonParams.get('server'),
31653174
'no_debug': true
31663175
},

js/src/table/change.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,25 @@ function verifyAfterSearchFieldChange (index, searchFormId) {
186186
}
187187
});
188188

189+
// validator method for IN(...), NOT IN(...)
190+
// BETWEEN and NOT BETWEEN
191+
// See all possible syntaxes in tests of https://regexr.com/7h1eq
192+
jQuery.validator.addMethod('validationFunctionForMultipleInt', function (value) {
193+
return value.match(/^(((0x[0-9a-f]+)|([+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)(e[+-]?[0-9]+)?))(,|$))+$/i) !== null;
194+
},
195+
window.Messages.strEnterValidNumber
196+
);
197+
189198
validateMultipleIntField($thisInput, true);
190199
} else {
200+
// validator method for INTs
201+
// See all possible syntaxes in tests of https://regexr.com/7h1ci
202+
jQuery.validator.addMethod('validationFunctionForInt', function (value) {
203+
return value.match(/^(0x[0-9a-f]+$)|([+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)(e[+-]?[0-9]+)?)$/i) !== null;
204+
},
205+
window.Messages.strEnterValidNumber
206+
);
207+
191208
$(searchFormId).validate({
192209
// update errors as we write
193210
onkeyup: function (element) {

libraries/classes/ConfigStorage/Relation.php

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use PhpMyAdmin\Identifiers\DatabaseName;
1111
use PhpMyAdmin\Identifiers\TableName;
1212
use PhpMyAdmin\InternalRelations;
13-
use PhpMyAdmin\RecentFavoriteTable;
1413
use PhpMyAdmin\SqlParser\Parser;
1514
use PhpMyAdmin\SqlParser\Statements\CreateStatement;
1615
use PhpMyAdmin\SqlParser\Utils\Table as TableUtils;
@@ -1622,32 +1621,13 @@ public function fixPmaTables(string $db, bool $create = true): void
16221621
}
16231622

16241623
$GLOBALS['cfg']['Server']['pmadb'] = $db;
1624+
1625+
//NOTE: I am unsure why we do that, as it defeats the purpose of the session cache
1626+
// Unset the cache
16251627
unset($_SESSION['relation'][$GLOBALS['server']]);
16261628
unset(self::$cache[$GLOBALS['server']]);
1627-
1628-
$relationParameters = $this->getRelationParameters();
1629-
if (
1630-
$relationParameters->recentlyUsedTablesFeature === null
1631-
&& $relationParameters->favoriteTablesFeature === null
1632-
) {
1633-
return;
1634-
}
1635-
1636-
// Since configuration storage is updated, we need to
1637-
// re-initialize the favorite and recent tables stored in the
1638-
// session from the current configuration storage.
1639-
if ($relationParameters->favoriteTablesFeature !== null) {
1640-
$favTables = RecentFavoriteTable::getInstance('favorite');
1641-
$_SESSION['tmpval']['favoriteTables'][$GLOBALS['server']] = $favTables->getFromDb();
1642-
}
1643-
1644-
if ($relationParameters->recentlyUsedTablesFeature !== null) {
1645-
$recentTables = RecentFavoriteTable::getInstance('recent');
1646-
$_SESSION['tmpval']['recentTables'][$GLOBALS['server']] = $recentTables->getFromDb();
1647-
}
1648-
1649-
// Reload navi panel to update the recent/favorite lists.
1650-
$GLOBALS['reload'] = true;
1629+
// Fill back the cache
1630+
$this->getRelationParameters();
16511631
}
16521632

16531633
/**

libraries/classes/Controllers/Database/Structure/FavoriteTableController.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __invoke(ServerRequest $request): void
4444
$GLOBALS['errorUrl'] = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database');
4545
$GLOBALS['errorUrl'] .= Url::getCommon(['db' => $GLOBALS['db']], '&');
4646

47-
if (! $this->hasDatabase() || ! $this->response->isAjax()) {
47+
if (! $this->response->isAjax()) {
4848
return;
4949
}
5050

@@ -72,6 +72,10 @@ public function __invoke(ServerRequest $request): void
7272
return;
7373
}
7474

75+
if (! $this->hasDatabase()) {
76+
return;
77+
}
78+
7579
$changes = true;
7680
$favoriteTable = $parameters['favorite_table'] ?? '';
7781
$alreadyFavorite = $this->checkFavoriteTable($favoriteTable);
@@ -166,10 +170,8 @@ private function synchronizeFavoriteTables(
166170
*/
167171
private function checkFavoriteTable(string $currentTable): bool
168172
{
169-
// ensure $_SESSION['tmpval']['favoriteTables'] is initialized
170-
RecentFavoriteTable::getInstance('favorite');
171-
$favoriteTables = $_SESSION['tmpval']['favoriteTables'][$GLOBALS['server']] ?? [];
172-
foreach ($favoriteTables as $value) {
173+
$recentFavoriteTables = RecentFavoriteTable::getInstance('favorite');
174+
foreach ($recentFavoriteTables->getTables() as $value) {
173175
if ($value['db'] == $GLOBALS['db'] && $value['table'] == $currentTable) {
174176
return true;
175177
}

libraries/classes/Controllers/Database/StructureController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,10 +591,8 @@ protected function getReplicationStatus(array $replicaInfo, string $table): arra
591591
*/
592592
protected function checkFavoriteTable(string $currentTable): bool
593593
{
594-
// ensure $_SESSION['tmpval']['favoriteTables'] is initialized
595-
RecentFavoriteTable::getInstance('favorite');
596-
$favoriteTables = $_SESSION['tmpval']['favoriteTables'][$GLOBALS['server']] ?? [];
597-
foreach ($favoriteTables as $value) {
594+
$recentFavoriteTables = RecentFavoriteTable::getInstance('favorite');
595+
foreach ($recentFavoriteTables->getTables() as $value) {
598596
if ($value['db'] == $GLOBALS['db'] && $value['table'] == $currentTable) {
599597
return true;
600598
}

libraries/classes/Header.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,29 +439,29 @@ private function getHttpHeaders(): array
439439
/**
440440
* Re-enable possible disabled XSS filters.
441441
*
442-
* @see https://www.owasp.org/index.php/List_of_useful_HTTP_headers
442+
* @see https://developer.mozilla.org/docs/Web/HTTP/Headers/X-XSS-Protection
443443
*/
444444
$headers['X-XSS-Protection'] = '1; mode=block';
445445

446446
/**
447447
* "nosniff", prevents Internet Explorer and Google Chrome from MIME-sniffing
448448
* a response away from the declared content-type.
449449
*
450-
* @see https://www.owasp.org/index.php/List_of_useful_HTTP_headers
450+
* @see https://developer.mozilla.org/docs/Web/HTTP/Headers/X-Content-Type-Options
451451
*/
452452
$headers['X-Content-Type-Options'] = 'nosniff';
453453

454454
/**
455455
* Adobe cross-domain-policies.
456456
*
457-
* @see https://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html
457+
* @see https://www.sentrium.co.uk/labs/application-security-101-http-headers
458458
*/
459459
$headers['X-Permitted-Cross-Domain-Policies'] = 'none';
460460

461461
/**
462462
* Robots meta tag.
463463
*
464-
* @see https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag
464+
* @see https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag
465465
*/
466466
$headers['X-Robots-Tag'] = 'noindex, nofollow';
467467

0 commit comments

Comments
 (0)