Commit Graph

84 Commits

Author SHA1 Message Date
Kamil Tekiela
c0b367cc57 Create Tracking namespace
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-17 22:35:32 +00:00
Maurício Meneghini Fauth
865c46e320
Move Theme and ThemeManager into the Theme namespace
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-13 10:25:48 -03:00
Maurício Meneghini Fauth
687c51dc1e
Replace $GLOBALS['cfg']['ZeroConf'] in Common class
Replaces it with PhpMyAdmin\Config\Settings::$zeroConf access.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-02 17:55:58 -03:00
Maurício Meneghini Fauth
5c5e8c2de1
Replace $GLOBALS['cfg']['MysqlMinVersion'] in Common class
Replaces with PhpMyAdmin\Config\Settings::$mysqlMinVersion access.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-02 17:29:54 -03:00
Kamil Tekiela
276577ca2a
Remove $GLOBALS['PMA_PHP_SELF'] (#18149)
* Remove $GLOBALS['PMA_PHP_SELF']

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

* Remove $GLOBALS['PMA_PHP_SELF'] from tests

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

* Moved cleanupPathInfo to Routing

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

* Remove parse_url from getRootPath

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

* Update baselines

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

* Remove invalid tests

Surely, we never expect PATH to be backslash delimited. The code is not designed to handle this and the tests for this don't make much sense.

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

* Fix trailing slash in path

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

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-27 17:56:27 -03:00
Kamil Tekiela
0bdcaba2d2
Add native property types (#18143)
* Add native property types

Includes TypeHints.UnionTypeHintFormat

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

* Set some default values for properties

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

* Format and promote properties

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

* Remove redundant asserts

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

* Redundant cast

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

* $tmanager->theme is never null

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

* Redundant variable

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

* Fix empty on $statementInfo bool

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

* Redundant casts

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

* Redundant issets

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

* getPacked() returns nullable string

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

* Redundant if

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

* $this->content can be null

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

* Simplify ThemeManager::getInstance()

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

* Use isset for checking if property is initialized

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

* Use nullable instead of uninitialized property

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

* password is no longer nullable

I can't verify that none of the globals ever tried to set it to null, but the variable should never be nullable.

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

* Update baselines

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

* $same_wide_width param can be float or int

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

* Update Message.php

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

* Cast Sub_part to int

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

* Fix one line doc comments

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

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-26 23:30:41 -03:00
Maurício Meneghini Fauth
77957a69a5
Add trailing comma for multi-line functions
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-24 20:48:46 -03:00
Maurício Meneghini Fauth
b0bc4f460e
Use null safe object operator where possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-20 18:21:56 -03:00
Maurício Meneghini Fauth
613678f8f5
Replace assignments with null coalesce equal operator
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-20 17:03:05 -03:00
Kamil Tekiela
80c4db7253 Use strict check when type is known
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-19 23:19:54 +00:00
Maurício Meneghini Fauth
41dec1effc
Extract connection type constants to the Connection class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-17 02:21:27 -03:00
Maurício Meneghini Fauth
a6bdf8a811
Create Dbal\Connection class
Wraps the connection object with the Connection class.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-16 15:31:02 -03:00
Maurício Meneghini Fauth
6122dfd0be
Replace exit with exception in Session class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-17 22:06:51 -03:00
Maurício Meneghini Fauth
a2a3f6d26d
Create a factory for auth plugin creation
Extracts the factory method from the Plugins class into a new class.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-16 19:32:10 -03:00
Maurício Meneghini Fauth
0379fcc385
Remove the auth_plugin global variable
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-16 16:51:22 -03:00
Maurício Meneghini Fauth
a6b7e5ef28
Remove exit construct from Plugins::getAuthPlugin()
Throws exception for invalid auth plugin instead of exiting.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-16 16:25:51 -03:00
Maurício Meneghini Fauth
561d9ca705
Remove containerBuilder global variable from Common class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-16 11:41:08 -03:00
Maurício Meneghini Fauth
b783681a8b Remove Config::fatalErrorHandler() method
Since there is an error handler register already, error_get_last is
always empty.

Also adds a try-catch to catch exceptions from the config file.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-16 10:27:18 -03:00
Maurício Meneghini Fauth
ad5e2abdab
Throw ConfigException for some Config errors
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-15 19:03:01 -03:00
Maurício Meneghini Fauth
b2eb6bf4c9
Extract config load and check from Config's constructor
This allows better handling of the user's config loading and validation.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-15 13:20:13 -03:00
Maurício Meneghini Fauth
c88152cf59
Use more specific exceptions for some errors
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-31 22:32:12 -03:00
Maurício Meneghini Fauth
103968f352
Replace fatalError() with exception in Core::warnMissingExtension()
Also moves some other calls to Core::warnMissingExtension() to the
Common::checkRequiredPhpExtensions() method.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-31 20:25:55 -03:00
Maurício Meneghini Fauth
3121dae621
Replace Core::fatalError() calls from the Common class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-31 20:25:54 -03:00
Maurício Meneghini Fauth
a7cb439d2a
Extract method that sets the server global variable
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-23 02:38:54 -03:00
Maurício Meneghini Fauth
22f1038ebb
Extract method that sets the sql_query global variable
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-23 02:16:17 -03:00
Maurício Meneghini Fauth
9706987031
Move /messages HTTP headers to the JavaScriptMessagesController
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-22 22:42:43 -03:00
Maurício Meneghini Fauth
334bd84002
Move Routing::callControllerForRoute call to Common class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-22 09:56:22 -03:00
Maurício Meneghini Fauth
49e7d82c0f
Extract setup routing logic to the Routing class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-22 09:56:21 -03:00
Maurício Meneghini Fauth
dbb9d68236
Extract setup page bootstrap to the Common class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-22 09:56:21 -03:00
Maurício Meneghini Fauth
2c3ce59718
Remove isMinimumCommon variable from global space
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-21 13:51:58 -03:00
Luca Perna
d1b5cb6987
16276 - Reduce the usage of SuperGlobals (#17795)
Signed-off-by: Luca Perna <luca@perna.rocks>
2022-10-20 01:52:38 -03:00
Maurício Meneghini Fauth
bb97ed988f
Reduce usage of the containerBuilder global variable
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-09-29 22:36:46 -03:00
Maurício Meneghini Fauth
6792b17e72
Add tryFromValue method to DatabaseName and TableName classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-09-18 16:32:42 -03:00
Maurício Meneghini Fauth
5acfb45262
Fix some errors in Common class found by Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-08-23 17:00:09 -03:00
Maurício Meneghini Fauth
87d695f2c8
Extract js/messages.php entry point into a route
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-08-06 22:25:32 -03:00
Maurício Meneghini Fauth
75cf045fa3
Extract url.php entry point into a route
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-08-06 15:02:49 -03:00
Maurício Meneghini Fauth
eb3703882b
Move Routing::getCurrentRoute to ServerRequest
The route is retrieved from the request, so it makes sense to move the
method to the Http\ServerRequest class.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-06-06 23:36:57 -03:00
Maurício Meneghini Fauth
3d3010916e
Fix an issue reported by Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-05-21 17:31:03 -03:00
Maurício Meneghini Fauth
2c5143feda Remove ResponseRenderer::getFooter method
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-04-09 12:32:14 -03:00
Maurício Meneghini Fauth
0d4d2a4935
Add exceptions for invalid identifier names
- Adds the PhpMyAdmin\Dbal\InvalidIdentifierName exception
- Adds the PhpMyAdmin\Dbal\InvalidDatabaseName exception
- Adds the PhpMyAdmin\Dbal\InvalidTableName exception

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-19 17:35:35 -03:00
Maurício Meneghini Fauth
5950693fb3
Fix possible undefined globals
Related to https://github.com/phpmyadmin/phpmyadmin/pull/17427.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-10 18:05:21 -03:00
Maurício Meneghini Fauth
1438cb211e
Replace global keyword with $GLOBALS
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-07 17:31:11 -03:00
Maurício Meneghini Fauth
7aec65222a
Fix an issue reported by PHPStan
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-02-28 12:21:11 -03:00
Maurício Meneghini Fauth
5a34a3bb04
Remove db and table properties from controllers
Replaces them with their respective globals.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-02-02 14:48:43 -03:00
Kamil Tekiela
47e81a5161 Remove $route global
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-01-27 11:47:40 +00:00
Kamil Tekiela
ef6dbe05ec Implement Common::getRequest() to remove global
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-01-27 11:42:39 +00:00
Maurício Meneghini Fauth
0bee94b27e
Merge branch 'QA_5_1-security' into master-security
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-01-11 14:31:56 -03:00
Maurício Meneghini Fauth
ca91eaeb38
Accept mixed for DatabaseName and TableName constructors
This avoids redundant type assertions.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-23 16:25:05 -03:00
Maurício Meneghini Fauth
995ec44d13
Move DatabaseInterface::initRelationParamsCache method to Relation class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-17 12:09:13 -03:00
Maurício Meneghini Fauth
9e2bb1e996
Replace Assert exceptions with a more specific one
Catches only \Webmozart\Assert\InvalidArgumentException instead of all
\InvalidArgumentException.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-09 14:50:25 -03:00