@@ -16,16 +16,16 @@ |
||
16 | 16 | |
17 | 17 | class BotCreationTask extends CreationTaskBase |
18 | 18 | { |
19 | - /** |
|
20 | - * @return IMediaWikiClient |
|
21 | - */ |
|
22 | - protected function getMediaWikiClient() |
|
23 | - { |
|
24 | - return new BotMediaWikiClient($this->getSiteConfiguration()); |
|
25 | - } |
|
19 | + /** |
|
20 | + * @return IMediaWikiClient |
|
21 | + */ |
|
22 | + protected function getMediaWikiClient() |
|
23 | + { |
|
24 | + return new BotMediaWikiClient($this->getSiteConfiguration()); |
|
25 | + } |
|
26 | 26 | |
27 | - protected function getCreationReason(Request $request, User $user) |
|
28 | - { |
|
29 | - return parent::getCreationReason($request, $user) . ', on behalf of [[User:' . $user->getOnWikiName() . ']]'; |
|
30 | - } |
|
27 | + protected function getCreationReason(Request $request, User $user) |
|
28 | + { |
|
29 | + return parent::getCreationReason($request, $user) . ', on behalf of [[User:' . $user->getOnWikiName() . ']]'; |
|
30 | + } |
|
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -14,14 +14,14 @@ |
||
14 | 14 | |
15 | 15 | class UserCreationTask extends CreationTaskBase |
16 | 16 | { |
17 | - /** |
|
18 | - * @return IMediaWikiClient |
|
19 | - */ |
|
20 | - protected function getMediaWikiClient() |
|
21 | - { |
|
22 | - $oauth = new OAuthUserHelper($this->getTriggerUser(), $this->getDatabase(), $this->getOauthProtocolHelper(), |
|
23 | - $this->getSiteConfiguration()); |
|
17 | + /** |
|
18 | + * @return IMediaWikiClient |
|
19 | + */ |
|
20 | + protected function getMediaWikiClient() |
|
21 | + { |
|
22 | + $oauth = new OAuthUserHelper($this->getTriggerUser(), $this->getDatabase(), $this->getOauthProtocolHelper(), |
|
23 | + $this->getSiteConfiguration()); |
|
24 | 24 | |
25 | - return $oauth; |
|
26 | - } |
|
25 | + return $oauth; |
|
26 | + } |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -20,73 +20,73 @@ |
||
20 | 20 | |
21 | 21 | class WelcomeUserTask extends BackgroundTaskBase |
22 | 22 | { |
23 | - public static function enqueue(User $triggerUser, Request $request, PdoDatabase $database) |
|
24 | - { |
|
25 | - $job = new JobQueue(); |
|
26 | - $job->setDatabase($database); |
|
27 | - $job->setTask(WelcomeUserTask::class); |
|
28 | - $job->setRequest($request->getId()); |
|
29 | - $job->setTriggerUserId($triggerUser->getId()); |
|
30 | - $job->save(); |
|
31 | - } |
|
32 | - |
|
33 | - public function execute() |
|
34 | - { |
|
35 | - $database = $this->getDatabase(); |
|
36 | - $request = $this->getRequest(); |
|
37 | - $user = $this->getTriggerUser(); |
|
38 | - |
|
39 | - if ($user->getWelcomeTemplate() === null) { |
|
40 | - $this->markFailed('Welcome template not specified'); |
|
41 | - |
|
42 | - return; |
|
43 | - } |
|
44 | - |
|
45 | - /** @var WelcomeTemplate $template */ |
|
46 | - $template = WelcomeTemplate::getById($user->getWelcomeTemplate(), $database); |
|
47 | - |
|
48 | - if ($template === false) { |
|
49 | - $this->markFailed('Welcome template missing'); |
|
50 | - |
|
51 | - return; |
|
52 | - } |
|
53 | - |
|
54 | - $oauth = new OAuthUserHelper($user, $database, $this->getOauthProtocolHelper(), |
|
55 | - $this->getSiteConfiguration()); |
|
56 | - $mediaWikiHelper = new MediaWikiHelper($oauth, $this->getSiteConfiguration()); |
|
57 | - |
|
58 | - if ($request->getStatus() !== RequestStatus::CLOSED) { |
|
59 | - $this->markFailed('Request is currently open'); |
|
60 | - |
|
61 | - return; |
|
62 | - } |
|
63 | - |
|
64 | - if (!$mediaWikiHelper->checkAccountExists($request->getName())){ |
|
65 | - $this->markFailed('Account does not exist!'); |
|
66 | - |
|
67 | - return; |
|
68 | - } |
|
69 | - |
|
70 | - $this->performWelcome($template, $request, $mediaWikiHelper); |
|
71 | - $this->markComplete(); |
|
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * Performs the welcome |
|
76 | - * |
|
77 | - * @param WelcomeTemplate $template |
|
78 | - * @param Request $request |
|
79 | - * @param MediaWikiHelper $mediaWikiHelper |
|
80 | - */ |
|
81 | - private function performWelcome( |
|
82 | - WelcomeTemplate $template, |
|
83 | - Request $request, |
|
84 | - MediaWikiHelper $mediaWikiHelper |
|
85 | - ) { |
|
86 | - $templateText = $template->getBotCode(); |
|
87 | - $templateText = str_replace('$signature', '~~~~', $templateText); |
|
88 | - $templateText = str_replace('$username', $request->getName(), $templateText); |
|
89 | - |
|
90 | - $mediaWikiHelper->addTalkPageMessage($request->getName(), 'Welcome!', 'Welcoming user created through [[WP:ACC]]', $templateText); |
|
91 | - } |
|
23 | + public static function enqueue(User $triggerUser, Request $request, PdoDatabase $database) |
|
24 | + { |
|
25 | + $job = new JobQueue(); |
|
26 | + $job->setDatabase($database); |
|
27 | + $job->setTask(WelcomeUserTask::class); |
|
28 | + $job->setRequest($request->getId()); |
|
29 | + $job->setTriggerUserId($triggerUser->getId()); |
|
30 | + $job->save(); |
|
31 | + } |
|
32 | + |
|
33 | + public function execute() |
|
34 | + { |
|
35 | + $database = $this->getDatabase(); |
|
36 | + $request = $this->getRequest(); |
|
37 | + $user = $this->getTriggerUser(); |
|
38 | + |
|
39 | + if ($user->getWelcomeTemplate() === null) { |
|
40 | + $this->markFailed('Welcome template not specified'); |
|
41 | + |
|
42 | + return; |
|
43 | + } |
|
44 | + |
|
45 | + /** @var WelcomeTemplate $template */ |
|
46 | + $template = WelcomeTemplate::getById($user->getWelcomeTemplate(), $database); |
|
47 | + |
|
48 | + if ($template === false) { |
|
49 | + $this->markFailed('Welcome template missing'); |
|
50 | + |
|
51 | + return; |
|
52 | + } |
|
53 | + |
|
54 | + $oauth = new OAuthUserHelper($user, $database, $this->getOauthProtocolHelper(), |
|
55 | + $this->getSiteConfiguration()); |
|
56 | + $mediaWikiHelper = new MediaWikiHelper($oauth, $this->getSiteConfiguration()); |
|
57 | + |
|
58 | + if ($request->getStatus() !== RequestStatus::CLOSED) { |
|
59 | + $this->markFailed('Request is currently open'); |
|
60 | + |
|
61 | + return; |
|
62 | + } |
|
63 | + |
|
64 | + if (!$mediaWikiHelper->checkAccountExists($request->getName())){ |
|
65 | + $this->markFailed('Account does not exist!'); |
|
66 | + |
|
67 | + return; |
|
68 | + } |
|
69 | + |
|
70 | + $this->performWelcome($template, $request, $mediaWikiHelper); |
|
71 | + $this->markComplete(); |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * Performs the welcome |
|
76 | + * |
|
77 | + * @param WelcomeTemplate $template |
|
78 | + * @param Request $request |
|
79 | + * @param MediaWikiHelper $mediaWikiHelper |
|
80 | + */ |
|
81 | + private function performWelcome( |
|
82 | + WelcomeTemplate $template, |
|
83 | + Request $request, |
|
84 | + MediaWikiHelper $mediaWikiHelper |
|
85 | + ) { |
|
86 | + $templateText = $template->getBotCode(); |
|
87 | + $templateText = str_replace('$signature', '~~~~', $templateText); |
|
88 | + $templateText = str_replace('$username', $request->getName(), $templateText); |
|
89 | + |
|
90 | + $mediaWikiHelper->addTalkPageMessage($request->getName(), 'Welcome!', 'Welcoming user created through [[WP:ACC]]', $templateText); |
|
91 | + } |
|
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -20,123 +20,123 @@ |
||
20 | 20 | |
21 | 21 | abstract class CreationTaskBase extends BackgroundTaskBase |
22 | 22 | { |
23 | - /** @var Request */ |
|
24 | - private $request; |
|
25 | - /** |
|
26 | - * @var MediaWikiHelper |
|
27 | - * Don't use this directly. |
|
28 | - */ |
|
29 | - private $mwHelper = null; |
|
30 | - |
|
31 | - public function execute() |
|
32 | - { |
|
33 | - $this->request = $this->getRequest(); |
|
34 | - $user = $this->getTriggerUser(); |
|
35 | - |
|
36 | - if ($this->request->getStatus() !== RequestStatus::JOBQUEUE) { |
|
37 | - $this->markCancelled('Request is not deferred to the job queue'); |
|
38 | - |
|
39 | - return; |
|
40 | - } |
|
41 | - |
|
42 | - if ($this->request->getEmailSent() != 0) { |
|
43 | - $this->markFailed('Request has already been sent an email'); |
|
44 | - |
|
45 | - return; |
|
46 | - } |
|
47 | - |
|
48 | - if ($this->getEmailTemplate() === null) { |
|
49 | - $this->markFailed('No email template specified'); |
|
50 | - |
|
51 | - return; |
|
52 | - } |
|
53 | - |
|
54 | - try { |
|
55 | - $this->performCreation($user); |
|
56 | - |
|
57 | - $this->request->setStatus(RequestStatus::CLOSED); |
|
58 | - $this->request->setReserved(null); |
|
59 | - $this->request->save(); |
|
60 | - |
|
61 | - // Log the closure as the user |
|
62 | - Logger::closeRequest($this->getDatabase(), $this->request, $this->getEmailTemplate()->getId(), null, |
|
63 | - $this->getTriggerUser()); |
|
64 | - |
|
65 | - $requestEmailHelper = new RequestEmailHelper($this->getEmailHelper()); |
|
66 | - $requestEmailHelper->sendMail($this->request, $this->getEmailTemplate()->getText(), $this->getTriggerUser(), |
|
67 | - false); |
|
68 | - |
|
69 | - $this->getNotificationHelper()->requestClosed($this->request, $this->getEmailTemplate()->getName()); |
|
70 | - } |
|
71 | - catch (Exception $ex) { |
|
72 | - $this->markFailed($ex->getMessage()); |
|
73 | - |
|
74 | - return; |
|
75 | - } |
|
76 | - |
|
77 | - $this->markComplete(); |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * @return IMediaWikiClient |
|
82 | - */ |
|
83 | - protected abstract function getMediaWikiClient(); |
|
84 | - |
|
85 | - protected function getMediaWikiHelper(){ |
|
86 | - if($this->mwHelper === null) { |
|
87 | - $this->mwHelper = new MediaWikiHelper($this->getMediaWikiClient(), $this->getSiteConfiguration()); |
|
88 | - } |
|
89 | - |
|
90 | - return $this->mwHelper; |
|
91 | - } |
|
92 | - |
|
93 | - protected function getCreationReason(Request $request, User $user) |
|
94 | - { |
|
95 | - return 'Requested account at [[WP:ACC]], request #' . $request->getId(); |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * @param string $name |
|
100 | - * |
|
101 | - * @return bool |
|
102 | - */ |
|
103 | - protected function checkAccountExists($name) |
|
104 | - { |
|
105 | - return $this->getMediaWikiHelper()->checkAccountExists($name); |
|
106 | - } |
|
107 | - |
|
108 | - protected function markFailed($reason = null) |
|
109 | - { |
|
110 | - $this->request->setStatus(RequestStatus::HOSPITAL); |
|
111 | - $this->request->save(); |
|
112 | - |
|
113 | - Logger::hospitalised($this->getDatabase(), $this->request); |
|
114 | - |
|
115 | - parent::markFailed($reason); |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @param $user |
|
120 | - * |
|
121 | - * @throws ApplicationLogicException |
|
122 | - */ |
|
123 | - protected function performCreation($user) |
|
124 | - { |
|
125 | - $mw = $this->getMediaWikiHelper(); |
|
126 | - |
|
127 | - $reason = $this->getCreationReason($this->request, $user); |
|
23 | + /** @var Request */ |
|
24 | + private $request; |
|
25 | + /** |
|
26 | + * @var MediaWikiHelper |
|
27 | + * Don't use this directly. |
|
28 | + */ |
|
29 | + private $mwHelper = null; |
|
30 | + |
|
31 | + public function execute() |
|
32 | + { |
|
33 | + $this->request = $this->getRequest(); |
|
34 | + $user = $this->getTriggerUser(); |
|
35 | + |
|
36 | + if ($this->request->getStatus() !== RequestStatus::JOBQUEUE) { |
|
37 | + $this->markCancelled('Request is not deferred to the job queue'); |
|
38 | + |
|
39 | + return; |
|
40 | + } |
|
41 | + |
|
42 | + if ($this->request->getEmailSent() != 0) { |
|
43 | + $this->markFailed('Request has already been sent an email'); |
|
44 | + |
|
45 | + return; |
|
46 | + } |
|
47 | + |
|
48 | + if ($this->getEmailTemplate() === null) { |
|
49 | + $this->markFailed('No email template specified'); |
|
50 | + |
|
51 | + return; |
|
52 | + } |
|
53 | + |
|
54 | + try { |
|
55 | + $this->performCreation($user); |
|
56 | + |
|
57 | + $this->request->setStatus(RequestStatus::CLOSED); |
|
58 | + $this->request->setReserved(null); |
|
59 | + $this->request->save(); |
|
60 | + |
|
61 | + // Log the closure as the user |
|
62 | + Logger::closeRequest($this->getDatabase(), $this->request, $this->getEmailTemplate()->getId(), null, |
|
63 | + $this->getTriggerUser()); |
|
64 | + |
|
65 | + $requestEmailHelper = new RequestEmailHelper($this->getEmailHelper()); |
|
66 | + $requestEmailHelper->sendMail($this->request, $this->getEmailTemplate()->getText(), $this->getTriggerUser(), |
|
67 | + false); |
|
68 | + |
|
69 | + $this->getNotificationHelper()->requestClosed($this->request, $this->getEmailTemplate()->getName()); |
|
70 | + } |
|
71 | + catch (Exception $ex) { |
|
72 | + $this->markFailed($ex->getMessage()); |
|
73 | + |
|
74 | + return; |
|
75 | + } |
|
76 | + |
|
77 | + $this->markComplete(); |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * @return IMediaWikiClient |
|
82 | + */ |
|
83 | + protected abstract function getMediaWikiClient(); |
|
84 | + |
|
85 | + protected function getMediaWikiHelper(){ |
|
86 | + if($this->mwHelper === null) { |
|
87 | + $this->mwHelper = new MediaWikiHelper($this->getMediaWikiClient(), $this->getSiteConfiguration()); |
|
88 | + } |
|
89 | + |
|
90 | + return $this->mwHelper; |
|
91 | + } |
|
92 | + |
|
93 | + protected function getCreationReason(Request $request, User $user) |
|
94 | + { |
|
95 | + return 'Requested account at [[WP:ACC]], request #' . $request->getId(); |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * @param string $name |
|
100 | + * |
|
101 | + * @return bool |
|
102 | + */ |
|
103 | + protected function checkAccountExists($name) |
|
104 | + { |
|
105 | + return $this->getMediaWikiHelper()->checkAccountExists($name); |
|
106 | + } |
|
107 | + |
|
108 | + protected function markFailed($reason = null) |
|
109 | + { |
|
110 | + $this->request->setStatus(RequestStatus::HOSPITAL); |
|
111 | + $this->request->save(); |
|
112 | + |
|
113 | + Logger::hospitalised($this->getDatabase(), $this->request); |
|
114 | + |
|
115 | + parent::markFailed($reason); |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @param $user |
|
120 | + * |
|
121 | + * @throws ApplicationLogicException |
|
122 | + */ |
|
123 | + protected function performCreation($user) |
|
124 | + { |
|
125 | + $mw = $this->getMediaWikiHelper(); |
|
126 | + |
|
127 | + $reason = $this->getCreationReason($this->request, $user); |
|
128 | 128 | |
129 | - if ($this->checkAccountExists($this->request->getName())) { |
|
130 | - throw new ApplicationLogicException('Account already exists'); |
|
131 | - } |
|
129 | + if ($this->checkAccountExists($this->request->getName())) { |
|
130 | + throw new ApplicationLogicException('Account already exists'); |
|
131 | + } |
|
132 | 132 | |
133 | - $mw->createAccount($this->request->getName(), $this->request->getEmail(), $reason); |
|
133 | + $mw->createAccount($this->request->getName(), $this->request->getEmail(), $reason); |
|
134 | 134 | |
135 | - if (!$this->checkAccountExists($this->request->getName())) { |
|
136 | - throw new ApplicationLogicException('Account creation appeared to succeed but account does not exist.'); |
|
137 | - } |
|
135 | + if (!$this->checkAccountExists($this->request->getName())) { |
|
136 | + throw new ApplicationLogicException('Account creation appeared to succeed but account does not exist.'); |
|
137 | + } |
|
138 | 138 | |
139 | - $this->request->setStatus(RequestStatus::CLOSED); |
|
140 | - $this->request->save(); |
|
141 | - } |
|
139 | + $this->request->setStatus(RequestStatus::CLOSED); |
|
140 | + $this->request->save(); |
|
141 | + } |
|
142 | 142 | } |
143 | 143 | \ No newline at end of file |
@@ -25,48 +25,48 @@ |
||
25 | 25 | |
26 | 26 | trait NavigationMenuAccessControl |
27 | 27 | { |
28 | - protected abstract function assign($name, $value); |
|
28 | + protected abstract function assign($name, $value); |
|
29 | 29 | |
30 | - /** |
|
31 | - * @return SecurityManager |
|
32 | - */ |
|
33 | - protected abstract function getSecurityManager(); |
|
30 | + /** |
|
31 | + * @return SecurityManager |
|
32 | + */ |
|
33 | + protected abstract function getSecurityManager(); |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param $currentUser |
|
37 | - */ |
|
38 | - protected function setupNavMenuAccess($currentUser) |
|
39 | - { |
|
40 | - $this->assign('nav__canRequests', $this->getSecurityManager() |
|
41 | - ->allows(PageMain::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
35 | + /** |
|
36 | + * @param $currentUser |
|
37 | + */ |
|
38 | + protected function setupNavMenuAccess($currentUser) |
|
39 | + { |
|
40 | + $this->assign('nav__canRequests', $this->getSecurityManager() |
|
41 | + ->allows(PageMain::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
42 | 42 | |
43 | - $this->assign('nav__canLogs', $this->getSecurityManager() |
|
44 | - ->allows(PageLog::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
45 | - $this->assign('nav__canUsers', $this->getSecurityManager() |
|
46 | - ->allows(StatsUsers::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
47 | - $this->assign('nav__canSearch', $this->getSecurityManager() |
|
48 | - ->allows(PageSearch::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
49 | - $this->assign('nav__canStats', $this->getSecurityManager() |
|
50 | - ->allows(StatsMain::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
43 | + $this->assign('nav__canLogs', $this->getSecurityManager() |
|
44 | + ->allows(PageLog::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
45 | + $this->assign('nav__canUsers', $this->getSecurityManager() |
|
46 | + ->allows(StatsUsers::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
47 | + $this->assign('nav__canSearch', $this->getSecurityManager() |
|
48 | + ->allows(PageSearch::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
49 | + $this->assign('nav__canStats', $this->getSecurityManager() |
|
50 | + ->allows(StatsMain::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
51 | 51 | |
52 | - $this->assign('nav__canBan', $this->getSecurityManager() |
|
53 | - ->allows(PageBan::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
54 | - $this->assign('nav__canEmailMgmt', $this->getSecurityManager() |
|
55 | - ->allows(PageEmailManagement::class, RoleConfiguration::MAIN, |
|
56 | - $currentUser) === SecurityManager::ALLOWED); |
|
57 | - $this->assign('nav__canWelcomeMgmt', $this->getSecurityManager() |
|
58 | - ->allows(PageWelcomeTemplateManagement::class, RoleConfiguration::MAIN, |
|
59 | - $currentUser) === SecurityManager::ALLOWED); |
|
60 | - $this->assign('nav__canSiteNoticeMgmt', $this->getSecurityManager() |
|
61 | - ->allows(PageSiteNotice::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
62 | - $this->assign('nav__canUserMgmt', $this->getSecurityManager() |
|
63 | - ->allows(PageUserManagement::class, RoleConfiguration::MAIN, |
|
64 | - $currentUser) === SecurityManager::ALLOWED); |
|
65 | - $this->assign('nav__canJobQueue', $this->getSecurityManager() |
|
66 | - ->allows(PageJobQueue::class, RoleConfiguration::MAIN, |
|
67 | - $currentUser) === SecurityManager::ALLOWED); |
|
52 | + $this->assign('nav__canBan', $this->getSecurityManager() |
|
53 | + ->allows(PageBan::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
54 | + $this->assign('nav__canEmailMgmt', $this->getSecurityManager() |
|
55 | + ->allows(PageEmailManagement::class, RoleConfiguration::MAIN, |
|
56 | + $currentUser) === SecurityManager::ALLOWED); |
|
57 | + $this->assign('nav__canWelcomeMgmt', $this->getSecurityManager() |
|
58 | + ->allows(PageWelcomeTemplateManagement::class, RoleConfiguration::MAIN, |
|
59 | + $currentUser) === SecurityManager::ALLOWED); |
|
60 | + $this->assign('nav__canSiteNoticeMgmt', $this->getSecurityManager() |
|
61 | + ->allows(PageSiteNotice::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
62 | + $this->assign('nav__canUserMgmt', $this->getSecurityManager() |
|
63 | + ->allows(PageUserManagement::class, RoleConfiguration::MAIN, |
|
64 | + $currentUser) === SecurityManager::ALLOWED); |
|
65 | + $this->assign('nav__canJobQueue', $this->getSecurityManager() |
|
66 | + ->allows(PageJobQueue::class, RoleConfiguration::MAIN, |
|
67 | + $currentUser) === SecurityManager::ALLOWED); |
|
68 | 68 | |
69 | - $this->assign('nav__canViewRequest', $this->getSecurityManager() |
|
70 | - ->allows(PageViewRequest::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
71 | - } |
|
69 | + $this->assign('nav__canViewRequest', $this->getSecurityManager() |
|
70 | + ->allows(PageViewRequest::class, RoleConfiguration::MAIN, $currentUser) === SecurityManager::ALLOWED); |
|
71 | + } |
|
72 | 72 | } |
73 | 73 | \ No newline at end of file |
@@ -17,9 +17,9 @@ |
||
17 | 17 | */ |
18 | 18 | class OAuthRequestRouter extends RequestRouter |
19 | 19 | { |
20 | - protected function getRouteFromPath($pathInfo) |
|
21 | - { |
|
22 | - // Hardcode the route for this entry point |
|
23 | - return array(PageOAuthCallback::class, 'authorise'); |
|
24 | - } |
|
20 | + protected function getRouteFromPath($pathInfo) |
|
21 | + { |
|
22 | + // Hardcode the route for this entry point |
|
23 | + return array(PageOAuthCallback::class, 'authorise'); |
|
24 | + } |
|
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -23,149 +23,149 @@ |
||
23 | 23 | |
24 | 24 | interface ITask |
25 | 25 | { |
26 | - /** |
|
27 | - * @return IEmailHelper |
|
28 | - */ |
|
29 | - public function getEmailHelper(); |
|
30 | - |
|
31 | - /** |
|
32 | - * @param IEmailHelper $emailHelper |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function setEmailHelper($emailHelper); |
|
37 | - |
|
38 | - /** |
|
39 | - * @return HttpHelper |
|
40 | - */ |
|
41 | - public function getHttpHelper(); |
|
42 | - |
|
43 | - /** |
|
44 | - * @param HttpHelper $httpHelper |
|
45 | - * |
|
46 | - * @return void |
|
47 | - */ |
|
48 | - public function setHttpHelper($httpHelper); |
|
49 | - |
|
50 | - /** |
|
51 | - * @return WikiTextHelper |
|
52 | - */ |
|
53 | - public function getWikiTextHelper(); |
|
54 | - |
|
55 | - /** |
|
56 | - * @param WikiTextHelper $wikiTextHelper |
|
57 | - * |
|
58 | - * @return void |
|
59 | - */ |
|
60 | - public function setWikiTextHelper($wikiTextHelper); |
|
61 | - |
|
62 | - /** |
|
63 | - * @return ILocationProvider |
|
64 | - */ |
|
65 | - public function getLocationProvider(); |
|
66 | - |
|
67 | - /** |
|
68 | - * @param ILocationProvider $locationProvider |
|
69 | - * |
|
70 | - * @return void |
|
71 | - */ |
|
72 | - public function setLocationProvider(ILocationProvider $locationProvider); |
|
73 | - |
|
74 | - /** |
|
75 | - * @return IXffTrustProvider |
|
76 | - */ |
|
77 | - public function getXffTrustProvider(); |
|
78 | - |
|
79 | - /** |
|
80 | - * @param IXffTrustProvider $xffTrustProvider |
|
81 | - * |
|
82 | - * @return void |
|
83 | - */ |
|
84 | - public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider); |
|
85 | - |
|
86 | - /** |
|
87 | - * @return IRDnsProvider |
|
88 | - */ |
|
89 | - public function getRdnsProvider(); |
|
90 | - |
|
91 | - /** |
|
92 | - * @param IRDnsProvider $rdnsProvider |
|
93 | - * |
|
94 | - * @return void |
|
95 | - */ |
|
96 | - public function setRdnsProvider($rdnsProvider); |
|
97 | - |
|
98 | - /** |
|
99 | - * @return IAntiSpoofProvider |
|
100 | - */ |
|
101 | - public function getAntiSpoofProvider(); |
|
102 | - |
|
103 | - /** |
|
104 | - * @param IAntiSpoofProvider $antiSpoofProvider |
|
105 | - * |
|
106 | - * @return void |
|
107 | - */ |
|
108 | - public function setAntiSpoofProvider($antiSpoofProvider); |
|
109 | - |
|
110 | - /** |
|
111 | - * @return PdoDatabase |
|
112 | - */ |
|
113 | - public function getDatabase(); |
|
114 | - |
|
115 | - /** |
|
116 | - * @param PdoDatabase $database |
|
117 | - * |
|
118 | - * @return void |
|
119 | - */ |
|
120 | - public function setDatabase($database); |
|
121 | - |
|
122 | - /** |
|
123 | - * @return IOAuthProtocolHelper |
|
124 | - */ |
|
125 | - public function getOAuthProtocolHelper(); |
|
126 | - |
|
127 | - /** |
|
128 | - * @param IOAuthProtocolHelper $oauthProtocolHelper |
|
129 | - * |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - public function setOAuthProtocolHelper($oauthProtocolHelper); |
|
133 | - |
|
134 | - /** |
|
135 | - * @return void |
|
136 | - */ |
|
137 | - public function execute(); |
|
138 | - |
|
139 | - /** |
|
140 | - * Sets the site configuration object for this page |
|
141 | - * |
|
142 | - * @param SiteConfiguration $configuration |
|
143 | - * |
|
144 | - * @return void |
|
145 | - */ |
|
146 | - public function setSiteConfiguration($configuration); |
|
147 | - |
|
148 | - /** |
|
149 | - * @return IrcNotificationHelper |
|
150 | - */ |
|
151 | - public function getNotificationHelper(); |
|
152 | - |
|
153 | - /** |
|
154 | - * @param IrcNotificationHelper $notificationHelper |
|
155 | - * |
|
156 | - * @return void |
|
157 | - */ |
|
158 | - public function setNotificationHelper($notificationHelper); |
|
159 | - |
|
160 | - /** |
|
161 | - * @return TorExitProvider |
|
162 | - */ |
|
163 | - public function getTorExitProvider(); |
|
164 | - |
|
165 | - /** |
|
166 | - * @param TorExitProvider $torExitProvider |
|
167 | - * |
|
168 | - * @return void |
|
169 | - */ |
|
170 | - public function setTorExitProvider($torExitProvider); |
|
26 | + /** |
|
27 | + * @return IEmailHelper |
|
28 | + */ |
|
29 | + public function getEmailHelper(); |
|
30 | + |
|
31 | + /** |
|
32 | + * @param IEmailHelper $emailHelper |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function setEmailHelper($emailHelper); |
|
37 | + |
|
38 | + /** |
|
39 | + * @return HttpHelper |
|
40 | + */ |
|
41 | + public function getHttpHelper(); |
|
42 | + |
|
43 | + /** |
|
44 | + * @param HttpHelper $httpHelper |
|
45 | + * |
|
46 | + * @return void |
|
47 | + */ |
|
48 | + public function setHttpHelper($httpHelper); |
|
49 | + |
|
50 | + /** |
|
51 | + * @return WikiTextHelper |
|
52 | + */ |
|
53 | + public function getWikiTextHelper(); |
|
54 | + |
|
55 | + /** |
|
56 | + * @param WikiTextHelper $wikiTextHelper |
|
57 | + * |
|
58 | + * @return void |
|
59 | + */ |
|
60 | + public function setWikiTextHelper($wikiTextHelper); |
|
61 | + |
|
62 | + /** |
|
63 | + * @return ILocationProvider |
|
64 | + */ |
|
65 | + public function getLocationProvider(); |
|
66 | + |
|
67 | + /** |
|
68 | + * @param ILocationProvider $locationProvider |
|
69 | + * |
|
70 | + * @return void |
|
71 | + */ |
|
72 | + public function setLocationProvider(ILocationProvider $locationProvider); |
|
73 | + |
|
74 | + /** |
|
75 | + * @return IXffTrustProvider |
|
76 | + */ |
|
77 | + public function getXffTrustProvider(); |
|
78 | + |
|
79 | + /** |
|
80 | + * @param IXffTrustProvider $xffTrustProvider |
|
81 | + * |
|
82 | + * @return void |
|
83 | + */ |
|
84 | + public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider); |
|
85 | + |
|
86 | + /** |
|
87 | + * @return IRDnsProvider |
|
88 | + */ |
|
89 | + public function getRdnsProvider(); |
|
90 | + |
|
91 | + /** |
|
92 | + * @param IRDnsProvider $rdnsProvider |
|
93 | + * |
|
94 | + * @return void |
|
95 | + */ |
|
96 | + public function setRdnsProvider($rdnsProvider); |
|
97 | + |
|
98 | + /** |
|
99 | + * @return IAntiSpoofProvider |
|
100 | + */ |
|
101 | + public function getAntiSpoofProvider(); |
|
102 | + |
|
103 | + /** |
|
104 | + * @param IAntiSpoofProvider $antiSpoofProvider |
|
105 | + * |
|
106 | + * @return void |
|
107 | + */ |
|
108 | + public function setAntiSpoofProvider($antiSpoofProvider); |
|
109 | + |
|
110 | + /** |
|
111 | + * @return PdoDatabase |
|
112 | + */ |
|
113 | + public function getDatabase(); |
|
114 | + |
|
115 | + /** |
|
116 | + * @param PdoDatabase $database |
|
117 | + * |
|
118 | + * @return void |
|
119 | + */ |
|
120 | + public function setDatabase($database); |
|
121 | + |
|
122 | + /** |
|
123 | + * @return IOAuthProtocolHelper |
|
124 | + */ |
|
125 | + public function getOAuthProtocolHelper(); |
|
126 | + |
|
127 | + /** |
|
128 | + * @param IOAuthProtocolHelper $oauthProtocolHelper |
|
129 | + * |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + public function setOAuthProtocolHelper($oauthProtocolHelper); |
|
133 | + |
|
134 | + /** |
|
135 | + * @return void |
|
136 | + */ |
|
137 | + public function execute(); |
|
138 | + |
|
139 | + /** |
|
140 | + * Sets the site configuration object for this page |
|
141 | + * |
|
142 | + * @param SiteConfiguration $configuration |
|
143 | + * |
|
144 | + * @return void |
|
145 | + */ |
|
146 | + public function setSiteConfiguration($configuration); |
|
147 | + |
|
148 | + /** |
|
149 | + * @return IrcNotificationHelper |
|
150 | + */ |
|
151 | + public function getNotificationHelper(); |
|
152 | + |
|
153 | + /** |
|
154 | + * @param IrcNotificationHelper $notificationHelper |
|
155 | + * |
|
156 | + * @return void |
|
157 | + */ |
|
158 | + public function setNotificationHelper($notificationHelper); |
|
159 | + |
|
160 | + /** |
|
161 | + * @return TorExitProvider |
|
162 | + */ |
|
163 | + public function getTorExitProvider(); |
|
164 | + |
|
165 | + /** |
|
166 | + * @param TorExitProvider $torExitProvider |
|
167 | + * |
|
168 | + * @return void |
|
169 | + */ |
|
170 | + public function setTorExitProvider($torExitProvider); |
|
171 | 171 | } |
172 | 172 | \ No newline at end of file |
@@ -23,229 +23,229 @@ |
||
23 | 23 | |
24 | 24 | abstract class TaskBase implements ITask |
25 | 25 | { |
26 | - /** @var SiteConfiguration */ |
|
27 | - private $siteConfiguration; |
|
28 | - /** @var IEmailHelper */ |
|
29 | - private $emailHelper; |
|
30 | - /** @var HttpHelper */ |
|
31 | - private $httpHelper; |
|
32 | - /** @var WikiTextHelper */ |
|
33 | - private $wikiTextHelper; |
|
34 | - /** @var ILocationProvider */ |
|
35 | - private $locationProvider; |
|
36 | - /** @var IXffTrustProvider */ |
|
37 | - private $xffTrustProvider; |
|
38 | - /** @var IRDnsProvider */ |
|
39 | - private $rdnsProvider; |
|
40 | - /** @var IAntiSpoofProvider */ |
|
41 | - private $antiSpoofProvider; |
|
42 | - /** @var IOAuthProtocolHelper */ |
|
43 | - private $oauthHelper; |
|
44 | - /** @var PdoDatabase */ |
|
45 | - private $database; |
|
46 | - /** @var IrcNotificationHelper */ |
|
47 | - private $notificationHelper; |
|
48 | - /** @var TorExitProvider */ |
|
49 | - private $torExitProvider; |
|
50 | - |
|
51 | - /** |
|
52 | - * @return IEmailHelper |
|
53 | - */ |
|
54 | - final public function getEmailHelper() |
|
55 | - { |
|
56 | - return $this->emailHelper; |
|
57 | - } |
|
58 | - |
|
59 | - /** |
|
60 | - * @param IEmailHelper $emailHelper |
|
61 | - */ |
|
62 | - final public function setEmailHelper($emailHelper) |
|
63 | - { |
|
64 | - $this->emailHelper = $emailHelper; |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * @return HttpHelper |
|
69 | - */ |
|
70 | - final public function getHttpHelper() |
|
71 | - { |
|
72 | - return $this->httpHelper; |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * @param HttpHelper $httpHelper |
|
77 | - */ |
|
78 | - final public function setHttpHelper($httpHelper) |
|
79 | - { |
|
80 | - $this->httpHelper = $httpHelper; |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * @return WikiTextHelper |
|
85 | - */ |
|
86 | - final public function getWikiTextHelper() |
|
87 | - { |
|
88 | - return $this->wikiTextHelper; |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * @param WikiTextHelper $wikiTextHelper |
|
93 | - */ |
|
94 | - final public function setWikiTextHelper($wikiTextHelper) |
|
95 | - { |
|
96 | - $this->wikiTextHelper = $wikiTextHelper; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @return ILocationProvider |
|
101 | - */ |
|
102 | - final public function getLocationProvider() |
|
103 | - { |
|
104 | - return $this->locationProvider; |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * @param ILocationProvider $locationProvider |
|
109 | - */ |
|
110 | - final public function setLocationProvider(ILocationProvider $locationProvider) |
|
111 | - { |
|
112 | - $this->locationProvider = $locationProvider; |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * @return IXffTrustProvider |
|
117 | - */ |
|
118 | - final public function getXffTrustProvider() |
|
119 | - { |
|
120 | - return $this->xffTrustProvider; |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * @param IXffTrustProvider $xffTrustProvider |
|
125 | - */ |
|
126 | - final public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider) |
|
127 | - { |
|
128 | - $this->xffTrustProvider = $xffTrustProvider; |
|
129 | - } |
|
130 | - |
|
131 | - /** |
|
132 | - * @return IRDnsProvider |
|
133 | - */ |
|
134 | - final public function getRdnsProvider() |
|
135 | - { |
|
136 | - return $this->rdnsProvider; |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @param IRDnsProvider $rdnsProvider |
|
141 | - */ |
|
142 | - public function setRdnsProvider($rdnsProvider) |
|
143 | - { |
|
144 | - $this->rdnsProvider = $rdnsProvider; |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * @return IAntiSpoofProvider |
|
149 | - */ |
|
150 | - public function getAntiSpoofProvider() |
|
151 | - { |
|
152 | - return $this->antiSpoofProvider; |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * @param IAntiSpoofProvider $antiSpoofProvider |
|
157 | - */ |
|
158 | - public function setAntiSpoofProvider($antiSpoofProvider) |
|
159 | - { |
|
160 | - $this->antiSpoofProvider = $antiSpoofProvider; |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * @return PdoDatabase |
|
165 | - */ |
|
166 | - final public function getDatabase() |
|
167 | - { |
|
168 | - return $this->database; |
|
169 | - } |
|
170 | - |
|
171 | - /** |
|
172 | - * @param PdoDatabase $database |
|
173 | - */ |
|
174 | - final public function setDatabase($database) |
|
175 | - { |
|
176 | - $this->database = $database; |
|
177 | - } |
|
178 | - |
|
179 | - /** |
|
180 | - * @return IOAuthProtocolHelper |
|
181 | - */ |
|
182 | - public function getOAuthProtocolHelper() |
|
183 | - { |
|
184 | - return $this->oauthHelper; |
|
185 | - } |
|
186 | - |
|
187 | - /** |
|
188 | - * @param IOAuthProtocolHelper $oauthProtocolHelper |
|
189 | - */ |
|
190 | - public function setOAuthProtocolHelper($oauthProtocolHelper) |
|
191 | - { |
|
192 | - $this->oauthHelper = $oauthProtocolHelper; |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * @return void |
|
197 | - */ |
|
198 | - abstract public function execute(); |
|
199 | - |
|
200 | - /** |
|
201 | - * @return IrcNotificationHelper |
|
202 | - */ |
|
203 | - public function getNotificationHelper() |
|
204 | - { |
|
205 | - return $this->notificationHelper; |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * @param IrcNotificationHelper $notificationHelper |
|
210 | - */ |
|
211 | - public function setNotificationHelper($notificationHelper) |
|
212 | - { |
|
213 | - $this->notificationHelper = $notificationHelper; |
|
214 | - } |
|
215 | - |
|
216 | - /** |
|
217 | - * @return TorExitProvider |
|
218 | - */ |
|
219 | - public function getTorExitProvider() |
|
220 | - { |
|
221 | - return $this->torExitProvider; |
|
222 | - } |
|
223 | - |
|
224 | - /** |
|
225 | - * @param TorExitProvider $torExitProvider |
|
226 | - */ |
|
227 | - public function setTorExitProvider($torExitProvider) |
|
228 | - { |
|
229 | - $this->torExitProvider = $torExitProvider; |
|
230 | - } |
|
231 | - |
|
232 | - /** |
|
233 | - * Gets the site configuration object |
|
234 | - * |
|
235 | - * @return SiteConfiguration |
|
236 | - */ |
|
237 | - final protected function getSiteConfiguration() |
|
238 | - { |
|
239 | - return $this->siteConfiguration; |
|
240 | - } |
|
241 | - |
|
242 | - /** |
|
243 | - * Sets the site configuration object for this page |
|
244 | - * |
|
245 | - * @param SiteConfiguration $configuration |
|
246 | - */ |
|
247 | - final public function setSiteConfiguration($configuration) |
|
248 | - { |
|
249 | - $this->siteConfiguration = $configuration; |
|
250 | - } |
|
26 | + /** @var SiteConfiguration */ |
|
27 | + private $siteConfiguration; |
|
28 | + /** @var IEmailHelper */ |
|
29 | + private $emailHelper; |
|
30 | + /** @var HttpHelper */ |
|
31 | + private $httpHelper; |
|
32 | + /** @var WikiTextHelper */ |
|
33 | + private $wikiTextHelper; |
|
34 | + /** @var ILocationProvider */ |
|
35 | + private $locationProvider; |
|
36 | + /** @var IXffTrustProvider */ |
|
37 | + private $xffTrustProvider; |
|
38 | + /** @var IRDnsProvider */ |
|
39 | + private $rdnsProvider; |
|
40 | + /** @var IAntiSpoofProvider */ |
|
41 | + private $antiSpoofProvider; |
|
42 | + /** @var IOAuthProtocolHelper */ |
|
43 | + private $oauthHelper; |
|
44 | + /** @var PdoDatabase */ |
|
45 | + private $database; |
|
46 | + /** @var IrcNotificationHelper */ |
|
47 | + private $notificationHelper; |
|
48 | + /** @var TorExitProvider */ |
|
49 | + private $torExitProvider; |
|
50 | + |
|
51 | + /** |
|
52 | + * @return IEmailHelper |
|
53 | + */ |
|
54 | + final public function getEmailHelper() |
|
55 | + { |
|
56 | + return $this->emailHelper; |
|
57 | + } |
|
58 | + |
|
59 | + /** |
|
60 | + * @param IEmailHelper $emailHelper |
|
61 | + */ |
|
62 | + final public function setEmailHelper($emailHelper) |
|
63 | + { |
|
64 | + $this->emailHelper = $emailHelper; |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * @return HttpHelper |
|
69 | + */ |
|
70 | + final public function getHttpHelper() |
|
71 | + { |
|
72 | + return $this->httpHelper; |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * @param HttpHelper $httpHelper |
|
77 | + */ |
|
78 | + final public function setHttpHelper($httpHelper) |
|
79 | + { |
|
80 | + $this->httpHelper = $httpHelper; |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * @return WikiTextHelper |
|
85 | + */ |
|
86 | + final public function getWikiTextHelper() |
|
87 | + { |
|
88 | + return $this->wikiTextHelper; |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * @param WikiTextHelper $wikiTextHelper |
|
93 | + */ |
|
94 | + final public function setWikiTextHelper($wikiTextHelper) |
|
95 | + { |
|
96 | + $this->wikiTextHelper = $wikiTextHelper; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @return ILocationProvider |
|
101 | + */ |
|
102 | + final public function getLocationProvider() |
|
103 | + { |
|
104 | + return $this->locationProvider; |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * @param ILocationProvider $locationProvider |
|
109 | + */ |
|
110 | + final public function setLocationProvider(ILocationProvider $locationProvider) |
|
111 | + { |
|
112 | + $this->locationProvider = $locationProvider; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * @return IXffTrustProvider |
|
117 | + */ |
|
118 | + final public function getXffTrustProvider() |
|
119 | + { |
|
120 | + return $this->xffTrustProvider; |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * @param IXffTrustProvider $xffTrustProvider |
|
125 | + */ |
|
126 | + final public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider) |
|
127 | + { |
|
128 | + $this->xffTrustProvider = $xffTrustProvider; |
|
129 | + } |
|
130 | + |
|
131 | + /** |
|
132 | + * @return IRDnsProvider |
|
133 | + */ |
|
134 | + final public function getRdnsProvider() |
|
135 | + { |
|
136 | + return $this->rdnsProvider; |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @param IRDnsProvider $rdnsProvider |
|
141 | + */ |
|
142 | + public function setRdnsProvider($rdnsProvider) |
|
143 | + { |
|
144 | + $this->rdnsProvider = $rdnsProvider; |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * @return IAntiSpoofProvider |
|
149 | + */ |
|
150 | + public function getAntiSpoofProvider() |
|
151 | + { |
|
152 | + return $this->antiSpoofProvider; |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * @param IAntiSpoofProvider $antiSpoofProvider |
|
157 | + */ |
|
158 | + public function setAntiSpoofProvider($antiSpoofProvider) |
|
159 | + { |
|
160 | + $this->antiSpoofProvider = $antiSpoofProvider; |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * @return PdoDatabase |
|
165 | + */ |
|
166 | + final public function getDatabase() |
|
167 | + { |
|
168 | + return $this->database; |
|
169 | + } |
|
170 | + |
|
171 | + /** |
|
172 | + * @param PdoDatabase $database |
|
173 | + */ |
|
174 | + final public function setDatabase($database) |
|
175 | + { |
|
176 | + $this->database = $database; |
|
177 | + } |
|
178 | + |
|
179 | + /** |
|
180 | + * @return IOAuthProtocolHelper |
|
181 | + */ |
|
182 | + public function getOAuthProtocolHelper() |
|
183 | + { |
|
184 | + return $this->oauthHelper; |
|
185 | + } |
|
186 | + |
|
187 | + /** |
|
188 | + * @param IOAuthProtocolHelper $oauthProtocolHelper |
|
189 | + */ |
|
190 | + public function setOAuthProtocolHelper($oauthProtocolHelper) |
|
191 | + { |
|
192 | + $this->oauthHelper = $oauthProtocolHelper; |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * @return void |
|
197 | + */ |
|
198 | + abstract public function execute(); |
|
199 | + |
|
200 | + /** |
|
201 | + * @return IrcNotificationHelper |
|
202 | + */ |
|
203 | + public function getNotificationHelper() |
|
204 | + { |
|
205 | + return $this->notificationHelper; |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * @param IrcNotificationHelper $notificationHelper |
|
210 | + */ |
|
211 | + public function setNotificationHelper($notificationHelper) |
|
212 | + { |
|
213 | + $this->notificationHelper = $notificationHelper; |
|
214 | + } |
|
215 | + |
|
216 | + /** |
|
217 | + * @return TorExitProvider |
|
218 | + */ |
|
219 | + public function getTorExitProvider() |
|
220 | + { |
|
221 | + return $this->torExitProvider; |
|
222 | + } |
|
223 | + |
|
224 | + /** |
|
225 | + * @param TorExitProvider $torExitProvider |
|
226 | + */ |
|
227 | + public function setTorExitProvider($torExitProvider) |
|
228 | + { |
|
229 | + $this->torExitProvider = $torExitProvider; |
|
230 | + } |
|
231 | + |
|
232 | + /** |
|
233 | + * Gets the site configuration object |
|
234 | + * |
|
235 | + * @return SiteConfiguration |
|
236 | + */ |
|
237 | + final protected function getSiteConfiguration() |
|
238 | + { |
|
239 | + return $this->siteConfiguration; |
|
240 | + } |
|
241 | + |
|
242 | + /** |
|
243 | + * Sets the site configuration object for this page |
|
244 | + * |
|
245 | + * @param SiteConfiguration $configuration |
|
246 | + */ |
|
247 | + final public function setSiteConfiguration($configuration) |
|
248 | + { |
|
249 | + $this->siteConfiguration = $configuration; |
|
250 | + } |
|
251 | 251 | } |
252 | 252 | \ No newline at end of file |
@@ -14,42 +14,42 @@ discard block |
||
14 | 14 | |
15 | 15 | class OAuthToken extends DataObject |
16 | 16 | { |
17 | - /** @var int */ |
|
18 | - private $user; |
|
19 | - /** @var string */ |
|
20 | - private $token; |
|
21 | - /** @var string */ |
|
22 | - private $secret; |
|
23 | - /** @var string */ |
|
24 | - private $type; |
|
25 | - /** @var string */ |
|
26 | - private $expiry; |
|
27 | - |
|
28 | - public function save() |
|
29 | - { |
|
30 | - if ($this->isNew()) { |
|
31 | - // insert |
|
32 | - $statement = $this->dbObject->prepare(<<<SQL |
|
17 | + /** @var int */ |
|
18 | + private $user; |
|
19 | + /** @var string */ |
|
20 | + private $token; |
|
21 | + /** @var string */ |
|
22 | + private $secret; |
|
23 | + /** @var string */ |
|
24 | + private $type; |
|
25 | + /** @var string */ |
|
26 | + private $expiry; |
|
27 | + |
|
28 | + public function save() |
|
29 | + { |
|
30 | + if ($this->isNew()) { |
|
31 | + // insert |
|
32 | + $statement = $this->dbObject->prepare(<<<SQL |
|
33 | 33 | INSERT INTO oauthtoken ( user, token, secret, type, expiry ) |
34 | 34 | VALUES ( :user, :token, :secret, :type, :expiry ); |
35 | 35 | SQL |
36 | - ); |
|
37 | - $statement->bindValue(":user", $this->user); |
|
38 | - $statement->bindValue(":token", $this->token); |
|
39 | - $statement->bindValue(":secret", $this->secret); |
|
40 | - $statement->bindValue(":type", $this->type); |
|
41 | - $statement->bindValue(":expiry", $this->expiry); |
|
42 | - |
|
43 | - if ($statement->execute()) { |
|
44 | - $this->id = (int)$this->dbObject->lastInsertId(); |
|
45 | - } |
|
46 | - else { |
|
47 | - throw new Exception($statement->errorInfo()); |
|
48 | - } |
|
49 | - } |
|
50 | - else { |
|
51 | - // update |
|
52 | - $statement = $this->dbObject->prepare(<<<SQL |
|
36 | + ); |
|
37 | + $statement->bindValue(":user", $this->user); |
|
38 | + $statement->bindValue(":token", $this->token); |
|
39 | + $statement->bindValue(":secret", $this->secret); |
|
40 | + $statement->bindValue(":type", $this->type); |
|
41 | + $statement->bindValue(":expiry", $this->expiry); |
|
42 | + |
|
43 | + if ($statement->execute()) { |
|
44 | + $this->id = (int)$this->dbObject->lastInsertId(); |
|
45 | + } |
|
46 | + else { |
|
47 | + throw new Exception($statement->errorInfo()); |
|
48 | + } |
|
49 | + } |
|
50 | + else { |
|
51 | + // update |
|
52 | + $statement = $this->dbObject->prepare(<<<SQL |
|
53 | 53 | UPDATE oauthtoken |
54 | 54 | SET token = :token |
55 | 55 | , secret = :secret |
@@ -58,109 +58,109 @@ discard block |
||
58 | 58 | , updateversion = updateversion + 1 |
59 | 59 | WHERE id = :id AND updateversion = :updateversion; |
60 | 60 | SQL |
61 | - ); |
|
62 | - |
|
63 | - $statement->bindValue(':id', $this->id); |
|
64 | - $statement->bindValue(':updateversion', $this->updateversion); |
|
65 | - |
|
66 | - $statement->bindValue(":token", $this->token); |
|
67 | - $statement->bindValue(":secret", $this->secret); |
|
68 | - $statement->bindValue(":type", $this->type); |
|
69 | - $statement->bindValue(":expiry", $this->expiry); |
|
70 | - |
|
71 | - if (!$statement->execute()) { |
|
72 | - throw new Exception($statement->errorInfo()); |
|
73 | - } |
|
74 | - |
|
75 | - if ($statement->rowCount() !== 1) { |
|
76 | - throw new OptimisticLockFailedException(); |
|
77 | - } |
|
78 | - |
|
79 | - $this->updateversion++; |
|
80 | - } |
|
81 | - } |
|
82 | - |
|
83 | - #region properties |
|
84 | - |
|
85 | - /** |
|
86 | - * @return mixed |
|
87 | - */ |
|
88 | - public function getUserId() |
|
89 | - { |
|
90 | - return $this->user; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * @param mixed $user |
|
95 | - */ |
|
96 | - public function setUserId($user) |
|
97 | - { |
|
98 | - $this->user = $user; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @return mixed |
|
103 | - */ |
|
104 | - public function getToken() |
|
105 | - { |
|
106 | - return $this->token; |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * @param mixed $token |
|
111 | - */ |
|
112 | - public function setToken($token) |
|
113 | - { |
|
114 | - $this->token = $token; |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * @return mixed |
|
119 | - */ |
|
120 | - public function getSecret() |
|
121 | - { |
|
122 | - return $this->secret; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * @param mixed $secret |
|
127 | - */ |
|
128 | - public function setSecret($secret) |
|
129 | - { |
|
130 | - $this->secret = $secret; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * @return mixed |
|
135 | - */ |
|
136 | - public function getType() |
|
137 | - { |
|
138 | - return $this->type; |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * @param mixed $type |
|
143 | - */ |
|
144 | - public function setType($type) |
|
145 | - { |
|
146 | - $this->type = $type; |
|
147 | - } |
|
148 | - |
|
149 | - /** |
|
150 | - * @return string |
|
151 | - */ |
|
152 | - public function getExpiry() |
|
153 | - { |
|
154 | - return $this->expiry; |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * @param string $expiry |
|
159 | - */ |
|
160 | - public function setExpiry($expiry) |
|
161 | - { |
|
162 | - $this->expiry = $expiry; |
|
163 | - } |
|
164 | - #endregion |
|
61 | + ); |
|
62 | + |
|
63 | + $statement->bindValue(':id', $this->id); |
|
64 | + $statement->bindValue(':updateversion', $this->updateversion); |
|
65 | + |
|
66 | + $statement->bindValue(":token", $this->token); |
|
67 | + $statement->bindValue(":secret", $this->secret); |
|
68 | + $statement->bindValue(":type", $this->type); |
|
69 | + $statement->bindValue(":expiry", $this->expiry); |
|
70 | + |
|
71 | + if (!$statement->execute()) { |
|
72 | + throw new Exception($statement->errorInfo()); |
|
73 | + } |
|
74 | + |
|
75 | + if ($statement->rowCount() !== 1) { |
|
76 | + throw new OptimisticLockFailedException(); |
|
77 | + } |
|
78 | + |
|
79 | + $this->updateversion++; |
|
80 | + } |
|
81 | + } |
|
82 | + |
|
83 | + #region properties |
|
84 | + |
|
85 | + /** |
|
86 | + * @return mixed |
|
87 | + */ |
|
88 | + public function getUserId() |
|
89 | + { |
|
90 | + return $this->user; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * @param mixed $user |
|
95 | + */ |
|
96 | + public function setUserId($user) |
|
97 | + { |
|
98 | + $this->user = $user; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @return mixed |
|
103 | + */ |
|
104 | + public function getToken() |
|
105 | + { |
|
106 | + return $this->token; |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * @param mixed $token |
|
111 | + */ |
|
112 | + public function setToken($token) |
|
113 | + { |
|
114 | + $this->token = $token; |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * @return mixed |
|
119 | + */ |
|
120 | + public function getSecret() |
|
121 | + { |
|
122 | + return $this->secret; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * @param mixed $secret |
|
127 | + */ |
|
128 | + public function setSecret($secret) |
|
129 | + { |
|
130 | + $this->secret = $secret; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * @return mixed |
|
135 | + */ |
|
136 | + public function getType() |
|
137 | + { |
|
138 | + return $this->type; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * @param mixed $type |
|
143 | + */ |
|
144 | + public function setType($type) |
|
145 | + { |
|
146 | + $this->type = $type; |
|
147 | + } |
|
148 | + |
|
149 | + /** |
|
150 | + * @return string |
|
151 | + */ |
|
152 | + public function getExpiry() |
|
153 | + { |
|
154 | + return $this->expiry; |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * @param string $expiry |
|
159 | + */ |
|
160 | + public function setExpiry($expiry) |
|
161 | + { |
|
162 | + $this->expiry = $expiry; |
|
163 | + } |
|
164 | + #endregion |
|
165 | 165 | |
166 | 166 | } |
167 | 167 | \ No newline at end of file |