Elgg  Version 6.1
routes.php
Go to the documentation of this file.
1 <?php
2 
3 return [
4  'index' => [
5  'path' => '/',
6  'resource' => 'index',
7  'walled' => false,
8  ],
9  'upgrade:init' => [
10  'path' => '/upgrade/init',
11  'resource' => 'upgrade',
12  'walled' => false,
13  'middleware' => [
14  \Elgg\Router\Middleware\UpgradeGatekeeper::class,
15  \Elgg\Router\Middleware\RewriteTest::class,
16  ],
17  ],
18  'upgrade:run' => [
19  'path' => '/upgrade/run',
20  'controller' => \Elgg\Upgrade\UpgradeController::class,
21  'walled' => false,
22  'middleware' => [
23  \Elgg\Router\Middleware\UpgradeGatekeeper::class,
24  ],
25  ],
26  'account:register' => [
27  'path' => '/register',
28  'resource' => 'account/register',
29  'walled' => false,
30  'middleware' => [
31  \Elgg\Router\Middleware\LoggedOutGatekeeper::class,
32  \Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,
33  ],
34  ],
35  'account:login' => [
36  'path' => '/login',
37  'resource' => 'account/login',
38  'walled' => false,
39  'middleware' => [
40  \Elgg\Router\Middleware\LoggedOutGatekeeper::class,
41  ],
42  ],
43  'account:password:reset' => [
44  'path' => '/forgotpassword',
45  'resource' => 'account/forgotten_password',
46  'walled' => false,
47  'middleware' => [
48  \Elgg\Router\Middleware\LoggedOutGatekeeper::class,
49  ],
50  ],
51  'account:password:change' => [
52  'path' => '/changepassword',
53  'resource' => 'account/change_password',
54  'walled' => false,
55  'middleware' => [
56  \Elgg\Router\Middleware\LoggedOutGatekeeper::class,
57  \Elgg\Router\Middleware\SignedRequestGatekeeper::class,
58  ],
59  ],
60  'account:email:confirm' => [
61  'path' => '/emailconfirm/{guid}',
62  'controller' => \Elgg\Users\EmailChangeController::class,
63  'walled' => false,
64  'middleware' => [
65  \Elgg\Router\Middleware\SignedRequestGatekeeper::class,
66  ],
67  ],
68  'account:validation:pending' => [
69  'path' => '/validation_pending',
70  'resource' => 'account/validation_pending',
71  'walled' => false,
72  'middleware' => [
73  \Elgg\Router\Middleware\LoggedOutGatekeeper::class,
74  ],
75  ],
76  'ajax' => [
77  'path' => '/ajax/{segments}',
78  'controller' => \Elgg\Ajax\Controller::class,
79  'requirements' => [
80  'segments' => '.+',
81  ],
82  'middleware' => [
83  \Elgg\Router\Middleware\AjaxGatekeeper::class,
84  ]
85  ],
86  'robots.txt' => [
87  'path' => '/robots.txt',
88  'resource' => 'robots.txt',
89  'walled' => false,
90  ],
91  'favicon.ico' => [
92  'path' => '/favicon.ico',
93  'resource' => 'favicon.ico',
94  'walled' => false,
95  ],
96  'manifest.json' => [
97  'path' => '/manifest.json',
98  'resource' => 'manifest.json',
99  'walled' => false,
100  ],
101  'admin:plugin_settings' => [
102  // needs to be registered before global admin route
103  'path' => '/admin/plugin_settings/{plugin_id}',
104  'resource' => 'admin/plugin_settings',
105  'middleware' => [
106  \Elgg\Router\Middleware\AdminGatekeeper::class,
107  ],
108  ],
109  'admin:online_users_count' => [
110  // needs to be registered before global admin route
111  'path' => '/admin/online_users_count',
112  'controller' => \Elgg\Controllers\OnlineUsersCount::class,
113  'middleware' => [
114  \Elgg\Router\Middleware\AdminGatekeeper::class,
115  ],
116  ],
117  'admin' => [
118  'path' => '/admin/{segments?}',
119  'resource' => 'admin',
120  'requirements' => [
121  'segments' => '.+',
122  ],
123  'middleware' => [
124  \Elgg\Router\Middleware\AdminGatekeeper::class,
125  ],
126  ],
127  'admin_plugin_text_file' => [
128  'path' => '/admin_plugin_text_file/{plugin_id}/{filename}',
129  'resource' => 'admin/plugin_text_file',
130  'middleware' => [
131  \Elgg\Router\Middleware\AdminGatekeeper::class,
132  ],
133  ],
134  'phpinfo' => [
135  'path' => '/phpinfo',
136  'resource' => 'phpinfo',
137  'middleware' => [
138  \Elgg\Router\Middleware\AdminGatekeeper::class,
139  ],
140  ],
141  'cron' => [
142  'path' => '/cron/{segments}',
143  'controller' => \Elgg\Controllers\Cron::class,
144  'requirements' => [
145  'segments' => '.+',
146  ],
147  'walled' => false,
148  ],
149  'serve-icon' => [
150  'path' => '/serve-icon/{guid}/{size}',
151  'controller' => \Elgg\Controllers\ServeIcon::class,
152  'walled' => false,
153  ],
154  'livesearch' => [
155  'path' => '/livesearch/{match_on?}',
156  'resource' => 'livesearch',
157  'requirements' => [
158  'match_on' => '\w+',
159  ],
160  ],
161  'security.txt' => [
162  'path' => '/security.txt',
163  'controller' => \Elgg\Controllers\SecurityTxt::class,
164  'walled' => false,
165  ],
166  'settings:index' => [
167  'path' => '/settings',
168  'resource' => 'settings/account',
169  'middleware' => [
170  \Elgg\Router\Middleware\Gatekeeper::class,
171  ],
172  ],
173  'settings:account' => [
174  'path' => '/settings/user/{username?}',
175  'resource' => 'settings/account',
176  'middleware' => [
177  \Elgg\Router\Middleware\Gatekeeper::class,
178  ],
179  'detect_page_owner' => true,
180  ],
181  'settings:notifications' => [
182  'path' => '/settings/notifications/{username}',
183  'resource' => 'settings/notifications',
184  'middleware' => [
185  \Elgg\Router\Middleware\UserPageOwnerCanEditGatekeeper::class,
186  ],
187  'detect_page_owner' => true,
188  ],
189  'settings:notifications:users' => [
190  'path' => '/settings/notifications/users/{username}',
191  'resource' => 'settings/notifications/users',
192  'middleware' => [
193  \Elgg\Router\Middleware\UserPageOwnerCanEditGatekeeper::class,
194  ],
195  'detect_page_owner' => true,
196  ],
197  'settings:statistics' => [
198  'path' => '/settings/statistics/{username?}',
199  'resource' => 'settings/statistics',
200  'middleware' => [
201  \Elgg\Router\Middleware\Gatekeeper::class,
202  ],
203  'detect_page_owner' => true,
204  ],
205  'settings:tools' => [
206  'path' => '/settings/plugins/{username}/{plugin_id}',
207  'resource' => 'settings/tools',
208  'middleware' => [
209  \Elgg\Router\Middleware\UserPageOwnerCanEditGatekeeper::class,
210  ],
211  'detect_page_owner' => true,
212  ],
213  'widgets:add_panel' => [
214  // @todo this route could also be a ajax view or have some parameters (context/container) in the route definition
215  'path' => '/widgets/add_panel',
216  'resource' => 'widgets/add_panel',
217  'middleware' => [
218  \Elgg\Router\Middleware\Gatekeeper::class,
219  ],
220  ],
221  'view:object:comment' => [
222  'path' => '/comment/view/{guid}/{container_guid?}',
223  'controller' => \Elgg\Controllers\CommentEntityRedirector::class,
224  ],
225  'view:user' => [
226  'path' => '/user/{guid}',
227  'resource' => 'user/view',
228  ],
229  'delete:user' => [
230  'path' => '/user/delete/{guid}',
231  'resource' => 'user/delete',
232  'middleware' => [
233  \Elgg\Router\Middleware\AdminGatekeeper::class,
234  ],
235  ],
236  'edit:user:avatar' => [
237  'path' => '/avatar/edit/{username}',
238  'resource' => 'avatar/edit',
239  'middleware' => [
240  \Elgg\Router\Middleware\UserPageOwnerCanEditGatekeeper::class,
241  ],
242  ],
243  'notifications:mute' => [
244  'path' => 'notifications/mute/{entity_guid}/{recipient_guid}',
245  'resource' => 'notifications/mute',
246  'requirements' => [
247  'entity_guid' => '\d+',
248  'recipient_guid' => '\d+',
249  ],
250  'middleware' => [
251  \Elgg\Router\Middleware\SignedRequestGatekeeper::class,
252  ],
253  'walled' => false,
254  ],
255  'trash:owner' => [
256  'path' => '/settings/trash/{username}',
257  'resource' => 'trash/owner',
258  'middleware' => [
259  \Elgg\Router\Middleware\Gatekeeper::class,
260  \Elgg\Router\Middleware\UserPageOwnerCanEditGatekeeper::class,
261  ],
262  ],
263  'trash:group' => [
264  'path' => '/trash/group/{guid}',
265  'resource' => 'trash/group',
266  'middleware' => [
267  \Elgg\Router\Middleware\Gatekeeper::class,
268  \Elgg\Router\Middleware\GroupPageOwnerCanEditGatekeeper::class,
269  ],
270  ],
271 ];