Passed
Push — master ( 1dce30...f6efd5 )
by Joas
15:03 queued 13s
created
apps/comments/lib/Listener/LoadAdditionalScripts.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@
 block discarded – undo
34 34
 use OCP\Util;
35 35
 
36 36
 class LoadAdditionalScripts implements IEventListener {
37
-	public function handle(Event $event): void {
38
-		if (!($event instanceof LoadAdditionalScriptsEvent)) {
39
-			return;
40
-		}
37
+    public function handle(Event $event): void {
38
+        if (!($event instanceof LoadAdditionalScriptsEvent)) {
39
+            return;
40
+        }
41 41
 
42
-		// TODO: make sure to only include the sidebar script when
43
-		// we properly split it between files list and sidebar
44
-		Util::addScript(Application::APP_ID, 'comments');
45
-	}
42
+        // TODO: make sure to only include the sidebar script when
43
+        // we properly split it between files list and sidebar
44
+        Util::addScript(Application::APP_ID, 'comments');
45
+    }
46 46
 
47 47
 }
Please login to merge, or discard this patch.
apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@
 block discarded – undo
194 194
 		$httpClient = $this->clientService->newClient();
195 195
 
196 196
 		try {
197
-			$response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare',
197
+			$response = $httpClient->post($remote.'/index.php/apps/federatedfilesharing/createFederatedShare',
198 198
 				[
199 199
 					'body' =>
200 200
 						[
Please login to merge, or discard this patch.
Indentation   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -57,188 +57,188 @@
 block discarded – undo
57 57
  */
58 58
 class MountPublicLinkController extends Controller {
59 59
 
60
-	/** @var FederatedShareProvider */
61
-	private $federatedShareProvider;
62
-
63
-	/** @var AddressHandler */
64
-	private $addressHandler;
65
-
66
-	/** @var IManager  */
67
-	private $shareManager;
68
-
69
-	/** @var  ISession */
70
-	private $session;
71
-
72
-	/** @var IL10N */
73
-	private $l;
74
-
75
-	/** @var IUserSession */
76
-	private $userSession;
77
-
78
-	/** @var IClientService */
79
-	private $clientService;
80
-
81
-	/** @var ICloudIdManager  */
82
-	private $cloudIdManager;
83
-
84
-	/**
85
-	 * MountPublicLinkController constructor.
86
-	 *
87
-	 * @param string $appName
88
-	 * @param IRequest $request
89
-	 * @param FederatedShareProvider $federatedShareProvider
90
-	 * @param IManager $shareManager
91
-	 * @param AddressHandler $addressHandler
92
-	 * @param ISession $session
93
-	 * @param IL10N $l
94
-	 * @param IUserSession $userSession
95
-	 * @param IClientService $clientService
96
-	 * @param ICloudIdManager $cloudIdManager
97
-	 */
98
-	public function __construct($appName,
99
-								IRequest $request,
100
-								FederatedShareProvider $federatedShareProvider,
101
-								IManager $shareManager,
102
-								AddressHandler $addressHandler,
103
-								ISession $session,
104
-								IL10N $l,
105
-								IUserSession $userSession,
106
-								IClientService $clientService,
107
-								ICloudIdManager $cloudIdManager
108
-	) {
109
-		parent::__construct($appName, $request);
110
-
111
-		$this->federatedShareProvider = $federatedShareProvider;
112
-		$this->shareManager = $shareManager;
113
-		$this->addressHandler = $addressHandler;
114
-		$this->session = $session;
115
-		$this->l = $l;
116
-		$this->userSession = $userSession;
117
-		$this->clientService = $clientService;
118
-		$this->cloudIdManager = $cloudIdManager;
119
-	}
120
-
121
-	/**
122
-	 * send federated share to a user of a public link
123
-	 *
124
-	 * @NoCSRFRequired
125
-	 * @PublicPage
126
-	 * @BruteForceProtection(action=publicLink2FederatedShare)
127
-	 *
128
-	 * @param string $shareWith
129
-	 * @param string $token
130
-	 * @param string $password
131
-	 * @return JSONResponse
132
-	 */
133
-	public function createFederatedShare($shareWith, $token, $password = '') {
134
-		if (!$this->federatedShareProvider->isOutgoingServer2serverShareEnabled()) {
135
-			return new JSONResponse(
136
-				['message' => 'This server doesn\'t support outgoing federated shares'],
137
-				Http::STATUS_BAD_REQUEST
138
-			);
139
-		}
140
-
141
-		try {
142
-			[, $server] = $this->addressHandler->splitUserRemote($shareWith);
143
-			$share = $this->shareManager->getShareByToken($token);
144
-		} catch (HintException $e) {
145
-			$response = new JSONResponse(['message' => $e->getHint()], Http::STATUS_BAD_REQUEST);
146
-			$response->throttle();
147
-			return $response;
148
-		}
149
-
150
-		// make sure that user is authenticated in case of a password protected link
151
-		$storedPassword = $share->getPassword();
152
-		$authenticated = $this->session->get('public_link_authenticated') === $share->getId() ||
153
-			$this->shareManager->checkPassword($share, $password);
154
-		if (!empty($storedPassword) && !$authenticated) {
155
-			$response = new JSONResponse(
156
-				['message' => 'No permission to access the share'],
157
-				Http::STATUS_BAD_REQUEST
158
-			);
159
-			$response->throttle();
160
-			return $response;
161
-		}
162
-
163
-		if (($share->getPermissions() & Constants::PERMISSION_READ) === 0) {
164
-			$response = new JSONResponse(
165
-				['message' => 'Mounting file drop not supported'],
166
-				Http::STATUS_BAD_REQUEST
167
-			);
168
-			$response->throttle();
169
-			return $response;
170
-		}
171
-
172
-		$share->setSharedWith($shareWith);
173
-		$share->setShareType(IShare::TYPE_REMOTE);
174
-
175
-		try {
176
-			$this->federatedShareProvider->create($share);
177
-		} catch (\Exception $e) {
178
-			\OC::$server->getLogger()->logException($e, [
179
-				'level' => ILogger::WARN,
180
-				'app' => 'federatedfilesharing',
181
-			]);
182
-			return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
183
-		}
184
-
185
-		return new JSONResponse(['remoteUrl' => $server]);
186
-	}
187
-
188
-	/**
189
-	 * ask other server to get a federated share
190
-	 *
191
-	 * @NoAdminRequired
192
-	 *
193
-	 * @param string $token
194
-	 * @param string $remote
195
-	 * @param string $password
196
-	 * @param string $owner (only for legacy reasons, can be removed with legacyMountPublicLink())
197
-	 * @param string $ownerDisplayName (only for legacy reasons, can be removed with legacyMountPublicLink())
198
-	 * @param string $name (only for legacy reasons, can be removed with legacyMountPublicLink())
199
-	 * @return JSONResponse
200
-	 */
201
-	public function askForFederatedShare($token, $remote, $password = '', $owner = '', $ownerDisplayName = '', $name = '') {
202
-		// check if server admin allows to mount public links from other servers
203
-		if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled() === false) {
204
-			return new JSONResponse(['message' => $this->l->t('Server to server sharing is not enabled on this server')], Http::STATUS_BAD_REQUEST);
205
-		}
206
-
207
-		$cloudId = $this->cloudIdManager->getCloudId($this->userSession->getUser()->getUID(), $this->addressHandler->generateRemoteURL());
208
-
209
-		$httpClient = $this->clientService->newClient();
210
-
211
-		try {
212
-			$response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare',
213
-				[
214
-					'body' =>
215
-						[
216
-							'token' => $token,
217
-							'shareWith' => rtrim($cloudId->getId(), '/'),
218
-							'password' => $password
219
-						],
220
-					'connect_timeout' => 10,
221
-				]
222
-			);
223
-		} catch (\Exception $e) {
224
-			if (empty($password)) {
225
-				$message = $this->l->t("Couldn't establish a federated share.");
226
-			} else {
227
-				$message = $this->l->t("Couldn't establish a federated share, maybe the password was wrong.");
228
-			}
229
-			return new JSONResponse(['message' => $message], Http::STATUS_BAD_REQUEST);
230
-		}
231
-
232
-		$body = $response->getBody();
233
-		$result = json_decode($body, true);
234
-
235
-		if (is_array($result) && isset($result['remoteUrl'])) {
236
-			return new JSONResponse(['message' => $this->l->t('Federated Share request sent, you will receive an invitation. Check your notifications.')]);
237
-		}
238
-
239
-		// if we doesn't get the expected response we assume that we try to add
240
-		// a federated share from a Nextcloud <= 9 server
241
-		$message = $this->l->t("Couldn't establish a federated share, it looks like the server to federate with is too old (Nextcloud <= 9).");
242
-		return new JSONResponse(['message' => $message], Http::STATUS_BAD_REQUEST);
243
-	}
60
+    /** @var FederatedShareProvider */
61
+    private $federatedShareProvider;
62
+
63
+    /** @var AddressHandler */
64
+    private $addressHandler;
65
+
66
+    /** @var IManager  */
67
+    private $shareManager;
68
+
69
+    /** @var  ISession */
70
+    private $session;
71
+
72
+    /** @var IL10N */
73
+    private $l;
74
+
75
+    /** @var IUserSession */
76
+    private $userSession;
77
+
78
+    /** @var IClientService */
79
+    private $clientService;
80
+
81
+    /** @var ICloudIdManager  */
82
+    private $cloudIdManager;
83
+
84
+    /**
85
+     * MountPublicLinkController constructor.
86
+     *
87
+     * @param string $appName
88
+     * @param IRequest $request
89
+     * @param FederatedShareProvider $federatedShareProvider
90
+     * @param IManager $shareManager
91
+     * @param AddressHandler $addressHandler
92
+     * @param ISession $session
93
+     * @param IL10N $l
94
+     * @param IUserSession $userSession
95
+     * @param IClientService $clientService
96
+     * @param ICloudIdManager $cloudIdManager
97
+     */
98
+    public function __construct($appName,
99
+                                IRequest $request,
100
+                                FederatedShareProvider $federatedShareProvider,
101
+                                IManager $shareManager,
102
+                                AddressHandler $addressHandler,
103
+                                ISession $session,
104
+                                IL10N $l,
105
+                                IUserSession $userSession,
106
+                                IClientService $clientService,
107
+                                ICloudIdManager $cloudIdManager
108
+    ) {
109
+        parent::__construct($appName, $request);
110
+
111
+        $this->federatedShareProvider = $federatedShareProvider;
112
+        $this->shareManager = $shareManager;
113
+        $this->addressHandler = $addressHandler;
114
+        $this->session = $session;
115
+        $this->l = $l;
116
+        $this->userSession = $userSession;
117
+        $this->clientService = $clientService;
118
+        $this->cloudIdManager = $cloudIdManager;
119
+    }
120
+
121
+    /**
122
+     * send federated share to a user of a public link
123
+     *
124
+     * @NoCSRFRequired
125
+     * @PublicPage
126
+     * @BruteForceProtection(action=publicLink2FederatedShare)
127
+     *
128
+     * @param string $shareWith
129
+     * @param string $token
130
+     * @param string $password
131
+     * @return JSONResponse
132
+     */
133
+    public function createFederatedShare($shareWith, $token, $password = '') {
134
+        if (!$this->federatedShareProvider->isOutgoingServer2serverShareEnabled()) {
135
+            return new JSONResponse(
136
+                ['message' => 'This server doesn\'t support outgoing federated shares'],
137
+                Http::STATUS_BAD_REQUEST
138
+            );
139
+        }
140
+
141
+        try {
142
+            [, $server] = $this->addressHandler->splitUserRemote($shareWith);
143
+            $share = $this->shareManager->getShareByToken($token);
144
+        } catch (HintException $e) {
145
+            $response = new JSONResponse(['message' => $e->getHint()], Http::STATUS_BAD_REQUEST);
146
+            $response->throttle();
147
+            return $response;
148
+        }
149
+
150
+        // make sure that user is authenticated in case of a password protected link
151
+        $storedPassword = $share->getPassword();
152
+        $authenticated = $this->session->get('public_link_authenticated') === $share->getId() ||
153
+            $this->shareManager->checkPassword($share, $password);
154
+        if (!empty($storedPassword) && !$authenticated) {
155
+            $response = new JSONResponse(
156
+                ['message' => 'No permission to access the share'],
157
+                Http::STATUS_BAD_REQUEST
158
+            );
159
+            $response->throttle();
160
+            return $response;
161
+        }
162
+
163
+        if (($share->getPermissions() & Constants::PERMISSION_READ) === 0) {
164
+            $response = new JSONResponse(
165
+                ['message' => 'Mounting file drop not supported'],
166
+                Http::STATUS_BAD_REQUEST
167
+            );
168
+            $response->throttle();
169
+            return $response;
170
+        }
171
+
172
+        $share->setSharedWith($shareWith);
173
+        $share->setShareType(IShare::TYPE_REMOTE);
174
+
175
+        try {
176
+            $this->federatedShareProvider->create($share);
177
+        } catch (\Exception $e) {
178
+            \OC::$server->getLogger()->logException($e, [
179
+                'level' => ILogger::WARN,
180
+                'app' => 'federatedfilesharing',
181
+            ]);
182
+            return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
183
+        }
184
+
185
+        return new JSONResponse(['remoteUrl' => $server]);
186
+    }
187
+
188
+    /**
189
+     * ask other server to get a federated share
190
+     *
191
+     * @NoAdminRequired
192
+     *
193
+     * @param string $token
194
+     * @param string $remote
195
+     * @param string $password
196
+     * @param string $owner (only for legacy reasons, can be removed with legacyMountPublicLink())
197
+     * @param string $ownerDisplayName (only for legacy reasons, can be removed with legacyMountPublicLink())
198
+     * @param string $name (only for legacy reasons, can be removed with legacyMountPublicLink())
199
+     * @return JSONResponse
200
+     */
201
+    public function askForFederatedShare($token, $remote, $password = '', $owner = '', $ownerDisplayName = '', $name = '') {
202
+        // check if server admin allows to mount public links from other servers
203
+        if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled() === false) {
204
+            return new JSONResponse(['message' => $this->l->t('Server to server sharing is not enabled on this server')], Http::STATUS_BAD_REQUEST);
205
+        }
206
+
207
+        $cloudId = $this->cloudIdManager->getCloudId($this->userSession->getUser()->getUID(), $this->addressHandler->generateRemoteURL());
208
+
209
+        $httpClient = $this->clientService->newClient();
210
+
211
+        try {
212
+            $response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare',
213
+                [
214
+                    'body' =>
215
+                        [
216
+                            'token' => $token,
217
+                            'shareWith' => rtrim($cloudId->getId(), '/'),
218
+                            'password' => $password
219
+                        ],
220
+                    'connect_timeout' => 10,
221
+                ]
222
+            );
223
+        } catch (\Exception $e) {
224
+            if (empty($password)) {
225
+                $message = $this->l->t("Couldn't establish a federated share.");
226
+            } else {
227
+                $message = $this->l->t("Couldn't establish a federated share, maybe the password was wrong.");
228
+            }
229
+            return new JSONResponse(['message' => $message], Http::STATUS_BAD_REQUEST);
230
+        }
231
+
232
+        $body = $response->getBody();
233
+        $result = json_decode($body, true);
234
+
235
+        if (is_array($result) && isset($result['remoteUrl'])) {
236
+            return new JSONResponse(['message' => $this->l->t('Federated Share request sent, you will receive an invitation. Check your notifications.')]);
237
+        }
238
+
239
+        // if we doesn't get the expected response we assume that we try to add
240
+        // a federated share from a Nextcloud <= 9 server
241
+        $message = $this->l->t("Couldn't establish a federated share, it looks like the server to federate with is too old (Nextcloud <= 9).");
242
+        return new JSONResponse(['message' => $message], Http::STATUS_BAD_REQUEST);
243
+    }
244 244
 }
