1
|
|
|
<?php |
2
|
|
|
/****************************************************************************** |
3
|
|
|
* Wikipedia Account Creation Assistance tool * |
4
|
|
|
* * |
5
|
|
|
* All code in this file is released into the public domain by the ACC * |
6
|
|
|
* Development Team. Please see team.json for a list of contributors. * |
7
|
|
|
******************************************************************************/ |
8
|
|
|
|
9
|
|
|
namespace Waca\Router; |
10
|
|
|
|
11
|
|
|
use Waca\Pages\Request\PageConfirmEmail; |
12
|
|
|
use Waca\Pages\Request\PageEmailConfirmationRequired; |
13
|
|
|
use Waca\Pages\Request\PageRequestAccount; |
14
|
|
|
use Waca\Pages\Request\PageRequestSubmitted; |
15
|
|
|
|
16
|
|
|
class PublicRequestRouter extends RequestRouter |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* Gets the route map to be used by this request router. |
20
|
|
|
* |
21
|
|
|
* @return array |
22
|
|
|
*/ |
23
|
|
|
protected function getRouteMap() |
24
|
|
|
{ |
25
|
|
|
return array( |
26
|
|
|
// Page showing a message stating the request has been submitted to our internal queues |
27
|
|
|
'requestSubmitted' => |
28
|
|
|
array( |
29
|
|
|
'class' => PageRequestSubmitted::class, |
30
|
|
|
'actions' => array(), |
31
|
|
|
), |
32
|
|
|
// Page showing a message stating that email confirmation is required to continue |
33
|
|
|
'emailConfirmationRequired' => |
34
|
|
|
array( |
35
|
|
|
'class' => PageEmailConfirmationRequired::class, |
36
|
|
|
'actions' => array(), |
37
|
|
|
), |
38
|
|
|
// Action page which handles email confirmation |
39
|
|
|
'confirmEmail' => |
40
|
|
|
array( |
41
|
|
|
'class' => PageConfirmEmail::class, |
42
|
|
|
'actions' => array(), |
43
|
|
|
), |
44
|
|
|
); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Gets the default route if no explicit route is requested. |
49
|
|
|
* |
50
|
|
|
* @return callable |
51
|
|
|
*/ |
52
|
|
|
protected function getDefaultRoute() |
53
|
|
|
{ |
54
|
|
|
return array(PageRequestAccount::class, 'main'); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function getRouteFromPath($pathInfo): array |
58
|
|
|
{ |
59
|
|
|
if (count($pathInfo) === 3 && $pathInfo[0] === 'r') { |
60
|
|
|
// this request should be routed to the dynamic request form handler |
61
|
|
|
return [PageRequestAccount::class, 'dynamic']; |
62
|
|
|
} |
63
|
|
|
else { |
64
|
|
|
return parent::getRouteFromPath($pathInfo); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
} |