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