Passed
Push — master ( 8b6d8e...bffb34 )
by Morris
13:17 queued 11s
created
settings/Controller/CertificateController.php 1 patch
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -37,144 +37,144 @@
 block discarded – undo
37 37
  * @package OC\Settings\Controller
38 38
  */
39 39
 class CertificateController extends Controller {
40
-	/** @var ICertificateManager */
41
-	private $userCertificateManager;
42
-	/** @var ICertificateManager  */
43
-	private $systemCertificateManager;
44
-	/** @var IL10N */
45
-	private $l10n;
46
-	/** @var IAppManager */
47
-	private $appManager;
48
-
49
-	/**
50
-	 * @param string $appName
51
-	 * @param IRequest $request
52
-	 * @param ICertificateManager $userCertificateManager
53
-	 * @param ICertificateManager $systemCertificateManager
54
-	 * @param IL10N $l10n
55
-	 * @param IAppManager $appManager
56
-	 */
57
-	public function __construct($appName,
58
-								IRequest $request,
59
-								ICertificateManager $userCertificateManager,
60
-								ICertificateManager $systemCertificateManager,
61
-								IL10N $l10n,
62
-								IAppManager $appManager) {
63
-		parent::__construct($appName, $request);
64
-		$this->userCertificateManager = $userCertificateManager;
65
-		$this->systemCertificateManager = $systemCertificateManager;
66
-		$this->l10n = $l10n;
67
-		$this->appManager = $appManager;
68
-	}
69
-
70
-	/**
71
-	 * Add a new personal root certificate to the users' trust store
72
-	 *
73
-	 * @NoAdminRequired
74
-	 * @NoSubadminRequired
75
-	 * @return DataResponse
76
-	 */
77
-	public function addPersonalRootCertificate() {
78
-		return $this->addCertificate($this->userCertificateManager);
79
-	}
80
-
81
-	/**
82
-	 * Add a new root certificate to a trust store
83
-	 *
84
-	 * @param ICertificateManager $certificateManager
85
-	 * @return DataResponse
86
-	 */
87
-	private function addCertificate(ICertificateManager $certificateManager) {
88
-		$headers = [];
89
-
90
-		if ($this->isCertificateImportAllowed() === false) {
91
-			return new DataResponse(['message' => 'Individual certificate management disabled'], Http::STATUS_FORBIDDEN, $headers);
92
-		}
93
-
94
-		$file = $this->request->getUploadedFile('rootcert_import');
95
-		if (empty($file)) {
96
-			return new DataResponse(['message' => 'No file uploaded'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
97
-		}
98
-
99
-		try {
100
-			$certificate = $certificateManager->addCertificate(file_get_contents($file['tmp_name']), $file['name']);
101
-			return new DataResponse(
102
-				[
103
-					'name' => $certificate->getName(),
104
-					'commonName' => $certificate->getCommonName(),
105
-					'organization' => $certificate->getOrganization(),
106
-					'validFrom' => $certificate->getIssueDate()->getTimestamp(),
107
-					'validTill' => $certificate->getExpireDate()->getTimestamp(),
108
-					'validFromString' => $this->l10n->l('date', $certificate->getIssueDate()),
109
-					'validTillString' => $this->l10n->l('date', $certificate->getExpireDate()),
110
-					'issuer' => $certificate->getIssuerName(),
111
-					'issuerOrganization' => $certificate->getIssuerOrganization(),
112
-				],
113
-				Http::STATUS_OK,
114
-				$headers
115
-			);
116
-		} catch (\Exception $e) {
117
-			return new DataResponse(['An error occurred.'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
118
-		}
119
-	}
120
-
121
-	/**
122
-	 * Removes a personal root certificate from the users' trust store
123
-	 *
124
-	 * @NoAdminRequired
125
-	 * @NoSubadminRequired
126
-	 * @param string $certificateIdentifier
127
-	 * @return DataResponse
128
-	 */
129
-	public function removePersonalRootCertificate($certificateIdentifier) {
130
-
131
-		if ($this->isCertificateImportAllowed() === false) {
132
-			return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN);
133
-		}
134
-
135
-		$this->userCertificateManager->removeCertificate($certificateIdentifier);
136
-		return new DataResponse();
137
-	}
138
-
139
-	/**
140
-	 * check if certificate import is allowed
141
-	 *
142
-	 * @return bool
143
-	 */
144
-	protected function isCertificateImportAllowed() {
145
-		$externalStorageEnabled = $this->appManager->isEnabledForUser('files_external');
146
-		if ($externalStorageEnabled) {
147
-			/** @var \OCA\Files_External\Service\BackendService $backendService */
148
-			$backendService = \OC_Mount_Config::$app->getContainer()->query('\OCA\Files_External\Service\BackendService');
149
-			if ($backendService->isUserMountingAllowed()) {
150
-				return true;
151
-			}
152
-		}
153
-		return false;
154
-	}
155
-
156
-	/**
157
-	 * Add a new personal root certificate to the system's trust store
158
-	 *
159
-	 * @return DataResponse
160
-	 */
161
-	public function addSystemRootCertificate() {
162
-		return $this->addCertificate($this->systemCertificateManager);
163
-	}
164
-
165
-	/**
166
-	 * Removes a personal root certificate from the users' trust store
167
-	 *
168
-	 * @param string $certificateIdentifier
169
-	 * @return DataResponse
170
-	 */
171
-	public function removeSystemRootCertificate($certificateIdentifier) {
172
-
173
-		if ($this->isCertificateImportAllowed() === false) {
174
-			return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN);
175
-		}
176
-
177
-		$this->systemCertificateManager->removeCertificate($certificateIdentifier);
178
-		return new DataResponse();
179
-	}
40
+    /** @var ICertificateManager */
41
+    private $userCertificateManager;
42
+    /** @var ICertificateManager  */
43
+    private $systemCertificateManager;
44
+    /** @var IL10N */
45
+    private $l10n;
46
+    /** @var IAppManager */
47
+    private $appManager;
48
+
49
+    /**
50
+     * @param string $appName
51
+     * @param IRequest $request
52
+     * @param ICertificateManager $userCertificateManager
53
+     * @param ICertificateManager $systemCertificateManager
54
+     * @param IL10N $l10n
55
+     * @param IAppManager $appManager
56
+     */
57
+    public function __construct($appName,
58
+                                IRequest $request,
59
+                                ICertificateManager $userCertificateManager,
60
+                                ICertificateManager $systemCertificateManager,
61
+                                IL10N $l10n,
62
+                                IAppManager $appManager) {
63
+        parent::__construct($appName, $request);
64
+        $this->userCertificateManager = $userCertificateManager;
65
+        $this->systemCertificateManager = $systemCertificateManager;
66
+        $this->l10n = $l10n;
67
+        $this->appManager = $appManager;
68
+    }
69
+
70
+    /**
71
+     * Add a new personal root certificate to the users' trust store
72
+     *
73
+     * @NoAdminRequired
74
+     * @NoSubadminRequired
75
+     * @return DataResponse
76
+     */
77
+    public function addPersonalRootCertificate() {
78
+        return $this->addCertificate($this->userCertificateManager);
79
+    }
80
+
81
+    /**
82
+     * Add a new root certificate to a trust store
83
+     *
84
+     * @param ICertificateManager $certificateManager
85
+     * @return DataResponse
86
+     */
87
+    private function addCertificate(ICertificateManager $certificateManager) {
88
+        $headers = [];
89
+
90
+        if ($this->isCertificateImportAllowed() === false) {
91
+            return new DataResponse(['message' => 'Individual certificate management disabled'], Http::STATUS_FORBIDDEN, $headers);
92
+        }
93
+
94
+        $file = $this->request->getUploadedFile('rootcert_import');
95
+        if (empty($file)) {
96
+            return new DataResponse(['message' => 'No file uploaded'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
97
+        }
98
+
99
+        try {
100
+            $certificate = $certificateManager->addCertificate(file_get_contents($file['tmp_name']), $file['name']);
101
+            return new DataResponse(
102
+                [
103
+                    'name' => $certificate->getName(),
104
+                    'commonName' => $certificate->getCommonName(),
105
+                    'organization' => $certificate->getOrganization(),
106
+                    'validFrom' => $certificate->getIssueDate()->getTimestamp(),
107
+                    'validTill' => $certificate->getExpireDate()->getTimestamp(),
108
+                    'validFromString' => $this->l10n->l('date', $certificate->getIssueDate()),
109
+                    'validTillString' => $this->l10n->l('date', $certificate->getExpireDate()),
110
+                    'issuer' => $certificate->getIssuerName(),
111
+                    'issuerOrganization' => $certificate->getIssuerOrganization(),
112
+                ],
113
+                Http::STATUS_OK,
114
+                $headers
115
+            );
116
+        } catch (\Exception $e) {
117
+            return new DataResponse(['An error occurred.'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
118
+        }
119
+    }
120
+
121
+    /**
122
+     * Removes a personal root certificate from the users' trust store
123
+     *
124
+     * @NoAdminRequired
125
+     * @NoSubadminRequired
126
+     * @param string $certificateIdentifier
127
+     * @return DataResponse
128
+     */
129
+    public function removePersonalRootCertificate($certificateIdentifier) {
130
+
131
+        if ($this->isCertificateImportAllowed() === false) {
132
+            return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN);
133
+        }
134
+
135
+        $this->userCertificateManager->removeCertificate($certificateIdentifier);
136
+        return new DataResponse();
137
+    }
138
+
139
+    /**
140
+     * check if certificate import is allowed
141
+     *
142
+     * @return bool
143
+     */
144
+    protected function isCertificateImportAllowed() {
145
+        $externalStorageEnabled = $this->appManager->isEnabledForUser('files_external');
146
+        if ($externalStorageEnabled) {
147
+            /** @var \OCA\Files_External\Service\BackendService $backendService */
148
+            $backendService = \OC_Mount_Config::$app->getContainer()->query('\OCA\Files_External\Service\BackendService');
149
+            if ($backendService->isUserMountingAllowed()) {
150
+                return true;
151
+            }
152
+        }
153
+        return false;
154
+    }
155
+
156
+    /**
157
+     * Add a new personal root certificate to the system's trust store
158
+     *
159
+     * @return DataResponse
160
+     */
161
+    public function addSystemRootCertificate() {
162
+        return $this->addCertificate($this->systemCertificateManager);
163
+    }
164
+
165
+    /**
166
+     * Removes a personal root certificate from the users' trust store
167
+     *
168
+     * @param string $certificateIdentifier
169
+     * @return DataResponse
170
+     */
171
+    public function removeSystemRootCertificate($certificateIdentifier) {
172
+
173
+        if ($this->isCertificateImportAllowed() === false) {
174
+            return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN);
175
+        }
176
+
177
+        $this->systemCertificateManager->removeCertificate($certificateIdentifier);
178
+        return new DataResponse();
179
+    }
180 180
 }
Please login to merge, or discard this patch.
core/Controller/ContactsMenuController.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -33,46 +33,46 @@
 block discarded – undo
33 33
 
34 34
 class ContactsMenuController extends Controller {
35 35
 
36
-	/** @var Manager */
37
-	private $manager;
36
+    /** @var Manager */
37
+    private $manager;
38 38
 
39
-	/** @var IUserSession */
40
-	private $userSession;
39
+    /** @var IUserSession */
40
+    private $userSession;
41 41
 
42
-	/**
43
-	 * @param IRequest $request
44
-	 * @param IUserSession $userSession
45
-	 * @param Manager $manager
46
-	 */
47
-	public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) {
48
-		parent::__construct('core', $request);
49
-		$this->userSession = $userSession;
50
-		$this->manager = $manager;
51
-	}
42
+    /**
43
+     * @param IRequest $request
44
+     * @param IUserSession $userSession
45
+     * @param Manager $manager
46
+     */
47
+    public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) {
48
+        parent::__construct('core', $request);
49
+        $this->userSession = $userSession;
50
+        $this->manager = $manager;
51
+    }
52 52
 
53
-	/**
54
-	 * @NoAdminRequired
55
-	 *
56
-	 * @param string|null filter
57
-	 * @return \JsonSerializable[]
58
-	 */
59
-	public function index($filter = null) {
60
-		return $this->manager->getEntries($this->userSession->getUser(), $filter);
61
-	}
53
+    /**
54
+     * @NoAdminRequired
55
+     *
56
+     * @param string|null filter
57
+     * @return \JsonSerializable[]
58
+     */
59
+    public function index($filter = null) {
60
+        return $this->manager->getEntries($this->userSession->getUser(), $filter);
61
+    }
62 62
 
63
-	/**
64
-	 * @NoAdminRequired
65
-	 *
66
-	 * @param integer $shareType
67
-	 * @param string $shareWith
68
-	 * @return JSONResponse|\JsonSerializable
69
-	 */
70
-	public function findOne($shareType, $shareWith) {
71
-		$contact = $this->manager->findOne($this->userSession->getUser(), $shareType, $shareWith);
63
+    /**
64
+     * @NoAdminRequired
65
+     *
66
+     * @param integer $shareType
67
+     * @param string $shareWith
68
+     * @return JSONResponse|\JsonSerializable
69
+     */
70
+    public function findOne($shareType, $shareWith) {
71
+        $contact = $this->manager->findOne($this->userSession->getUser(), $shareType, $shareWith);
72 72
 
73
-		if ($contact) {
74
-			return $contact;
75
-		}
76
-		return new JSONResponse([], Http::STATUS_NOT_FOUND);
77
-	}
73
+        if ($contact) {
74
+            return $contact;
75
+        }
76
+        return new JSONResponse([], Http::STATUS_NOT_FOUND);
77
+    }
78 78
 }
Please login to merge, or discard this patch.
core/Controller/OCSController.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -30,122 +30,122 @@
 block discarded – undo
30 30
 
31 31
 class OCSController extends \OCP\AppFramework\OCSController {
32 32
 
33
-	/** @var CapabilitiesManager */
34
-	private $capabilitiesManager;
35
-	/** @var IUserSession */
36
-	private $userSession;
37
-	/** @var IUserManager */
38
-	private $userManager;
39
-	/** @var Manager */
40
-	private $keyManager;
33
+    /** @var CapabilitiesManager */
34
+    private $capabilitiesManager;
35
+    /** @var IUserSession */
36
+    private $userSession;
37
+    /** @var IUserManager */
38
+    private $userManager;
39
+    /** @var Manager */
40
+    private $keyManager;
41 41
 
42
-	/**
43
-	 * OCSController constructor.
44
-	 *
45
-	 * @param string $appName
46
-	 * @param IRequest $request
47
-	 * @param CapabilitiesManager $capabilitiesManager
48
-	 * @param IUserSession $userSession
49
-	 * @param IUserManager $userManager
50
-	 * @param Manager $keyManager
51
-	 */
52
-	public function __construct($appName,
53
-								IRequest $request,
54
-								CapabilitiesManager $capabilitiesManager,
55
-								IUserSession $userSession,
56
-								IUserManager $userManager,
57
-								Manager $keyManager) {
58
-		parent::__construct($appName, $request);
59
-		$this->capabilitiesManager = $capabilitiesManager;
60
-		$this->userSession = $userSession;
61
-		$this->userManager = $userManager;
62
-		$this->keyManager = $keyManager;
63
-	}
42
+    /**
43
+     * OCSController constructor.
44
+     *
45
+     * @param string $appName
46
+     * @param IRequest $request
47
+     * @param CapabilitiesManager $capabilitiesManager
48
+     * @param IUserSession $userSession
49
+     * @param IUserManager $userManager
50
+     * @param Manager $keyManager
51
+     */
52
+    public function __construct($appName,
53
+                                IRequest $request,
54
+                                CapabilitiesManager $capabilitiesManager,
55
+                                IUserSession $userSession,
56
+                                IUserManager $userManager,
57
+                                Manager $keyManager) {
58
+        parent::__construct($appName, $request);
59
+        $this->capabilitiesManager = $capabilitiesManager;
60
+        $this->userSession = $userSession;
61
+        $this->userManager = $userManager;
62
+        $this->keyManager = $keyManager;
63
+    }
64 64
 
65
-	/**
66
-	 * @PublicPage
67
-	 *
68
-	 * @return DataResponse
69
-	 */
70
-	public function getConfig() {
71
-		$data = [
72
-			'version' => '1.7',
73
-			'website' => 'Nextcloud',
74
-			'host' => $this->request->getServerHost(),
75
-			'contact' => '',
76
-			'ssl' => 'false',
77
-		];
65
+    /**
66
+     * @PublicPage
67
+     *
68
+     * @return DataResponse
69
+     */
70
+    public function getConfig() {
71
+        $data = [
72
+            'version' => '1.7',
73
+            'website' => 'Nextcloud',
74
+            'host' => $this->request->getServerHost(),
75
+            'contact' => '',
76
+            'ssl' => 'false',
77
+        ];
78 78
 
79
-		return new DataResponse($data);
80
-	}
79
+        return new DataResponse($data);
80
+    }
81 81
 
82
-	/**
83
-	 * @PublicPage
84
-	 *
85
-	 * @return DataResponse
86
-	 */
87
-	public function getCapabilities() {
88
-		$result = [];
89
-		list($major, $minor, $micro) = \OCP\Util::getVersion();
90
-		$result['version'] = array(
91
-			'major' => $major,
92
-			'minor' => $minor,
93
-			'micro' => $micro,
94
-			'string' => \OC_Util::getVersionString(),
95
-			'edition' => '',
96
-		);
82
+    /**
83
+     * @PublicPage
84
+     *
85
+     * @return DataResponse
86
+     */
87
+    public function getCapabilities() {
88
+        $result = [];
89
+        list($major, $minor, $micro) = \OCP\Util::getVersion();
90
+        $result['version'] = array(
91
+            'major' => $major,
92
+            'minor' => $minor,
93
+            'micro' => $micro,
94
+            'string' => \OC_Util::getVersionString(),
95
+            'edition' => '',
96
+        );
97 97
 
98
-		if($this->userSession->isLoggedIn()) {
99
-			$result['capabilities'] = $this->capabilitiesManager->getCapabilities();
100
-		} else {
101
-			$result['capabilities'] = $this->capabilitiesManager->getCapabilities(true);
102
-		}
98
+        if($this->userSession->isLoggedIn()) {
99
+            $result['capabilities'] = $this->capabilitiesManager->getCapabilities();
100
+        } else {
101
+            $result['capabilities'] = $this->capabilitiesManager->getCapabilities(true);
102
+        }
103 103
 
104
-		return new DataResponse($result);
105
-	}
104
+        return new DataResponse($result);
105
+    }
106 106
 
107
-	/**
108
-	 * @PublicPage
109
-	 * @BruteForceProtection(action=login)
110
-	 *
111
-	 * @param string $login
112
-	 * @param string $password
113
-	 * @return DataResponse
114
-	 */
115
-	public function personCheck($login = '', $password = '') {
116
-		if ($login !== '' && $password !== '') {
117
-			if ($this->userManager->checkPassword($login, $password)) {
118
-				return new DataResponse([
119
-					'person' => [
120
-						'personid' => $login
121
-					]
122
-				]);
123
-			}
107
+    /**
108
+     * @PublicPage
109
+     * @BruteForceProtection(action=login)
110
+     *
111
+     * @param string $login
112
+     * @param string $password
113
+     * @return DataResponse
114
+     */
115
+    public function personCheck($login = '', $password = '') {
116
+        if ($login !== '' && $password !== '') {
117
+            if ($this->userManager->checkPassword($login, $password)) {
118
+                return new DataResponse([
119
+                    'person' => [
120
+                        'personid' => $login
121
+                    ]
122
+                ]);
123
+            }
124 124
 
125
-			$response = new DataResponse([], 102);
126
-			$response->throttle();
127
-			return $response;
128
-		}
129
-		return new DataResponse([], 101);
130
-	}
125
+            $response = new DataResponse([], 102);
126
+            $response->throttle();
127
+            return $response;
128
+        }
129
+        return new DataResponse([], 101);
130
+    }
131 131
 
132
-	/**
133
-	 * @PublicPage
134
-	 *
135
-	 * @param string $cloudId
136
-	 * @return DataResponse
137
-	 */
138
-	public function getIdentityProof($cloudId) {
139
-		$userObject = $this->userManager->get($cloudId);
132
+    /**
133
+     * @PublicPage
134
+     *
135
+     * @param string $cloudId
136
+     * @return DataResponse
137
+     */
138
+    public function getIdentityProof($cloudId) {
139
+        $userObject = $this->userManager->get($cloudId);
140 140
 
141
-		if($userObject !== null) {
142
-			$key = $this->keyManager->getKey($userObject);
143
-			$data = [
144
-				'public' => $key->getPublic(),
145
-			];
146
-			return new DataResponse($data);
147
-		}
141
+        if($userObject !== null) {
142
+            $key = $this->keyManager->getKey($userObject);
143
+            $data = [
144
+                'public' => $key->getPublic(),
145
+            ];
146
+            return new DataResponse($data);
147
+        }
148 148
 
149
-		return new DataResponse(['User not found'], 404);
150
-	}
149
+        return new DataResponse(['User not found'], 404);
150
+    }
151 151
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Notification/Notifier.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -32,52 +32,52 @@
 block discarded – undo
32 32
 
33 33
 class Notifier implements INotifier {
34 34
 
35
-	/** @var IFactory */
36
-	protected $l10nFactory;
35
+    /** @var IFactory */
36
+    protected $l10nFactory;
37 37
 
38
-	/**
39
-	 * @param IFactory $l10nFactory
40
-	 */
41
-	 public function __construct(\OCP\L10N\IFactory $l10nFactory) {
42
-		$this->l10nFactory = $l10nFactory;
43
-	}
38
+    /**
39
+     * @param IFactory $l10nFactory
40
+     */
41
+        public function __construct(\OCP\L10N\IFactory $l10nFactory) {
42
+        $this->l10nFactory = $l10nFactory;
43
+    }
44 44
 
45
-	/**
46
-	 * @param INotification $notification
47
-	 * @param string $languageCode The code of the language that should be used to prepare the notification
48
-	 * @return INotification
49
-	 * @throws \InvalidArgumentException When the notification was not prepared by a notifier
50
-	 */
51
-	public function prepare(INotification $notification, $languageCode) {
52
-		if ($notification->getApp() !== 'user_ldap') {
53
-			// Not my app => throw
54
-			throw new \InvalidArgumentException();
55
-		}
45
+    /**
46
+     * @param INotification $notification
47
+     * @param string $languageCode The code of the language that should be used to prepare the notification
48
+     * @return INotification
49
+     * @throws \InvalidArgumentException When the notification was not prepared by a notifier
50
+     */
51
+    public function prepare(INotification $notification, $languageCode) {
52
+        if ($notification->getApp() !== 'user_ldap') {
53
+            // Not my app => throw
54
+            throw new \InvalidArgumentException();
55
+        }
56 56
 
57
-		// Read the language from the notification
58
-		$l = $this->l10nFactory->get('user_ldap', $languageCode);
57
+        // Read the language from the notification
58
+        $l = $this->l10nFactory->get('user_ldap', $languageCode);
59 59
 
60
-		switch ($notification->getSubject()) {
61
-			// Deal with known subjects
62
-			case 'pwd_exp_warn_days':
63
-				$params = $notification->getSubjectParameters();
64
-				$days = (int) $params[0];
65
-				if ($days === 2) {
66
-					$notification->setParsedSubject($l->t('Your password will expire tomorrow.'));
67
-				} else if ($days === 1) {
68
-					$notification->setParsedSubject($l->t('Your password will expire today.'));
69
-				} else {
70
-					$notification->setParsedSubject($l->n(
71
-						'Your password will expire within %n day.',
72
-						'Your password will expire within %n days.',
73
-						$days
74
-					));
75
-				}
76
-				return $notification;
60
+        switch ($notification->getSubject()) {
61
+            // Deal with known subjects
62
+            case 'pwd_exp_warn_days':
63
+                $params = $notification->getSubjectParameters();
64
+                $days = (int) $params[0];
65
+                if ($days === 2) {
66
+                    $notification->setParsedSubject($l->t('Your password will expire tomorrow.'));
67
+                } else if ($days === 1) {
68
+                    $notification->setParsedSubject($l->t('Your password will expire today.'));
69
+                } else {
70
+                    $notification->setParsedSubject($l->n(
71
+                        'Your password will expire within %n day.',
72
+                        'Your password will expire within %n days.',
73
+                        $days
74
+                    ));
75
+                }
76
+                return $notification;
77 77
 
78
-			default:
79
-				// Unknown subject => Unknown notification => throw
80
-				throw new \InvalidArgumentException();
81
-		}
82
-	}
78
+            default:
79
+                // Unknown subject => Unknown notification => throw
80
+                throw new \InvalidArgumentException();
81
+        }
82
+    }
83 83
 }
Please login to merge, or discard this patch.
apps/comments/appinfo/routes.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
  */
22 22
 
23 23
 return [
24
-	'routes' => [
25
-		['name' => 'Notifications#view', 'url' => '/notifications/view/{id}', 'verb' => 'GET'],
26
-	]
24
+    'routes' => [
25
+        ['name' => 'Notifications#view', 'url' => '/notifications/view/{id}', 'verb' => 'GET'],
26
+    ]
27 27
 ];
Please login to merge, or discard this patch.
apps/dav/lib/Connector/LegacyDAVACL.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -32,42 +32,42 @@
 block discarded – undo
32 32
 
33 33
 class LegacyDAVACL extends DavAclPlugin {
34 34
 
35
-	/**
36
-	 * @inheritdoc
37
-	 */
38
-	public function getCurrentUserPrincipals() {
39
-		$principalV2 = $this->getCurrentUserPrincipal();
35
+    /**
36
+     * @inheritdoc
37
+     */
38
+    public function getCurrentUserPrincipals() {
39
+        $principalV2 = $this->getCurrentUserPrincipal();
40 40
 
41
-		if (is_null($principalV2)) return [];
41
+        if (is_null($principalV2)) return [];
42 42
 
43
-		$principalV1 = $this->convertPrincipal($principalV2, false);
44
-		return array_merge(
45
-			[
46
-				$principalV2,
47
-				$principalV1
48
-			],
49
-			$this->getPrincipalMembership($principalV1)
50
-		);
51
-	}
43
+        $principalV1 = $this->convertPrincipal($principalV2, false);
44
+        return array_merge(
45
+            [
46
+                $principalV2,
47
+                $principalV1
48
+            ],
49
+            $this->getPrincipalMembership($principalV1)
50
+        );
51
+    }
52 52
 
53
-	private function convertPrincipal($principal, $toV2) {
54
-		list(, $name) = \Sabre\Uri\split($principal);
55
-		if ($toV2) {
56
-			return "principals/users/$name";
57
-		}
58
-		return "principals/$name";
59
-	}
53
+    private function convertPrincipal($principal, $toV2) {
54
+        list(, $name) = \Sabre\Uri\split($principal);
55
+        if ($toV2) {
56
+            return "principals/users/$name";
57
+        }
58
+        return "principals/$name";
59
+    }
60 60
 
61
-	public function propFind(PropFind $propFind, INode $node) {
62
-		/* Overload current-user-principal */
63
-		$propFind->handle('{DAV:}current-user-principal', function () {
64
-			if ($url = parent::getCurrentUserPrincipal()) {
65
-				return new Principal(Principal::HREF, $url . '/');
66
-			} else {
67
-				return new Principal(Principal::UNAUTHENTICATED);
68
-			}
69
-		});
61
+    public function propFind(PropFind $propFind, INode $node) {
62
+        /* Overload current-user-principal */
63
+        $propFind->handle('{DAV:}current-user-principal', function () {
64
+            if ($url = parent::getCurrentUserPrincipal()) {
65
+                return new Principal(Principal::HREF, $url . '/');
66
+            } else {
67
+                return new Principal(Principal::UNAUTHENTICATED);
68
+            }
69
+        });
70 70
 
71
-		return parent::propFind($propFind, $node);
72
-	}
71
+        return parent::propFind($propFind, $node);
72
+    }
73 73
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/Backend.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -57,110 +57,110 @@
 block discarded – undo
57 57
  */
58 58
 class Backend implements \JsonSerializable {
59 59
 
60
-	use VisibilityTrait;
61
-	use FrontendDefinitionTrait;
62
-	use PriorityTrait;
63
-	use DependencyTrait;
64
-	use StorageModifierTrait;
65
-	use IdentifierTrait;
66
-
67
-	/** @var string storage class */
68
-	private $storageClass;
69
-
70
-	/** @var array 'scheme' => true, supported authentication schemes */
71
-	private $authSchemes = [];
72
-
73
-	/** @var AuthMechanism|callable authentication mechanism fallback */
74
-	private $legacyAuthMechanism;
75
-
76
-	/**
77
-	 * @return string
78
-	 */
79
-	public function getStorageClass() {
80
-		return $this->storageClass;
81
-	}
82
-
83
-	/**
84
-	 * @param string $class
85
-	 * @return $this
86
-	 */
87
-	public function setStorageClass($class) {
88
-		$this->storageClass = $class;
89
-		return $this;
90
-	}
91
-
92
-	/**
93
-	 * @return array
94
-	 */
95
-	public function getAuthSchemes() {
96
-		if (empty($this->authSchemes)) {
97
-			return [AuthMechanism::SCHEME_NULL => true];
98
-		}
99
-		return $this->authSchemes;
100
-	}
101
-
102
-	/**
103
-	 * @param string $scheme
104
-	 * @return self
105
-	 */
106
-	public function addAuthScheme($scheme) {
107
-		$this->authSchemes[$scheme] = true;
108
-		return $this;
109
-	}
110
-
111
-	/**
112
-	 * @param array $parameters storage parameters, for dynamic mechanism selection
113
-	 * @return AuthMechanism
114
-	 */
115
-	public function getLegacyAuthMechanism(array $parameters = []) {
116
-		if (is_callable($this->legacyAuthMechanism)) {
117
-			return call_user_func($this->legacyAuthMechanism, $parameters);
118
-		}
119
-		return $this->legacyAuthMechanism;
120
-	}
121
-
122
-	/**
123
-	 * @param AuthMechanism $authMechanism
124
-	 * @return self
125
-	 */
126
-	public function setLegacyAuthMechanism(AuthMechanism $authMechanism) {
127
-		$this->legacyAuthMechanism = $authMechanism;
128
-		return $this;
129
-	}
130
-
131
-	/**
132
-	 * @param callable $callback dynamic auth mechanism selection
133
-	 * @return self
134
-	 */
135
-	public function setLegacyAuthMechanismCallback(callable $callback) {
136
-		$this->legacyAuthMechanism = $callback;
137
-	}
138
-
139
-	/**
140
-	 * Serialize into JSON for client-side JS
141
-	 *
142
-	 * @return array
143
-	 */
144
-	public function jsonSerialize() {
145
-		$data = $this->jsonSerializeDefinition();
146
-		$data += $this->jsonSerializeIdentifier();
147
-
148
-		$data['backend'] = $data['name']; // legacy compat
149
-		$data['priority'] = $this->getPriority();
150
-		$data['authSchemes'] = $this->getAuthSchemes();
151
-
152
-		return $data;
153
-	}
154
-
155
-	/**
156
-	 * Check if parameters are satisfied in a StorageConfig
157
-	 *
158
-	 * @param StorageConfig $storage
159
-	 * @return bool
160
-	 */
161
-	public function validateStorage(StorageConfig $storage) {
162
-		return $this->validateStorageDefinition($storage);
163
-	}
60
+    use VisibilityTrait;
61
+    use FrontendDefinitionTrait;
62
+    use PriorityTrait;
63
+    use DependencyTrait;
64
+    use StorageModifierTrait;
65
+    use IdentifierTrait;
66
+
67
+    /** @var string storage class */
68
+    private $storageClass;
69
+
70
+    /** @var array 'scheme' => true, supported authentication schemes */
71
+    private $authSchemes = [];
72
+
73
+    /** @var AuthMechanism|callable authentication mechanism fallback */
74
+    private $legacyAuthMechanism;
75
+
76
+    /**
77
+     * @return string
78
+     */
79
+    public function getStorageClass() {
80
+        return $this->storageClass;
81
+    }
82
+
83
+    /**
84
+     * @param string $class
85
+     * @return $this
86
+     */
87
+    public function setStorageClass($class) {
88
+        $this->storageClass = $class;
89
+        return $this;
90
+    }
91
+
92
+    /**
93
+     * @return array
94
+     */
95
+    public function getAuthSchemes() {
96
+        if (empty($this->authSchemes)) {
97
+            return [AuthMechanism::SCHEME_NULL => true];
98
+        }
99
+        return $this->authSchemes;
100
+    }
101
+
102
+    /**
103
+     * @param string $scheme
104
+     * @return self
105
+     */
106
+    public function addAuthScheme($scheme) {
107
+        $this->authSchemes[$scheme] = true;
108
+        return $this;
109
+    }
110
+
111
+    /**
112
+     * @param array $parameters storage parameters, for dynamic mechanism selection
113
+     * @return AuthMechanism
114
+     */
115
+    public function getLegacyAuthMechanism(array $parameters = []) {
116
+        if (is_callable($this->legacyAuthMechanism)) {
117
+            return call_user_func($this->legacyAuthMechanism, $parameters);
118
+        }
119
+        return $this->legacyAuthMechanism;
120
+    }
121
+
122
+    /**
123
+     * @param AuthMechanism $authMechanism
124
+     * @return self
125
+     */
126
+    public function setLegacyAuthMechanism(AuthMechanism $authMechanism) {
127
+        $this->legacyAuthMechanism = $authMechanism;
128
+        return $this;
129
+    }
130
+
131
+    /**
132
+     * @param callable $callback dynamic auth mechanism selection
133
+     * @return self
134
+     */
135
+    public function setLegacyAuthMechanismCallback(callable $callback) {
136
+        $this->legacyAuthMechanism = $callback;
137
+    }
138
+
139
+    /**
140
+     * Serialize into JSON for client-side JS
141
+     *
142
+     * @return array
143
+     */
144
+    public function jsonSerialize() {
145
+        $data = $this->jsonSerializeDefinition();
146
+        $data += $this->jsonSerializeIdentifier();
147
+
148
+        $data['backend'] = $data['name']; // legacy compat
149
+        $data['priority'] = $this->getPriority();
150
+        $data['authSchemes'] = $this->getAuthSchemes();
151
+
152
+        return $data;
153
+    }
154
+
155
+    /**
156
+     * Check if parameters are satisfied in a StorageConfig
157
+     *
158
+     * @param StorageConfig $storage
159
+     * @return bool
160
+     */
161
+    public function validateStorage(StorageConfig $storage) {
162
+        return $this->validateStorageDefinition($storage);
163
+    }
164 164
 
165 165
 }
166 166
 
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/FrontendDefinitionTrait.php 1 patch
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -31,129 +31,129 @@
 block discarded – undo
31 31
  */
32 32
 trait FrontendDefinitionTrait {
33 33
 
34
-	/** @var string human-readable mechanism name */
35
-	private $text;
36
-
37
-	/** @var DefinitionParameter[] parameters for mechanism */
38
-	private $parameters = [];
39
-
40
-	/** @var string[] custom JS */
41
-	private $customJs = [];
42
-
43
-	/**
44
-	 * @return string
45
-	 */
46
-	public function getText() {
47
-		return $this->text;
48
-	}
49
-
50
-	/**
51
-	 * @param string $text
52
-	 * @return $this
53
-	 */
54
-	public function setText($text) {
55
-		$this->text = $text;
56
-		return $this;
57
-	}
58
-
59
-	/**
60
-	 * @param FrontendDefinitionTrait $a
61
-	 * @param FrontendDefinitionTrait $b
62
-	 * @return int
63
-	 */
64
-	public static function lexicalCompare(FrontendDefinitionTrait $a, FrontendDefinitionTrait $b) {
65
-		return strcmp($a->getText(), $b->getText());
66
-	}
67
-
68
-	/**
69
-	 * @return DefinitionParameter[]
70
-	 */
71
-	public function getParameters() {
72
-		return $this->parameters;
73
-	}
74
-
75
-	/**
76
-	 * @param DefinitionParameter[] $parameters
77
-	 * @return self
78
-	 */
79
-	public function addParameters(array $parameters) {
80
-		foreach ($parameters as $parameter) {
81
-			$this->addParameter($parameter);
82
-		}
83
-		return $this;
84
-	}
85
-
86
-	/**
87
-	 * @param DefinitionParameter $parameter
88
-	 * @return self
89
-	 */
90
-	public function addParameter(DefinitionParameter $parameter) {
91
-		$this->parameters[$parameter->getName()] = $parameter;
92
-		return $this;
93
-	}
94
-
95
-	/**
96
-	 * @return string[]
97
-	 */
98
-	public function getCustomJs() {
99
-		return $this->customJs;
100
-	}
101
-
102
-	/**
103
-	 * @param string $custom
104
-	 * @return self
105
-	 */
106
-	public function addCustomJs($custom) {
107
-		$this->customJs[] = $custom;
108
-		return $this;
109
-	}
110
-
111
-	/**
112
-	 * @param string $custom
113
-	 * @return self
114
-	 * @deprecated 9.1.0, use addCustomJs() instead
115
-	 */
116
-	public function setCustomJs($custom) {
117
-		$this->customJs = [$custom];
118
-		return $this;
119
-	}
120
-
121
-	/**
122
-	 * Serialize into JSON for client-side JS
123
-	 *
124
-	 * @return array
125
-	 */
126
-	public function jsonSerializeDefinition() {
127
-		$configuration = [];
128
-		foreach ($this->getParameters() as $parameter) {
129
-			$configuration[$parameter->getName()] = $parameter;
130
-		}
131
-
132
-		$data = [
133
-			'name' => $this->getText(),
134
-			'configuration' => $configuration,
135
-			'custom' => $this->getCustomJs(),
136
-		];
137
-		return $data;
138
-	}
139
-
140
-	/**
141
-	 * Check if parameters are satisfied in a StorageConfig
142
-	 *
143
-	 * @param StorageConfig $storage
144
-	 * @return bool
145
-	 */
146
-	public function validateStorageDefinition(StorageConfig $storage) {
147
-		foreach ($this->getParameters() as $name => $parameter) {
148
-			$value = $storage->getBackendOption($name);
149
-			if (!is_null($value) || !$parameter->isOptional()) {
150
-				if (!$parameter->validateValue($value)) {
151
-					return false;
152
-				}
153
-				$storage->setBackendOption($name, $value);
154
-			}
155
-		}
156
-		return true;
157
-	}
34
+    /** @var string human-readable mechanism name */
35
+    private $text;
36
+
37
+    /** @var DefinitionParameter[] parameters for mechanism */
38
+    private $parameters = [];
39
+
40
+    /** @var string[] custom JS */
41
+    private $customJs = [];
42
+
43
+    /**
44
+     * @return string
45
+     */
46
+    public function getText() {
47
+        return $this->text;
48
+    }
49
+
50
+    /**
51
+     * @param string $text
52
+     * @return $this
53
+     */
54
+    public function setText($text) {
55
+        $this->text = $text;
56
+        return $this;
57
+    }
58
+
59
+    /**
60
+     * @param FrontendDefinitionTrait $a
61
+     * @param FrontendDefinitionTrait $b
62
+     * @return int
63
+     */
64
+    public static function lexicalCompare(FrontendDefinitionTrait $a, FrontendDefinitionTrait $b) {
65
+        return strcmp($a->getText(), $b->getText());
66
+    }
67
+
68
+    /**
69
+     * @return DefinitionParameter[]
70
+     */
71
+    public function getParameters() {
72
+        return $this->parameters;
73
+    }
74
+
75
+    /**
76
+     * @param DefinitionParameter[] $parameters
77
+     * @return self
78
+     */
79
+    public function addParameters(array $parameters) {
80
+        foreach ($parameters as $parameter) {
81
+            $this->addParameter($parameter);
82
+        }
83
+        return $this;
84
+    }
85
+
86
+    /**
87
+     * @param DefinitionParameter $parameter
88
+     * @return self
89
+     */
90
+    public function addParameter(DefinitionParameter $parameter) {
91
+        $this->parameters[$parameter->getName()] = $parameter;
92
+        return $this;
93
+    }
94
+
95
+    /**
96
+     * @return string[]
97
+     */
98
+    public function getCustomJs() {
99
+        return $this->customJs;
100
+    }
101
+
102
+    /**
103
+     * @param string $custom
104
+     * @return self
105
+     */
106
+    public function addCustomJs($custom) {
107
+        $this->customJs[] = $custom;
108
+        return $this;
109
+    }
110
+
111
+    /**
112
+     * @param string $custom
113
+     * @return self
114
+     * @deprecated 9.1.0, use addCustomJs() instead
115
+     */
116
+    public function setCustomJs($custom) {
117
+        $this->customJs = [$custom];
118
+        return $this;
119
+    }
120
+
121
+    /**
122
+     * Serialize into JSON for client-side JS
123
+     *
124
+     * @return array
125
+     */
126
+    public function jsonSerializeDefinition() {
127
+        $configuration = [];
128
+        foreach ($this->getParameters() as $parameter) {
129
+            $configuration[$parameter->getName()] = $parameter;
130
+        }
131
+
132
+        $data = [
133
+            'name' => $this->getText(),
134
+            'configuration' => $configuration,
135
+            'custom' => $this->getCustomJs(),
136
+        ];
137
+        return $data;
138
+    }
139
+
140
+    /**
141
+     * Check if parameters are satisfied in a StorageConfig
142
+     *
143
+     * @param StorageConfig $storage
144
+     * @return bool
145
+     */
146
+    public function validateStorageDefinition(StorageConfig $storage) {
147
+        foreach ($this->getParameters() as $name => $parameter) {
148
+            $value = $storage->getBackendOption($name);
149
+            if (!is_null($value) || !$parameter->isOptional()) {
150
+                if (!$parameter->validateValue($value)) {
151
+                    return false;
152
+                }
153
+                $storage->setBackendOption($name, $value);
154
+            }
155
+        }
156
+        return true;
157
+    }
158 158
 
159 159
 }
Please login to merge, or discard this patch.
files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@
 block discarded – undo
29 29
  * Authentication mechanism or backend has insufficient data
30 30
  */
31 31
 class InsufficientDataForMeaningfulAnswerException extends StorageNotAvailableException {
32
-	/**
33
-	 * StorageNotAvailableException constructor.
34
-	 *
35
-	 * @param string $message
36
-	 * @param int $code
37
-	 * @param \Exception|null $previous
38
-	 * @since 6.0.0
39
-	 */
40
-	public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) {
41
-		parent::__construct($message, $code, $previous);
42
-	}
32
+    /**
33
+     * StorageNotAvailableException constructor.
34
+     *
35
+     * @param string $message
36
+     * @param int $code
37
+     * @param \Exception|null $previous
38
+     * @since 6.0.0
39
+     */
40
+    public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) {
41
+        parent::__construct($message, $code, $previous);
42
+    }
43 43
 }
Please login to merge, or discard this patch.