-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes_frontend.php
executable file
·58 lines (48 loc) · 1.37 KB
/
routes_frontend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
if(!isset($router)) die("Do not call this directly!");
function BasePage($name)
{
DrawViewWithTemplate($name, "page");
}
function Page($name)
{
return function () use ($name) {
Site::$am_frontend = true;
BasePage($name);
};
}
function LoginPage($name)
{
return function () use ($name) {
Site::$am_frontend = true;
if (requireLogin())
BasePage($name);
};
}
// Basic //
$router->get('/', function () {
DrawViewWithTemplate("home", "page");
});
$router->get('/medals', function () {
DrawViewWithTemplate("medals", "page");
});
$router->get('/x', function () {
DrawViewWithTemplate("preview", "page");
});
$router->get('/medals/{medal}/', function ($medal) {
DrawViewWithTemplate("medals", "page", $medal);
});
$router->get('/test/', function () {
DrawViewWithTemplate("test", "page");
});
$router->get('/login', function () {
General::Redirect("https://osu.ppy.sh/oauth/authorize?response_type=code&redirect_uri=" . htmlentities(REDIRECT_URI) . "&client_id=" . CLIENT_ID);
//General::Redirect("https://osu.ppy.sh/oauth/authorize?client_id=" . CLIENT_ID . "&redirect_uri=" . REDIRECT_URI . "&response_type=code");
});
$router->get('/oauth', function () {
Oauth\Login::FrontendLogin();
});
$router->get('/logout', function () {
\Database\Session::Logout();
General::Redirect("/");
});