1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Modules\Dashboard;
13
14 use ICanBoogie\HTTP\RedirectResponse;
15 use ICanBoogie\Routing\Dispatcher;
16 use ICanBoogie\Route;
17
18 class Hooks
19 {
20 21 22 23 24 25 26
27 static public function before_routing_dispatcher_dispatch(Dispatcher\BeforeDispatchEvent $event, Dispatcher $dispatcher)
28 {
29 global $core;
30
31 $path = $event->request->decontextualized_path;
32
33 if ($path !== '/admin' || $core->user->is_guest || $core->user instanceof \Icybee\Modules\Members\Member)
34 {
35 return;
36 }
37
38 $event->response = new RedirectResponse(\ICanBoogie\Routing\contextualize('/admin/dashboard'));
39 }
40 }