forked from WWBN/AVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.php
345 lines (337 loc) · 12.7 KB
/
routes.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<?php
require_once 'objects/simple-php-router/vendor/autoload.php';
$basePath = parse_url ($global['webSiteRootURL'], PHP_URL_PATH);
use Pecee\SimpleRouter\SimpleRouter;
//At the beginnign, so it no plugin can overwrite defined rules
require_once $global['systemRootPath'] . 'plugin/YouPHPTubePlugin.php';
YouPHPTubePlugin::addRoutes();
SimpleRouter::get($basePath, function() {
require_once "view/index.php"; exit;
});
SimpleRouter::get($basePath."info", function() {
require_once "view/info.php"; exit;
});
/*SimpleRouter::post($basePath."subscribes.json", function() {
require_once "objects/subscribe.json.php";
});*/
SimpleRouter::get($basePath."siteConfigurations", function() {
require_once "view/configurations.php"; exit;
});
SimpleRouter::get($basePath."signUp", function() {
require_once "view/signUp.php"; exit;
});
SimpleRouter::get($basePath."categories", function() {
require_once "view/managerCategories.php"; exit;
});
SimpleRouter::get($basePath."about", function() {
require_once "view/about.php"; exit;
});
SimpleRouter::get($basePath."orphanFiles", function() {
require_once "view/orphanFiles.php"; exit;
});
SimpleRouter::get($basePath."contact", function() {
require_once "view/contact.php"; exit;
});
SimpleRouter::get($basePath."user", function() {
require_once "view/user.php"; exit;
});
SimpleRouter::get($basePath."users", function() {
require_once "view/managerUsers.php"; exit;
});
SimpleRouter::get($basePath."usersGroups", function() {
require_once "view/managerUsersGroups.php"; exit;
});
SimpleRouter::get($basePath."mvideos", function() {
require_once "view/managerVideos.php"; exit;
});
SimpleRouter::get($basePath."videosAndroid.json", function() {
require_once "objects/videosAndroid.json.php"; exit;
});
SimpleRouter::get($basePath."videoAndroid.json", function() {
require_once "objects/videoAndroid.json.php"; exit;
});
SimpleRouter::get($basePath."captcha", function() {
require_once "objects/getCaptcha.php"; exit;
});
SimpleRouter::get($basePath."logoff", function() {
require_once "objects/logoff.php"; exit;
});
SimpleRouter::get($basePath."charts", function() {
require_once "view/charts.php"; exit;
});
SimpleRouter::get($basePath."update", function() {
require_once "view/update.php"; exit;
});
SimpleRouter::post($basePath."update", function() {
require_once "view/update.php"; exit;
});
SimpleRouter::post($basePath."googleAdView", function() {
require_once "view/googleAdView.php"; exit;
});
SimpleRouter::post($basePath."notifications.json", function() {
require_once "objects/notifications.json.php"; exit;
});
SimpleRouter::get($basePath."notifySubscribers.json", function() {
require_once "objects/notifySubscribers.json.php"; exit;
});
SimpleRouter::get($basePath."subscribes", function() {
require_once "view/managerSubscribes.php"; exit;
});
SimpleRouter::post($basePath."videosList", function() {
require_once "view/videosList.php"; exit;
});
SimpleRouter::post($basePath."getDownloadProgress", function() {
require_once "objects/downloadVideoProgress.php"; exit;
});
SimpleRouter::post($basePath."downloadNow", function() {
require_once "objects/downloadVideo.php"; exit;
});
SimpleRouter::get($basePath."comments", function() {
require_once "view/managerComments.php"; exit;
});
SimpleRouter::get($basePath."videoOnly", function() {
$_GET['type'] = "video";
require_once "view/index.php"; exit;
});
SimpleRouter::get($basePath."audioOnly", function() {
$_GET['type'] = "audio";
require_once "view/index.php"; exit;
});
SimpleRouter::post($basePath."comments.json/{videoId}", function($videoId) {
$_GET['video_id'] = $videoId;
require_once "objects/comments.json.php"; exit;
});
// eventualy incomplete
SimpleRouter::post($basePath."status", function() {
require_once "objects/status.json.php"; exit;
});
SimpleRouter::get($basePath."plugins", function() {
require_once "view/managerPlugins.php"; exit;
});
SimpleRouter::post($basePath."youPHPTubeQueueEncoder.json", function() {
require_once "objects/youPHPTubeQueueEncoder.json.php"; exit;
});
SimpleRouter::post($basePath."youPHPTubeEncoder.json", function() {
require_once "objects/youPHPTubeEncoder.json.php"; exit;
});
SimpleRouter::get($basePath."youPHPTubeQueueEncoder.json", function() {
require_once "objects/youPHPTubeQueueEncoder.json.php"; exit;
});
SimpleRouter::get($basePath."youPHPTubeEncoder.json", function() {
require_once "objects/youPHPTubeEncoder.json.php"; exit;
});
SimpleRouter::post($basePath."plugins.json", function() {
require_once "objects/plugins.json.php"; exit;
});
SimpleRouter::get($basePath."channels", function() {
require_once "view/channels.php"; exit;
});
SimpleRouter::get($basePath."help", function() {
require_once "view/help.php"; exit;
});
SimpleRouter::post($basePath."like", function() {
$_GET['like']="1";
require_once "objects/like.json.php"; exit;
});
SimpleRouter::post($basePath."dislike", function() {
$_GET['like']="-1";
require_once "objects/like.json.php"; exit;
});
SimpleRouter::get($basePath."channel/{channelName?}", function ($channelName = '') {
$_GET['channelName'] = $channelName;
require_once 'view/channel.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
SimpleRouter::get($basePath."cat/{catName?}", function ($catName = '') {
$_GET['catName'] = $catName;
require_once 'view/index.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
SimpleRouter::get($basePath."upload", function () {
require_once 'view/mini-upload-form/index.php'; exit;
});
SimpleRouter::get($basePath."cat/{catName}/video/{videoName?}", function ($catName,$videoName = '') {
$_GET['catName'] = $catName;
$_GET['videoName'] = $videoName;
require_once 'view/index.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
SimpleRouter::get($basePath."cat/{catName?}", function ($catName = '') {
$_GET['catName'] = $catName;
require_once 'view/index.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
SimpleRouter::get($basePath."video/{videoName?}", function ($videoName = '') {
$_GET['videoName'] = $videoName;
require_once 'view/index.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
SimpleRouter::get($basePath."v/{videoName?}", function ($videoName = '') {
$_GET['v'] = $videoName;
require_once 'view/index.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
// if it's used external, by encoder or so
SimpleRouter::post($basePath."login", function() {
require_once "objects/login.json.php"; exit;
});
SimpleRouter::get($basePath."login", function() {
require_once "objects/login.json.php"; exit;
});
// Translated!
SimpleRouter::get($basePath.__("info"), function() {
require_once "view/info.php"; exit;
});
/*SimpleRouter::post($basePath."subscribes.json", function() {
require_once "objects/subscribe.json.php";
});*/
SimpleRouter::get($basePath.__("siteConfigurations"), function() {
require_once "view/configurations.php"; exit;
});
SimpleRouter::get($basePath.__("signUp"), function() {
require_once "view/signUp.php"; exit;
});
SimpleRouter::get($basePath.__("categories"), function() {
require_once "view/managerCategories.php"; exit;
});
SimpleRouter::get($basePath.__("about"), function() {
require_once "view/about.php"; exit;
});
SimpleRouter::get($basePath.__("orphanFiles"), function() {
require_once "view/orphanFiles.php"; exit;
});
SimpleRouter::get($basePath.__("contact"), function() {
require_once "view/contact.php"; exit;
});
SimpleRouter::get($basePath.__("user"), function() {
require_once "view/user.php"; exit;
});
SimpleRouter::get($basePath.__("users"), function() {
require_once "view/managerUsers.php"; exit;
});
SimpleRouter::get($basePath.__("usersGroups"), function() {
require_once "view/managerUsersGroups.php"; exit;
});
SimpleRouter::get($basePath.__("mvideos"), function() {
require_once "view/managerVideos.php"; exit;
});
SimpleRouter::get($basePath."videosAndroid.json", function() {
require_once "objects/videosAndroid.json.php"; exit;
});
SimpleRouter::get($basePath."videoAndroid.json", function() {
require_once "objects/videoAndroid.json.php"; exit;
});
SimpleRouter::get($basePath."captcha", function() {
require_once "objects/getCaptcha.php"; exit;
});
SimpleRouter::get($basePath.__("logoff"), function() {
require_once "objects/logoff.php"; exit;
});
SimpleRouter::get($basePath.__("charts"), function() {
require_once "view/charts.php"; exit;
});
SimpleRouter::get($basePath.__("update"), function() {
require_once "view/update.php"; exit;
});
SimpleRouter::post($basePath."googleAdView", function() {
require_once "view/googleAdView.php"; exit;
});
SimpleRouter::post($basePath."notifications.json", function() {
require_once "objects/notifications.json.php"; exit;
});
SimpleRouter::get($basePath."notifySubscribers.json", function() {
require_once "objects/notifySubscribers.json.php"; exit;
});
SimpleRouter::get($basePath.__("subscribes"), function() {
require_once "view/managerSubscribes.php"; exit;
});
SimpleRouter::post($basePath.__("videosList"), function() {
require_once "view/videosList.php"; exit;
});
SimpleRouter::post($basePath."getDownloadProgress", function() {
require_once "objects/downloadVideoProgress.php"; exit;
});
SimpleRouter::post($basePath."downloadNow", function() {
require_once "objects/downloadVideo.php"; exit;
});
SimpleRouter::get($basePath."comments", function() {
require_once "view/managerComments.php"; exit;
});
SimpleRouter::get($basePath.__("videoOnly"), function() {
$_GET['type'] = "video";
require_once "view/index.php"; exit;
});
SimpleRouter::get($basePath.__("audioOnly"), function() {
$_GET['type'] = "audio";
require_once "view/index.php"; exit;
});
SimpleRouter::post($basePath."comments.json/{videoId}", function($videoId) {
$_GET['video_id'] = $videoId;
require_once "objects/comments.json.php"; exit;
});
// eventualy incomplete
SimpleRouter::post($basePath."status", function() {
require_once "objects/status.json.php"; exit;
});
SimpleRouter::get($basePath."plugins", function() {
require_once "view/managerPlugins.php"; exit;
});
SimpleRouter::post($basePath."youPHPTubeQueueEncoder.json", function() {
require_once "objects/youPHPTubeQueueEncoder.json.php"; exit;
});
SimpleRouter::post($basePath."youPHPTubeEncoder.json", function() {
require_once "objects/youPHPTubeEncoder.json.php"; exit;
});
SimpleRouter::get($basePath."youPHPTubeQueueEncoder.json", function() {
require_once "objects/youPHPTubeQueueEncoder.json.php"; exit;
});
SimpleRouter::get($basePath."youPHPTubeEncoder.json", function() {
require_once "objects/youPHPTubeEncoder.json.php"; exit;
});
SimpleRouter::post($basePath."plugins.json", function() {
require_once "objects/plugins.json.php"; exit;
});
SimpleRouter::get($basePath."channels", function() {
require_once "view/channels.php"; exit;
});
SimpleRouter::get($basePath.__("help"), function() {
require_once "view/help.php"; exit;
});
SimpleRouter::post($basePath."like", function() {
$_GET['like']="1";
require_once "objects/like.json.php"; exit;
});
SimpleRouter::post($basePath."dislike", function() {
$_GET['like']="-1";
require_once "objects/like.json.php"; exit;
});
SimpleRouter::get($basePath.__("channel")."/{channelName?}", function ($channelName = '') {
$_GET['channelName'] = $channelName;
require_once 'view/channel.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
SimpleRouter::get($basePath.__("cat")."/{catName?}", function ($catName = '') {
$_GET['catName'] = $catName;
require_once 'view/index.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
SimpleRouter::get($basePath."upload", function () {
require_once 'view/mini-upload-form/index.php'; exit;
});
SimpleRouter::get($basePath.__("cat")."/{catName}/video/{videoName?}", function ($catName,$videoName = '') {
$_GET['catName'] = $catName;
$_GET['videoName'] = $videoName;
require_once 'view/index.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
SimpleRouter::get($basePath.__("cat")."/{catName?}", function ($catName = '') {
$_GET['catName'] = $catName;
require_once 'view/index.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
SimpleRouter::get($basePath."video/{videoName?}", function ($videoName = '') {
$_GET['videoName'] = $videoName;
require_once 'view/index.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
SimpleRouter::get($basePath."v/{videoName?}", function ($videoName = '') {
$_GET['v'] = $videoName;
require_once 'view/index.php'; exit;
},['defaultParameterRegex' => '[\w\-]+']);
// if it's used external, by encoder or so
SimpleRouter::post($basePath.__("login"), function() {
require_once "objects/login.json.php"; exit;
});
SimpleRouter::get($basePath.__("login"), function() {
require_once "objects/login.json.php"; exit;
});
?>