Please login to merge, or discard this patch.
apps/files_versions/lib/Listener/LoadSidebarListener.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@
 block discarded – undo
34 34
 use OCP\Util;
35 35
 
36 36
 class LoadSidebarListener implements IEventListener {
37
-	public function handle(Event $event): void {
38
-		if (!($event instanceof LoadSidebar)) {
39
-			return;
40
-		}
37
+    public function handle(Event $event): void {
38
+        if (!($event instanceof LoadSidebar)) {
39
+            return;
40
+        }
41 41
 
42
-		// TODO: make sure to only include the sidebar script when
43
-		// we properly split it between files list and sidebar
44
-		Util::addScript(Application::APP_ID, 'files_versions');
45
-	}
42
+        // TODO: make sure to only include the sidebar script when
43
+        // we properly split it between files list and sidebar
44
+        Util::addScript(Application::APP_ID, 'files_versions');
45
+    }
46 46
 
47 47
 }
Please login to merge, or discard this patch.
apps/files_versions/lib/Listener/LoadAdditionalListener.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@
 block discarded – undo
34 34
 use OCP\Util;
35 35
 
36 36
 class LoadAdditionalListener implements IEventListener {
37
-	public function handle(Event $event): void {
38
-		if (!($event instanceof LoadAdditionalScriptsEvent)) {
39
-			return;
40
-		}
37
+    public function handle(Event $event): void {
38
+        if (!($event instanceof LoadAdditionalScriptsEvent)) {
39
+            return;
40
+        }
41 41
 
42
-		// TODO: make sure to only include the sidebar script when
43
-		// we properly split it between files list and sidebar
44
-		Util::addScript(Application::APP_ID, 'files_versions');
45
-	}
42
+        // TODO: make sure to only include the sidebar script when
43
+        // we properly split it between files list and sidebar
44
+        Util::addScript(Application::APP_ID, 'files_versions');
45
+    }
46 46
 
47 47
 }
