From b8dfbe45c8588323c73c0ead742c44521b61fdae Mon Sep 17 00:00:00 2001 From: Amenadiel Date: Tue, 7 Jan 2020 00:36:44 -0300 Subject: [PATCH] Creating Tag v6.0.0-RC1 at 2020-01-07 - ignoring test folder for packagist distro --- .php_cs.cache | 2 +- README.md | 39 +++++----- config.inc.php-dist | 21 +++--- index.php | 68 ++++++++---------- src/classes/ContainerUtils.php | 34 +++++++-- src/lib.inc.php | 82 +--------------------- src/middleware/Middleware.php | 23 ++++++ src/middleware/PopulateRequestResponse.php | 81 +++++++++++++++++++++ 8 files changed, 196 insertions(+), 154 deletions(-) create mode 100644 src/middleware/Middleware.php create mode 100644 src/middleware/PopulateRequestResponse.php diff --git a/.php_cs.cache b/.php_cs.cache index e72718714..2f34f29ba 100644 --- a/.php_cs.cache +++ b/.php_cs.cache @@ -1 +1 @@ -{"php":"7.4.1","version":"2.16.1:v2.16.1#c8afb599858876e95e8ebfcd97812d383fa23f02","indent":" ","lineEnding":"\n","rules":{"no_php4_constructor":true,"php_unit_namespaced":{"target":"6.0"},"php_unit_dedicate_assert":{"target":"5.6"},"php_unit_expectation":{"target":"5.6"},"php_unit_mock":{"target":"5.5"},"php_unit_no_expectation_annotation":{"target":"4.3"},"array_syntax":{"syntax":"short"},"binary_operator_spaces":{"align_double_arrow":true,"align_equals":true},"blank_line_after_opening_tag":true,"blank_line_before_statement":true,"braces":true,"cast_spaces":true,"class_attributes_separation":{"elements":["method"]},"class_definition":true,"concat_space":true,"declare_equal_normalize":true,"function_typehint_space":true,"include":true,"increment_style":true,"lowercase_cast":true,"lowercase_static_reference":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":{"ensure_fully_multiline":true},"native_function_casing":true,"native_function_type_declaration_casing":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["break","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","return","square_brace_block","switch","throw","use","useTrait","use_trait"]},"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_mixed":true,"allow_unused_params":true},"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unneeded_curly_braces":true,"no_unneeded_final_method":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"object_operator_without_whitespace":true,"ordered_imports":true,"php_unit_fqcn_annotation":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":true,"phpdoc_var_without_name":true,"return_type_declaration":true,"semicolon_after_instruction":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_throw":true,"single_quote":true,"single_trait_insert_per_statement":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline_array":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"modernize_types_casting":true,"align_multiline_comment":true,"combine_consecutive_issets":true,"combine_consecutive_unsets":true,"compact_nullable_typehint":true,"escape_implicit_backslashes":true,"explicit_indirect_variable":true,"explicit_string_variable":true,"final_internal_class":true,"header_comment":{"commentType":"PHPDoc","header":"PHPPgAdmin v6.0.0-RC1"},"heredoc_to_nowdoc":true,"list_syntax":{"syntax":"long"},"method_chaining_indentation":true,"multiline_comment_opening_closing":true,"no_null_property_initialization":true,"no_short_echo_tag":true,"no_superfluous_elseif":true,"no_unreachable_default_argument_value":true,"no_useless_else":true,"no_useless_return":true,"php_unit_strict":true,"php_unit_test_annotation":true,"php_unit_test_class_requires_covers":true,"phpdoc_add_missing_param_annotation":true,"phpdoc_order":true,"strict_param":true},"hashes":{"src\/classes\/ADOdbException.php":825054767,"src\/classes\/ContainerUtils.php":4272551978,"src\/classes\/Translations.php":976958025,"src\/classes\/ADONewConnection.php":3182435466,"src\/classes\/ADORecordSet.php":3680710199,"src\/classes\/Misc.php":904496808,"src\/classes\/ArrayRecordSet.php":855075865,"src\/classes\/PluginManager.php":2977807860,"src\/controllers\/OperatorsController.php":941969450,"src\/controllers\/InfoController.php":2689420424,"src\/controllers\/SequencesController.php":2462884402,"src\/controllers\/LoginController.php":3518741519,"src\/controllers\/BrowserController.php":1199936595,"src\/controllers\/LanguagesController.php":3828769383,"src\/controllers\/OpclassesController.php":2906544770,"src\/controllers\/SqlController.php":43253890,"src\/controllers\/CastsController.php":1193925651,"src\/controllers\/TblpropertiesController.php":1571749532,"src\/controllers\/ConversionsController.php":2746606829,"src\/controllers\/FulltextController.php":3039784761,"src\/controllers\/IndexesController.php":119164030,"src\/controllers\/MaterializedviewpropertiesController.php":819592380,"src\/controllers\/BaseController.php":1681924030,"src\/controllers\/TablespacesController.php":1104045852,"src\/controllers\/ServersController.php":3836918534,"src\/controllers\/PrivilegesController.php":1686031167,"src\/controllers\/DataexportController.php":2581613081,"src\/controllers\/TablesController.php":2681936275,"src\/controllers\/MaterializedviewsController.php":3074990556,"src\/controllers\/ViewpropertiesController.php":2934799065,"src\/controllers\/SchemasController.php":2943251120,"src\/controllers\/DisplayController.php":1309289725,"src\/controllers\/FunctionsController.php":2171207984,"src\/controllers\/TriggersController.php":839644731,"src\/controllers\/UsersController.php":3943376301,"src\/controllers\/DatabaseController.php":1891536950,"src\/controllers\/AcinsertController.php":1715737958,"src\/controllers\/SqleditController.php":3011525187,"src\/controllers\/ViewsController.php":4113881512,"src\/controllers\/IntroController.php":3496394188,"src\/controllers\/AlldbController.php":871559708,"src\/controllers\/ColpropertiesController.php":2326175447,"src\/controllers\/TypesController.php":1236070071,"src\/controllers\/DomainsController.php":1859716592,"src\/controllers\/ConstraintsController.php":2880388587,"src\/controllers\/RolesController.php":388816947,"src\/controllers\/HelpController.php":2893523592,"src\/controllers\/RulesController.php":2982226196,"src\/controllers\/HistoryController.php":2935624630,"src\/controllers\/AggregatesController.php":2741983872,"src\/controllers\/DbexportController.php":3047879974,"src\/controllers\/GroupsController.php":1774877614,"src\/controllers\/DataimportController.php":836536621,"src\/database\/Postgres90.php":2049505828,"src\/database\/ADOdbBase.php":158655109,"src\/database\/Postgres84.php":781351078,"src\/database\/Postgres82.php":1044797496,"src\/database\/Postgres.php":364734924,"src\/database\/Postgres80.php":1284994685,"src\/database\/Postgres11.php":1328532207,"src\/database\/Postgres74.php":1439219096,"src\/database\/Postgres81.php":2439382765,"src\/database\/databasetraits\/StatsTrait.php":668902995,"src\/database\/databasetraits\/SchemaTrait.php":3205028848,"src\/database\/databasetraits\/ColumnTrait.php":3207590854,"src\/database\/databasetraits\/AggregateTrait.php":3881579916,"src\/database\/databasetraits\/TriggerTrait.php":257000532,"src\/database\/databasetraits\/PrivilegesTrait.php":3283754794,"src\/database\/databasetraits\/RoleTrait.php":199842892,"src\/database\/databasetraits\/FtsTrait.php":2218009273,"src\/database\/databasetraits\/HasTrait.php":408710804,"src\/database\/databasetraits\/TableTrait.php":1459726165,"src\/database\/databasetraits\/FunctionTrait.php":42356423,"src\/database\/databasetraits\/RowTrait.php":2915786598,"src\/database\/databasetraits\/TablespaceTrait.php":1973623363,"src\/database\/databasetraits\/DatabaseTrait.php":2941489465,"src\/database\/databasetraits\/SequenceTrait.php":574156635,"src\/database\/databasetraits\/DomainTrait.php":464905412,"src\/database\/databasetraits\/OperatorTrait.php":67439130,"src\/database\/databasetraits\/IndexTrait.php":3955182649,"src\/database\/databasetraits\/ViewTrait.php":1852979711,"src\/database\/databasetraits\/TypeTrait.php":205444818,"src\/database\/Postgres94.php":3615539083,"src\/database\/Postgres83.php":2203248377,"src\/database\/Postgres92.php":3947035600,"src\/database\/Postgres10.php":2072333308,"src\/database\/Connection.php":98808153,"src\/database\/Postgres95.php":3572120501,"src\/database\/Postgres91.php":2935757451,"src\/database\/Postgres96.php":1818794408,"src\/database\/Postgres93.php":1193239172,"src\/decorators\/UrlDecorator.php":226919275,"src\/decorators\/BranchUrlDecorator.php":3168516245,"src\/decorators\/FieldDecorator.php":4152812554,"src\/decorators\/ArrayMergeDecorator.php":4164842401,"src\/decorators\/ReplaceDecorator.php":24981586,"src\/decorators\/CallbackDecorator.php":2821954152,"src\/decorators\/ActionUrlDecorator.php":3114248420,"src\/decorators\/ConcatDecorator.php":3498174683,"src\/decorators\/IfEmptyDecorator.php":4150822137,"src\/decorators\/Decorator.php":437442420,"src\/decorators\/RedirectUrlDecorator.php":4166009270,"src\/help\/PostgresDoc10.php":3641906681,"src\/help\/PostgresDoc74.php":1512450154,"src\/help\/PostgresDoc82.php":2881373619,"src\/help\/PostgresDoc83.php":2644168186,"src\/help\/PostgresDoc91.php":3081886897,"src\/help\/PostgresDoc96.php":154371202,"src\/help\/PostgresDoc95.php":287915738,"src\/help\/PostgresDoc84.php":3076785333,"src\/help\/PostgresDoc93.php":4078721192,"src\/help\/PostgresDoc92.php":1222326634,"src\/help\/PostgresDoc90.php":1362550071,"src\/help\/PostgresDoc80.php":3479272995,"src\/help\/PostgresDoc94.php":3894448275,"src\/help\/PostgresDoc81.php":2764961597,"src\/translations\/French.php":3880627942,"src\/translations\/Afrikaans.php":2673732846,"src\/translations\/Catalan.php":1333116784,"src\/translations\/Arabic.php":2114574082,"src\/translations\/Polish.php":1818369508,"src\/translations\/ChineseTr.php":579892088,"src\/translations\/Lithuanian.php":790875180,"src\/translations\/Danish.php":3342966268,"src\/translations\/PortugueseBr.php":284219180,"src\/translations\/Hungarian.php":2231900353,"src\/translations\/Hebrew.php":2172289195,"src\/translations\/Slovak.php":887200794,"src\/translations\/Mongol.php":1251827150,"src\/translations\/Romanian.php":2373007003,"src\/translations\/ChineseUtf8ZhTw.php":4245256853,"src\/translations\/Italian.php":4287541206,"src\/translations\/Spanish.php":426659789,"src\/translations\/Dutch.php":3884258958,"src\/translations\/ChineseUtf8ZhCn.php":2751640321,"src\/translations\/Greek.php":309497058,"src\/translations\/Galician.php":1517592825,"src\/translations\/Turkish.php":2998152301,"src\/translations\/PortuguesePt.php":2626042474,"src\/translations\/Ukrainian.php":2023351133,"src\/translations\/ChineseSim.php":2428264346,"src\/translations\/Japanese.php":1944292122,"src\/translations\/English.php":3045553118,"src\/translations\/Russian.php":3190807717,"src\/translations\/Czech.php":3253016338,"src\/translations\/Swedish.php":999657642,"src\/translations\/RussianUtf8.php":3722043399,"src\/translations\/German.php":1483704440,"src\/xhtml\/TreeController.php":2201501702,"src\/xhtml\/HTMLTableController.php":2830120865,"src\/xhtml\/XHtmlSelect.php":1204290878,"src\/xhtml\/HTMLController.php":423828083,"src\/xhtml\/HTMLFooterController.php":2661122200,"src\/xhtml\/XHtmlButton.php":2083531323,"src\/xhtml\/HTMLHeaderController.php":65776700,"src\/xhtml\/XHtmlElement.php":1004724959,"src\/xhtml\/XHtmlOption.php":3648782538,"src\/xhtml\/XHtmlSimpleElement.php":2306676159,"src\/xhtml\/HTMLNavbarController.php":2267619508,"src\/traits\/HelperTrait.php":3181772942,"src\/traits\/FormTrait.php":1420658246,"src\/traits\/ServersTrait.php":1927337863,"src\/traits\/InsertEditRowTrait.php":1099751187,"src\/traits\/MiscTrait.php":3625552268,"src\/traits\/ExportTrait.php":764919083,"src\/traits\/ViewsMatviewsTrait.php":3011418249,"src\/traits\/AdminTrait.php":1357924913,"src\/traits\/ViewsMatViewsPropertiesTrait.php":667522305,"tests\/views\/casts.php":1238674471,"tests\/views\/conversions.php":2021481280,"tests\/views\/dataimport.php":1275385442,"tests\/views\/intro.php":717515710,"tests\/views\/servers.php":1070804547,"tests\/views\/tables.php":3581551789,"tests\/views\/operators.php":460203356,"tests\/views\/triggers.php":2914746621,"tests\/views\/alldb.php":2840074568,"tests\/views\/acinsert.php":3245153246,"tests\/views\/aggregates.php":4270524012,"tests\/views\/dbexport.php":1777852364,"tests\/views\/functions.php":1207461247,"tests\/views\/groups.php":1179113401,"tests\/views\/viewproperties.php":1191855860,"tests\/views\/dataexport.php":391708853,"tests\/views\/sequences.php":1837073598,"tests\/views\/info.php":2855909016,"tests\/views\/materializedviews.php":392695216,"tests\/views\/types.php":4003163340,"tests\/views\/tablespaces.php":63944599,"tests\/views\/opclasses.php":506935034,"tests\/views\/login.php":2468506920,"tests\/views\/schemas.php":4245023803,"tests\/views\/help.php":2029397915,"tests\/views\/tblproperties.php":2845120406,"tests\/views\/display.php":3895446006,"tests\/views\/indexes.php":232322537,"tests\/views\/rules.php":196604868,"tests\/views\/roles.php":1650201290,"tests\/views\/materializedviewproperties.php":2356361222,"tests\/views\/domains.php":3379864214,"tests\/views\/languages.php":3077896645,"tests\/views\/privileges.php":1413381666,"tests\/views\/history.php":582751340,"tests\/views\/colproperties.php":1096899698,"tests\/views\/views.php":3343597713,"tests\/views\/fulltext.php":1378742860,"tests\/views\/sql.php":314558657,"tests\/views\/sqledit.php":2856677743,"tests\/views\/database.php":537323017,"tests\/views\/users.php":2030654504,"tests\/views\/browser.php":2003663271,"tests\/views\/constraints.php":3534077795,"tests\/unit\/ContainerTest.php":2615222722,"tests\/unit\/ViewTest.php":678568275,"tests\/selenium\/src\/99-cleantests.php":3145093995,"tests\/selenium\/src\/01-roles.php":3322243353,"tests\/selenium\/src\/25-column.php":2238849610,"tests\/selenium\/src\/10-table.php":2803912212,"tests\/selenium\/src\/35-index.php":2452322607,"tests\/selenium\/src\/15-sequence.php":3897865638,"tests\/selenium\/src\/08-domaine.php":1213992669,"tests\/selenium\/src\/12-admin.php":729786564,"tests\/selenium\/src\/20-constraint.php":2875405550,"tests\/selenium\/src\/06-schema.php":3372970480,"tests\/selenium\/src\/04-database.php":430607003,"tests\/selenium\/src\/30-view.php":1158395238,"tests\/selenium\/testBuilder.class.php":45748002,"tests\/selenium\/TestSuite.php":491846684,"tests\/_support\/Helper\/Acceptance.php":3109926544,"tests\/_support\/Helper\/Functional.php":2429167900,"tests\/_support\/Helper\/Unit.php":3551903794,"tests\/_support\/UnitTester.php":4235039562,"tests\/_support\/AcceptanceTester.php":1308178123,"tests\/_support\/_generated\/UnitTesterActions.php":3358989793,"tests\/_support\/FunctionalTester.php":2409739719,"tests\/simpletest\/config.tests.php":1708869964,"tests\/simpletest\/testcase\/Databases\/ProcessesTest.php":3663936598,"tests\/simpletest\/testcase\/Databases\/AdminTest.php":1178110473,"tests\/simpletest\/testcase\/Databases\/CastsTest.php":1534522870,"tests\/simpletest\/testcase\/Databases\/DatabaseTest.php":1958789074,"tests\/simpletest\/testcase\/Databases\/VariablesTest.php":1884732621,"tests\/simpletest\/testcase\/Databases\/HelpTest.php":3045505700,"tests\/simpletest\/testcase\/Databases\/SqlTest.php":4130032578,"tests\/simpletest\/testcase\/Databases\/DatabaseGroupTest.php":2576852907,"tests\/simpletest\/testcase\/Databases\/SchemaBasicTest.php":3921858158,"tests\/simpletest\/testcase\/Databases\/LanguageTest.php":155357525,"tests\/simpletest\/testcase\/Databases\/FindObjectsTest.php":1193017594,"tests\/simpletest\/testcase\/Schemas\/DomainTest.php":457318487,"tests\/simpletest\/testcase\/Schemas\/TableTest.php":1945758432,"tests\/simpletest\/testcase\/Schemas\/TypeTest.php":1546232430,"tests\/simpletest\/testcase\/Schemas\/FunctionTest.php":37111242,"tests\/simpletest\/testcase\/Schemas\/SchemasGroupTest.php":2486713986,"tests\/simpletest\/testcase\/Schemas\/ConversionTest.php":2311845339,"tests\/simpletest\/testcase\/Schemas\/SequenceTest.php":3473303031,"tests\/simpletest\/testcase\/Schemas\/ViewTest.php":3704747422,"tests\/simpletest\/testcase\/Schemas\/OperatorTest.php":2671700422,"tests\/simpletest\/testcase\/Schemas\/AggregateTest.php":1463579043,"tests\/simpletest\/testcase\/Schemas\/OpClassTest.php":876132308,"tests\/simpletest\/testcase\/simpletest.inc.php":2274415542,"tests\/simpletest\/testcase\/testphpPgAdminMain.php":1089162123,"tests\/simpletest\/testcase\/Public\/SetPrecondition.php":1091301981,"tests\/simpletest\/testcase\/Public\/common.php":3621144952,"tests\/simpletest\/testcase\/phpcoverage.inc.php":3621930486,"tests\/simpletest\/testcase\/Common\/SecurityTest.php":588192186,"tests\/simpletest\/testcase\/Common\/CommonGroupTest.php":1604131415,"tests\/simpletest\/testcase\/Common\/ImportTest.php":3602677302,"tests\/simpletest\/testcase\/Common\/ExportTest.php":4072327288,"tests\/simpletest\/testcase\/coveragephpPgAdminMain.php":1970931641,"tests\/simpletest\/testcase\/Server\/TableSpacesTest.php":2221893784,"tests\/simpletest\/testcase\/Server\/ReportsTest.php":463997488,"tests\/simpletest\/testcase\/Server\/GroupsTest.php":2795941681,"tests\/simpletest\/testcase\/Server\/ServerGroupTest.php":3381304008,"tests\/simpletest\/testcase\/Server\/UsersTest.php":3716216150,"tests\/simpletest\/testcase\/Tables\/InfoTest.php":1274328824,"tests\/simpletest\/testcase\/Tables\/ConstraintsTest.php":1540391915,"tests\/simpletest\/testcase\/Tables\/TableGroupTest.php":1753974728,"tests\/simpletest\/testcase\/Tables\/ColumnTest.php":1131914980,"tests\/simpletest\/testcase\/Tables\/TriggersTest.php":388231982,"tests\/simpletest\/testcase\/Tables\/DeadlockTest.php":4026092701,"tests\/simpletest\/testcase\/Tables\/RulesTest.php":2041252470,"tests\/simpletest\/testcase\/Tables\/IndexesTest.php":310575,"tests\/simpletest\/tests.php":2339228220,"index.php":911598016}} \ No newline at end of file +{"php":"7.4.1","version":"2.16.1:v2.16.1#c8afb599858876e95e8ebfcd97812d383fa23f02","indent":" ","lineEnding":"\n","rules":{"no_php4_constructor":true,"php_unit_namespaced":{"target":"6.0"},"php_unit_dedicate_assert":{"target":"5.6"},"php_unit_expectation":{"target":"5.6"},"php_unit_mock":{"target":"5.5"},"php_unit_no_expectation_annotation":{"target":"4.3"},"array_syntax":{"syntax":"short"},"binary_operator_spaces":{"align_double_arrow":true,"align_equals":true},"blank_line_after_opening_tag":true,"blank_line_before_statement":true,"braces":true,"cast_spaces":true,"class_attributes_separation":{"elements":["method"]},"class_definition":true,"concat_space":true,"declare_equal_normalize":true,"function_typehint_space":true,"include":true,"increment_style":true,"lowercase_cast":true,"lowercase_static_reference":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":{"ensure_fully_multiline":true},"native_function_casing":true,"native_function_type_declaration_casing":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["break","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","return","square_brace_block","switch","throw","use","useTrait","use_trait"]},"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_mixed":true,"allow_unused_params":true},"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unneeded_curly_braces":true,"no_unneeded_final_method":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"object_operator_without_whitespace":true,"ordered_imports":true,"php_unit_fqcn_annotation":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":true,"phpdoc_var_without_name":true,"return_type_declaration":true,"semicolon_after_instruction":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_throw":true,"single_quote":true,"single_trait_insert_per_statement":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline_array":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"modernize_types_casting":true,"align_multiline_comment":true,"combine_consecutive_issets":true,"combine_consecutive_unsets":true,"compact_nullable_typehint":true,"escape_implicit_backslashes":true,"explicit_indirect_variable":true,"explicit_string_variable":true,"final_internal_class":true,"header_comment":{"commentType":"PHPDoc","header":"PHPPgAdmin v6.0.0-RC1"},"heredoc_to_nowdoc":true,"list_syntax":{"syntax":"long"},"method_chaining_indentation":true,"multiline_comment_opening_closing":true,"no_null_property_initialization":true,"no_short_echo_tag":true,"no_superfluous_elseif":true,"no_unreachable_default_argument_value":true,"no_useless_else":true,"no_useless_return":true,"php_unit_strict":true,"php_unit_test_annotation":true,"php_unit_test_class_requires_covers":true,"phpdoc_add_missing_param_annotation":true,"phpdoc_order":true,"strict_param":true},"hashes":{"src\/classes\/ADOdbException.php":825054767,"src\/classes\/ContainerUtils.php":3386658693,"src\/classes\/Translations.php":976958025,"src\/classes\/ADONewConnection.php":3182435466,"src\/classes\/ADORecordSet.php":3680710199,"src\/classes\/Misc.php":904496808,"src\/classes\/ArrayRecordSet.php":855075865,"src\/classes\/PluginManager.php":2977807860,"src\/controllers\/OperatorsController.php":941969450,"src\/controllers\/InfoController.php":2689420424,"src\/controllers\/SequencesController.php":2462884402,"src\/controllers\/LoginController.php":3518741519,"src\/controllers\/BrowserController.php":1199936595,"src\/controllers\/LanguagesController.php":3828769383,"src\/controllers\/OpclassesController.php":2906544770,"src\/controllers\/SqlController.php":43253890,"src\/controllers\/CastsController.php":1193925651,"src\/controllers\/TblpropertiesController.php":1571749532,"src\/controllers\/ConversionsController.php":2746606829,"src\/controllers\/FulltextController.php":3039784761,"src\/controllers\/IndexesController.php":119164030,"src\/controllers\/MaterializedviewpropertiesController.php":819592380,"src\/controllers\/BaseController.php":1681924030,"src\/controllers\/TablespacesController.php":1104045852,"src\/controllers\/ServersController.php":3836918534,"src\/controllers\/PrivilegesController.php":1686031167,"src\/controllers\/DataexportController.php":2581613081,"src\/controllers\/TablesController.php":2681936275,"src\/controllers\/MaterializedviewsController.php":3074990556,"src\/controllers\/ViewpropertiesController.php":2934799065,"src\/controllers\/SchemasController.php":2943251120,"src\/controllers\/DisplayController.php":1309289725,"src\/controllers\/FunctionsController.php":2171207984,"src\/controllers\/TriggersController.php":839644731,"src\/controllers\/UsersController.php":3943376301,"src\/controllers\/DatabaseController.php":1891536950,"src\/controllers\/AcinsertController.php":1715737958,"src\/controllers\/SqleditController.php":3011525187,"src\/controllers\/ViewsController.php":4113881512,"src\/controllers\/IntroController.php":3496394188,"src\/controllers\/AlldbController.php":871559708,"src\/controllers\/ColpropertiesController.php":2326175447,"src\/controllers\/TypesController.php":1236070071,"src\/controllers\/DomainsController.php":1859716592,"src\/controllers\/ConstraintsController.php":2880388587,"src\/controllers\/RolesController.php":388816947,"src\/controllers\/HelpController.php":2893523592,"src\/controllers\/RulesController.php":2982226196,"src\/controllers\/HistoryController.php":2935624630,"src\/controllers\/AggregatesController.php":2741983872,"src\/controllers\/DbexportController.php":3047879974,"src\/controllers\/GroupsController.php":1774877614,"src\/controllers\/DataimportController.php":836536621,"src\/database\/Postgres90.php":2049505828,"src\/database\/ADOdbBase.php":158655109,"src\/database\/Postgres84.php":781351078,"src\/database\/Postgres82.php":1044797496,"src\/database\/Postgres.php":364734924,"src\/database\/Postgres80.php":1284994685,"src\/database\/Postgres11.php":1328532207,"src\/database\/Postgres74.php":1439219096,"src\/database\/Postgres81.php":2439382765,"src\/database\/databasetraits\/StatsTrait.php":668902995,"src\/database\/databasetraits\/SchemaTrait.php":3205028848,"src\/database\/databasetraits\/ColumnTrait.php":3207590854,"src\/database\/databasetraits\/AggregateTrait.php":3881579916,"src\/database\/databasetraits\/TriggerTrait.php":257000532,"src\/database\/databasetraits\/PrivilegesTrait.php":3283754794,"src\/database\/databasetraits\/RoleTrait.php":199842892,"src\/database\/databasetraits\/FtsTrait.php":2218009273,"src\/database\/databasetraits\/HasTrait.php":408710804,"src\/database\/databasetraits\/TableTrait.php":1459726165,"src\/database\/databasetraits\/FunctionTrait.php":42356423,"src\/database\/databasetraits\/RowTrait.php":2915786598,"src\/database\/databasetraits\/TablespaceTrait.php":1973623363,"src\/database\/databasetraits\/DatabaseTrait.php":2941489465,"src\/database\/databasetraits\/SequenceTrait.php":574156635,"src\/database\/databasetraits\/DomainTrait.php":464905412,"src\/database\/databasetraits\/OperatorTrait.php":67439130,"src\/database\/databasetraits\/IndexTrait.php":3955182649,"src\/database\/databasetraits\/ViewTrait.php":1852979711,"src\/database\/databasetraits\/TypeTrait.php":205444818,"src\/database\/Postgres94.php":3615539083,"src\/database\/Postgres83.php":2203248377,"src\/database\/Postgres92.php":3947035600,"src\/database\/Postgres10.php":2072333308,"src\/database\/Connection.php":98808153,"src\/database\/Postgres95.php":3572120501,"src\/database\/Postgres91.php":2935757451,"src\/database\/Postgres96.php":1818794408,"src\/database\/Postgres93.php":1193239172,"src\/decorators\/UrlDecorator.php":226919275,"src\/decorators\/BranchUrlDecorator.php":3168516245,"src\/decorators\/FieldDecorator.php":4152812554,"src\/decorators\/ArrayMergeDecorator.php":4164842401,"src\/decorators\/ReplaceDecorator.php":24981586,"src\/decorators\/CallbackDecorator.php":2821954152,"src\/decorators\/ActionUrlDecorator.php":3114248420,"src\/decorators\/ConcatDecorator.php":3498174683,"src\/decorators\/IfEmptyDecorator.php":4150822137,"src\/decorators\/Decorator.php":437442420,"src\/decorators\/RedirectUrlDecorator.php":4166009270,"src\/help\/PostgresDoc10.php":3641906681,"src\/help\/PostgresDoc74.php":1512450154,"src\/help\/PostgresDoc82.php":2881373619,"src\/help\/PostgresDoc83.php":2644168186,"src\/help\/PostgresDoc91.php":3081886897,"src\/help\/PostgresDoc96.php":154371202,"src\/help\/PostgresDoc95.php":287915738,"src\/help\/PostgresDoc84.php":3076785333,"src\/help\/PostgresDoc93.php":4078721192,"src\/help\/PostgresDoc92.php":1222326634,"src\/help\/PostgresDoc90.php":1362550071,"src\/help\/PostgresDoc80.php":3479272995,"src\/help\/PostgresDoc94.php":3894448275,"src\/help\/PostgresDoc81.php":2764961597,"src\/translations\/French.php":3880627942,"src\/translations\/Afrikaans.php":2673732846,"src\/translations\/Catalan.php":1333116784,"src\/translations\/Arabic.php":2114574082,"src\/translations\/Polish.php":1818369508,"src\/translations\/ChineseTr.php":579892088,"src\/translations\/Lithuanian.php":790875180,"src\/translations\/Danish.php":3342966268,"src\/translations\/PortugueseBr.php":284219180,"src\/translations\/Hungarian.php":2231900353,"src\/translations\/Hebrew.php":2172289195,"src\/translations\/Slovak.php":887200794,"src\/translations\/Mongol.php":1251827150,"src\/translations\/Romanian.php":2373007003,"src\/translations\/ChineseUtf8ZhTw.php":4245256853,"src\/translations\/Italian.php":4287541206,"src\/translations\/Spanish.php":426659789,"src\/translations\/Dutch.php":3884258958,"src\/translations\/ChineseUtf8ZhCn.php":2751640321,"src\/translations\/Greek.php":309497058,"src\/translations\/Galician.php":1517592825,"src\/translations\/Turkish.php":2998152301,"src\/translations\/PortuguesePt.php":2626042474,"src\/translations\/Ukrainian.php":2023351133,"src\/translations\/ChineseSim.php":2428264346,"src\/translations\/Japanese.php":1944292122,"src\/translations\/English.php":3045553118,"src\/translations\/Russian.php":3190807717,"src\/translations\/Czech.php":3253016338,"src\/translations\/Swedish.php":999657642,"src\/translations\/RussianUtf8.php":3722043399,"src\/translations\/German.php":1483704440,"src\/xhtml\/TreeController.php":2201501702,"src\/xhtml\/HTMLTableController.php":2830120865,"src\/xhtml\/XHtmlSelect.php":1204290878,"src\/xhtml\/HTMLController.php":423828083,"src\/xhtml\/HTMLFooterController.php":2661122200,"src\/xhtml\/XHtmlButton.php":2083531323,"src\/xhtml\/HTMLHeaderController.php":65776700,"src\/xhtml\/XHtmlElement.php":1004724959,"src\/xhtml\/XHtmlOption.php":3648782538,"src\/xhtml\/XHtmlSimpleElement.php":2306676159,"src\/xhtml\/HTMLNavbarController.php":2267619508,"src\/traits\/HelperTrait.php":3181772942,"src\/traits\/FormTrait.php":1420658246,"src\/traits\/ServersTrait.php":1927337863,"src\/traits\/InsertEditRowTrait.php":1099751187,"src\/traits\/MiscTrait.php":3625552268,"src\/traits\/ExportTrait.php":764919083,"src\/traits\/ViewsMatviewsTrait.php":3011418249,"src\/traits\/AdminTrait.php":1357924913,"src\/traits\/ViewsMatViewsPropertiesTrait.php":667522305,"tests\/views\/casts.php":1238674471,"tests\/views\/conversions.php":2021481280,"tests\/views\/dataimport.php":1275385442,"tests\/views\/intro.php":717515710,"tests\/views\/servers.php":1070804547,"tests\/views\/tables.php":3581551789,"tests\/views\/operators.php":460203356,"tests\/views\/triggers.php":2914746621,"tests\/views\/alldb.php":2840074568,"tests\/views\/acinsert.php":3245153246,"tests\/views\/aggregates.php":4270524012,"tests\/views\/dbexport.php":1777852364,"tests\/views\/functions.php":1207461247,"tests\/views\/groups.php":1179113401,"tests\/views\/viewproperties.php":1191855860,"tests\/views\/dataexport.php":391708853,"tests\/views\/sequences.php":1837073598,"tests\/views\/info.php":2855909016,"tests\/views\/materializedviews.php":392695216,"tests\/views\/types.php":4003163340,"tests\/views\/tablespaces.php":63944599,"tests\/views\/opclasses.php":506935034,"tests\/views\/login.php":2468506920,"tests\/views\/schemas.php":4245023803,"tests\/views\/help.php":2029397915,"tests\/views\/tblproperties.php":2845120406,"tests\/views\/display.php":3895446006,"tests\/views\/indexes.php":232322537,"tests\/views\/rules.php":196604868,"tests\/views\/roles.php":1650201290,"tests\/views\/materializedviewproperties.php":2356361222,"tests\/views\/domains.php":3379864214,"tests\/views\/languages.php":3077896645,"tests\/views\/privileges.php":1413381666,"tests\/views\/history.php":582751340,"tests\/views\/colproperties.php":1096899698,"tests\/views\/views.php":3343597713,"tests\/views\/fulltext.php":1378742860,"tests\/views\/sql.php":314558657,"tests\/views\/sqledit.php":2856677743,"tests\/views\/database.php":537323017,"tests\/views\/users.php":2030654504,"tests\/views\/browser.php":2003663271,"tests\/views\/constraints.php":3534077795,"tests\/unit\/ContainerTest.php":2615222722,"tests\/unit\/ViewTest.php":678568275,"tests\/selenium\/src\/99-cleantests.php":3145093995,"tests\/selenium\/src\/01-roles.php":3322243353,"tests\/selenium\/src\/25-column.php":2238849610,"tests\/selenium\/src\/10-table.php":2803912212,"tests\/selenium\/src\/35-index.php":2452322607,"tests\/selenium\/src\/15-sequence.php":3897865638,"tests\/selenium\/src\/08-domaine.php":1213992669,"tests\/selenium\/src\/12-admin.php":729786564,"tests\/selenium\/src\/20-constraint.php":2875405550,"tests\/selenium\/src\/06-schema.php":3372970480,"tests\/selenium\/src\/04-database.php":430607003,"tests\/selenium\/src\/30-view.php":1158395238,"tests\/selenium\/testBuilder.class.php":45748002,"tests\/selenium\/TestSuite.php":491846684,"tests\/_support\/Helper\/Acceptance.php":3109926544,"tests\/_support\/Helper\/Functional.php":2429167900,"tests\/_support\/Helper\/Unit.php":3551903794,"tests\/_support\/UnitTester.php":4235039562,"tests\/_support\/AcceptanceTester.php":1308178123,"tests\/_support\/_generated\/UnitTesterActions.php":3358989793,"tests\/_support\/FunctionalTester.php":2409739719,"tests\/simpletest\/config.tests.php":1708869964,"tests\/simpletest\/testcase\/Databases\/ProcessesTest.php":3663936598,"tests\/simpletest\/testcase\/Databases\/AdminTest.php":1178110473,"tests\/simpletest\/testcase\/Databases\/CastsTest.php":1534522870,"tests\/simpletest\/testcase\/Databases\/DatabaseTest.php":1958789074,"tests\/simpletest\/testcase\/Databases\/VariablesTest.php":1884732621,"tests\/simpletest\/testcase\/Databases\/HelpTest.php":3045505700,"tests\/simpletest\/testcase\/Databases\/SqlTest.php":4130032578,"tests\/simpletest\/testcase\/Databases\/DatabaseGroupTest.php":2576852907,"tests\/simpletest\/testcase\/Databases\/SchemaBasicTest.php":3921858158,"tests\/simpletest\/testcase\/Databases\/LanguageTest.php":155357525,"tests\/simpletest\/testcase\/Databases\/FindObjectsTest.php":1193017594,"tests\/simpletest\/testcase\/Schemas\/DomainTest.php":457318487,"tests\/simpletest\/testcase\/Schemas\/TableTest.php":1945758432,"tests\/simpletest\/testcase\/Schemas\/TypeTest.php":1546232430,"tests\/simpletest\/testcase\/Schemas\/FunctionTest.php":37111242,"tests\/simpletest\/testcase\/Schemas\/SchemasGroupTest.php":2486713986,"tests\/simpletest\/testcase\/Schemas\/ConversionTest.php":2311845339,"tests\/simpletest\/testcase\/Schemas\/SequenceTest.php":3473303031,"tests\/simpletest\/testcase\/Schemas\/ViewTest.php":3704747422,"tests\/simpletest\/testcase\/Schemas\/OperatorTest.php":2671700422,"tests\/simpletest\/testcase\/Schemas\/AggregateTest.php":1463579043,"tests\/simpletest\/testcase\/Schemas\/OpClassTest.php":876132308,"tests\/simpletest\/testcase\/simpletest.inc.php":2274415542,"tests\/simpletest\/testcase\/testphpPgAdminMain.php":1089162123,"tests\/simpletest\/testcase\/Public\/SetPrecondition.php":1091301981,"tests\/simpletest\/testcase\/Public\/common.php":3621144952,"tests\/simpletest\/testcase\/phpcoverage.inc.php":3621930486,"tests\/simpletest\/testcase\/Common\/SecurityTest.php":588192186,"tests\/simpletest\/testcase\/Common\/CommonGroupTest.php":1604131415,"tests\/simpletest\/testcase\/Common\/ImportTest.php":3602677302,"tests\/simpletest\/testcase\/Common\/ExportTest.php":4072327288,"tests\/simpletest\/testcase\/coveragephpPgAdminMain.php":1970931641,"tests\/simpletest\/testcase\/Server\/TableSpacesTest.php":2221893784,"tests\/simpletest\/testcase\/Server\/ReportsTest.php":463997488,"tests\/simpletest\/testcase\/Server\/GroupsTest.php":2795941681,"tests\/simpletest\/testcase\/Server\/ServerGroupTest.php":3381304008,"tests\/simpletest\/testcase\/Server\/UsersTest.php":3716216150,"tests\/simpletest\/testcase\/Tables\/InfoTest.php":1274328824,"tests\/simpletest\/testcase\/Tables\/ConstraintsTest.php":1540391915,"tests\/simpletest\/testcase\/Tables\/TableGroupTest.php":1753974728,"tests\/simpletest\/testcase\/Tables\/ColumnTest.php":1131914980,"tests\/simpletest\/testcase\/Tables\/TriggersTest.php":388231982,"tests\/simpletest\/testcase\/Tables\/DeadlockTest.php":4026092701,"tests\/simpletest\/testcase\/Tables\/RulesTest.php":2041252470,"tests\/simpletest\/testcase\/Tables\/IndexesTest.php":310575,"tests\/simpletest\/tests.php":2339228220,"index.php":2421780117}} \ No newline at end of file diff --git a/README.md b/README.md index 6535db529..44816c3df 100644 --- a/README.md +++ b/README.md @@ -11,22 +11,25 @@ PHP Based administration tool for PostgreSQL. Blazing fast routing with [Slim Fr This is a hard fork of [phppgadmin](https://github.com/phppgadmin/phppgadmin) which adds the following enhancements: -- Composer Installation and dependency management -- Autoloading (thanks to the above) -- Namespaced classes -- Removal of global variables -- Full PHP 7+ support -- Support for PG 9.3+ features (Materialized Views, BRIN Indexes, etc) -- Nice urls +- Composer Installation and dependency management +- [PSR-2 Coding Standard](https://www.php-fig.org/psr/psr-2) (Will evolve to PSR-12 soon) +- [PSR-4 Autoloading](https://www.php-fig.org/psr/psr-4) +- Removal of global variables (WIP) +- Removal of superglobals in favour of [PSR-7 Message interfaces](http://www.php-fig.org/psr/psr-7/) (WIP) +- Full PHP 7+ support +- Usage of Dependency Injection compliant with [PSR-11 Container interface](http://www.php-fig.org/psr/psr-11/) +- Support for PG 9.3+ features (Materialized Views, BRIN Indexes, etc) +- Nice urls ### WIP Other enhancements are in progress and would be a nice to have: -- Replace usage of superglobals with [PSR-7 Message interfaces](http://www.php-fig.org/psr/psr-7/) to carry information around. -- Usage of Dependency Injection compliant with [PSR-11 Container interface](http://www.php-fig.org/psr/psr-11/) +## Requirements -This project is made on top of [Slim Framework 3](https://www.slimframework.com/) and communicates with the Database using [AdoDB](https://adodb.org/) +- PHP 5.6+ (but you should really, really consider switching to at least v7.1) +- ext-psql +- [Composer](https://getcomposer.org/download/) ## Installation @@ -51,7 +54,7 @@ composer install --no-dev If there's something broken and I cannot risk breaking the rest to fix your issue, I might push a fix or feature to [develop branch](https://github.com/HuasoFoundries/phpPgAdmin6/tree/develop). Said branch can be installed as ```sh -composer create-project huasofoundries/phppgadmin6 *@beta --no-dev --prefer-dist +composer create-project huasofoundries/phppgadmin6 v6.*.*@beta --no-dev --prefer-dist ``` (or, you know, clone the repo and make sure you're in develop branch) @@ -134,12 +137,12 @@ You can choose between one of them if you use this work. We're preserving due credits to all people that contributed in the past, as well as other release notes contained in the old version of [phppgadmin](https://github.com/phppgadmin/phppgadmin) -- [Bugs](docs/BUGS.md) -- [Changelog](docs/CHANGELOG.md) (_outdated_) -- [Credits](docs/CREDITS.md) -- [Developers](docs/DEVELOPERS.md) -- [FAQ](docs/FAQ.md) (_outdated_) -- [History](docs/HISTORY.md) (_outdated_) -- [Translators](docs/TRANSLATORS.md) +- [Bugs](docs/BUGS.md) +- [Changelog](docs/CHANGELOG.md) (_outdated_) +- [Credits](docs/CREDITS.md) +- [Developers](docs/DEVELOPERS.md) +- [FAQ](docs/FAQ.md) (_outdated_) +- [History](docs/HISTORY.md) (_outdated_) +- [Translators](docs/TRANSLATORS.md) Kudos to all people that helped build the original project, upon which this one was built. diff --git a/config.inc.php-dist b/config.inc.php-dist index e9aba7653..a03af933f 100644 --- a/config.inc.php-dist +++ b/config.inc.php-dist @@ -9,26 +9,24 @@ -// Set this to true to enable debug features -$conf['debugmode'] = false; - // Enable this to debug on console using // https://github.com/barbushin/php-console // (Only in Chrome) $conf['php_console'] = true; $conf['debugmode'] = true; - if ($conf['php_console'] === true && // PHP_CONSOLE doesn't work on PHP 7.4 yet version_compare(PHP_VERSION, 7.4, '<') && - isset($_SERVER['HTTP_USER_AGENT']) && - stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false) { + class_exists('PhpConsole\Handler')) { - $handler = PhpConsole\Handler::getInstance(); + $phpConsoleHandler = PhpConsole\Handler::getInstance(); +/* Get the reference to the connector instance +$connector=$phpConsoleHandler->getConnector(); + */ /* Set a password for PHPConsole Connector -$connector=$handler->getConnector(); +$connector->setPassword('yohoho123', true); */ /* enable in SSL mode only @@ -36,13 +34,14 @@ $connector->enableSslOnlyMode(); */ /* Override default Handler behavior: -$handler->setHandleErrors(false); // disable errors handling -$handler->setHandleExceptions(false); // disable exceptions handling -$handler->setCallOldHandlers(false); // disable passing errors & exceptions to prviously defined handlers +$phpConsoleHandler->setHandleErrors(false); // disable errors handling +$phpConsoleHandler->setHandleExceptions(false); // disable exceptions handling +$phpConsoleHandler->setCallOldHandlers(false); // disable passing errors & exceptions to prviously defined handlers */ } + // optionally, set a path for your error log, relative to this project root // $conf['error_log']='temp/phppga.php_error.log'; diff --git a/index.php b/index.php index 31d365398..c91e87ab1 100644 --- a/index.php +++ b/index.php @@ -4,44 +4,39 @@ * PHPPgAdmin v6.0.0-RC1 */ -require_once __DIR__ . '/src/lib.inc.php'; +require_once __DIR__.'/src/lib.inc.php'; // This section is made to be able to parse requests coming from PHP Builtin webserver if (PHP_SAPI === 'cli-server') { - //include_once __DIR__ . '/src/cli.router.php'; $will_redirect = false; - $req_uri = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['REQUEST_URI']; - $first10chars = substr($req_uri, 0, 10); - if ($first10chars === '/index.php') { + // @todo is PHP_SELF is not set, chances are REQUEST_URI won't either + $req_uri = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['REQUEST_URI']; + if (substr($req_uri, 0, 10) === '/index.php') { $will_redirect = true; $req_uri = substr($req_uri, 10); } $filePath = realpath(ltrim($req_uri, '/')); - $new_location = 'Location: http://' . $_SERVER['HTTP_HOST'] . $req_uri; - - if ($filePath && is_readable($filePath)) { - // 1. check that file is not outside of this directory for security - // 2. check for circular reference to router.php - // 3. don't serve dotfiles - - if (strpos($filePath, BASE_PATH . DIRECTORY_SEPARATOR) === 0 && - $filePath != BASE_PATH . DIRECTORY_SEPARATOR . 'index.php' && - substr(basename($filePath), 0, 1) != '.' - ) { - if (strtolower(substr($filePath, -4)) == '.php') { - // php file; serve through interpreter - include $filePath; - - return; - } - if ($will_redirect) { - header($new_location, true, 301); - - return; - } - // asset file; serve from filesystem - return false; + $new_location = 'Location: http://'.$_SERVER['HTTP_HOST'].$req_uri; + + if ($filePath && // 1. check that filepath is set + is_readable($filePath) && // 2. and references a readable file/folder + strpos($filePath, BASE_PATH.DIRECTORY_SEPARATOR) === 0 && // 3. And is inside this folder + $filePath != BASE_PATH.DIRECTORY_SEPARATOR.'index.php' && // 4. discard circular references to index.php + substr(basename($filePath), 0, 1) != '.' // 5. don't serve dotfiles + ) { + if (strtolower(substr($filePath, -4)) == '.php') { + // php file; serve through interpreter + include $filePath; + + return; } + if ($will_redirect) { + header($new_location, true, 301); + + return; + } + // asset file; serve from filesystem + return false; } } @@ -53,7 +48,6 @@ /* @scrutinizer ignore-unused */ $args ) { - return $response ->withHeader('Content-type', 'application/json') ->withJson(['version' => $this->version]); @@ -73,7 +67,7 @@ $loginShared = $request->getParsedBodyParam('loginShared'); $loginServer = $request->getParsedBodyParam('loginServer'); $loginUsername = $request->getParsedBodyParam('loginUsername'); - $loginPassword = $request->getParsedBodyParam('loginPassword_' . md5($loginServer)); + $loginPassword = $request->getParsedBodyParam('loginPassword_'.md5($loginServer)); // If login action is set, then set session variables if ((bool) $loginServer && (bool) $loginUsername && $loginPassword !== null) { @@ -146,16 +140,16 @@ $safe_subjects = ($subject === 'servers' || $subject === 'intro' || $subject === 'browser'); if ($this->misc->getServerId() === null && !$safe_subjects) { - return $response->withStatus(302)->withHeader('Location', SUBFOLDER . '/src/views/servers'); + return $response->withStatus(302)->withHeader('Location', SUBFOLDER.'/src/views/servers'); } if (!isset($_server_info['username']) && $subject !== 'login' && !$safe_subjects) { - $destinationurl = SUBFOLDER . '/src/views/login?server=' . $this->misc->getServerId(); + $destinationurl = SUBFOLDER.'/src/views/login?server='.$this->misc->getServerId(); return $response->withStatus(302)->withHeader('Location', $destinationurl); } - $className = '\PHPPgAdmin\Controller\\' . ucfirst($subject) . 'Controller'; + $className = '\PHPPgAdmin\Controller\\'.ucfirst($subject).'Controller'; $controller = new $className($this); return $controller->render(); @@ -184,7 +178,7 @@ $subject = 'servers'; } - return maybeRenderIframes($this, $response, $subject, $query_string); + return $this->utils->maybeRenderIframes($response, $subject, $query_string); }); $app->get('/', function ( @@ -199,11 +193,11 @@ $query_string = $request->getUri()->getQuery(); - return maybeRenderIframes($this, $response, $subject, $query_string); + return $this->utils->maybeRenderIframes($response, $subject, $query_string); }); $app->get('[/{path:.*}]', function ($request, $response, $args) { - $filepath = \BASE_PATH . '/' . $args['path']; + $filepath = \BASE_PATH.'/'.$args['path']; $query_string = $request->getUri()->getQuery(); $this->utils->dump($query_string, $filepath); diff --git a/src/classes/ContainerUtils.php b/src/classes/ContainerUtils.php index 8afd2f25b..06a9c8ded 100644 --- a/src/classes/ContainerUtils.php +++ b/src/classes/ContainerUtils.php @@ -31,7 +31,7 @@ class ContainerUtils */ public function __construct() { - $composerinfo = json_decode(file_get_contents(BASE_PATH . '/composer.json')); + $composerinfo = json_decode(file_get_contents(BASE_PATH.'/composer.json')); $appVersion = $composerinfo->version; $phpMinVer = (str_replace(['<', '>', '='], '', $composerinfo->require->php)); @@ -49,14 +49,14 @@ public function __construct() 'base_path' => BASE_PATH, 'debug' => DEBUGMODE, - 'routerCacheFile' => BASE_PATH . '/temp/route.cache.php', + 'routerCacheFile' => BASE_PATH.'/temp/route.cache.php', // Configuration file version. If this is greater than that in config.inc.php, then // the app will refuse to run. This and $conf['version'] should be incremented whenever // backwards incompatible changes are made to config.inc.php-dist. 'base_version' => 60, // Application version - 'appVersion' => 'v' . $appVersion, + 'appVersion' => 'v'.$appVersion, // Application name 'appName' => 'phpPgAdmin6', @@ -73,7 +73,7 @@ public function __construct() // Fetch DI Container $container = $this->app->getContainer(); $container['utils'] = $this; - $container['version'] = 'v' . $appVersion; + $container['version'] = 'v'.$appVersion; $container['errors'] = []; $this->container = $container; @@ -88,6 +88,26 @@ public static function createContainer() return [self::$instance->container, self::$instance->app]; } + public function maybeRenderIframes($response, $subject, $query_string) + { + $c = $this->container; + $in_test = $c->view->offsetGet('in_test'); + + if ($in_test === '1') { + $className = '\PHPPgAdmin\Controller\\'.ucfirst($subject).'Controller'; + $controller = new $className($c); + + return $controller->render(); + } + + $viewVars = [ + 'url' => '/src/views/'.$subject.($query_string ? '?'.$query_string : ''), + 'headertemplate' => 'header.twig', + ]; + + return $c->view->render($response, 'iframe_view.twig', $viewVars); + } + /** * Gets the theme from * 1. The $_REQUEST global (when it's chosen from start screen) @@ -186,10 +206,10 @@ public function getRedirectUrl() // if server_id isn't set, then you will be redirected to intro if ($this->container->requestobj->getQueryParam('server') === null) { - $destinationurl = \SUBFOLDER . '/src/views/intro'; + $destinationurl = \SUBFOLDER.'/src/views/intro'; } else { // otherwise, you'll be redirected to the login page for that server; - $destinationurl = \SUBFOLDER . '/src/views/login' . ($query_string ? '?' . $query_string : ''); + $destinationurl = \SUBFOLDER.'/src/views/login'.($query_string ? '?'.$query_string : ''); } return $destinationurl; @@ -213,7 +233,7 @@ public function getDestinationWithLastTab($subject) $destinationurl = $this->getRedirectUrl(); } else { $url = $this->container->misc->getLastTabURL($subject); - $this->addFlash($url, 'getLastTabURL for ' . $subject); + $this->addFlash($url, 'getLastTabURL for '.$subject); // Load query vars into superglobal arrays if (isset($url['urlvars'])) { $urlvars = []; diff --git a/src/lib.inc.php b/src/lib.inc.php index 2e12c2f49..8c182bf32 100644 --- a/src/lib.inc.php +++ b/src/lib.inc.php @@ -178,15 +178,6 @@ public static function debug() {} return $plugin_manager; }; -$container['serializer'] = function ($c) { - $serializerbuilder = \JMS\Serializer\SerializerBuilder::create(); - $serializer = $serializerbuilder - ->setCacheDir(BASE_PATH . '/temp/jms') - ->setDebug($c->get('settings')['debug']) - ->build(); - return $serializer; -}; - // Create Misc class references $container['misc'] = function ($c) { $misc = new \PHPPgAdmin\Misc($c); @@ -202,17 +193,12 @@ public static function debug() {} } $_theme = $c->utils->getTheme($conf, $_server_info); - // if any of the above conditions had set the $_theme variable - // then we store it in the session and a cookie - // and we overwrite $conf['theme'] with its value if (!is_null($_theme)) { /* save the selected theme in cookie for a year */ setcookie('ppaTheme', $_theme, time() + 31536000, '/'); $_SESSION['ppaTheme'] = $_theme; + $misc->setConf('theme', $_theme); } - - $misc->setConf('theme', $_theme); - return $misc; }; @@ -279,71 +265,7 @@ public static function debug() {} // Set the requestobj and responseobj properties of the container // as the value of $request and $response, which already contain the route -$app->add( - function ($request, $response, $next) { - - $this['requestobj'] = $request; - $this['responseobj'] = $response; - - $this['server'] = $request->getParam('server'); - $this['database'] = $request->getParam('database'); - $this['schema'] = $request->getParam('schema'); - $misc = $this->get('misc'); - - $misc->setHREF(); - $misc->setForm(); - - $this->view->offsetSet('METHOD', $request->getMethod()); - if ($request->getAttribute('route')) { - $this->view->offsetSet('subject', $request->getAttribute('route')->getArgument('subject')); - } - - $query_string = $request->getUri()->getQuery(); - $this->view->offsetSet('query_string', $query_string); - $path = (SUBFOLDER ? (SUBFOLDER . '/') : '') . $request->getUri()->getPath() . ($query_string ? '?' . $query_string : ''); - $this->view->offsetSet('path', $path); - - $params = $request->getParams(); - - $viewparams = []; - - foreach ($params as $key => $value) { - if (is_scalar($value)) { - $viewparams[$key] = $value; - } - } - - if (isset($_COOKIE['IN_TEST'])) { - $in_test = (string) $_COOKIE['IN_TEST']; - } else { - $in_test = '0'; - } - - // remove tabs and linebreaks from query - if (isset($params['query'])) { - $viewparams['query'] = str_replace(["\r", "\n", "\t"], ' ', $params['query']); - } - $this->view->offsetSet('params', $viewparams); - $this->view->offsetSet('in_test', $in_test); - - if (count($this['errors']) > 0) { - return ($this->haltHandler)($this->requestobj, $this->responseobj, $this['errors'], 412); - } - - $messages = $this->flash->getMessages(); - if (!empty($messages)) { - foreach ($messages as $key => $message) { - \PC::debug($message, 'Flash: ' . $key); - } - } - - // First execute anything else - $response = $next($request, $response); - - // Any other request, pass on current response - return $response; - } -); +$app->add(new \PHPPgAdmin\Middleware\PopulateRequestResponse($container)); $container['action'] = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; diff --git a/src/middleware/Middleware.php b/src/middleware/Middleware.php new file mode 100644 index 000000000..c6314fb46 --- /dev/null +++ b/src/middleware/Middleware.php @@ -0,0 +1,23 @@ +container = $container; + $this->router = $container->get('router'); + } + + public function __get($property) + { + if (isset($this->container->{$property})) { + return $this->container->{$property}; + } + } +} diff --git a/src/middleware/PopulateRequestResponse.php b/src/middleware/PopulateRequestResponse.php new file mode 100644 index 000000000..97416fa84 --- /dev/null +++ b/src/middleware/PopulateRequestResponse.php @@ -0,0 +1,81 @@ +container; + $container['requestobj'] = $request; + $container['responseobj'] = $response; + + $container['server'] = $request->getParam('server'); + $container['database'] = $request->getParam('database'); + $container['schema'] = $request->getParam('schema'); + $misc = $container->get('misc'); + + $misc->setHREF(); + $misc->setForm(); + + $container->view->offsetSet('METHOD', $request->getMethod()); + if ($request->getAttribute('route')) { + $container->view->offsetSet('subject', $request->getAttribute('route')->getArgument('subject')); + } + + $query_string = $request->getUri()->getQuery(); + $container->view->offsetSet('query_string', $query_string); + $path = (SUBFOLDER ? (SUBFOLDER . '/') : '') . $request->getUri()->getPath() . ($query_string ? '?' . $query_string : ''); + $container->view->offsetSet('path', $path); + + $params = $request->getParams(); + + $viewparams = []; + + foreach ($params as $key => $value) { + if (is_scalar($value)) { + $viewparams[$key] = $value; + } + } + + if (isset($_COOKIE['IN_TEST'])) { + $in_test = (string) $_COOKIE['IN_TEST']; + } else { + $in_test = '0'; + } + + // remove tabs and linebreaks from query + if (isset($params['query'])) { + $viewparams['query'] = str_replace(["\r", "\n", "\t"], ' ', $params['query']); + } + $container->view->offsetSet('params', $viewparams); + $container->view->offsetSet('in_test', $in_test); + + if (count($container['errors']) > 0) { + return ($container->haltHandler)($container->requestobj, $container->responseobj, $container['errors'], 412); + } + + $messages = $container->flash->getMessages(); + if (!empty($messages)) { + foreach ($messages as $key => $message) { + \PC::debug($message, 'Flash: ' . $key); + } + } + + // First execute anything else + $response = $next($request, $response); + + // Any other request, pass on current response + return $response; + } +}