Commit Graph

473 Commits

Author SHA1 Message Date
Kamil Tekiela
47a039d70c Implement ResultInterface & MysqliResult
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-31 23:59:24 +00:00
Maurício Meneghini Fauth
8e9dfe79db
Merge pull request #17243 from kamil-tekiela/Refactor-Results.php
Refactor results.php
2021-12-27 09:21:49 -03:00
Kamil Tekiela
e2dc2a9c86 Remove getUnsortedSqlAndSortByKeyDropDown()
This was stupid abstraction. This method did 2 things. When the code that prepares unsorted SQL is moved out of this method, the rest can be absorbed by getSortByKeyDropDown(). This method didn't declare any local variables, it took parameters that were just passed along to other methods. The code to get unsorted SQL was just a single instruction that was self-explanatory. Indexes relied on properties so they didn't need to be a parameter to the other method.

This method only added complexity instead of reducing it.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-26 23:10:34 +00:00
Kamil Tekiela
7a735ddf92 Redesign CSS class generation
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-26 23:10:34 +00:00
Kamil Tekiela
9969b9d103 $printview global is always null
The variable is not set anywhere in the current codebase.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-26 23:10:34 +00:00
Kamil Tekiela
acb91c0b34 Refactor Results.php
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-26 23:10:34 +00:00
Kamil Tekiela
97810b3a21 Fix bug #17239
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-26 23:10:34 +00:00
Kamil Tekiela
eba8621881 Use DI for Results.php
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-26 23:10:34 +00:00
Maurício Meneghini Fauth
d84af02945
Create VO classes for each RelationParameters features
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-26 19:17:58 -03:00
Maurício Meneghini Fauth
c4e2582e56
Use TableName for RelationParameters tables
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-26 19:17:57 -03:00
Maurício Meneghini Fauth
44fe103b9c
Remove @access annotations
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-22 11:43:45 -03:00
Maurício Meneghini Fauth
2a4b170a34
Merge branch 'QA_5_1'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-21 13:13:09 -03:00
Maurício Meneghini Fauth
c411121fd8
Move Relation classes into the ConfigStorage namespace
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-17 12:09:13 -03:00
Kamil Tekiela
903afe871b Bug fix: SQL string in confirmation popup should not be escaped
The values of < > ' " & are double escaped in the confirmation dialog.
Since the values are inserted via twig into HTML, there is no need to
escape them twice.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-14 12:22:25 +00:00
Maurício Meneghini Fauth
4c3bf41d56
Use DatabaseName for RelationParameters::db instead of string
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-11 08:10:40 -03:00
Maurício Meneghini Fauth
c4575fd48b
Add methods to check for RelationParameters features
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-11 08:10:40 -03:00
Kamil Tekiela
ce527035c2 PHPStan checkAlwaysTrueCheckTypeFunctionCall fixes
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-08 15:26:52 +00:00
Kamil Tekiela
be87571da6 PHPStan checkAlwaysTrueStrictComparison fixes
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-08 15:26:52 +00:00
Kamil Tekiela
a42803297c
Psalm fixes 3 (#17221)
* Update psalm-baseline.xml

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Small bug fixes

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* non-falsy-string is always true

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* currentSearch property is nullable

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove unusued parameter $columnIndex

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Use parameters instead of globals in sendEditor()

The two globals in this method are read-only. There is an unused
parameter in the signature. Let's add one more and use them instead of globals.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove unusued parameter $crlf

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-03 12:40:19 -03:00
Kamil Tekiela
f446e6da88 Remove unused variables
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-03 15:12:56 +00:00
Kamil Tekiela
1270efc2a9
Refactor util.php (#17212)
* Remove extra space

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove null checks on properties that cannot be null

The value could be null only if the property exists in stdClass
returned by mysqli but is null. Mysqli doesn't do that. Unless the value
can be null in some other way, this check is redundant.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Add psalm-return

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove $handle parameter of getUniqueCondition()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Type hint the $row parameter

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

Co-authored-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-02 17:37:09 -03:00
Maurício Meneghini Fauth
857a9d3337
Remove unnecessary @var annotations
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-11-18 12:15:30 -03:00
Maurício Meneghini Fauth
b2a51c4d84
Create the RelationParameters value object
Replaces the $cfgRelation array with the RelationParameters value
object.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-11-14 18:22:36 -03:00
Maurício Meneghini Fauth
220ed30ef8
Remove printview.css theme files
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-10-31 17:35:55 -03:00
Maurício Meneghini Fauth
3e0856c77b
Remove useless string concatenations
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-27 21:40:22 -03:00
Maurício Meneghini Fauth
e9ec9e8b71
Replace rand functions with random_int
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-27 19:05:42 -03:00
Maurício Meneghini Fauth
f00d70cccb
Remove useless whitespaces
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-15 17:05:40 -03:00
Maurício Meneghini Fauth
9f3510d11a
Add bool return type where possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-14 20:11:51 -03:00
Maurício Meneghini Fauth
7f6472b2c2
Add void return type where possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-13 15:29:11 -03:00
Maurício Meneghini Fauth
8f2f3eff40
Remove the Core::isValid method
This improves the type checking and simplifies the code.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-02 13:20:50 -03:00
William Desportes
1850efdc03
Fix coding standard issues
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-08-23 20:17:02 +02:00
William Desportes
8d19bef81d
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-08-22 23:19:15 +02:00
William Desportes
8f4514c7e9
Fix #17046 - "Uncaught TypeError: htmlspecialchars() expects parameter 1 to be string, null given"
Fixes: #17046

"libraries/classes/Display/Results.php not guarding against null metadata in getHeaderTablesForColumns"

Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-08-22 23:04:17 +02:00
Lukas Bixen
a1e473ab66 Fix #17062: Improve uniqueness of SQL query hashes
Use server and database in addition to query when generating hash

Signed-off-by: Lukas Bixen <lrb2_@outlook.com>
2021-08-21 22:35:49 -05:00
Maurício Meneghini Fauth
f970299289
Remove $defaultFunction variable from Display\Results
Makes the type of $transformationPlugin variable more strict.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-08-09 12:50:28 -03:00
Lukas Bixen
75c4de2d5d Fix text alignment in some Bootstrap tables:
Replaced instances of the `right` CSS class (used only for `pma-table`s)
with Bootstrap's `text-right`

Signed-off-by: Lukas Bixen <lrb2_@outlook.com>
2021-08-08 18:12:37 -05:00
Maurício Meneghini Fauth
04d3c83559
Fix some errors found by PHPStan/Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-08-05 16:09:08 -03:00
William Desportes
cef66ddc19
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-27 02:59:31 +02:00
William Desportes
6addfdfd96
Fix #17027 - Better handle display of sorted binary columns in results summary
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-27 01:56:11 +02:00
Maximilian Krög
808cd82780
Use negative length with mb_substr where possible
Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
2021-07-18 23:59:46 +02:00
William Desportes
4499e75901
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-16 02:49:36 +02:00
William Desportes
34acbcdc38
Fix calls to fetchRow using two parameters but function has only one parameter
None of our fetchRow methods have more than one parameter

Thank you Psalm for catching this !

Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-16 02:28:03 +02:00
Maurício Meneghini Fauth
1835ebb4fc
Replace mb_strpos !== false with str_contains
See: https://wiki.php.net/rfc/str_contains#case-insensitivity_and_multibyte_strings

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-07-10 13:43:40 -03:00
Maurício Meneghini Fauth
6ae07c96fb
Replace strpos !== false with str_contains
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-07-09 22:30:42 -03:00
Maurício Meneghini Fauth
8e4d6229a9
Fix some errors found by Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-07-06 00:37:27 -03:00
Maurício Meneghini Fauth
9adaa912e1
Rename Response class to ResponseRenderer
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-30 12:35:22 -03:00
Maurício Meneghini Fauth
b1c936a0f3
Fix some errors found by Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-25 15:03:05 -03:00
William Desportes
0a1f083990
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-06-23 20:36:21 +02:00
William Desportes
8e148afc9e
Fix two possible PHP errors with int data
Actually, one poped out on tests after #16935
Ref: #14936

Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-06-22 00:29:32 +02:00
William Desportes
6549c11361
Fix #16896 - Distinct URLs are broken on nullable text fields
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-06-22 00:29:32 +02:00