1414use PhpMyAdmin \Dbal \ResultInterface ;
1515use PhpMyAdmin \FieldMetadata ;
1616use PhpMyAdmin \Html \Generator ;
17+ use PhpMyAdmin \Http \ServerRequest ;
1718use PhpMyAdmin \Indexes \Index ;
1819use PhpMyAdmin \Indexes \IndexColumn ;
1920use PhpMyAdmin \Message ;
@@ -2789,7 +2790,7 @@ private function getDataCellForNonNumericColumns(
27892790 * @todo currently this is called twice unnecessary
27902791 * @todo ignore LIMIT and ORDER in query!?
27912792 */
2792- public function setConfigParamsForDisplayTable (StatementInfo $ statementInfo ): void
2793+ public function setConfigParamsForDisplayTable (ServerRequest $ request , StatementInfo $ statementInfo ): void
27932794 {
27942795 $ sqlMd5 = md5 ($ this ->server . $ this ->db . $ this ->sqlQuery );
27952796 $ query = $ _SESSION ['tmpval ' ]['query ' ][$ sqlMd5 ] ?? [];
@@ -2801,97 +2802,74 @@ public function setConfigParamsForDisplayTable(StatementInfo $statementInfo): vo
28012802 }
28022803
28032804 // The value can also be from _GET as described on issue #16146 when sorting results
2804- $ sessionMaxRows = $ _GET [ 'session_max_rows ' ] ?? $ _POST [ ' session_max_rows ' ] ?? '' ;
2805+ $ sessionMaxRows = $ request -> getParam ( 'session_max_rows ' ) ;
28052806
28062807 if (is_numeric ($ sessionMaxRows )) {
28072808 $ query ['max_rows ' ] = (int ) $ sessionMaxRows ;
2808- unset($ _GET ['session_max_rows ' ], $ _POST ['session_max_rows ' ]);
28092809 } elseif ($ sessionMaxRows === self ::ALL_ROWS ) {
28102810 $ query ['max_rows ' ] = self ::ALL_ROWS ;
2811- unset($ _GET ['session_max_rows ' ], $ _POST ['session_max_rows ' ]);
28122811 } elseif (empty ($ query ['max_rows ' ])) {
28132812 $ query ['max_rows ' ] = $ this ->config ->config ->maxRows ;
28142813 }
28152814
2816- if ( isset ( $ _REQUEST [ ' pos ' ]) && is_numeric ( $ _REQUEST [ 'pos ' ])) {
2817- $ query [ ' pos ' ] = ( int ) $ _REQUEST [ ' pos ' ];
2818- unset( $ _REQUEST ['pos ' ]) ;
2815+ $ pos = $ request -> getParam ( 'pos ' );
2816+ if ( is_numeric ( $ pos)) {
2817+ $ query ['pos ' ] = ( int ) $ pos ;
28192818 } elseif (empty ($ query ['pos ' ])) {
28202819 $ query ['pos ' ] = 0 ;
28212820 }
28222821
28232822 // Full text is needed in case of explain statements, if not specified.
28242823 $ fullText = $ statementInfo ->flags ->queryType === StatementType::Explain;
28252824
2826- if (
2827- isset ($ _REQUEST ['pftext ' ]) && in_array (
2828- $ _REQUEST ['pftext ' ],
2829- [self ::DISPLAY_PARTIAL_TEXT , self ::DISPLAY_FULL_TEXT ],
2830- true ,
2831- )
2832- ) {
2833- $ query ['pftext ' ] = $ _REQUEST ['pftext ' ];
2834- unset($ _REQUEST ['pftext ' ]);
2825+ $ pftext = $ request ->getParam ('pftext ' );
2826+ if (in_array ($ pftext , [self ::DISPLAY_PARTIAL_TEXT , self ::DISPLAY_FULL_TEXT ], true )) {
2827+ $ query ['pftext ' ] = $ pftext ;
28352828 } elseif ($ fullText ) {
28362829 $ query ['pftext ' ] = self ::DISPLAY_FULL_TEXT ;
28372830 } elseif (empty ($ query ['pftext ' ])) {
28382831 $ query ['pftext ' ] = self ::DISPLAY_PARTIAL_TEXT ;
28392832 }
28402833
2841- if (
2842- isset ($ _REQUEST ['relational_display ' ]) && in_array (
2843- $ _REQUEST ['relational_display ' ],
2844- [self ::RELATIONAL_KEY , self ::RELATIONAL_DISPLAY_COLUMN ],
2845- true ,
2846- )
2847- ) {
2848- $ query ['relational_display ' ] = $ _REQUEST ['relational_display ' ];
2849- unset($ _REQUEST ['relational_display ' ]);
2834+ $ relationalDisplay = $ request ->getParam ('relational_display ' );
2835+ if (in_array ($ relationalDisplay , [self ::RELATIONAL_KEY , self ::RELATIONAL_DISPLAY_COLUMN ], true )) {
2836+ $ query ['relational_display ' ] = $ relationalDisplay ;
28502837 } elseif (empty ($ query ['relational_display ' ])) {
28512838 // The current session value has priority over a
28522839 // change via Settings; this change will be apparent
28532840 // starting from the next session
28542841 $ query ['relational_display ' ] = $ this ->config ->settings ['RelationalDisplay ' ];
28552842 }
28562843
2857- if (
2858- isset ($ _REQUEST ['geoOption ' ]) && in_array (
2859- $ _REQUEST ['geoOption ' ],
2860- [self ::GEOMETRY_DISP_WKT , self ::GEOMETRY_DISP_WKB , self ::GEOMETRY_DISP_GEOM ],
2861- true ,
2862- )
2863- ) {
2864- $ query ['geoOption ' ] = $ _REQUEST ['geoOption ' ];
2865- unset($ _REQUEST ['geoOption ' ]);
2844+ $ geoOption = $ request ->getParam ('geoOption ' );
2845+ if (in_array ($ geoOption , [self ::GEOMETRY_DISP_WKT , self ::GEOMETRY_DISP_WKB , self ::GEOMETRY_DISP_GEOM ], true )) {
2846+ $ query ['geoOption ' ] = $ geoOption ;
28662847 } elseif (empty ($ query ['geoOption ' ])) {
28672848 $ query ['geoOption ' ] = self ::GEOMETRY_DISP_GEOM ;
28682849 }
28692850
2870- if (isset ( $ _REQUEST [ 'display_binary ' ] )) {
2851+ if ($ request -> has ( 'display_binary ' )) {
28712852 $ query ['display_binary ' ] = true ;
2872- unset($ _REQUEST ['display_binary ' ]);
2873- } elseif (isset ($ _REQUEST ['display_options_form ' ])) {
2853+ } elseif ($ request ->has ('display_options_form ' )) {
28742854 // we know that the checkbox was unchecked
28752855 unset($ query ['display_binary ' ]);
2876- } elseif (! isset ( $ _REQUEST [ 'full_text_button ' ] )) {
2856+ } elseif (! $ request -> has ( 'full_text_button ' )) {
28772857 // selected by default because some operations like OPTIMIZE TABLE
28782858 // and all queries involving functions return "binary" contents,
28792859 // according to low-level field flags
28802860 $ query ['display_binary ' ] = true ;
28812861 }
28822862
2883- if (isset ( $ _REQUEST [ 'display_blob ' ] )) {
2863+ if ($ request -> has ( 'display_blob ' )) {
28842864 $ query ['display_blob ' ] = true ;
2885- unset($ _REQUEST ['display_blob ' ]);
2886- } elseif (isset ($ _REQUEST ['display_options_form ' ])) {
2865+ } elseif ($ request ->has ('display_options_form ' )) {
28872866 // we know that the checkbox was unchecked
28882867 unset($ query ['display_blob ' ]);
28892868 }
28902869
2891- if (isset ( $ _REQUEST [ 'hide_transformation ' ] )) {
2870+ if ($ request -> has ( 'hide_transformation ' )) {
28922871 $ query ['hide_transformation ' ] = true ;
2893- unset($ _REQUEST ['hide_transformation ' ]);
2894- } elseif (isset ($ _REQUEST ['display_options_form ' ])) {
2872+ } elseif ($ request ->has ('display_options_form ' )) {
28952873 // we know that the checkbox was unchecked
28962874 unset($ query ['hide_transformation ' ]);
28972875 }
0 commit comments