Please login to merge, or discard this patch.
apps/updatenotification/lib/Command/Check.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		// Server
69 69
 		$r = $this->updateChecker->getUpdateState();
70 70
 		if (isset($r['updateAvailable']) && $r['updateAvailable']) {
71
-			$output->writeln($r['updateVersionString'] . ' is available. Get more information on how to update at '. $r['updateLink'] . '.');
71
+			$output->writeln($r['updateVersionString'].' is available. Get more information on how to update at '.$r['updateLink'].'.');
72 72
 			$updatesAvailableCount += 1;
73 73
 		}
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		foreach ($apps as $app) {
79 79
 			$update = $this->installer->isUpdateAvailable($app);
80 80
 			if ($update !== false) {
81
-				$output->writeln('Update for ' . $app . ' to version ' . $update . ' is available.');
81
+				$output->writeln('Update for '.$app.' to version '.$update.' is available.');
82 82
 				$updatesAvailableCount += 1;
83 83
 			}
84 84
 		}
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		} elseif ($updatesAvailableCount === 1) {
90 90
 			$output->writeln('<comment>1 update available</comment>');
91 91
 		} else {
92
-			$output->writeln('<comment>' . $updatesAvailableCount . ' updates available</comment>');
92
+			$output->writeln('<comment>'.$updatesAvailableCount.' updates available</comment>');
93 93
 		}
