Change "Null" to "NULL" on grid edit null popup to make the text mean the NULL value...
[phpmyadmin.git] / libraries / routes.php
blobcfc582b25b2e68b443137f265880d22b0b96849f
1 <?php
3 declare(strict_types=1);
5 use FastRoute\RouteCollector;
6 use PhpMyAdmin\Controllers\BrowseForeignersController;
7 use PhpMyAdmin\Controllers\ChangeLogController;
8 use PhpMyAdmin\Controllers\CheckRelationsController;
9 use PhpMyAdmin\Controllers\ColumnController;
10 use PhpMyAdmin\Controllers\ConfigController;
11 use PhpMyAdmin\Controllers\Database\CentralColumnsController;
12 use PhpMyAdmin\Controllers\Database\DataDictionaryController;
13 use PhpMyAdmin\Controllers\Database\DesignerController;
14 use PhpMyAdmin\Controllers\Database\EventsController;
15 use PhpMyAdmin\Controllers\Database\ExportController as DatabaseExportController;
16 use PhpMyAdmin\Controllers\Database\ImportController as DatabaseImportController;
17 use PhpMyAdmin\Controllers\Database\MultiTableQueryController;
18 use PhpMyAdmin\Controllers\Database\OperationsController;
19 use PhpMyAdmin\Controllers\Database\QueryByExampleController;
20 use PhpMyAdmin\Controllers\Database\RoutinesController;
21 use PhpMyAdmin\Controllers\Database\SearchController;
22 use PhpMyAdmin\Controllers\Database\SqlAutoCompleteController;
23 use PhpMyAdmin\Controllers\Database\SqlController as DatabaseSqlController;
24 use PhpMyAdmin\Controllers\Database\SqlFormatController;
25 use PhpMyAdmin\Controllers\Database\StructureController;
26 use PhpMyAdmin\Controllers\Database\TrackingController;
27 use PhpMyAdmin\Controllers\Database\TriggersController;
28 use PhpMyAdmin\Controllers\DatabaseController;
29 use PhpMyAdmin\Controllers\ErrorReportController;
30 use PhpMyAdmin\Controllers\ExportController;
31 use PhpMyAdmin\Controllers\ExportTemplateController;
32 use PhpMyAdmin\Controllers\GisDataEditorController;
33 use PhpMyAdmin\Controllers\HomeController;
34 use PhpMyAdmin\Controllers\ImportController;
35 use PhpMyAdmin\Controllers\ImportStatusController;
36 use PhpMyAdmin\Controllers\LicenseController;
37 use PhpMyAdmin\Controllers\LintController;
38 use PhpMyAdmin\Controllers\LogoutController;
39 use PhpMyAdmin\Controllers\NavigationController;
40 use PhpMyAdmin\Controllers\NormalizationController;
41 use PhpMyAdmin\Controllers\PhpInfoController;
42 use PhpMyAdmin\Controllers\Preferences\ExportController as PreferencesExportController;
43 use PhpMyAdmin\Controllers\Preferences\FeaturesController;
44 use PhpMyAdmin\Controllers\Preferences\ImportController as PreferencesImportController;
45 use PhpMyAdmin\Controllers\Preferences\MainPanelController;
46 use PhpMyAdmin\Controllers\Preferences\ManageController;
47 use PhpMyAdmin\Controllers\Preferences\NavigationController as PreferencesNavigationController;
48 use PhpMyAdmin\Controllers\Preferences\SqlController as PreferencesSqlController;
49 use PhpMyAdmin\Controllers\Preferences\TwoFactorController;
50 use PhpMyAdmin\Controllers\SchemaExportController;
51 use PhpMyAdmin\Controllers\Server\BinlogController;
52 use PhpMyAdmin\Controllers\Server\CollationsController;
53 use PhpMyAdmin\Controllers\Server\DatabasesController;
54 use PhpMyAdmin\Controllers\Server\EnginesController;
55 use PhpMyAdmin\Controllers\Server\ExportController as ServerExportController;
56 use PhpMyAdmin\Controllers\Server\ImportController as ServerImportController;
57 use PhpMyAdmin\Controllers\Server\PluginsController;
58 use PhpMyAdmin\Controllers\Server\PrivilegesController;
59 use PhpMyAdmin\Controllers\Server\ReplicationController;
60 use PhpMyAdmin\Controllers\Server\SqlController as ServerSqlController;
61 use PhpMyAdmin\Controllers\Server\Status\AdvisorController;
62 use PhpMyAdmin\Controllers\Server\Status\MonitorController;
63 use PhpMyAdmin\Controllers\Server\Status\ProcessesController;
64 use PhpMyAdmin\Controllers\Server\Status\QueriesController;
65 use PhpMyAdmin\Controllers\Server\Status\StatusController;
66 use PhpMyAdmin\Controllers\Server\Status\VariablesController as StatusVariables;
67 use PhpMyAdmin\Controllers\Server\UserGroupsController;
68 use PhpMyAdmin\Controllers\Server\VariablesController;
69 use PhpMyAdmin\Controllers\SqlController;
70 use PhpMyAdmin\Controllers\Table\AddFieldController;
71 use PhpMyAdmin\Controllers\Table\ChangeController;
72 use PhpMyAdmin\Controllers\Table\ChartController;
73 use PhpMyAdmin\Controllers\Table\CreateController;
74 use PhpMyAdmin\Controllers\Table\DeleteController;
75 use PhpMyAdmin\Controllers\Table\ExportController as TableExportController;
76 use PhpMyAdmin\Controllers\Table\FindReplaceController;
77 use PhpMyAdmin\Controllers\Table\GetFieldController;
78 use PhpMyAdmin\Controllers\Table\GisVisualizationController;
79 use PhpMyAdmin\Controllers\Table\ImportController as TableImportController;
80 use PhpMyAdmin\Controllers\Table\IndexesController;
81 use PhpMyAdmin\Controllers\Table\MaintenanceController;
82 use PhpMyAdmin\Controllers\Table\OperationsController as TableOperationsController;
83 use PhpMyAdmin\Controllers\Table\PartitionController;
84 use PhpMyAdmin\Controllers\Table\RecentFavoriteController;
85 use PhpMyAdmin\Controllers\Table\RelationController;
86 use PhpMyAdmin\Controllers\Table\ReplaceController;
87 use PhpMyAdmin\Controllers\Table\SearchController as TableSearchController;
88 use PhpMyAdmin\Controllers\Table\SqlController as TableSqlController;
89 use PhpMyAdmin\Controllers\Table\StructureController as TableStructureController;
90 use PhpMyAdmin\Controllers\Table\TrackingController as TableTrackingController;
91 use PhpMyAdmin\Controllers\Table\TriggersController as TableTriggersController;
92 use PhpMyAdmin\Controllers\Table\ZoomSearchController;
93 use PhpMyAdmin\Controllers\TableController;
94 use PhpMyAdmin\Controllers\ThemesController;
95 use PhpMyAdmin\Controllers\TransformationOverviewController;
96 use PhpMyAdmin\Controllers\TransformationWrapperController;
97 use PhpMyAdmin\Controllers\UserPasswordController;
98 use PhpMyAdmin\Controllers\VersionCheckController;
99 use PhpMyAdmin\Controllers\ViewCreateController;
100 use PhpMyAdmin\Controllers\ViewOperationsController;
102 if (! defined('PHPMYADMIN')) {
103 exit;
106 return static function (RouteCollector $routes): void {
107 $routes->addGroup('', static function (RouteCollector $routes): void {
108 $routes->addRoute(['GET', 'POST'], '[/]', [HomeController::class, 'index']);
109 $routes->post('/set-theme', [HomeController::class, 'setTheme']);
110 $routes->post('/collation-connection', [HomeController::class, 'setCollationConnection']);
111 $routes->addRoute(['GET', 'POST'], '/recent-table', [HomeController::class, 'reloadRecentTablesList']);
112 $routes->addRoute(['GET', 'POST'], '/git-revision', [HomeController::class, 'gitRevision']);
114 $routes->addRoute(['GET', 'POST'], '/browse-foreigners', [BrowseForeignersController::class, 'index']);
115 $routes->get('/changelog', [ChangeLogController::class, 'index']);
116 $routes->addRoute(['GET', 'POST'], '/check-relations', [CheckRelationsController::class, 'index']);
117 $routes->post('/columns', [ColumnController::class, 'all']);
118 $routes->addGroup('/config', static function (RouteCollector $routes): void {
119 $routes->post('/get', [ConfigController::class, 'get']);
120 $routes->post('/set', [ConfigController::class, 'set']);
122 $routes->addGroup('/database', static function (RouteCollector $routes): void {
123 $routes->addGroup('/central-columns', static function (RouteCollector $routes): void {
124 $routes->addRoute(['GET', 'POST'], '', [CentralColumnsController::class, 'index']);
125 $routes->post('/populate', [CentralColumnsController::class, 'populateColumns']);
127 $routes->get('/data-dictionary', [DataDictionaryController::class, 'index']);
128 $routes->addRoute(['GET', 'POST'], '/designer', [DesignerController::class, 'index']);
129 $routes->addRoute(['GET', 'POST'], '/events', [EventsController::class, 'index']);
130 $routes->addRoute(['GET', 'POST'], '/export', [DatabaseExportController::class, 'index']);
131 $routes->addRoute(['GET', 'POST'], '/import', [DatabaseImportController::class, 'index']);
132 $routes->addGroup('/multi-table-query', static function (RouteCollector $routes): void {
133 $routes->get('', [MultiTableQueryController::class, 'index']);
134 $routes->get('/tables', [MultiTableQueryController::class, 'table']);
135 $routes->post('/query', [MultiTableQueryController::class, 'displayResults']);
137 $routes->addGroup('/operations', static function (RouteCollector $routes): void {
138 $routes->addRoute(['GET', 'POST'], '', [OperationsController::class, 'index']);
139 $routes->post('/collation', [OperationsController::class, 'collation']);
141 $routes->addRoute(['GET', 'POST'], '/qbe', [QueryByExampleController::class, 'index']);
142 $routes->addRoute(['GET', 'POST'], '/routines', [RoutinesController::class, 'index']);
143 $routes->addRoute(['GET', 'POST'], '/search', [SearchController::class, 'index']);
144 $routes->addGroup('/sql', static function (RouteCollector $routes): void {
145 $routes->addRoute(['GET', 'POST'], '', [DatabaseSqlController::class, 'index']);
146 $routes->post('/autocomplete', [SqlAutoCompleteController::class, 'index']);
147 $routes->post('/format', [SqlFormatController::class, 'index']);
149 $routes->addGroup('/structure', static function (RouteCollector $routes): void {
150 $routes->addRoute(['GET', 'POST'], '', [StructureController::class, 'index']);
151 $routes->post('/add-prefix', [StructureController::class, 'addPrefix']);
152 $routes->post('/add-prefix-table', [StructureController::class, 'addPrefixTable']);
153 $routes->post('/central-columns-add', [StructureController::class, 'centralColumnsAdd']);
154 $routes->post('/central-columns-make-consistent', [
155 StructureController::class,
156 'centralColumnsMakeConsistent',
158 $routes->post('/central-columns-remove', [StructureController::class, 'centralColumnsRemove']);
159 $routes->post('/change-prefix-form', [StructureController::class, 'changePrefixForm']);
160 $routes->post('/copy-form', [StructureController::class, 'copyForm']);
161 $routes->post('/copy-table', [StructureController::class, 'copyTable']);
162 $routes->post('/copy-table-with-prefix', [StructureController::class, 'copyTableWithPrefix']);
163 $routes->post('/drop-form', [StructureController::class, 'dropForm']);
164 $routes->post('/drop-table', [StructureController::class, 'dropTable']);
165 $routes->post('/empty-form', [StructureController::class, 'emptyForm']);
166 $routes->post('/empty-table', [StructureController::class, 'emptyTable']);
167 $routes->addRoute(['GET', 'POST'], '/favorite-table', [
168 StructureController::class,
169 'addRemoveFavoriteTablesAction',
171 $routes->addRoute(['GET', 'POST'], '/real-row-count', [
172 StructureController::class,
173 'handleRealRowCountRequestAction',
175 $routes->post('/replace-prefix', [StructureController::class, 'replacePrefix']);
176 $routes->post('/show-create', [StructureController::class, 'showCreate']);
178 $routes->addRoute(['GET', 'POST'], '/tracking', [TrackingController::class, 'index']);
179 $routes->addRoute(['GET', 'POST'], '/triggers', [TriggersController::class, 'index']);
181 $routes->post('/databases', [DatabaseController::class, 'all']);
182 $routes->addRoute(['GET', 'POST'], '/error-report', [ErrorReportController::class, 'index']);
183 $routes->addGroup('/export', static function (RouteCollector $routes): void {
184 $routes->addRoute(['GET', 'POST'], '', [ExportController::class, 'index']);
185 $routes->get('/check-time-out', [ExportController::class, 'checkTimeOut']);
186 $routes->post('/tables', [DatabaseExportController::class, 'tables']);
187 $routes->addGroup('/template', static function (RouteCollector $routes): void {
188 $routes->post('/create', [ExportTemplateController::class, 'create']);
189 $routes->post('/delete', [ExportTemplateController::class, 'delete']);
190 $routes->post('/load', [ExportTemplateController::class, 'load']);
191 $routes->post('/update', [ExportTemplateController::class, 'update']);
194 $routes->addRoute(['GET', 'POST'], '/gis-data-editor', [GisDataEditorController::class, 'index']);
195 $routes->addRoute(['GET', 'POST'], '/import', [ImportController::class, 'index']);
196 $routes->addRoute(['GET', 'POST'], '/import-status', [ImportStatusController::class, 'index']);
197 $routes->get('/license', [LicenseController::class, 'index']);
198 $routes->addRoute(['GET', 'POST'], '/lint', [LintController::class, 'index']);
199 $routes->addRoute(['GET', 'POST'], '/logout', [LogoutController::class, 'index']);
200 $routes->addRoute(['GET', 'POST'], '/navigation', [NavigationController::class, 'index']);
201 $routes->addRoute(['GET', 'POST'], '/normalization', [NormalizationController::class, 'index']);
202 $routes->get('/phpinfo', [PhpInfoController::class, 'index']);
203 $routes->addGroup('/preferences', static function (RouteCollector $routes): void {
204 $routes->addRoute(['GET', 'POST'], '/export', [PreferencesExportController::class, 'index']);
205 $routes->addRoute(['GET', 'POST'], '/features', [FeaturesController::class, 'index']);
206 $routes->addRoute(['GET', 'POST'], '/import', [PreferencesImportController::class, 'index']);
207 $routes->addRoute(['GET', 'POST'], '/main-panel', [MainPanelController::class, 'index']);
208 $routes->addRoute(['GET', 'POST'], '/manage', [ManageController::class, 'index']);
209 $routes->addRoute(['GET', 'POST'], '/navigation', [PreferencesNavigationController::class, 'index']);
210 $routes->addRoute(['GET', 'POST'], '/sql', [PreferencesSqlController::class, 'index']);
211 $routes->addRoute(['GET', 'POST'], '/two-factor', [TwoFactorController::class, 'index']);
213 $routes->addRoute(['GET', 'POST'], '/schema-export', [SchemaExportController::class, 'index']);
214 $routes->addGroup('/server', static function (RouteCollector $routes): void {
215 $routes->addRoute(['GET', 'POST'], '/binlog', [BinlogController::class, 'index']);
216 $routes->get('/collations', [CollationsController::class, 'index']);
217 $routes->addGroup('/databases', static function (RouteCollector $routes): void {
218 $routes->addRoute(['GET', 'POST'], '', [DatabasesController::class, 'index']);
219 $routes->post('/create', [DatabasesController::class, 'create']);
220 $routes->post('/destroy', [DatabasesController::class, 'destroy']);
222 $routes->addGroup('/engines', static function (RouteCollector $routes): void {
223 $routes->get('', [EnginesController::class, 'index']);
224 $routes->get('/{engine}[/{page}]', [EnginesController::class, 'show']);
226 $routes->addRoute(['GET', 'POST'], '/export', [ServerExportController::class, 'index']);
227 $routes->addRoute(['GET', 'POST'], '/import', [ServerImportController::class, 'index']);
228 $routes->get('/plugins', [PluginsController::class, 'index']);
229 $routes->addRoute(['GET', 'POST'], '/privileges', [PrivilegesController::class, 'index']);
230 $routes->addRoute(['GET', 'POST'], '/replication', [ReplicationController::class, 'index']);
231 $routes->addRoute(['GET', 'POST'], '/sql', [ServerSqlController::class, 'index']);
232 $routes->addGroup('/status', static function (RouteCollector $routes): void {
233 $routes->get('', [StatusController::class, 'index']);
234 $routes->get('/advisor', [AdvisorController::class, 'index']);
235 $routes->addGroup('/monitor', static function (RouteCollector $routes): void {
236 $routes->get('', [MonitorController::class, 'index']);
237 $routes->post('/chart', [MonitorController::class, 'chartingData']);
238 $routes->post('/slow-log', [MonitorController::class, 'logDataTypeSlow']);
239 $routes->post('/general-log', [MonitorController::class, 'logDataTypeGeneral']);
240 $routes->post('/log-vars', [MonitorController::class, 'loggingVars']);
241 $routes->post('/query', [MonitorController::class, 'queryAnalyzer']);
243 $routes->addGroup('/processes', static function (RouteCollector $routes): void {
244 $routes->addRoute(['GET', 'POST'], '', [ProcessesController::class, 'index']);
245 $routes->post('/refresh', [ProcessesController::class, 'refresh']);
246 $routes->post('/kill/{id:\d+}', [ProcessesController::class, 'kill']);
248 $routes->get('/queries', [QueriesController::class, 'index']);
249 $routes->addRoute(['GET', 'POST'], '/variables', [StatusVariables::class, 'index']);
251 $routes->addRoute(['GET', 'POST'], '/user-groups', [UserGroupsController::class, 'index']);
252 $routes->addGroup('/variables', static function (RouteCollector $routes): void {
253 $routes->get('', [VariablesController::class, 'index']);
254 $routes->get('/get/{name}', [VariablesController::class, 'getValue']);
255 $routes->post('/set/{name}', [VariablesController::class, 'setValue']);
258 $routes->addGroup('/sql', static function (RouteCollector $routes): void {
259 $routes->addRoute(['GET', 'POST'], '', [SqlController::class, 'index']);
260 $routes->post('/get-relational-values', [SqlController::class, 'getRelationalValues']);
261 $routes->post('/get-enum-values', [SqlController::class, 'getEnumValues']);
262 $routes->post('/get-set-values', [SqlController::class, 'getSetValues']);
263 $routes->get('/get-default-fk-check-value', [SqlController::class, 'getDefaultForeignKeyCheckValue']);
264 $routes->post('/set-column-preferences', [SqlController::class, 'setColumnOrderOrVisibility']);
266 $routes->addGroup('/table', static function (RouteCollector $routes): void {
267 $routes->addRoute(['GET', 'POST'], '/add-field', [AddFieldController::class, 'index']);
268 $routes->addGroup('/change', static function (RouteCollector $routes): void {
269 $routes->addRoute(['GET', 'POST'], '', [ChangeController::class, 'index']);
270 $routes->post('/rows', [ChangeController::class, 'rows']);
272 $routes->addRoute(['GET', 'POST'], '/chart', [ChartController::class, 'index']);
273 $routes->addRoute(['GET', 'POST'], '/create', [CreateController::class, 'index']);
274 $routes->addGroup('/delete', static function (RouteCollector $routes): void {
275 $routes->post('/confirm', [DeleteController::class, 'confirm']);
276 $routes->post('/rows', [DeleteController::class, 'rows']);
278 $routes->addGroup('/export', static function (RouteCollector $routes): void {
279 $routes->addRoute(['GET', 'POST'], '', [TableExportController::class, 'index']);
280 $routes->post('/rows', [TableExportController::class, 'rows']);
282 $routes->addRoute(['GET', 'POST'], '/find-replace', [FindReplaceController::class, 'index']);
283 $routes->addRoute(['GET', 'POST'], '/get-field', [GetFieldController::class, 'index']);
284 $routes->addRoute(['GET', 'POST'], '/gis-visualization', [GisVisualizationController::class, 'index']);
285 $routes->addRoute(['GET', 'POST'], '/import', [TableImportController::class, 'index']);
286 $routes->addRoute(['GET', 'POST'], '/indexes', [IndexesController::class, 'index']);
287 $routes->addRoute(['GET', 'POST'], '/indexes/rename', [IndexesController::class, 'indexRename']);
288 $routes->addGroup('/maintenance', static function (RouteCollector $routes): void {
289 $routes->post('/analyze', [MaintenanceController::class, 'analyze']);
290 $routes->post('/check', [MaintenanceController::class, 'check']);
291 $routes->post('/checksum', [MaintenanceController::class, 'checksum']);
292 $routes->post('/optimize', [MaintenanceController::class, 'optimize']);
293 $routes->post('/repair', [MaintenanceController::class, 'repair']);
295 $routes->addGroup('/partition', static function (RouteCollector $routes): void {
296 $routes->post('/analyze', [PartitionController::class, 'analyze']);
297 $routes->post('/check', [PartitionController::class, 'check']);
298 $routes->post('/drop', [PartitionController::class, 'drop']);
299 $routes->post('/optimize', [PartitionController::class, 'optimize']);
300 $routes->post('/rebuild', [PartitionController::class, 'rebuild']);
301 $routes->post('/repair', [PartitionController::class, 'repair']);
302 $routes->post('/truncate', [PartitionController::class, 'truncate']);
304 $routes->addRoute(['GET', 'POST'], '/operations', [TableOperationsController::class, 'index']);
305 $routes->addRoute(['GET', 'POST'], '/recent-favorite', [RecentFavoriteController::class, 'index']);
306 $routes->addRoute(['GET', 'POST'], '/relation', [RelationController::class, 'index']);
307 $routes->addRoute(['GET', 'POST'], '/replace', [ReplaceController::class, 'index']);
308 $routes->addRoute(['GET', 'POST'], '/search', [TableSearchController::class, 'index']);
309 $routes->addRoute(['GET', 'POST'], '/sql', [TableSqlController::class, 'index']);
310 $routes->addGroup('/structure', static function (RouteCollector $routes): void {
311 $routes->addRoute(['GET', 'POST'], '', [TableStructureController::class, 'index']);
312 $routes->post('/add-key', [TableStructureController::class, 'addKey']);
313 $routes->post('/browse', [TableStructureController::class, 'browse']);
314 $routes->post('/central-columns-add', [TableStructureController::class, 'addToCentralColumns']);
315 $routes->post('/central-columns-remove', [TableStructureController::class, 'removeFromCentralColumns']);
316 $routes->addRoute(['GET', 'POST'], '/change', [TableStructureController::class, 'change']);
317 $routes->post('/drop', [TableStructureController::class, 'drop']);
318 $routes->post('/drop-confirm', [TableStructureController::class, 'dropConfirm']);
319 $routes->post('/fulltext', [TableStructureController::class, 'fulltext']);
320 $routes->post('/index', [TableStructureController::class, 'addIndex']);
321 $routes->post('/move-columns', [TableStructureController::class, 'moveColumns']);
322 $routes->post('/partitioning', [TableStructureController::class, 'partitioning']);
323 $routes->post('/primary', [TableStructureController::class, 'primary']);
324 $routes->post('/reserved-word-check', [TableStructureController::class, 'reservedWordCheck']);
325 $routes->post('/save', [TableStructureController::class, 'save']);
326 $routes->post('/spatial', [TableStructureController::class, 'spatial']);
327 $routes->post('/unique', [TableStructureController::class, 'unique']);
329 $routes->addRoute(['GET', 'POST'], '/tracking', [TableTrackingController::class, 'index']);
330 $routes->addRoute(['GET', 'POST'], '/triggers', [TableTriggersController::class, 'index']);
331 $routes->addRoute(['GET', 'POST'], '/zoom-search', [ZoomSearchController::class, 'index']);
333 $routes->post('/tables', [TableController::class, 'all']);
334 $routes->get('/themes', [ThemesController::class, 'index']);
335 $routes->addGroup('/transformation', static function (RouteCollector $routes): void {
336 $routes->addRoute(['GET', 'POST'], '/overview', [TransformationOverviewController::class, 'index']);
337 $routes->addRoute(['GET', 'POST'], '/wrapper', [TransformationWrapperController::class, 'index']);
339 $routes->addRoute(['GET', 'POST'], '/user-password', [UserPasswordController::class, 'index']);
340 $routes->addRoute(['GET', 'POST'], '/version-check', [VersionCheckController::class, 'index']);
341 $routes->addGroup('/view', static function (RouteCollector $routes): void {
342 $routes->addRoute(['GET', 'POST'], '/create', [ViewCreateController::class, 'index']);
343 $routes->addRoute(['GET', 'POST'], '/operations', [ViewOperationsController::class, 'index']);