-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.php
80 lines (49 loc) · 2.39 KB
/
index.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
# init
require __DIR__.'/@import/init.php';
$tpl = new Templater();
if($tpl->route('/\A\/\z/', ['GET'])){
$tpl->import('views/home/home');
}else if($tpl->route('/\A\/notifications\z/i', ['GET'])){
$tpl->import('views/notifications/notifications');
}else if($tpl->route('/\A\/challenges\z/i', ['GET'])){
$tpl->import('views/challenges/challenges');
}else if($tpl->route('/\A\/challenges\/\@(?<chal_name>[a-zA-Z0-9_-]{1,10})\z/i', ['GET'], $args)){
$tpl->import('views/challenges/challenges', $args);
}else if($tpl->route('/\A\/challenges\/tag\/(?<chal_tag>[a-zA-Z0-9_-]{1,10})\z/i', ['GET'], $args)){
$tpl->import('views/challenges/challenges', $args);
}else if($tpl->route('/\A\/challenges\/authentication\z/i', ['POST'])){
$tpl->import('apis/challenges/authentication');
}else if($tpl->route('/\A\/scoreboard\z/i', ['GET'])){
$tpl->import('views/scoreboard/scoreboard');
}else if($tpl->route('/\A\/solves\z/i', ['GET'])){
$tpl->import('views/solves/solves');
}else if($tpl->route('/\A\/users\z/i', ['GET'])){
$tpl->import('views/users/users');
}else if($tpl->route('/\A\/users\/sign-in\z/i', ['GET'])){
$tpl->import('views/users/sign-in');
}else if($tpl->route('/\A\/users\/sign-in\z/i', ['POST'])){
$tpl->import('apis/users/sign-in');
}else if($tpl->route('/\A\/users\/sign-up\z/i', ['GET'])){
$tpl->import('views/users/sign-up');
}else if($tpl->route('/\A\/users\/sign-up\z/i', ['POST'])){
$tpl->import('apis/users/sign-up');
}else if($tpl->route('/\A\/users\/verify-name\z/i', ['POST'])){
$tpl->import('apis/users/verify-name');
}else if($tpl->route('/\A\/users\/verify-email\z/i', ['POST'])){
$tpl->import('apis/users/verify-email');
}else if($tpl->route('/\A\/users\/sign-out\z/i', ['GET'])){
$tpl->import('apis/users/sign-out');
}else if($tpl->route('/\A\/users\/\@(?<user_name>[a-zA-Z0-9_-]{5,20})\z/i', ['GET'], $args)){
$tpl->import('views/users/profile', $args);
}else if($tpl->route('/\A\/users\/settings\z/i', ['GET'], $args)){
$tpl->import('views/users/settings', $args);
}else if($tpl->route('/\A\/users\/settings\z/i', ['POST'], $args)){
$tpl->import('apis/users/settings', $args);
}else if($tpl->route('/\A\/wechall\/user-score\z/i', ['GET'])){
$tpl->import('apis/wechall/user-score');
}else if($tpl->route('/\A\/wechall\/validate-mail\z/i', ['GET'])){
$tpl->import('apis/wechall/validate-mail');
}else{
$tpl->error(404);
}