94 94
 
95 95
 		return 0;
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -37,65 +37,65 @@
 block discarded – undo
37 37
 
38 38
 class Check extends Command {
39 39
 
40
-	/**
41
-	 * @var Installer $installer
42
-	 */
43
-	private $installer;
40
+    /**
41
+     * @var Installer $installer
42
+     */
43
+    private $installer;
44 44
 
45
-	/**
46
-	 * @var AppManager $appManager
47
-	 */
48
-	private $appManager;
45
+    /**
46
+     * @var AppManager $appManager
47
+     */
48
+    private $appManager;
49 49
 
50
-	/**
51
-	 * @var UpdateChecker $updateChecker
52
-	 */
53
-	private $updateChecker;
50
+    /**
51
+     * @var UpdateChecker $updateChecker
52
+     */
53
+    private $updateChecker;
54 54
 
55
-	public function __construct(AppManager $appManager, UpdateChecker $updateChecker, Installer $installer) {
56
-		parent::__construct();
57
-		$this->installer = $installer;
58
-		$this->appManager = $appManager;
59
-		$this->updateChecker = $updateChecker;
60
-	}
55
+    public function __construct(AppManager $appManager, UpdateChecker $updateChecker, Installer $installer) {
56
+        parent::__construct();
57
+        $this->installer = $installer;
58
+        $this->appManager = $appManager;
59
+        $this->updateChecker = $updateChecker;
60
+    }
61 61
 
62
-	protected function configure(): void {
63
-		$this
64
-			->setName('update:check')
65
-			->setDescription('Check for server and app updates')
66
-		;
67
-	}
62
+    protected function configure(): void {
63
+        $this
64
+            ->setName('update:check')
65
+            ->setDescription('Check for server and app updates')
66
+        ;
67
+    }
68 68
 
69
-	protected function execute(InputInterface $input, OutputInterface $output): int {
70
-		$updatesAvailableCount = 0;
69
+    protected function execute(InputInterface $input, OutputInterface $output): int {
70
+        $updatesAvailableCount = 0;
71 71
 
72
-		// Server
73
-		$r = $this->updateChecker->getUpdateState();
74
-		if (isset($r['updateAvailable']) && $r['updateAvailable']) {
75
-			$output->writeln($r['updateVersionString'] . ' is available. Get more information on how to update at '. $r['updateLink'] . '.');
76
-			$updatesAvailableCount += 1;
77
-		}
72
+        // Server
73
+        $r = $this->updateChecker->getUpdateState();
74
+        if (isset($r['updateAvailable']) && $r['updateAvailable']) {
75
+            $output->writeln($r['updateVersionString'] . ' is available. Get more information on how to update at '. $r['updateLink'] . '.');
76
+            $updatesAvailableCount += 1;
77
+        }
78 78
 
79 79
 
80
-		// Apps
81
-		$apps = $this->appManager->getInstalledApps();
82
-		foreach ($apps as $app) {
83
-			$update = $this->installer->isUpdateAvailable($app);
84
-			if ($update !== false) {
85
-				$output->writeln('Update for ' . $app . ' to version ' . $update . ' is available.');
86
-				$updatesAvailableCount += 1;
87
-			}
88
-		}
80
+        // Apps
81
+        $apps = $this->appManager->getInstalledApps();
82
+        foreach ($apps as $app) {
83
+            $update = $this->installer->isUpdateAvailable($app);
84
+            if ($update !== false) {
85
+                $output->writeln('Update for ' . $app . ' to version ' . $update . ' is available.');
86
+                $updatesAvailableCount += 1;
87
+            }
88
+        }
89 89
 
90
-		// Report summary
91
-		if ($updatesAvailableCount === 0) {
92
-			$output->writeln('<info>Everything up to date</info>');
93
-		} elseif ($updatesAvailableCount === 1) {
94
-			$output->writeln('<comment>1 update available</comment>');
95
-		} else {
96
-			$output->writeln('<comment>' . $updatesAvailableCount . ' updates available</comment>');
97
-		}
90
+        // Report summary
91
+        if ($updatesAvailableCount === 0) {
92
+            $output->writeln('<info>Everything up to date</info>');
93
+        } elseif ($updatesAvailableCount === 1) {
94
+            $output->writeln('<comment>1 update available</comment>');
95
+        } else {
96
+            $output->writeln('<comment>' . $updatesAvailableCount . ' updates available</comment>');
97
+        }
98 98
 
99
-		return 0;
100
-	}
99
+        return 0;
100
+    }
101 101
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Notification/Listener.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -37,97 +37,97 @@
 block discarded – undo
37 37
 
38 38
 class Listener {
39 39
 
40
-	/** @var INotificationManager */
41
-	protected $notificationManager;
42
-	/** @var IShareManager */
43
-	protected $shareManager;
44
-	/** @var IGroupManager */
45
-	protected $groupManager;
46
-
47
-	public function __construct(
48
-		INotificationManager $notificationManager,
49
-		IShareManager $shareManager,
50
-		IGroupManager $groupManager
51
-	) {
52
-		$this->notificationManager = $notificationManager;
53
-		$this->shareManager = $shareManager;
54
-		$this->groupManager = $groupManager;
55
-	}
56
-
57
-	/**
58
-	 * @param GenericEvent $event
59
-	 */
60
-	public function shareNotification(GenericEvent $event): void {
61
-		/** @var IShare $share */
62
-		$share = $event->getSubject();
63
-		$notification = $this->instantiateNotification($share);
64
-
65
-		if ($share->getShareType() === IShare::TYPE_USER) {
66
-			$notification->setSubject(Notifier::INCOMING_USER_SHARE)
67
-				->setUser($share->getSharedWith());
68
-			$this->notificationManager->notify($notification);
69
-		} elseif ($share->getShareType() === IShare::TYPE_GROUP) {
70
-			$notification->setSubject(Notifier::INCOMING_GROUP_SHARE);
71
-			$group = $this->groupManager->get($share->getSharedWith());
72
-
73
-			foreach ($group->getUsers() as $user) {
74
-				if ($user->getUID() === $share->getShareOwner() ||
75
-					$user->getUID() === $share->getSharedBy()) {
76
-					continue;
77
-				}
78
-
79
-				$notification->setUser($user->getUID());
80
-				$this->notificationManager->notify($notification);
81
-			}
82
-		}
83
-	}
84
-
85
-	/**
86
-	 * @param GenericEvent $event
87
-	 */
88
-	public function userAddedToGroup(GenericEvent $event): void {
89
-		/** @var IGroup $group */
90
-		$group = $event->getSubject();
91
-		/** @var IUser $user */
92
-		$user = $event->getArgument('user');
93
-
94
-		$offset = 0;
95
-		while (true) {
96
-			$shares = $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_GROUP, null, 50, $offset);
97
-			if (empty($shares)) {
98
-				break;
99
-			}
100
-
101
-			foreach ($shares as $share) {
102
-				if ($share->getSharedWith() !== $group->getGID()) {
103
-					continue;
104
-				}
105
-
106
-				if ($user->getUID() === $share->getShareOwner() ||
107
-					$user->getUID() === $share->getSharedBy()) {
108
-					continue;
109
-				}
110
-
111
-				$notification = $this->instantiateNotification($share);
112
-				$notification->setSubject(Notifier::INCOMING_GROUP_SHARE)
113
-					->setUser($user->getUID());
114
-				$this->notificationManager->notify($notification);
115
-			}
116
-			$offset += 50;
117
-		}
118
-	}
119
-
120
-	/**
121
-	 * @param IShare $share
122
-	 * @return INotification
123
-	 */
124
-	protected function instantiateNotification(IShare $share): INotification {
125
-		$notification = $this->notificationManager->createNotification();
126
-		$notification
127
-			->setApp('files_sharing')
128
-			->setObject('share', $share->getFullId())
129
-			->setDateTime($share->getShareTime());
130
-
131
-		return $notification;
132
-	}
40
+    /** @var INotificationManager */
41
+    protected $notificationManager;
42
+    /** @var IShareManager */
43
+    protected $shareManager;
44
+    /** @var IGroupManager */
45
+    protected $groupManager;
46
+
47
+    public function __construct(
48
+        INotificationManager $notificationManager,
49
+        IShareManager $shareManager,
50
+        IGroupManager $groupManager
51
+    ) {
52
+        $this->notificationManager = $notificationManager;
53
+        $this->shareManager = $shareManager;
54
+        $this->groupManager = $groupManager;
55
+    }
56
+
57
+    /**
58
+     * @param GenericEvent $event
59
+     */
60
+    public function shareNotification(GenericEvent $event): void {
61
+        /** @var IShare $share */
62
+        $share = $event->getSubject();
63
+        $notification = $this->instantiateNotification($share);
64
+
65
+        if ($share->getShareType() === IShare::TYPE_USER) {
66
+            $notification->setSubject(Notifier::INCOMING_USER_SHARE)
67
+                ->setUser($share->getSharedWith());
68
+            $this->notificationManager->notify($notification);
69
+        } elseif ($share->getShareType() === IShare::TYPE_GROUP) {
70
+            $notification->setSubject(Notifier::INCOMING_GROUP_SHARE);
71
+            $group = $this->groupManager->get($share->getSharedWith());
72
+
73
+            foreach ($group->getUsers() as $user) {
74
+                if ($user->getUID() === $share->getShareOwner() ||
75
+                    $user->getUID() === $share->getSharedBy()) {
76
+                    continue;
77
+                }
78
+
79
+                $notification->setUser($user->getUID());
80
+                $this->notificationManager->notify($notification);
81
+            }
82
+        }
83
+    }
84
+
85
+    /**
86
+     * @param GenericEvent $event
87
+     */
88
+    public function userAddedToGroup(GenericEvent $event): void {
89
+        /** @var IGroup $group */
90
+        $group = $event->getSubject();
91
+        /** @var IUser $user */
92
+        $user = $event->getArgument('user');
93
+
94
+        $offset = 0;
95
+        while (true) {
96
+            $shares = $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_GROUP, null, 50, $offset);
97
+            if (empty($shares)) {
98
+                break;
99
+            }
100
+
101
+            foreach ($shares as $share) {
102
+                if ($share->getSharedWith() !== $group->getGID()) {
103
+                    continue;
104
+                }
105
+
106
+                if ($user->getUID() === $share->getShareOwner() ||
107
+                    $user->getUID() === $share->getSharedBy()) {
108
+                    continue;
109
+                }
110
+
111
+                $notification = $this->instantiateNotification($share);
112
+                $notification->setSubject(Notifier::INCOMING_GROUP_SHARE)
113
+                    ->setUser($user->getUID());
114
+                $this->notificationManager->notify($notification);
115
+            }
116
+            $offset += 50;
117
+        }
118
+    }
119
+
120
+    /**
121
+     * @param IShare $share
122
+     * @return INotification
123
+     */
124
+    protected function instantiateNotification(IShare $share): INotification {
125
+        $notification = $this->notificationManager->createNotification();
126
+        $notification
127
+            ->setApp('files_sharing')
128
+            ->setObject('share', $share->getFullId())
129
+            ->setDateTime($share->getShareTime());
130
+
131
+        return $notification;
132
+    }
133 133
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/Check/AbstractStringCheck.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -27,96 +27,96 @@
 block discarded – undo
