Failed Conditions
Push — newinternal-releasecandidate ( 327c61...a30d14 )
by Simon
15:28 queued 05:26
created
includes/RequestStatus.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 
11 11
 class RequestStatus
12 12
 {
13
-    const HOSPITAL = 'Hospital';
14
-    const JOBQUEUE = 'JobQueue';
15
-    const CLOSED = 'Closed';
13
+	const HOSPITAL = 'Hospital';
14
+	const JOBQUEUE = 'JobQueue';
15
+	const CLOSED = 'Closed';
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Background/Task/BotCreationTask.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/Background/Task/UserCreationTask.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/Background/Task/WelcomeUserTask.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -20,73 +20,73 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/Background/CreationTaskBase.php 1 patch
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -20,123 +20,123 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/Fragments/NavigationMenuAccessControl.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -25,48 +25,48 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/Fragments/RequestData.php 1 patch
Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -24,324 +24,324 @@
 block discarded – undo
24 24
 
25 25
 trait RequestData
26 26
 {
27
-    /**
28
-     * @var array Array of IP address classed as 'private' by RFC1918.
29
-     */
30
-    protected static $rfc1918ips = array(
31
-        "10.0.0.0"    => "10.255.255.255",
32
-        "172.16.0.0"  => "172.31.255.255",
33
-        "192.168.0.0" => "192.168.255.255",
34
-        "169.254.0.0" => "169.254.255.255",
35
-        "127.0.0.0"   => "127.255.255.255",
36
-    );
37
-
38
-    /**
39
-     * Gets a request object
40
-     *
41
-     * @param PdoDatabase $database  The database connection
42
-     * @param int         $requestId The ID of the request to retrieve
43
-     *
44
-     * @return Request
45
-     * @throws ApplicationLogicException
46
-     */
47
-    protected function getRequest(PdoDatabase $database, $requestId)
48
-    {
49
-        if ($requestId === null) {
50
-            throw new ApplicationLogicException("No request specified");
51
-        }
52
-
53
-        $request = Request::getById($requestId, $database);
54
-        if ($request === false || !is_a($request, Request::class)) {
55
-            throw new ApplicationLogicException('Could not load the requested request!');
56
-        }
57
-
58
-        return $request;
59
-    }
60
-
61
-    /**
62
-     * Returns a value stating whether the user is allowed to see private data or not
63
-     *
64
-     * @param Request $request
65
-     * @param User    $currentUser
66
-     *
67
-     * @return bool
68
-     * @category Security-Critical
69
-     */
70
-    protected function isAllowedPrivateData(Request $request, User $currentUser)
71
-    {
72
-        // Test the main security barrier for private data access using SecurityManager
73
-        if ($this->barrierTest('alwaysSeePrivateData', $currentUser, 'RequestData')) {
74
-            // Tool admins/check-users can always see private data
75
-            return true;
76
-        }
77
-
78
-        // reserving user is allowed to see the data
79
-        if ($currentUser->getId() === $request->getReserved()
80
-            && $request->getReserved() !== null
81
-            && $this->barrierTest('seePrivateDataWhenReserved', $currentUser, 'RequestData')
82
-        ) {
83
-            return true;
84
-        }
85
-
86
-        // user has the reveal hash
87
-        if (WebRequest::getString('hash') === $request->getRevealHash()
88
-            && $this->barrierTest('seePrivateDataWithHash', $currentUser, 'RequestData')
89
-        ) {
90
-            return true;
91
-        }
92
-
93
-        // nope. Not allowed.
94
-        return false;
95
-    }
96
-
97
-    /**
98
-     * Tests the security barrier for a specified action.
99
-     *
100
-     * Don't use within templates
101
-     *
102
-     * @param string      $action
103
-     *
104
-     * @param User        $user
105
-     * @param null|string $pageName
106
-     *
107
-     * @return bool
108
-     * @category Security-Critical
109
-     */
110
-    abstract protected function barrierTest($action, User $user, $pageName = null);
111
-
112
-    /**
113
-     * Gets the name of the route that has been passed from the request router.
114
-     * @return string
115
-     */
116
-    abstract protected function getRouteName();
117
-
118
-    /** @return SecurityManager */
119
-    abstract protected function getSecurityManager();
120
-
121
-    /**
122
-     * Sets the name of the template this page should display.
123
-     *
124
-     * @param string $name
125
-     */
126
-    abstract protected function setTemplate($name);
127
-
128
-    /** @return IXffTrustProvider */
129
-    abstract protected function getXffTrustProvider();
130
-
131
-    /** @return ILocationProvider */
132
-    abstract protected function getLocationProvider();
133
-
134
-    /** @return IRDnsProvider */
135
-    abstract protected function getRdnsProvider();
136
-
137
-    /**
138
-     * Assigns a Smarty variable
139
-     *
140
-     * @param  array|string $name  the template variable name(s)
141
-     * @param  mixed        $value the value to assign
142
-     */
143
-    abstract protected function assign($name, $value);
144
-
145
-    /**
146
-     * @param int         $requestReservationId
147
-     * @param PdoDatabase $database
148
-     * @param User        $currentUser
149
-     */
150
-    protected function setupReservationDetails($requestReservationId, PdoDatabase $database, User $currentUser)
151
-    {
152
-        $requestIsReserved = $requestReservationId !== null;
153
-        $this->assign('requestIsReserved', $requestIsReserved);
154
-        $this->assign('requestIsReservedByMe', false);
155
-
156
-        if ($requestIsReserved) {
157
-            $this->assign('requestReservedByName', User::getById($requestReservationId, $database)->getUsername());
158
-            $this->assign('requestReservedById', $requestReservationId);
159
-
160
-            if ($requestReservationId === $currentUser->getId()) {
161
-                $this->assign('requestIsReservedByMe', true);
162
-            }
163
-        }
164
-
165
-        $this->assign('canBreakReservation', $this->barrierTest('force', $currentUser, PageBreakReservation::class));
166
-    }
167
-
168
-    /**
169
-     * Adds private request data to Smarty. DO NOT USE WITHOUT FIRST CHECKING THAT THE USER IS AUTHORISED!
170
-     *
171
-     * @param Request           $request
172
-     * @param User              $currentUser
173
-     * @param SiteConfiguration $configuration
174
-     *
175
-     * @param PdoDatabase       $database
176
-     */
177
-    protected function setupPrivateData(
178
-        $request,
179
-        User $currentUser,
180
-        SiteConfiguration $configuration,
181
-        PdoDatabase $database
182
-    ) {
183
-        $xffProvider = $this->getXffTrustProvider();
184
-
185
-        $relatedEmailRequests = RequestSearchHelper::get($database)
186
-            ->byEmailAddress($request->getEmail())
187
-            ->withConfirmedEmail()
188
-            ->excludingPurgedData($configuration)
189
-            ->excludingRequest($request->getId())
190
-            ->fetch();
191
-
192
-        $this->assign('requestEmail', $request->getEmail());
193
-        $emailDomain = explode("@", $request->getEmail())[1];
194
-        $this->assign("emailurl", $emailDomain);
195
-        $this->assign('requestRelatedEmailRequestsCount', count($relatedEmailRequests));
196
-        $this->assign('requestRelatedEmailRequests', $relatedEmailRequests);
197
-
198
-        $trustedIp = $xffProvider->getTrustedClientIp($request->getIp(), $request->getForwardedIp());
199
-        $this->assign('requestTrustedIp', $trustedIp);
200
-        $this->assign('requestRealIp', $request->getIp());
201
-        $this->assign('requestForwardedIp', $request->getForwardedIp());
202
-
203
-        $trustedIpLocation = $this->getLocationProvider()->getIpLocation($trustedIp);
204
-        $this->assign('requestTrustedIpLocation', $trustedIpLocation);
205
-
206
-        $this->assign('requestHasForwardedIp', $request->getForwardedIp() !== null);
207
-
208
-        $relatedIpRequests = RequestSearchHelper::get($database)
209
-            ->byIp($trustedIp)
210
-            ->withConfirmedEmail()
211
-            ->excludingPurgedData($configuration)
212
-            ->excludingRequest($request->getId())
213
-            ->fetch();
214
-
215
-        $this->assign('requestRelatedIpRequestsCount', count($relatedIpRequests));
216
-        $this->assign('requestRelatedIpRequests', $relatedIpRequests);
217
-
218
-        $this->assign('showRevealLink', false);
219
-        if ($request->getReserved() === $currentUser->getId() ||
220
-            $this->barrierTest('alwaysSeeHash', $currentUser, 'RequestData')
221
-        ) {
222
-            $this->assign('showRevealLink', true);
223
-            $this->assign('revealHash', $request->getRevealHash());
224
-        }
225
-
226
-        $this->setupForwardedIpData($request);
227
-    }
228
-
229
-    /**
230
-     * Adds checkuser request data to Smarty. DO NOT USE WITHOUT FIRST CHECKING THAT THE USER IS AUTHORISED!
231
-     *
232
-     * @param Request $request
233
-     */
234
-    protected function setupCheckUserData(Request $request)
235
-    {
236
-        $this->assign('requestUserAgent', $request->getUserAgent());
237
-    }
238
-
239
-    /**
240
-     * Sets up the basic data for this request, and adds it to Smarty
241
-     *
242
-     * @param Request           $request
243
-     * @param SiteConfiguration $config
244
-     */
245
-    protected function setupBasicData(Request $request, SiteConfiguration $config)
246
-    {
247
-        $this->assign('requestId', $request->getId());
248
-        $this->assign('updateVersion', $request->getUpdateVersion());
249
-        $this->assign('requestName', $request->getName());
250
-        $this->assign('requestDate', $request->getDate());
251
-        $this->assign('requestStatus', $request->getStatus());
252
-
253
-        $isClosed = !array_key_exists($request->getStatus(), $config->getRequestStates())
254
-            && $request->getStatus() !== RequestStatus::HOSPITAL;
255
-        $this->assign('requestIsClosed', $isClosed);
256
-    }
257
-
258
-    /**
259
-     * Sets up the forwarded IP data for this request and adds it to Smarty
260
-     *
261
-     * @param Request $request
262
-     */
263
-    protected function setupForwardedIpData(Request $request)
264
-    {
265
-        if ($request->getForwardedIp() !== null) {
266
-            $requestProxyData = array(); // Initialize array to store data to be output in Smarty template.
267
-            $proxyIndex = 0;
268
-
269
-            // Assuming [client] <=> [proxy1] <=> [proxy2] <=> [proxy3] <=> [us], we will see an XFF header of [client],
270
-            // [proxy1], [proxy2], and our actual IP will be [proxy3]
271
-            $proxies = explode(",", $request->getForwardedIp());
272
-            $proxies[] = $request->getIp();
273
-
274
-            // Origin is the supposed "client" IP.
275
-            $origin = $proxies[0];
276
-            $this->assign("forwardedOrigin", $origin);
277
-
278
-            // We step through the servers in reverse order, from closest to furthest
279
-            $proxies = array_reverse($proxies);
280
-
281
-            // By default, we have trust, because the first in the chain is now REMOTE_ADDR, which is hardest to spoof.
282
-            $trust = true;
283
-
284
-            /**
285
-             * @var int    $index     The zero-based index of the proxy.
286
-             * @var string $proxyData The proxy IP address (although possibly not!)
287
-             */
288
-            foreach ($proxies as $index => $proxyData) {
289
-                $proxyAddress = trim($proxyData);
290
-                $requestProxyData[$proxyIndex]['ip'] = $proxyAddress;
291
-
292
-                // get data on this IP.
293
-                $thisProxyIsTrusted = $this->getXffTrustProvider()->isTrusted($proxyAddress);
294
-
295
-                $proxyIsInPrivateRange = $this->getXffTrustProvider()
296
-                    ->ipInRange(self::$rfc1918ips, $proxyAddress);
297
-
298
-                if (!$proxyIsInPrivateRange) {
299
-                    $proxyReverseDns = $this->getRdnsProvider()->getReverseDNS($proxyAddress);
300
-                    $proxyLocation = $this->getLocationProvider()->getIpLocation($proxyAddress);
301
-                }
302
-                else {
303
-                    // this is going to fail, so why bother trying?
304
-                    $proxyReverseDns = false;
305
-                    $proxyLocation = false;
306
-                }
307
-
308
-                // current trust chain status BEFORE this link
309
-                $preLinkTrust = $trust;
310
-
311
-                // is *this* link trusted? Note, this will be true even if there is an untrusted link before this!
312
-                $requestProxyData[$proxyIndex]['trustedlink'] = $thisProxyIsTrusted;
313
-
314
-                // set the trust status of the chain to this point
315
-                $trust = $trust & $thisProxyIsTrusted;
316
-
317
-                // If this is the origin address, and the chain was trusted before this point, then we can trust
318
-                // the origin.
319
-                if ($preLinkTrust && $proxyAddress == $origin) {
320
-                    // if this is the origin, then we are at the last point in the chain.
321
-                    // @todo: this is probably the cause of some bugs when an IP appears twice - we're missing a check
322
-                    // to see if this is *really* the last in the chain, rather than just the same IP as it.
323
-                    $trust = true;
324
-                }
325
-
326
-                $requestProxyData[$proxyIndex]['trust'] = $trust;
327
-
328
-                $requestProxyData[$proxyIndex]['rdnsfailed'] = $proxyReverseDns === false;
329
-                $requestProxyData[$proxyIndex]['rdns'] = $proxyReverseDns;
330
-                $requestProxyData[$proxyIndex]['routable'] = !$proxyIsInPrivateRange;
331
-
332
-                $requestProxyData[$proxyIndex]['location'] = $proxyLocation;
333
-
334
-                if ($proxyReverseDns === $proxyAddress && $proxyIsInPrivateRange === false) {
335
-                    $requestProxyData[$proxyIndex]['rdns'] = null;
336
-                }
337
-
338
-                $showLinks = (!$trust || $proxyAddress == $origin) && !$proxyIsInPrivateRange;
339
-                $requestProxyData[$proxyIndex]['showlinks'] = $showLinks;
340
-
341
-                $proxyIndex++;
342
-            }
343
-
344
-            $this->assign("requestProxyData", $requestProxyData);
345
-        }
346
-    }
27
+	/**
28
+	 * @var array Array of IP address classed as 'private' by RFC1918.
29
+	 */
30
+	protected static $rfc1918ips = array(
31
+		"10.0.0.0"    => "10.255.255.255",
32
+		"172.16.0.0"  => "172.31.255.255",
33
+		"192.168.0.0" => "192.168.255.255",
34
+		"169.254.0.0" => "169.254.255.255",
35
+		"127.0.0.0"   => "127.255.255.255",
36
+	);
37
+
38
+	/**
39
+	 * Gets a request object
40
+	 *
41
+	 * @param PdoDatabase $database  The database connection
42
+	 * @param int         $requestId The ID of the request to retrieve
43
+	 *
44
+	 * @return Request
45
+	 * @throws ApplicationLogicException
46
+	 */
47
+	protected function getRequest(PdoDatabase $database, $requestId)
48
+	{
49
+		if ($requestId === null) {
50
+			throw new ApplicationLogicException("No request specified");
51
+		}
52
+
53
+		$request = Request::getById($requestId, $database);
54
+		if ($request === false || !is_a($request, Request::class)) {
55
+			throw new ApplicationLogicException('Could not load the requested request!');
56
+		}
57
+
58
+		return $request;
59
+	}
60
+
61
+	/**
62
+	 * Returns a value stating whether the user is allowed to see private data or not
63
+	 *
64
+	 * @param Request $request
65
+	 * @param User    $currentUser
66
+	 *
67
+	 * @return bool
68
+	 * @category Security-Critical
69
+	 */
70
+	protected function isAllowedPrivateData(Request $request, User $currentUser)
71
+	{
72
+		// Test the main security barrier for private data access using SecurityManager
73
+		if ($this->barrierTest('alwaysSeePrivateData', $currentUser, 'RequestData')) {
74
+			// Tool admins/check-users can always see private data
75
+			return true;
76
+		}
77
+
78
+		// reserving user is allowed to see the data
79
+		if ($currentUser->getId() === $request->getReserved()
80
+			&& $request->getReserved() !== null
81
+			&& $this->barrierTest('seePrivateDataWhenReserved', $currentUser, 'RequestData')
82
+		) {
83
+			return true;
84
+		}
85
+
86
+		// user has the reveal hash
87
+		if (WebRequest::getString('hash') === $request->getRevealHash()
88
+			&& $this->barrierTest('seePrivateDataWithHash', $currentUser, 'RequestData')
89
+		) {
90
+			return true;
91
+		}
92
+
93
+		// nope. Not allowed.
94
+		return false;
95
+	}
96
+
97
+	/**
98
+	 * Tests the security barrier for a specified action.
99
+	 *
100
+	 * Don't use within templates
101
+	 *
102
+	 * @param string      $action
103
+	 *
104
+	 * @param User        $user
105
+	 * @param null|string $pageName
106
+	 *
107
+	 * @return bool
108
+	 * @category Security-Critical
109
+	 */
110
+	abstract protected function barrierTest($action, User $user, $pageName = null);
111
+
112
+	/**
113
+	 * Gets the name of the route that has been passed from the request router.
114
+	 * @return string
115
+	 */
116
+	abstract protected function getRouteName();
117
+
118
+	/** @return SecurityManager */
119
+	abstract protected function getSecurityManager();
120
+
121
+	/**
122
+	 * Sets the name of the template this page should display.
123
+	 *
124
+	 * @param string $name
125
+	 */
126
+	abstract protected function setTemplate($name);
127
+
128
+	/** @return IXffTrustProvider */
129
+	abstract protected function getXffTrustProvider();
130
+
131
+	/** @return ILocationProvider */
132
+	abstract protected function getLocationProvider();
133
+
134
+	/** @return IRDnsProvider */
135
+	abstract protected function getRdnsProvider();
136
+
137
+	/**
138
+	 * Assigns a Smarty variable
139
+	 *
140
+	 * @param  array|string $name  the template variable name(s)
141
+	 * @param  mixed        $value the value to assign
142
+	 */
143
+	abstract protected function assign($name, $value);
144
+
145
+	/**
146
+	 * @param int         $requestReservationId
147
+	 * @param PdoDatabase $database
148
+	 * @param User        $currentUser
149
+	 */
150
+	protected function setupReservationDetails($requestReservationId, PdoDatabase $database, User $currentUser)
151
+	{
152
+		$requestIsReserved = $requestReservationId !== null;
153
+		$this->assign('requestIsReserved', $requestIsReserved);
154
+		$this->assign('requestIsReservedByMe', false);
155
+
156
+		if ($requestIsReserved) {
157
+			$this->assign('requestReservedByName', User::getById($requestReservationId, $database)->getUsername());
158
+			$this->assign('requestReservedById', $requestReservationId);
159
+
160
+			if ($requestReservationId === $currentUser->getId()) {
161
+				$this->assign('requestIsReservedByMe', true);
162
+			}
163
+		}
164
+
165
+		$this->assign('canBreakReservation', $this->barrierTest('force', $currentUser, PageBreakReservation::class));
166
+	}
167
+
168
+	/**
169
+	 * Adds private request data to Smarty. DO NOT USE WITHOUT FIRST CHECKING THAT THE USER IS AUTHORISED!
170
+	 *
171
+	 * @param Request           $request
172
+	 * @param User              $currentUser
173
+	 * @param SiteConfiguration $configuration
174
+	 *
175
+	 * @param PdoDatabase       $database
176
+	 */
177
+	protected function setupPrivateData(
178
+		$request,
179
+		User $currentUser,
180
+		SiteConfiguration $configuration,
181
+		PdoDatabase $database
182
+	) {
183
+		$xffProvider = $this->getXffTrustProvider();
184
+
185
+		$relatedEmailRequests = RequestSearchHelper::get($database)
186
+			->byEmailAddress($request->getEmail())
187
+			->withConfirmedEmail()
188
+			->excludingPurgedData($configuration)
189
+			->excludingRequest($request->getId())
190
+			->fetch();
191
+
192
+		$this->assign('requestEmail', $request->getEmail());
193
+		$emailDomain = explode("@", $request->getEmail())[1];
194
+		$this->assign("emailurl", $emailDomain);
195
+		$this->assign('requestRelatedEmailRequestsCount', count($relatedEmailRequests));
196
+		$this->assign('requestRelatedEmailRequests', $relatedEmailRequests);
197
+
198
+		$trustedIp = $xffProvider->getTrustedClientIp($request->getIp(), $request->getForwardedIp());
199
+		$this->assign('requestTrustedIp', $trustedIp);
200
+		$this->assign('requestRealIp', $request->getIp());
201
+		$this->assign('requestForwardedIp', $request->getForwardedIp());
202
+
203
+		$trustedIpLocation = $this->getLocationProvider()->getIpLocation($trustedIp);
204
+		$this->assign('requestTrustedIpLocation', $trustedIpLocation);
205
+
206
+		$this->assign('requestHasForwardedIp', $request->getForwardedIp() !== null);
207
+
208
+		$relatedIpRequests = RequestSearchHelper::get($database)
209
+			->byIp($trustedIp)
210
+			->withConfirmedEmail()
211
+			->excludingPurgedData($configuration)
212
+			->excludingRequest($request->getId())
213
+			->fetch();
214
+
215
+		$this->assign('requestRelatedIpRequestsCount', count($relatedIpRequests));
216
+		$this->assign('requestRelatedIpRequests', $relatedIpRequests);
217
+
218
+		$this->assign('showRevealLink', false);
219
+		if ($request->getReserved() === $currentUser->getId() ||
220
+			$this->barrierTest('alwaysSeeHash', $currentUser, 'RequestData')
221
+		) {
222
+			$this->assign('showRevealLink', true);
223
+			$this->assign('revealHash', $request->getRevealHash());
224
+		}
225
+
226
+		$this->setupForwardedIpData($request);
227
+	}
228
+
229
+	/**
230
+	 * Adds checkuser request data to Smarty. DO NOT USE WITHOUT FIRST CHECKING THAT THE USER IS AUTHORISED!
231
+	 *
232
+	 * @param Request $request
233
+	 */
234
+	protected function setupCheckUserData(Request $request)
235
+	{
236
+		$this->assign('requestUserAgent', $request->getUserAgent());
237
+	}
238
+
239
+	/**
240
+	 * Sets up the basic data for this request, and adds it to Smarty
241
+	 *
242
+	 * @param Request           $request
243
+	 * @param SiteConfiguration $config
244
+	 */
245
+	protected function setupBasicData(Request $request, SiteConfiguration $config)
246
+	{
247
+		$this->assign('requestId', $request->getId());
248
+		$this->assign('updateVersion', $request->getUpdateVersion());
249
+		$this->assign('requestName', $request->getName());
250
+		$this->assign('requestDate', $request->getDate());
251
+		$this->assign('requestStatus', $request->getStatus());
252
+
253
+		$isClosed = !array_key_exists($request->getStatus(), $config->getRequestStates())
254
+			&& $request->getStatus() !== RequestStatus::HOSPITAL;
255
+		$this->assign('requestIsClosed', $isClosed);
256
+	}
257
+
258
+	/**
259
+	 * Sets up the forwarded IP data for this request and adds it to Smarty
260
+	 *
261
+	 * @param Request $request
262
+	 */
263
+	protected function setupForwardedIpData(Request $request)
264
+	{
265
+		if ($request->getForwardedIp() !== null) {
266
+			$requestProxyData = array(); // Initialize array to store data to be output in Smarty template.
267
+			$proxyIndex = 0;
268
+
269
+			// Assuming [client] <=> [proxy1] <=> [proxy2] <=> [proxy3] <=> [us], we will see an XFF header of [client],
270
+			// [proxy1], [proxy2], and our actual IP will be [proxy3]
271
+			$proxies = explode(",", $request->getForwardedIp());
272
+			$proxies[] = $request->getIp();
273
+
274
+			// Origin is the supposed "client" IP.
275
+			$origin = $proxies[0];
276
+			$this->assign("forwardedOrigin", $origin);
277
+
278
+			// We step through the servers in reverse order, from closest to furthest
279
+			$proxies = array_reverse($proxies);
280
+
281
+			// By default, we have trust, because the first in the chain is now REMOTE_ADDR, which is hardest to spoof.
282
+			$trust = true;
283
+
284
+			/**
285
+			 * @var int    $index     The zero-based index of the proxy.
286
+			 * @var string $proxyData The proxy IP address (although possibly not!)
287
+			 */
288
+			foreach ($proxies as $index => $proxyData) {
289
+				$proxyAddress = trim($proxyData);
290
+				$requestProxyData[$proxyIndex]['ip'] = $proxyAddress;
291
+
292
+				// get data on this IP.
293
+				$thisProxyIsTrusted = $this->getXffTrustProvider()->isTrusted($proxyAddress);
294
+
295
+				$proxyIsInPrivateRange = $this->getXffTrustProvider()
296
+					->ipInRange(self::$rfc1918ips, $proxyAddress);
297
+
298
+				if (!$proxyIsInPrivateRange) {
299
+					$proxyReverseDns = $this->getRdnsProvider()->getReverseDNS($proxyAddress);
300
+					$proxyLocation = $this->getLocationProvider()->getIpLocation($proxyAddress);
301
+				}
302
+				else {
303
+					// this is going to fail, so why bother trying?
304
+					$proxyReverseDns = false;
305
+					$proxyLocation = false;
306
+				}
307
+
308
+				// current trust chain status BEFORE this link
309
+				$preLinkTrust = $trust;
310
+
311
+				// is *this* link trusted? Note, this will be true even if there is an untrusted link before this!
312
+				$requestProxyData[$proxyIndex]['trustedlink'] = $thisProxyIsTrusted;
313
+
314
+				// set the trust status of the chain to this point
315
+				$trust = $trust & $thisProxyIsTrusted;
316
+
317
+				// If this is the origin address, and the chain was trusted before this point, then we can trust
318
+				// the origin.
319
+				if ($preLinkTrust && $proxyAddress == $origin) {
320
+					// if this is the origin, then we are at the last point in the chain.
321
+					// @todo: this is probably the cause of some bugs when an IP appears twice - we're missing a check
322
+					// to see if this is *really* the last in the chain, rather than just the same IP as it.
323
+					$trust = true;
324
+				}
325
+
326
+				$requestProxyData[$proxyIndex]['trust'] = $trust;
327
+
328
+				$requestProxyData[$proxyIndex]['rdnsfailed'] = $proxyReverseDns === false;
329
+				$requestProxyData[$proxyIndex]['rdns'] = $proxyReverseDns;
330
+				$requestProxyData[$proxyIndex]['routable'] = !$proxyIsInPrivateRange;
331
+
332
+				$requestProxyData[$proxyIndex]['location'] = $proxyLocation;
333
+
334
+				if ($proxyReverseDns === $proxyAddress && $proxyIsInPrivateRange === false) {
335
+					$requestProxyData[$proxyIndex]['rdns'] = null;
336
+				}
337
+
338
+				$showLinks = (!$trust || $proxyAddress == $origin) && !$proxyIsInPrivateRange;
339
+				$requestProxyData[$proxyIndex]['showlinks'] = $showLinks;
340
+
341
+				$proxyIndex++;
342
+			}
343
+
344
+			$this->assign("requestProxyData", $requestProxyData);
345
+		}
346
+	}
347 347
 }
Please login to merge, or discard this patch.
includes/Router/OAuthRequestRouter.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/Tasks/ITask.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -23,149 +23,149 @@
 block discarded – undo
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
Please login to merge, or discard this patch.