27 27
 
28 28
 abstract class AbstractStringCheck implements ICheck {
29 29
 
30
-	/** @var array[] Nested array: [Pattern => [ActualValue => Regex Result]] */
31
-	protected $matches;
30
+    /** @var array[] Nested array: [Pattern => [ActualValue => Regex Result]] */
31
+    protected $matches;
32 32
 
33
-	/** @var IL10N */
34
-	protected $l;
33
+    /** @var IL10N */
34
+    protected $l;
35 35
 
36
-	/**
37
-	 * @param IL10N $l
38
-	 */
39
-	public function __construct(IL10N $l) {
40
-		$this->l = $l;
41
-	}
36
+    /**
37
+     * @param IL10N $l
38
+     */
39
+    public function __construct(IL10N $l) {
40
+        $this->l = $l;
41
+    }
42 42
 
43
-	/**
44
-	 * @return string
45
-	 */
46
-	abstract protected function getActualValue();
43
+    /**
44
+     * @return string
45
+     */
46
+    abstract protected function getActualValue();
47 47
 
48
-	/**
49
-	 * @param string $operator
50
-	 * @param string $value
51
-	 * @return bool
52
-	 */
53
-	public function executeCheck($operator, $value) {
54
-		$actualValue = $this->getActualValue();
55
-		return $this->executeStringCheck($operator, $value, $actualValue);
56
-	}
48
+    /**
49
+     * @param string $operator
50
+     * @param string $value
51
+     * @return bool
52
+     */
53
+    public function executeCheck($operator, $value) {
54
+        $actualValue = $this->getActualValue();
55
+        return $this->executeStringCheck($operator, $value, $actualValue);
56
+    }
57 57
 
58
-	/**
59
-	 * @param string $operator
60
-	 * @param string $checkValue
61
-	 * @param string $actualValue
62
-	 * @return bool
63
-	 */
64
-	protected function executeStringCheck($operator, $checkValue, $actualValue) {
65
-		if ($operator === 'is') {
66
-			return $checkValue === $actualValue;
67
-		} elseif ($operator === '!is') {
68
-			return $checkValue !== $actualValue;
69
-		} else {
70
-			$match = $this->match($checkValue, $actualValue);
71
-			if ($operator === 'matches') {
72
-				return $match === 1;
73
-			} else {
74
-				return $match === 0;
75
-			}
76
-		}
77
-	}
58
+    /**
59
+     * @param string $operator
60
+     * @param string $checkValue
61
+     * @param string $actualValue
62
+     * @return bool
63
+     */
64
+    protected function executeStringCheck($operator, $checkValue, $actualValue) {
65
+        if ($operator === 'is') {
66
+            return $checkValue === $actualValue;
67
+        } elseif ($operator === '!is') {
68
+            return $checkValue !== $actualValue;
69
+        } else {
70
+            $match = $this->match($checkValue, $actualValue);
71
+            if ($operator === 'matches') {
72
+                return $match === 1;
73
+            } else {
74
+                return $match === 0;
75
+            }
76
+        }
77
+    }
78 78
 
79
-	/**
80
-	 * @param string $operator
81
-	 * @param string $value
82
-	 * @throws \UnexpectedValueException
83
-	 */
84
-	public function validateCheck($operator, $value) {
85
-		if (!in_array($operator, ['is', '!is', 'matches', '!matches'])) {
86
-			throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
87
-		}
79
+    /**
80
+     * @param string $operator
81
+     * @param string $value
82
+     * @throws \UnexpectedValueException
83
+     */
84
+    public function validateCheck($operator, $value) {
85
+        if (!in_array($operator, ['is', '!is', 'matches', '!matches'])) {
86
+            throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1);
87
+        }
88 88
 
89
-		if (in_array($operator, ['matches', '!matches']) &&
90
-			  @preg_match($value, null) === false) {
91
-			throw new \UnexpectedValueException($this->l->t('The given regular expression is invalid'), 2);
92
-		}
93
-	}
89
+        if (in_array($operator, ['matches', '!matches']) &&
90
+              @preg_match($value, null) === false) {
91
+            throw new \UnexpectedValueException($this->l->t('The given regular expression is invalid'), 2);
92
+        }
93
+    }
94 94
 
95
-	public function supportedEntities(): array {
96
-		// universal by default
97
-		return [];
98
-	}
95
+    public function supportedEntities(): array {
96
+        // universal by default
97
+        return [];
98
+    }
99 99
 
100
-	public function isAvailableForScope(int $scope): bool {
101
-		// admin only by default
102
-		return $scope === IManager::SCOPE_ADMIN;
103
-	}
100
+    public function isAvailableForScope(int $scope): bool {
101
+        // admin only by default
102
+        return $scope === IManager::SCOPE_ADMIN;
103
+    }
104 104
 
105
-	/**
106
-	 * @param string $pattern
107
-	 * @param string $subject
108
-	 * @return int|bool
109
-	 */
110
-	protected function match($pattern, $subject) {
111
-		$patternHash = md5($pattern);
112
-		$subjectHash = md5($subject);
113
-		if (isset($this->matches[$patternHash][$subjectHash])) {
114
-			return $this->matches[$patternHash][$subjectHash];
115
-		}
116
-		if (!isset($this->matches[$patternHash])) {
117
-			$this->matches[$patternHash] = [];
118
-		}
119
-		$this->matches[$patternHash][$subjectHash] = preg_match($pattern, $subject);
120
-		return $this->matches[$patternHash][$subjectHash];
121
-	}
105
+    /**
106
+     * @param string $pattern
107
+     * @param string $subject
108
+     * @return int|bool
109
+     */
110
+    protected function match($pattern, $subject) {
111
+        $patternHash = md5($pattern);
112
+        $subjectHash = md5($subject);
113
+        if (isset($this->matches[$patternHash][$subjectHash])) {
114
+            return $this->matches[$patternHash][$subjectHash];
115
+        }
116
+        if (!isset($this->matches[$patternHash])) {
117
+            $this->matches[$patternHash] = [];
118
+        }
119
+        $this->matches[$patternHash][$subjectHash] = preg_match($pattern, $subject);
120
+        return $this->matches[$patternHash][$subjectHash];
121
+    }
122 122
 }
Please login to merge, or discard this patch.
apps/settings/templates/settings/empty.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,4 +21,4 @@
 block discarded – undo
21 21
  *
22 22
  */
23 23
 
24
-	# used for Personal/Additional settings as fallback for legacy settings
24
+    # used for Personal/Additional settings as fallback for legacy settings
Please login to merge, or discard this patch.
lib/private/Authentication/Login/TwoFactorCommand.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -35,61 +35,61 @@
 block discarded – undo
35 35
 
36 36
 class TwoFactorCommand extends ALoginCommand {
37 37
 
38
-	/** @var Manager */
39
-	private $twoFactorManager;
38
+    /** @var Manager */
39
+    private $twoFactorManager;
40 40
 
41
-	/** @var MandatoryTwoFactor */
42
-	private $mandatoryTwoFactor;
41
+    /** @var MandatoryTwoFactor */
42
+    private $mandatoryTwoFactor;
43 43
 
44
-	/** @var IURLGenerator */
45
-	private $urlGenerator;
44
+    /** @var IURLGenerator */
45
+    private $urlGenerator;
46 46
 
47
-	public function __construct(Manager $twoFactorManager,
48
-								MandatoryTwoFactor $mandatoryTwoFactor,
49
-								IURLGenerator $urlGenerator) {
50
-		$this->twoFactorManager = $twoFactorManager;
51
-		$this->mandatoryTwoFactor = $mandatoryTwoFactor;
52
-		$this->urlGenerator = $urlGenerator;
53
-	}
47
+    public function __construct(Manager $twoFactorManager,
48
+                                MandatoryTwoFactor $mandatoryTwoFactor,
49
+                                IURLGenerator $urlGenerator) {
50
+        $this->twoFactorManager = $twoFactorManager;
51
+        $this->mandatoryTwoFactor = $mandatoryTwoFactor;
52
+        $this->urlGenerator = $urlGenerator;
53
+    }
54 54
 
55
-	public function process(LoginData $loginData): LoginResult {
56
-		if (!$this->twoFactorManager->isTwoFactorAuthenticated($loginData->getUser())) {
57
-			return $this->processNextOrFinishSuccessfully($loginData);
58
-		}
55
+    public function process(LoginData $loginData): LoginResult {
56
+        if (!$this->twoFactorManager->isTwoFactorAuthenticated($loginData->getUser())) {
57
+            return $this->processNextOrFinishSuccessfully($loginData);
58
+        }
59 59
 
60
-		$this->twoFactorManager->prepareTwoFactorLogin($loginData->getUser(), $loginData->isRememberLogin());
60
+        $this->twoFactorManager->prepareTwoFactorLogin($loginData->getUser(), $loginData->isRememberLogin());
61 61
 
62
-		$providerSet = $this->twoFactorManager->getProviderSet($loginData->getUser());
63
-		$loginProviders = $this->twoFactorManager->getLoginSetupProviders($loginData->getUser());
64
-		$providers = $providerSet->getPrimaryProviders();
65
-		if (empty($providers)
66
-			&& !$providerSet->isProviderMissing()
67
-			&& !empty($loginProviders)
68
-			&& $this->mandatoryTwoFactor->isEnforcedFor($loginData->getUser())) {
69
-			// No providers set up, but 2FA is enforced and setup providers are available
70
-			$url = 'core.TwoFactorChallenge.setupProviders';
71
-			$urlParams = [];
72
-		} elseif (!$providerSet->isProviderMissing() && count($providers) === 1) {
73
-			// Single provider (and no missing ones), hence we can redirect to that provider's challenge page directly
74
-			/* @var $provider IProvider */
75
-			$provider = array_pop($providers);
76
-			$url = 'core.TwoFactorChallenge.showChallenge';
77
-			$urlParams = [
78
-				'challengeProviderId' => $provider->getId(),
79
-			];
80
-		} else {
81
-			$url = 'core.TwoFactorChallenge.selectChallenge';
82
-			$urlParams = [];
83
-		}
62
+        $providerSet = $this->twoFactorManager->getProviderSet($loginData->getUser());
63
+        $loginProviders = $this->twoFactorManager->getLoginSetupProviders($loginData->getUser());
64
+        $providers = $providerSet->getPrimaryProviders();
65
+        if (empty($providers)
66
+            && !$providerSet->isProviderMissing()
67
+            && !empty($loginProviders)
68
+            && $this->mandatoryTwoFactor->isEnforcedFor($loginData->getUser())) {
69
+            // No providers set up, but 2FA is enforced and setup providers are available
70
+            $url = 'core.TwoFactorChallenge.setupProviders';
71
+            $urlParams = [];
72
+        } elseif (!$providerSet->isProviderMissing() && count($providers) === 1) {
73
+            // Single provider (and no missing ones), hence we can redirect to that provider's challenge page directly
74
+            /* @var $provider IProvider */
75
+            $provider = array_pop($providers);
76
+            $url = 'core.TwoFactorChallenge.showChallenge';
77
+            $urlParams = [
78
+                'challengeProviderId' => $provider->getId(),
79
+            ];
80
+        } else {
81
+            $url = 'core.TwoFactorChallenge.selectChallenge';
82
+            $urlParams = [];
83
+        }
84 84
 
85
-		if ($loginData->getRedirectUrl() !== null) {
86
-			$urlParams['redirect_url'] = $loginData->getRedirectUrl();
87
-		}
85
+        if ($loginData->getRedirectUrl() !== null) {
86
+            $urlParams['redirect_url'] = $loginData->getRedirectUrl();
87
+        }
88 88
 
89
-		return LoginResult::success(
90
-			$loginData,
91
-			$this->urlGenerator->linkToRoute($url, $urlParams)
92
-		);
93
-	}
89
+        return LoginResult::success(
90
+            $loginData,
91
+            $this->urlGenerator->linkToRoute($url, $urlParams)
92
+        );
93
+    }
94 94
 
95 95
 }
Please login to merge, or discard this patch.