Completed
Pull Request — master (#4890)
by Blizzz
15:45
created
lib/private/Settings/Personal/PersonalInfo.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
 				$ln = array('code' => $lang, 'name' => $potentialName);
136 136
 			} elseif ($lang === 'en') {
137 137
 				$ln = ['code' => $lang, 'name' => 'English (US)'];
138
-			}else{//fallback to language code
138
+			} else{//fallback to language code
139 139
 				$ln=array('code'=>$lang, 'name'=>$lang);
140 140
 			}
141 141
 
Please login to merge, or discard this patch.
Indentation   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -39,246 +39,246 @@
 block discarded – undo
39 39
 use OCP\Settings\ISettings;
40 40
 
41 41
 class PersonalInfo implements ISettings {
42
-	/** @var IConfig */
43
-	private $config;
44
-	/** @var IUserManager */
45
-	private $userManager;
46
-	/** @var AccountManager */
47
-	private $accountManager;
48
-	/** @var IGroupManager */
49
-	private $groupManager;
50
-	/** @var IAppManager */
51
-	private $appManager;
52
-	/** @var IFactory */
53
-	private $l10nFactory;
42
+    /** @var IConfig */
43
+    private $config;
44
+    /** @var IUserManager */
45
+    private $userManager;
46
+    /** @var AccountManager */
47
+    private $accountManager;
48
+    /** @var IGroupManager */
49
+    private $groupManager;
50
+    /** @var IAppManager */
51
+    private $appManager;
52
+    /** @var IFactory */
53
+    private $l10nFactory;
54 54
 
55
-	const COMMON_LANGUAGE_CODES = [
56
-		'en', 'es', 'fr', 'de', 'de_DE', 'ja', 'ar', 'ru', 'nl', 'it',
57
-		'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'tr', 'zh_CN', 'ko'
58
-	];
55
+    const COMMON_LANGUAGE_CODES = [
56
+        'en', 'es', 'fr', 'de', 'de_DE', 'ja', 'ar', 'ru', 'nl', 'it',
57
+        'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'tr', 'zh_CN', 'ko'
58
+    ];
59 59
 
60
-	/** @var IL10N */
61
-	private $l;
60
+    /** @var IL10N */
61
+    private $l;
62 62
 
63
-	/**
64
-	 * @param IConfig $config
65
-	 * @param IUserManager $userManager
66
-	 * @param IGroupManager $groupManager
67
-	 * @param AccountManager $accountManager
68
-	 * @param IFactory $l10nFactory
69
-	 * @param IL10N $l
70
-	 */
71
-	public function __construct(
72
-		IConfig $config,
73
-		IUserManager $userManager,
74
-		IGroupManager $groupManager,
75
-		AccountManager $accountManager,
76
-		IAppManager $appManager,
77
-		IFactory $l10nFactory,
78
-		IL10N $l
79
-	) {
80
-		$this->config = $config;
81
-		$this->userManager = $userManager;
82
-		$this->accountManager = $accountManager;
83
-		$this->groupManager = $groupManager;
84
-		$this->appManager = $appManager;
85
-		$this->l10nFactory = $l10nFactory;
86
-		$this->l = $l;
87
-	}
63
+    /**
64
+     * @param IConfig $config
65
+     * @param IUserManager $userManager
66
+     * @param IGroupManager $groupManager
67
+     * @param AccountManager $accountManager
68
+     * @param IFactory $l10nFactory
69
+     * @param IL10N $l
70
+     */
71
+    public function __construct(
72
+        IConfig $config,
73
+        IUserManager $userManager,
74
+        IGroupManager $groupManager,
75
+        AccountManager $accountManager,
76
+        IAppManager $appManager,
77
+        IFactory $l10nFactory,
78
+        IL10N $l
79
+    ) {
80
+        $this->config = $config;
81
+        $this->userManager = $userManager;
82
+        $this->accountManager = $accountManager;
83
+        $this->groupManager = $groupManager;
84
+        $this->appManager = $appManager;
85
+        $this->l10nFactory = $l10nFactory;
86
+        $this->l = $l;
87
+    }
88 88
 
89
-	/**
90
-	 * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
91
-	 * @since 9.1
92
-	 */
93
-	public function getForm() {
94
-		$federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
95
-		$lookupServerUploadEnabled = false;
96
-		if($federatedFileSharingEnabled) {
97
-			$federatedFileSharing = new Application();
98
-			$shareProvider = $federatedFileSharing->getFederatedShareProvider();
99
-			$lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
100
-		}
89
+    /**
90
+     * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
91
+     * @since 9.1
92
+     */
93
+    public function getForm() {
94
+        $federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
95
+        $lookupServerUploadEnabled = false;
96
+        if($federatedFileSharingEnabled) {
97
+            $federatedFileSharing = new Application();
98
+            $shareProvider = $federatedFileSharing->getFederatedShareProvider();
99
+            $lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
100
+        }
101 101
 
102
-		$uid = \OC_User::getUser();
103
-		$user = $this->userManager->get($uid);
104
-		$userData = $this->accountManager->getUser($user);
102
+        $uid = \OC_User::getUser();
103
+        $user = $this->userManager->get($uid);
104
+        $userData = $this->accountManager->getUser($user);
105 105
 
106
-		$storageInfo = \OC_Helper::getStorageInfo('/');
107
-		if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) {
108
-			$totalSpace = $this->l->t('Unlimited');
109
-		} else {
110
-			$totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
111
-		}
106
+        $storageInfo = \OC_Helper::getStorageInfo('/');
107
+        if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) {
108
+            $totalSpace = $this->l->t('Unlimited');
109
+        } else {
110
+            $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
111
+        }
112 112
 
113
-		$languageParameters = $this->getLanguages($user);
114
-		$messageParameters = $this->getMessageParameters($userData);
113
+        $languageParameters = $this->getLanguages($user);
114
+        $messageParameters = $this->getMessageParameters($userData);
115 115
 
116
-		$parameters = [
117
-			'total_space' => $totalSpace,
118
-			'usage' => \OC_Helper::humanFileSize($storageInfo['used']),
119
-			'usage_relative' => $storageInfo['relative'],
120
-			'quota' => $storageInfo['quota'],
121
-			'avatarChangeSupported' => \OC_User::canUserChangeAvatar($uid),
122
-			'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
123
-			'avatarScope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
124
-			'displayNameChangeSupported' => \OC_User::canUserChangeDisplayName($uid),
125
-			'displayName' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['value'],
126
-			'displayNameScope' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['scope'],
127
-			'email' => $userData[AccountManager::PROPERTY_EMAIL]['value'],
128
-			'emailScope' => $userData[AccountManager::PROPERTY_EMAIL]['scope'],
129
-			'emailVerification' => $userData[AccountManager::PROPERTY_EMAIL]['verified'],
130
-			'phone' => $userData[AccountManager::PROPERTY_PHONE]['value'],
131
-			'phoneScope' => $userData[AccountManager::PROPERTY_PHONE]['scope'],
132
-			'address' => $userData[AccountManager::PROPERTY_ADDRESS]['value'],
133
-			'addressScope' => $userData[AccountManager::PROPERTY_ADDRESS]['scope'],
134
-			'website' =>  $userData[AccountManager::PROPERTY_WEBSITE]['value'],
135
-			'websiteScope' =>  $userData[AccountManager::PROPERTY_WEBSITE]['scope'],
136
-			'websiteVerification' => $userData[AccountManager::PROPERTY_WEBSITE]['verified'],
137
-			'twitter' => $userData[AccountManager::PROPERTY_TWITTER]['value'],
138
-			'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'],
139
-			'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'],
140
-			'groups' => $this->getGroups($user),
141
-			'passwordChangeSupported' => \OC_User::canUserChangePassword($uid),
142
-		] + $messageParameters + $languageParameters;
116
+        $parameters = [
117
+            'total_space' => $totalSpace,
118
+            'usage' => \OC_Helper::humanFileSize($storageInfo['used']),
119
+            'usage_relative' => $storageInfo['relative'],
120
+            'quota' => $storageInfo['quota'],
121
+            'avatarChangeSupported' => \OC_User::canUserChangeAvatar($uid),
122
+            'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
123
+            'avatarScope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
124
+            'displayNameChangeSupported' => \OC_User::canUserChangeDisplayName($uid),
125
+            'displayName' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['value'],
126
+            'displayNameScope' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['scope'],
127
+            'email' => $userData[AccountManager::PROPERTY_EMAIL]['value'],
128
+            'emailScope' => $userData[AccountManager::PROPERTY_EMAIL]['scope'],
129
+            'emailVerification' => $userData[AccountManager::PROPERTY_EMAIL]['verified'],
130
+            'phone' => $userData[AccountManager::PROPERTY_PHONE]['value'],
131
+            'phoneScope' => $userData[AccountManager::PROPERTY_PHONE]['scope'],
132
+            'address' => $userData[AccountManager::PROPERTY_ADDRESS]['value'],
133
+            'addressScope' => $userData[AccountManager::PROPERTY_ADDRESS]['scope'],
134
+            'website' =>  $userData[AccountManager::PROPERTY_WEBSITE]['value'],
135
+            'websiteScope' =>  $userData[AccountManager::PROPERTY_WEBSITE]['scope'],
136
+            'websiteVerification' => $userData[AccountManager::PROPERTY_WEBSITE]['verified'],
137
+            'twitter' => $userData[AccountManager::PROPERTY_TWITTER]['value'],
138
+            'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'],
139
+            'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'],
140
+            'groups' => $this->getGroups($user),
141
+            'passwordChangeSupported' => \OC_User::canUserChangePassword($uid),
142
+        ] + $messageParameters + $languageParameters;
143 143
 
144 144
 
145
-		return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
146
-	}
145
+        return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
146
+    }
147 147
 
148
-	/**
149
-	 * @return string the section ID, e.g. 'sharing'
150
-	 * @since 9.1
151
-	 */
152
-	public function getSection() {
153
-		return 'personal-info';
154
-	}
148
+    /**
149
+     * @return string the section ID, e.g. 'sharing'
150
+     * @since 9.1
151
+     */
152
+    public function getSection() {
153
+        return 'personal-info';
154
+    }
155 155
 
156
-	/**
157
-	 * @return int whether the form should be rather on the top or bottom of
158
-	 * the admin section. The forms are arranged in ascending order of the
159
-	 * priority values. It is required to return a value between 0 and 100.
160
-	 *
161
-	 * E.g.: 70
162
-	 * @since 9.1
163
-	 */
164
-	public function getPriority() {
165
-		return 10;
166
-	}
156
+    /**
157
+     * @return int whether the form should be rather on the top or bottom of
158
+     * the admin section. The forms are arranged in ascending order of the
159
+     * priority values. It is required to return a value between 0 and 100.
160
+     *
161
+     * E.g.: 70
162
+     * @since 9.1
163
+     */
164
+    public function getPriority() {
165
+        return 10;
166
+    }
167 167
 
168
-	/**
169
-	 * returns a sorted list of the user's group GIDs
170
-	 *
171
-	 * @param IUser $user
172
-	 * @return array
173
-	 */
174
-	private function getGroups(IUser $user) {
175
-		$groups = array_map(
176
-			function(IGroup $group) {
177
-				return $group->getGID();
178
-			},
179
-			$this->groupManager->getUserGroups($user)
180
-		);
181
-		sort($groups);
168
+    /**
169
+     * returns a sorted list of the user's group GIDs
170
+     *
171
+     * @param IUser $user
172
+     * @return array
173
+     */
174
+    private function getGroups(IUser $user) {
175
+        $groups = array_map(
176
+            function(IGroup $group) {
177
+                return $group->getGID();
178
+            },
179
+            $this->groupManager->getUserGroups($user)
180
+        );
181
+        sort($groups);
182 182
 
183
-		return $groups;
184
-	}
183
+        return $groups;
184
+    }
185 185
 
186
-	/**
187
-	 * returns the user language, common language and other languages in an
188
-	 * associative array
189
-	 *
190
-	 * @param IUser $user
191
-	 * @return array
192
-	 */
193
-	private function getLanguages(IUser $user) {
194
-		$forceLanguage = $this->config->getSystemValue('force_language', false);
195
-		if($forceLanguage !== false) {
196
-			return [];
197
-		}
186
+    /**
187
+     * returns the user language, common language and other languages in an
188
+     * associative array
189
+     *
190
+     * @param IUser $user
191
+     * @return array
192
+     */
193
+    private function getLanguages(IUser $user) {
194
+        $forceLanguage = $this->config->getSystemValue('force_language', false);
195
+        if($forceLanguage !== false) {
196
+            return [];
197
+        }
198 198
 
199
-		$uid = $user->getUID();
199
+        $uid = $user->getUID();
200 200
 
201
-		$userLang = $this->config->getUserValue($uid, 'core', 'lang', $this->l10nFactory->findLanguage());
202
-		$languageCodes = $this->l10nFactory->findAvailableLanguages();
201
+        $userLang = $this->config->getUserValue($uid, 'core', 'lang', $this->l10nFactory->findLanguage());
202
+        $languageCodes = $this->l10nFactory->findAvailableLanguages();
203 203
 
204
-		$commonLanguages = [];
205
-		$languages = [];
204
+        $commonLanguages = [];
205
+        $languages = [];
206 206
 
207
-		foreach($languageCodes as $lang) {
208
-			$l = \OC::$server->getL10N('settings', $lang);
209
-			// TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
210
-			$potentialName = (string) $l->t('__language_name__');
211
-			if($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file
212
-				$ln = array('code' => $lang, 'name' => $potentialName);
213
-			} elseif ($lang === 'en') {
214
-				$ln = ['code' => $lang, 'name' => 'English (US)'];
215
-			}else{//fallback to language code
216
-				$ln=array('code'=>$lang, 'name'=>$lang);
217
-			}
207
+        foreach($languageCodes as $lang) {
208
+            $l = \OC::$server->getL10N('settings', $lang);
209
+            // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
210
+            $potentialName = (string) $l->t('__language_name__');
211
+            if($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file
212
+                $ln = array('code' => $lang, 'name' => $potentialName);
213
+            } elseif ($lang === 'en') {
214
+                $ln = ['code' => $lang, 'name' => 'English (US)'];
215
+            }else{//fallback to language code
216
+                $ln=array('code'=>$lang, 'name'=>$lang);
217
+            }
218 218
 
219
-			// put appropriate languages into appropriate arrays, to print them sorted
220
-			// used language -> common languages -> divider -> other languages
221
-			if ($lang === $userLang) {
222
-				$userLang = $ln;
223
-			} elseif (in_array($lang, self::COMMON_LANGUAGE_CODES)) {
224
-				$commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)]=$ln;
225
-			} else {
226
-				$languages[]=$ln;
227
-			}
228
-		}
219
+            // put appropriate languages into appropriate arrays, to print them sorted
220
+            // used language -> common languages -> divider -> other languages
221
+            if ($lang === $userLang) {
222
+                $userLang = $ln;
223
+            } elseif (in_array($lang, self::COMMON_LANGUAGE_CODES)) {
224
+                $commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)]=$ln;
225
+            } else {
226
+                $languages[]=$ln;
227
+            }
228
+        }
229 229
 
230
-		// if user language is not available but set somehow: show the actual code as name
231
-		if (!is_array($userLang)) {
232
-			$userLang = [
233
-				'code' => $userLang,
234
-				'name' => $userLang,
235
-			];
236
-		}
230
+        // if user language is not available but set somehow: show the actual code as name
231
+        if (!is_array($userLang)) {
232
+            $userLang = [
233
+                'code' => $userLang,
234
+                'name' => $userLang,
235
+            ];
236
+        }
237 237
 
238
-		ksort($commonLanguages);
238
+        ksort($commonLanguages);
239 239
 
240
-		// sort now by displayed language not the iso-code
241
-		usort( $languages, function ($a, $b) {
242
-			if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) {
243
-				// If a doesn't have a name, but b does, list b before a
244
-				return 1;
245
-			}
246
-			if ($a['code'] !== $a['name'] && $b['code'] === $b['name']) {
247
-				// If a does have a name, but b doesn't, list a before b
248
-				return -1;
249
-			}
250
-			// Otherwise compare the names
251
-			return strcmp($a['name'], $b['name']);
252
-		});
240
+        // sort now by displayed language not the iso-code
241
+        usort( $languages, function ($a, $b) {
242
+            if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) {
243
+                // If a doesn't have a name, but b does, list b before a
244
+                return 1;
245
+            }
246
+            if ($a['code'] !== $a['name'] && $b['code'] === $b['name']) {
247
+                // If a does have a name, but b doesn't, list a before b
248
+                return -1;
249
+            }
250
+            // Otherwise compare the names
251
+            return strcmp($a['name'], $b['name']);
252
+        });
253 253
 
254
-		return [
255
-			'activelanguage' => $userLang,
256
-			'commonlanguages' => $commonLanguages,
257
-			'languages' => $languages
258
-		];
259
-	}
254
+        return [
255
+            'activelanguage' => $userLang,
256
+            'commonlanguages' => $commonLanguages,
257
+            'languages' => $languages
258
+        ];
259
+    }
260 260
 
261
-	/**
262
-	 * @param array $userData
263
-	 * @return array
264
-	 */
265
-	private function getMessageParameters(array $userData) {
266
-		$needVerifyMessage = [AccountManager::PROPERTY_EMAIL, AccountManager::PROPERTY_WEBSITE, AccountManager::PROPERTY_TWITTER];
267
-		$messageParameters = [];
268
-		foreach ($needVerifyMessage as $property) {
269
-			switch ($userData[$property]['verified']) {
270
-				case AccountManager::VERIFIED:
271
-					$message = $this->l->t('Verifying');
272
-					break;
273
-				case AccountManager::VERIFICATION_IN_PROGRESS:
274
-					$message = $this->l->t('Verifying …');
275
-					break;
276
-				default:
277
-					$message = $this->l->t('Verify');
278
-			}
279
-			$messageParameters[$property . 'Message'] = $message;
280
-		}
281
-		return $messageParameters;
282
-	}
261
+    /**
262
+     * @param array $userData
263
+     * @return array
264
+     */
265
+    private function getMessageParameters(array $userData) {
266
+        $needVerifyMessage = [AccountManager::PROPERTY_EMAIL, AccountManager::PROPERTY_WEBSITE, AccountManager::PROPERTY_TWITTER];
267
+        $messageParameters = [];
268
+        foreach ($needVerifyMessage as $property) {
269
+            switch ($userData[$property]['verified']) {
270
+                case AccountManager::VERIFIED:
271
+                    $message = $this->l->t('Verifying');
272
+                    break;
273
+                case AccountManager::VERIFICATION_IN_PROGRESS:
274
+                    $message = $this->l->t('Verifying …');
275
+                    break;
276
+                default:
277
+                    $message = $this->l->t('Verify');
278
+            }
279
+            $messageParameters[$property . 'Message'] = $message;
280
+        }
281
+        return $messageParameters;
282
+    }
283 283
 
284 284
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	public function getForm() {
94 94
 		$federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
95 95
 		$lookupServerUploadEnabled = false;
96
-		if($federatedFileSharingEnabled) {
96
+		if ($federatedFileSharingEnabled) {
97 97
 			$federatedFileSharing = new Application();
98 98
 			$shareProvider = $federatedFileSharing->getFederatedShareProvider();
99 99
 			$lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	private function getLanguages(IUser $user) {
194 194
 		$forceLanguage = $this->config->getSystemValue('force_language', false);
195
-		if($forceLanguage !== false) {
195
+		if ($forceLanguage !== false) {
196 196
 			return [];
197 197
 		}
198 198
 
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
 		$commonLanguages = [];
205 205
 		$languages = [];
206 206
 
207
-		foreach($languageCodes as $lang) {
207
+		foreach ($languageCodes as $lang) {
208 208
 			$l = \OC::$server->getL10N('settings', $lang);
209 209
 			// TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
210 210
 			$potentialName = (string) $l->t('__language_name__');
211
-			if($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file
211
+			if ($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file
212 212
 				$ln = array('code' => $lang, 'name' => $potentialName);
213 213
 			} elseif ($lang === 'en') {
214 214
 				$ln = ['code' => $lang, 'name' => 'English (US)'];
215
-			}else{//fallback to language code
216
-				$ln=array('code'=>$lang, 'name'=>$lang);
215
+			} else {//fallback to language code
216
+				$ln = array('code'=>$lang, 'name'=>$lang);
217 217
 			}
218 218
 
219 219
 			// put appropriate languages into appropriate arrays, to print them sorted
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 			if ($lang === $userLang) {
222 222
 				$userLang = $ln;
223 223
 			} elseif (in_array($lang, self::COMMON_LANGUAGE_CODES)) {
224
-				$commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)]=$ln;
224
+				$commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)] = $ln;
225 225
 			} else {
226
-				$languages[]=$ln;
226
+				$languages[] = $ln;
227 227
 			}
228 228
 		}
229 229
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		ksort($commonLanguages);
239 239
 
240 240
 		// sort now by displayed language not the iso-code
241
-		usort( $languages, function ($a, $b) {
241
+		usort($languages, function($a, $b) {
242 242
 			if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) {
243 243
 				// If a doesn't have a name, but b does, list b before a
244 244
 				return 1;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 				default:
277 277
 					$message = $this->l->t('Verify');
278 278
 			}
279
-			$messageParameters[$property . 'Message'] = $message;
279
+			$messageParameters[$property.'Message'] = $message;
280 280
 		}
281 281
 		return $messageParameters;
282 282
 	}
Please login to merge, or discard this patch.
settings/templates/settings/frame.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	<ul>
33 33
 		<li class="settings-caption">Personal</li>
34 34
 		<?php
35
-		foreach($_['forms']['personal'] as $form) {
36
-			if (isset($form['anchor'])) {
37
-				$anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => $form['anchor']]);
38
-				$class = 'nav-icon-' . $form['anchor'];
39
-				$sectionName = $form['section-name'];
40
-				$active = $form['active'] ? ' class="active"' : '';
41
-				?>
35
+        foreach($_['forms']['personal'] as $form) {
36
+            if (isset($form['anchor'])) {
37
+                $anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => $form['anchor']]);
38
+                $class = 'nav-icon-' . $form['anchor'];
39
+                $sectionName = $form['section-name'];
40
+                $active = $form['active'] ? ' class="active"' : '';
41
+                ?>
42 42
 				<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?>>
43 43
 					<a href="<?php p($anchor); ?>">
44 44
 						<?php if (!empty($form['icon'])) { ?>
@@ -50,24 +50,24 @@  discard block
 block discarded – undo
50 50
 					</a>
51 51
 				</li>
52 52
 				<?php
53
-			}
54
-		}
55
-		?>
53
+            }
54
+        }
55
+        ?>
56 56
 
57 57
 		<?php
58
-		if(!empty($_['forms']['admin'])) {
59
-			?>
58
+        if(!empty($_['forms']['admin'])) {
59
+            ?>
60 60
 			<li class="settings-caption">Administration</li>
61 61
 			<?php
62
-		}
63
-		foreach($_['forms']['admin'] as $form) {
64
-			if (isset($form['anchor'])) {
62
+        }
63
+        foreach($_['forms']['admin'] as $form) {
64
+            if (isset($form['anchor'])) {
65 65
 
66
-				$anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]);
67
-				$class = 'nav-icon-' . $form['anchor'];
68
-				$sectionName = $form['section-name'];
69
-				$active = $form['active'] ? ' class="active"' : '';
70
-		?>
66
+                $anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]);
67
+                $class = 'nav-icon-' . $form['anchor'];
68
+                $sectionName = $form['section-name'];
69
+                $active = $form['active'] ? ' class="active"' : '';
70
+        ?>
71 71
 				<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?>>
72 72
 					<a href="<?php p($anchor); ?>">
73 73
 						<?php if (!empty($form['icon'])) { ?>
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 					</a>
80 80
 				</li>
81 81
 		<?php
82
-			}
83
-		}
84
-		?>
82
+            }
83
+        }
84
+        ?>
85 85
 	</ul>
86 86
 </div>
87 87
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 style('settings', 'settings');
25
-script('settings', [ 'settings', 'admin', 'log', 'certificates'] );
25
+script('settings', ['settings', 'admin', 'log', 'certificates']);
26 26
 script('core', ['multiselect', 'setupchecks']);
27 27
 script('files', 'jquery.fileupload');
28 28
 
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 	<ul>
33 33
 		<li class="settings-caption">Personal</li>
34 34
 		<?php
35
-		foreach($_['forms']['personal'] as $form) {
35
+		foreach ($_['forms']['personal'] as $form) {
36 36
 			if (isset($form['anchor'])) {
37 37
 				$anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => $form['anchor']]);
38
-				$class = 'nav-icon-' . $form['anchor'];
38
+				$class = 'nav-icon-'.$form['anchor'];
39 39
 				$sectionName = $form['section-name'];
40 40
 				$active = $form['active'] ? ' class="active"' : '';
41 41
 				?>
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
 		?>
56 56
 
57 57
 		<?php
58
-		if(!empty($_['forms']['admin'])) {
58
+		if (!empty($_['forms']['admin'])) {
59 59
 			?>
60 60
 			<li class="settings-caption">Administration</li>
61 61
 			<?php
62 62
 		}
63
-		foreach($_['forms']['admin'] as $form) {
63
+		foreach ($_['forms']['admin'] as $form) {
64 64
 			if (isset($form['anchor'])) {
65 65
 
66 66
 				$anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]);
67
-				$class = 'nav-icon-' . $form['anchor'];
67
+				$class = 'nav-icon-'.$form['anchor'];
68 68
 				$sectionName = $form['section-name'];
69 69
 				$active = $form['active'] ? ' class="active"' : '';
70 70
 		?>
Please login to merge, or discard this patch.
lib/private/Settings/Personal/SyncClients.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -30,56 +30,56 @@
 block discarded – undo
30 30
 
31 31
 class SyncClients implements ISettings {
32 32
 
33
-	/** @var IConfig */
34
-	private $config;
35
-	/** @var \OC_Defaults */
36
-	private $defaults;
33
+    /** @var IConfig */
34
+    private $config;
35
+    /** @var \OC_Defaults */
36
+    private $defaults;
37 37
 
38
-	public function __construct(IConfig $config, \OC_Defaults $defaults) {
39
-		$this->config = $config;
40
-		$this->defaults = $defaults;
41
-	}
38
+    public function __construct(IConfig $config, \OC_Defaults $defaults) {
39
+        $this->config = $config;
40
+        $this->defaults = $defaults;
41
+    }
42 42
 
43
-	/**
44
-	 * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
45
-	 * @since 9.1
46
-	 */
47
-	public function getForm() {
48
-		$parameters = [ 'clients' => $this->getClientLinks() ];
49
-		return new TemplateResponse('settings', 'settings/personal/sync-clients', $parameters);
50
-	}
43
+    /**
44
+     * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
45
+     * @since 9.1
46
+     */
47
+    public function getForm() {
48
+        $parameters = [ 'clients' => $this->getClientLinks() ];
49
+        return new TemplateResponse('settings', 'settings/personal/sync-clients', $parameters);
50
+    }
51 51
 
52
-	/**
53
-	 * @return string the section ID, e.g. 'sharing'
54
-	 * @since 9.1
55
-	 */
56
-	public function getSection() {
57
-		return 'sync-clients';
58
-	}
52
+    /**
53
+     * @return string the section ID, e.g. 'sharing'
54
+     * @since 9.1
55
+     */
56
+    public function getSection() {
57
+        return 'sync-clients';
58
+    }
59 59
 
60
-	/**
61
-	 * @return int whether the form should be rather on the top or bottom of
62
-	 * the admin section. The forms are arranged in ascending order of the
63
-	 * priority values. It is required to return a value between 0 and 100.
64
-	 *
65
-	 * E.g.: 70
66
-	 * @since 9.1
67
-	 */
68
-	public function getPriority() {
69
-		return 20;
70
-	}
60
+    /**
61
+     * @return int whether the form should be rather on the top or bottom of
62
+     * the admin section. The forms are arranged in ascending order of the
63
+     * priority values. It is required to return a value between 0 and 100.
64
+     *
65
+     * E.g.: 70
66
+     * @since 9.1
67
+     */
68
+    public function getPriority() {
69
+        return 20;
70
+    }
71 71
 
72
-	/**
73
-	 * returns an array containing links to the various clients
74
-	 *
75
-	 * @return array
76
-	 */
77
-	private function getClientLinks() {
78
-		$clients = [
79
-			'desktop' => $this->config->getSystemValue('customclient_desktop', $this->defaults->getSyncClientUrl()),
80
-			'android' => $this->config->getSystemValue('customclient_android', $this->defaults->getAndroidClientUrl()),
81
-			'ios' => $this->config->getSystemValue('customclient_ios', $this->defaults->getiOSClientUrl())
82
-		];
83
-		return $clients;
84
-	}
72
+    /**
73
+     * returns an array containing links to the various clients
74
+     *
75
+     * @return array
76
+     */
77
+    private function getClientLinks() {
78
+        $clients = [
79
+            'desktop' => $this->config->getSystemValue('customclient_desktop', $this->defaults->getSyncClientUrl()),
80
+            'android' => $this->config->getSystemValue('customclient_android', $this->defaults->getAndroidClientUrl()),
81
+            'ios' => $this->config->getSystemValue('customclient_ios', $this->defaults->getiOSClientUrl())
82
+        ];
83
+        return $clients;
84
+    }
85 85
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	 * @since 9.1
46 46
 	 */
47 47
 	public function getForm() {
48
-		$parameters = [ 'clients' => $this->getClientLinks() ];
48
+		$parameters = ['clients' => $this->getClientLinks()];
49 49
 		return new TemplateResponse('settings', 'settings/personal/sync-clients', $parameters);
50 50
 	}
51 51
 
Please login to merge, or discard this patch.
lib/private/NavigationManager.php 1 patch
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -41,241 +41,241 @@
 block discarded – undo
41 41
  */
42 42
 
43 43
 class NavigationManager implements INavigationManager {
44
-	protected $entries = [];
45
-	protected $closureEntries = [];
46
-	protected $activeEntry;
47
-	/** @var bool */
48
-	protected $init = false;
49
-	/** @var IAppManager|AppManager */
50
-	protected $appManager;
51
-	/** @var IURLGenerator */
52
-	private $urlGenerator;
53
-	/** @var IFactory */
54
-	private $l10nFac;
55
-	/** @var IUserSession */
56
-	private $userSession;
57
-	/** @var IGroupManager|Manager */
58
-	private $groupManager;
59
-	/** @var IConfig */
60
-	private $config;
44
+    protected $entries = [];
45
+    protected $closureEntries = [];
46
+    protected $activeEntry;
47
+    /** @var bool */
48
+    protected $init = false;
49
+    /** @var IAppManager|AppManager */
50
+    protected $appManager;
51
+    /** @var IURLGenerator */
52
+    private $urlGenerator;
53
+    /** @var IFactory */
54
+    private $l10nFac;
55
+    /** @var IUserSession */
56
+    private $userSession;
57
+    /** @var IGroupManager|Manager */
58
+    private $groupManager;
59
+    /** @var IConfig */
60
+    private $config;
61 61
 
62
-	public function __construct(IAppManager $appManager,
63
-						 IURLGenerator $urlGenerator,
64
-						 IFactory $l10nFac,
65
-						 IUserSession $userSession,
66
-						 IGroupManager $groupManager,
67
-						 IConfig $config) {
68
-		$this->appManager = $appManager;
69
-		$this->urlGenerator = $urlGenerator;
70
-		$this->l10nFac = $l10nFac;
71
-		$this->userSession = $userSession;
72
-		$this->groupManager = $groupManager;
73
-		$this->config = $config;
74
-	}
62
+    public function __construct(IAppManager $appManager,
63
+                            IURLGenerator $urlGenerator,
64
+                            IFactory $l10nFac,
65
+                            IUserSession $userSession,
66
+                            IGroupManager $groupManager,
67
+                            IConfig $config) {
68
+        $this->appManager = $appManager;
69
+        $this->urlGenerator = $urlGenerator;
70
+        $this->l10nFac = $l10nFac;
71
+        $this->userSession = $userSession;
72
+        $this->groupManager = $groupManager;
73
+        $this->config = $config;
74
+    }
75 75
 
76
-	/**
77
-	 * Creates a new navigation entry
78
-	 *
79
-	 * @param array|\Closure $entry Array containing: id, name, order, icon and href key
80
-	 *					The use of a closure is preferred, because it will avoid
81
-	 * 					loading the routing of your app, unless required.
82
-	 * @return void
83
-	 */
84
-	public function add($entry) {
85
-		if ($entry instanceof \Closure) {
86
-			$this->closureEntries[] = $entry;
87
-			return;
88
-		}
76
+    /**
77
+     * Creates a new navigation entry
78
+     *
79
+     * @param array|\Closure $entry Array containing: id, name, order, icon and href key
80
+     *					The use of a closure is preferred, because it will avoid
81
+     * 					loading the routing of your app, unless required.
82
+     * @return void
83
+     */
84
+    public function add($entry) {
85
+        if ($entry instanceof \Closure) {
86
+            $this->closureEntries[] = $entry;
87
+            return;
88
+        }
89 89
 
90
-		$entry['active'] = false;
91
-		if(!isset($entry['icon'])) {
92
-			$entry['icon'] = '';
93
-		}
94
-		if(!isset($entry['type'])) {
95
-			$entry['type'] = 'link';
96
-		}
97
-		$this->entries[] = $entry;
98
-	}
90
+        $entry['active'] = false;
91
+        if(!isset($entry['icon'])) {
92
+            $entry['icon'] = '';
93
+        }
94
+        if(!isset($entry['type'])) {
95
+            $entry['type'] = 'link';
96
+        }
97
+        $this->entries[] = $entry;
98
+    }
99 99
 
100
-	/**
101
-	 * returns all the added Menu entries
102
-	 * @param string $type
103
-	 * @return array an array of the added entries
104
-	 */
105
-	public function getAll($type = 'link') {
106
-		$this->init();
107
-		foreach ($this->closureEntries as $c) {
108
-			$this->add($c());
109
-		}
110
-		$this->closureEntries = array();
100
+    /**
101
+     * returns all the added Menu entries
102
+     * @param string $type
103
+     * @return array an array of the added entries
104
+     */
105
+    public function getAll($type = 'link') {
106
+        $this->init();
107
+        foreach ($this->closureEntries as $c) {
108
+            $this->add($c());
109
+        }
110
+        $this->closureEntries = array();
111 111
 
112
-		if ($type === 'all') {
113
-			return $this->entries;
114
-		}
112
+        if ($type === 'all') {
113
+            return $this->entries;
114
+        }
115 115
 
116
-		return array_filter($this->entries, function($entry) use ($type) {
117
-			return $entry['type'] === $type;
118
-		});
119
-	}
116
+        return array_filter($this->entries, function($entry) use ($type) {
117
+            return $entry['type'] === $type;
118
+        });
119
+    }
120 120
 
121
-	/**
122
-	 * removes all the entries
123
-	 */
124
-	public function clear($loadDefaultLinks = true) {
125
-		$this->entries = [];
126
-		$this->closureEntries = [];
127
-		$this->init = !$loadDefaultLinks;
128
-	}
121
+    /**
122
+     * removes all the entries
123
+     */
124
+    public function clear($loadDefaultLinks = true) {
125
+        $this->entries = [];
126
+        $this->closureEntries = [];
127
+        $this->init = !$loadDefaultLinks;
128
+    }
129 129
 
130
-	/**
131
-	 * Sets the current navigation entry of the currently running app
132
-	 * @param string $id of the app entry to activate (from added $entry)
133
-	 */
134
-	public function setActiveEntry($id) {
135
-		$this->activeEntry = $id;
136
-	}
130
+    /**
131
+     * Sets the current navigation entry of the currently running app
132
+     * @param string $id of the app entry to activate (from added $entry)
133
+     */
134
+    public function setActiveEntry($id) {
135
+        $this->activeEntry = $id;
136
+    }
137 137
 
138
-	/**
139
-	 * gets the active Menu entry
140
-	 * @return string id or empty string
141
-	 *
142
-	 * This function returns the id of the active navigation entry (set by
143
-	 * setActiveEntry
144
-	 */
145
-	public function getActiveEntry() {
146
-		return $this->activeEntry;
147
-	}
138
+    /**
139
+     * gets the active Menu entry
140
+     * @return string id or empty string
141
+     *
142
+     * This function returns the id of the active navigation entry (set by
143
+     * setActiveEntry
144
+     */
145
+    public function getActiveEntry() {
146
+        return $this->activeEntry;
147
+    }
148 148
 
149
-	private function init() {
150
-		if ($this->init) {
151
-			return;
152
-		}
153
-		$this->init = true;
149
+    private function init() {
150
+        if ($this->init) {
151
+            return;
152
+        }
153
+        $this->init = true;
154 154
 
155
-		$l = $this->l10nFac->get('lib');
156
-		if ($this->config->getSystemValue('knowledgebaseenabled', true)) {
157
-			$this->add([
158
-				'type' => 'settings',
159
-				'id' => 'help',
160
-				'order' => 5,
161
-				'href' => $this->urlGenerator->linkToRoute('settings_help'),
162
-				'name' => $l->t('Help'),
163
-				'icon' => $this->urlGenerator->imagePath('settings', 'help.svg'),
164
-			]);
165
-		}
155
+        $l = $this->l10nFac->get('lib');
156
+        if ($this->config->getSystemValue('knowledgebaseenabled', true)) {
157
+            $this->add([
158
+                'type' => 'settings',
159
+                'id' => 'help',
160
+                'order' => 5,
161
+                'href' => $this->urlGenerator->linkToRoute('settings_help'),
162
+                'name' => $l->t('Help'),
163
+                'icon' => $this->urlGenerator->imagePath('settings', 'help.svg'),
164
+            ]);
165
+        }
166 166
 
167
-		if ($this->userSession->isLoggedIn()) {
168
-			if ($this->isAdmin()) {
169
-				// App management
170
-				$this->add([
171
-					'type' => 'settings',
172
-					'id' => 'core_apps',
173
-					'order' => 3,
174
-					'href' => $this->urlGenerator->linkToRoute('settings.AppSettings.viewApps'),
175
-					'icon' => $this->urlGenerator->imagePath('settings', 'apps.svg'),
176
-					'name' => $l->t('Apps'),
177
-				]);
178
-			}
167
+        if ($this->userSession->isLoggedIn()) {
168
+            if ($this->isAdmin()) {
169
+                // App management
170
+                $this->add([
171
+                    'type' => 'settings',
172
+                    'id' => 'core_apps',
173
+                    'order' => 3,
174
+                    'href' => $this->urlGenerator->linkToRoute('settings.AppSettings.viewApps'),
175
+                    'icon' => $this->urlGenerator->imagePath('settings', 'apps.svg'),
176
+                    'name' => $l->t('Apps'),
177
+                ]);
178
+            }
179 179
 
180
-			// Personal and (if applicable) admin settings
181
-			$this->add([
182
-				'type' => 'settings',
183
-				'id' => 'settings',
184
-				'order' => 1,
185
-				'href' => $this->urlGenerator->linkToRoute('settings.PersonalSettings.index'),
186
-				'name' => $l->t('Settings'),
187
-				'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'),
188
-			]);
180
+            // Personal and (if applicable) admin settings
181
+            $this->add([
182
+                'type' => 'settings',
183
+                'id' => 'settings',
184
+                'order' => 1,
185
+                'href' => $this->urlGenerator->linkToRoute('settings.PersonalSettings.index'),
186
+                'name' => $l->t('Settings'),
187
+                'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'),
188
+            ]);
189 189
 
190
-			// Logout
191
-			$this->add([
192
-				'type' => 'settings',
193
-				'id' => 'logout',
194
-				'order' => 99999,
195
-				'href' => $this->urlGenerator->linkToRouteAbsolute(
196
-					'core.login.logout',
197
-					['requesttoken' => \OCP\Util::callRegister()]
198
-				),
199
-				'name' => $l->t('Log out'),
200
-				'icon' => $this->urlGenerator->imagePath('core', 'actions/logout.svg'),
201
-			]);
190
+            // Logout
191
+            $this->add([
192
+                'type' => 'settings',
193
+                'id' => 'logout',
194
+                'order' => 99999,
195
+                'href' => $this->urlGenerator->linkToRouteAbsolute(
196
+                    'core.login.logout',
197
+                    ['requesttoken' => \OCP\Util::callRegister()]
198
+                ),
199
+                'name' => $l->t('Log out'),
200
+                'icon' => $this->urlGenerator->imagePath('core', 'actions/logout.svg'),
201
+            ]);
202 202
 
203
-			if ($this->isSubadmin()) {
204
-				// User management
205
-				$this->add([
206
-					'type' => 'settings',
207
-					'id' => 'core_users',
208
-					'order' => 4,
209
-					'href' => $this->urlGenerator->linkToRoute('settings_users'),
210
-					'name' => $l->t('Users'),
211
-					'icon' => $this->urlGenerator->imagePath('settings', 'users.svg'),
212
-				]);
213
-			}
214
-		}
203
+            if ($this->isSubadmin()) {
204
+                // User management
205
+                $this->add([
206
+                    'type' => 'settings',
207
+                    'id' => 'core_users',
208
+                    'order' => 4,
209
+                    'href' => $this->urlGenerator->linkToRoute('settings_users'),
210
+                    'name' => $l->t('Users'),
211
+                    'icon' => $this->urlGenerator->imagePath('settings', 'users.svg'),
212
+                ]);
213
+            }
214
+        }
215 215
 
216
-		if ($this->appManager === 'null') {
217
-			return;
218
-		}
219
-		foreach ($this->appManager->getInstalledApps() as $app) {
220
-			// load plugins and collections from info.xml
221
-			$info = $this->appManager->getAppInfo($app);
222
-			if (empty($info['navigations'])) {
223
-				continue;
224
-			}
225
-			foreach ($info['navigations'] as $nav) {
226
-				if (!isset($nav['name'])) {
227
-					continue;
228
-				}
229
-				if (!isset($nav['route'])) {
230
-					continue;
231
-				}
232
-				$role = isset($nav['@attributes']['role']) ? $nav['@attributes']['role'] : 'all';
233
-				if ($role === 'admin' && !$this->isAdmin()) {
234
-					continue;
235
-				}
236
-				$l = $this->l10nFac->get($app);
237
-				$id = isset($nav['id']) ? $nav['id'] : $app;
238
-				$order = isset($nav['order']) ? $nav['order'] : 100;
239
-				$type = isset($nav['type']) ? $nav['type'] : 'link';
240
-				$route = $this->urlGenerator->linkToRoute($nav['route']);
241
-				$icon = isset($nav['icon']) ? $nav['icon'] : 'app.svg';
242
-				foreach ([$icon, "$app.svg"] as $i) {
243
-					try {
244
-						$icon = $this->urlGenerator->imagePath($app, $i);
245
-						break;
246
-					} catch (\RuntimeException $ex) {
247
-						// no icon? - ignore it then
248
-					}
249
-				}
250
-				if ($icon === null) {
251
-					$icon = $this->urlGenerator->imagePath('core', 'default-app-icon');
252
-				}
216
+        if ($this->appManager === 'null') {
217
+            return;
218
+        }
219
+        foreach ($this->appManager->getInstalledApps() as $app) {
220
+            // load plugins and collections from info.xml
221
+            $info = $this->appManager->getAppInfo($app);
222
+            if (empty($info['navigations'])) {
223
+                continue;
224
+            }
225
+            foreach ($info['navigations'] as $nav) {
226
+                if (!isset($nav['name'])) {
227
+                    continue;
228
+                }
229
+                if (!isset($nav['route'])) {
230
+                    continue;
231
+                }
232
+                $role = isset($nav['@attributes']['role']) ? $nav['@attributes']['role'] : 'all';
233
+                if ($role === 'admin' && !$this->isAdmin()) {
234
+                    continue;
235
+                }
236
+                $l = $this->l10nFac->get($app);
237
+                $id = isset($nav['id']) ? $nav['id'] : $app;
238
+                $order = isset($nav['order']) ? $nav['order'] : 100;
239
+                $type = isset($nav['type']) ? $nav['type'] : 'link';
240
+                $route = $this->urlGenerator->linkToRoute($nav['route']);
241
+                $icon = isset($nav['icon']) ? $nav['icon'] : 'app.svg';
242
+                foreach ([$icon, "$app.svg"] as $i) {
243
+                    try {
244
+                        $icon = $this->urlGenerator->imagePath($app, $i);
245
+                        break;
246
+                    } catch (\RuntimeException $ex) {
247
+                        // no icon? - ignore it then
248
+                    }
249
+                }
250
+                if ($icon === null) {
251
+                    $icon = $this->urlGenerator->imagePath('core', 'default-app-icon');
252
+                }
253 253
 
254
-				$this->add([
255
-					'id' => $id,
256
-					'order' => $order,
257
-					'href' => $route,
258
-					'icon' => $icon,
259
-					'type' => $type,
260
-					'name' => $l->t($nav['name']),
261
-				]);
262
-			}
263
-		}
264
-	}
254
+                $this->add([
255
+                    'id' => $id,
256
+                    'order' => $order,
257
+                    'href' => $route,
258
+                    'icon' => $icon,
259
+                    'type' => $type,
260
+                    'name' => $l->t($nav['name']),
261
+                ]);
262
+            }
263
+        }
264
+    }
265 265
 
266
-	private function isAdmin() {
267
-		$user = $this->userSession->getUser();
268
-		if ($user !== null) {
269
-			return $this->groupManager->isAdmin($user->getUID());
270
-		}
271
-		return false;
272
-	}
266
+    private function isAdmin() {
267
+        $user = $this->userSession->getUser();
268
+        if ($user !== null) {
269
+            return $this->groupManager->isAdmin($user->getUID());
270
+        }
271
+        return false;
272
+    }
273 273
 
274
-	private function isSubadmin() {
275
-		$user = $this->userSession->getUser();
276
-		if ($user !== null) {
277
-			return $this->groupManager->getSubAdmin()->isSubAdmin($user);
278
-		}
279
-		return false;
280
-	}
274
+    private function isSubadmin() {
275
+        $user = $this->userSession->getUser();
276
+        if ($user !== null) {
277
+            return $this->groupManager->getSubAdmin()->isSubAdmin($user);
278
+        }
279
+        return false;
280
+    }
281 281
 }
Please login to merge, or discard this patch.
lib/public/Settings/IManager.php 2 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -27,99 +27,99 @@
 block discarded – undo
27 27
  * @since 9.1
28 28
  */
29 29
 interface IManager {
30
-	/**
31
-	 * @since 9.1.0
32
-	 */
33
-	const KEY_ADMIN_SETTINGS = 'admin';
30
+    /**
31
+     * @since 9.1.0
32
+     */
33
+    const KEY_ADMIN_SETTINGS = 'admin';
34 34
 
35
-	/**
36
-	 * @since 9.1.0
37
-	 */
38
-	const KEY_ADMIN_SECTION  = 'admin-section';
35
+    /**
36
+     * @since 9.1.0
37
+     */
38
+    const KEY_ADMIN_SECTION  = 'admin-section';
39 39
 
40
-	/**
41
-	 * @since 12.0.0
42
-	 */
43
-	const KEY_PERSONAL_SETTINGS = 'personal';
40
+    /**
41
+     * @since 12.0.0
42
+     */
43
+    const KEY_PERSONAL_SETTINGS = 'personal';
44 44
 
45
-	/**
46
-	 * @since 12.0.0
47
-	 */
48
-	const KEY_PERSONAL_SECTION  = 'personal-section';
45
+    /**
46
+     * @since 12.0.0
47
+     */
48
+    const KEY_PERSONAL_SECTION  = 'personal-section';
49 49
 
50
-	/**
51
-	 * sets up settings according to data specified by an apps info.xml, within
52
-	 * the <settings> element.
53
-	 *
54
-	 * @param array $settings an associative array, allowed keys are as specified
55
-	 *                        by the KEY_ constant of  this interface. The value
56
-	 *                        must always be a class name, implement either
57
-	 *                        IAdmin or ISection. I.e. only one section and admin
58
-	 *                        setting can be configured per app.
59
-	 * @since 9.1.0
60
-	 */
61
-	public function setupSettings(array $settings);
50
+    /**
51
+     * sets up settings according to data specified by an apps info.xml, within
52
+     * the <settings> element.
53
+     *
54
+     * @param array $settings an associative array, allowed keys are as specified
55
+     *                        by the KEY_ constant of  this interface. The value
56
+     *                        must always be a class name, implement either
57
+     *                        IAdmin or ISection. I.e. only one section and admin
58
+     *                        setting can be configured per app.
59
+     * @since 9.1.0
60
+     */
61
+    public function setupSettings(array $settings);
62 62
 
63
-	/**
64
-	 * attempts to remove an apps section and/or settings entry. A listener is
65
-	 * added centrally making sure that this method is called ones an app was
66
-	 * disabled.
67
-	 *
68
-	 * What this does not help with is when applications change their settings
69
-	 * or section classes during their life time. New entries will be added,
70
-	 * but inactive ones will still reside in the database.
71
-	 *
72
-	 * @param string $appId
73
-	 * @since 9.1.0
74
-	 */
75
-	public function onAppDisabled($appId);
63
+    /**
64
+     * attempts to remove an apps section and/or settings entry. A listener is
65
+     * added centrally making sure that this method is called ones an app was
66
+     * disabled.
67
+     *
68
+     * What this does not help with is when applications change their settings
69
+     * or section classes during their life time. New entries will be added,
70
+     * but inactive ones will still reside in the database.
71
+     *
72
+     * @param string $appId
73
+     * @since 9.1.0
74
+     */
75
+    public function onAppDisabled($appId);
76 76
 
77
-	/**
78
-	 * The method should check all registered classes whether they are still
79
-	 * instantiable and remove them, if not. This method is called by a
80
-	 * background job once, after one or more apps were updated.
81
-	 *
82
-	 * An app`s info.xml can change during an update and make it unknown whether
83
-	 * a registered class name was changed or not. An old one would just stay
84
-	 * registered. Another case is if an admin takes a radical approach and
85
-	 * simply removes an app from the app folder. These unregular checks will
86
-	 * take care of such situations.
87
-	 *
88
-	 * @since 9.1.0
89
-	 */
90
-	public function checkForOrphanedClassNames();
77
+    /**
78
+     * The method should check all registered classes whether they are still
79
+     * instantiable and remove them, if not. This method is called by a
80
+     * background job once, after one or more apps were updated.
81
+     *
82
+     * An app`s info.xml can change during an update and make it unknown whether
83
+     * a registered class name was changed or not. An old one would just stay
84
+     * registered. Another case is if an admin takes a radical approach and
85
+     * simply removes an app from the app folder. These unregular checks will
86
+     * take care of such situations.
87
+     *
88
+     * @since 9.1.0
89
+     */
90
+    public function checkForOrphanedClassNames();
91 91
 
92
-	/**
93
-	 * returns a list of the admin sections
94
-	 *
95
-	 * @return array array of ISection[] where key is the priority
96
-	 * @since 9.1.0
97
-	 */
98
-	public function getAdminSections();
92
+    /**
93
+     * returns a list of the admin sections
94
+     *
95
+     * @return array array of ISection[] where key is the priority
96
+     * @since 9.1.0
97
+     */
98
+    public function getAdminSections();
99 99
 
100
-	/**
101
-	 * returns a list of the personal sections
102
-	 *
103
-	 * @return array array of ISection[] where key is the priority
104
-	 * @since 12.0.0
105
-	 */
106
-	public function getPersonalSections();
100
+    /**
101
+     * returns a list of the personal sections
102
+     *
103
+     * @return array array of ISection[] where key is the priority
104
+     * @since 12.0.0
105
+     */
106
+    public function getPersonalSections();
107 107
 
108
-	/**
109
-	 * returns a list of the admin settings
110
-	 *
111
-	 * @param string $section the section id for which to load the settings
112
-	 * @return array array of IAdmin[] where key is the priority
113
-	 * @since 9.1.0
114
-	 */
115
-	public function getAdminSettings($section);
108
+    /**
109
+     * returns a list of the admin settings
110
+     *
111
+     * @param string $section the section id for which to load the settings
112
+     * @return array array of IAdmin[] where key is the priority
113
+     * @since 9.1.0
114
+     */
115
+    public function getAdminSettings($section);
116 116
 
117
-	/**
118
-	 * returns a list of the personal  settings
119
-	 *
120
-	 * @param string $section the section id for which to load the settings
121
-	 * @return array array of IPersonal[] where key is the priority
122
-	 * @since 12.0.0
123
-	 */
124
-	public function getPersonalSettings($section);
117
+    /**
118
+     * returns a list of the personal  settings
119
+     *
120
+     * @param string $section the section id for which to load the settings
121
+     * @return array array of IPersonal[] where key is the priority
122
+     * @since 12.0.0
123
+     */
124
+    public function getPersonalSettings($section);
125 125
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	/**
36 36
 	 * @since 9.1.0
37 37
 	 */
38
-	const KEY_ADMIN_SECTION  = 'admin-section';
38
+	const KEY_ADMIN_SECTION = 'admin-section';
39 39
 
40 40
 	/**
41 41
 	 * @since 12.0.0
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	/**
46 46
 	 * @since 12.0.0
47 47
 	 */
48
-	const KEY_PERSONAL_SECTION  = 'personal-section';
48
+	const KEY_PERSONAL_SECTION = 'personal-section';
49 49
 
50 50
 	/**
51 51
 	 * sets up settings according to data specified by an apps info.xml, within
Please login to merge, or discard this patch.
settings/templates/settings/personal/personal.info.php 3 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 /** @var array $_ */
26 26
 
27 27
 script('settings', [
28
-	'usersettings',
29
-	'federationsettingsview',
30
-	'federationscopemenu',
31
-	'settings/personalInfo',
28
+    'usersettings',
29
+    'federationsettingsview',
30
+    'federationscopemenu',
31
+    'settings/personalInfo',
32 32
 ]);
33 33
 vendor_script('strengthify/jquery.strengthify');
34 34
 vendor_style('strengthify/strengthify');
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 		<p id="quotatext">
47 47
 			<?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
48 48
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>',
49
-					[$_['usage'], $_['total_space']]));?>
49
+                    [$_['usage'], $_['total_space']]));?>
50 50
 			<?php else: ?>
51 51
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)',
52
-					[$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
52
+                    [$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
53 53
 			<?php endif ?>
54 54
 		</p>
55 55
 	</div>
@@ -118,17 +118,17 @@  discard block
 block discarded – undo
118 118
 				<div class="verify <?php if ($_['email'] === ''  || $_['emailScope'] !== 'public') p('hidden'); ?>">
119 119
 					<img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src="
120 120
 				<?php
121
-					switch($_['emailVerification']) {
122
-						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
123
-							p(image_path('core', 'actions/verifying.svg'));
124
-							break;
125
-						case \OC\Accounts\AccountManager::VERIFIED:
126
-							p(image_path('core', 'actions/verified.svg'));
127
-							break;
128
-						default:
129
-							p(image_path('core', 'actions/verify.svg'));
130
-					}
131
-					?>">
121
+                    switch($_['emailVerification']) {
122
+                        case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
123
+                            p(image_path('core', 'actions/verifying.svg'));
124
+                            break;
125
+                        case \OC\Accounts\AccountManager::VERIFIED:
126
+                            p(image_path('core', 'actions/verified.svg'));
127
+                            break;
128
+                        default:
129
+                            p(image_path('core', 'actions/verify.svg'));
130
+                    }
131
+                    ?>">
132 132
 				</div>
133 133
 				<input type="email" name="email" id="email" value="<?php p($_['email']); ?>"
134 134
 					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
@@ -185,17 +185,17 @@  discard block
 block discarded – undo
185 185
 					<div class="verify <?php if ($_['website'] === ''  || $_['websiteScope'] !== 'public') p('hidden'); ?>">
186 186
 						<img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src="
187 187
 				<?php
188
-						switch($_['websiteVerification']) {
189
-							case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
190
-								p(image_path('core', 'actions/verifying.svg'));
191
-								break;
192
-							case \OC\Accounts\AccountManager::VERIFIED:
193
-								p(image_path('core', 'actions/verified.svg'));
194
-								break;
195
-							default:
196
-								p(image_path('core', 'actions/verify.svg'));
197
-						}
198
-						?>"
188
+                        switch($_['websiteVerification']) {
189
+                            case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
190
+                                p(image_path('core', 'actions/verifying.svg'));
191
+                                break;
192
+                            case \OC\Accounts\AccountManager::VERIFIED:
193
+                                p(image_path('core', 'actions/verified.svg'));
194
+                                break;
195
+                            default:
196
+                                p(image_path('core', 'actions/verify.svg'));
197
+                        }
198
+                        ?>"
199 199
 							<?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
200 200
 						>
201 201
 						<div class="verification-dialog popovermenu bubble menu">
@@ -222,17 +222,17 @@  discard block
 block discarded – undo
222 222
 					<div class="verify <?php if ($_['twitter'] === ''  || $_['twitterScope'] !== 'public') p('hidden'); ?>">
223 223
 						<img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src="
224 224
 				<?php
225
-						switch($_['twitterVerification']) {
226
-							case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
227
-								p(image_path('core', 'actions/verifying.svg'));
228
-								break;
229
-							case \OC\Accounts\AccountManager::VERIFIED:
230
-								p(image_path('core', 'actions/verified.svg'));
231
-								break;
232
-							default:
233
-								p(image_path('core', 'actions/verify.svg'));
234
-						}
235
-						?>"
225
+                        switch($_['twitterVerification']) {
226
+                            case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
227
+                                p(image_path('core', 'actions/verifying.svg'));
228
+                                break;
229
+                            case \OC\Accounts\AccountManager::VERIFIED:
230
+                                p(image_path('core', 'actions/verified.svg'));
231
+                                break;
232
+                            default:
233
+                                p(image_path('core', 'actions/verify.svg'));
234
+                        }
235
+                        ?>"
236 236
 							<?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
237 237
 						>
238 238
 						<div class="verification-dialog popovermenu bubble menu">
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 
266 266
 <?php
267 267
 if($_['passwordChangeSupported']) {
268
-	script('jquery-showpassword');
269
-	?>
268
+    script('jquery-showpassword');
269
+    ?>
270 270
 	<form id="passwordform" class="section">
271 271
 		<h2 class="inlineblock"><?php p($l->t('Password'));?></h2>
272 272
 		<div id="password-error-msg" class="msg success inlineblock" style="display: none;">Saved</div>
Please login to merge, or discard this patch.
Braces   +32 added lines, -11 removed lines patch added patch discarded remove patch
@@ -47,9 +47,12 @@  discard block
 block discarded – undo
47 47
 			<?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
48 48
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>',
49 49
 					[$_['usage'], $_['total_space']]));?>
50
-			<?php else: ?>
50
+			<?php else {
51
+    : ?>
51 52
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)',
52
-					[$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
53
+					[$_['usage'], $_['total_space'],  $_['usage_relative']]));
54
+}
55
+?>
53 56
 			<?php endif ?>
54 57
 		</p>
55 58
 	</div>
@@ -71,8 +74,11 @@  discard block
 block discarded – undo
71 74
 					<div class="hidden button icon-delete svg" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div>
72 75
 					<input type="file" name="files[]" id="uploadavatar" class="hiddenuploadfield">
73 76
 					<p><em><?php p($l->t('png or jpg, max. 20 MB')); ?></em></p>
74
-				<?php else: ?>
75
-					<?php p($l->t('Picture provided by original account')); ?>
77
+				<?php else {
78
+    : ?>
79
+					<?php p($l->t('Picture provided by original account'));
80
+}
81
+?>
76 82
 				<?php endif; ?>
77 83
 			</div>
78 84
 
@@ -115,7 +121,10 @@  discard block
 block discarded – undo
115 121
 					<label for="email"><?php p($l->t('Email')); ?></label>
116 122
 					<span class="icon-password"/>
117 123
 				</h2>
118
-				<div class="verify <?php if ($_['email'] === ''  || $_['emailScope'] !== 'public') p('hidden'); ?>">
124
+				<div class="verify <?php if ($_['email'] === ''  || $_['emailScope'] !== 'public') {
125
+    p('hidden');
126
+}
127
+?>">
119 128
 					<img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src="
120 129
 				<?php
121 130
 					switch($_['emailVerification']) {
@@ -182,7 +191,10 @@  discard block
 block discarded – undo
182 191
 						<label for="website"><?php p($l->t('Website')); ?></label>
183 192
 						<span class="icon-password"/>
184 193
 					</h2>
185
-					<div class="verify <?php if ($_['website'] === ''  || $_['websiteScope'] !== 'public') p('hidden'); ?>">
194
+					<div class="verify <?php if ($_['website'] === ''  || $_['websiteScope'] !== 'public') {
195
+    p('hidden');
196
+}
197
+?>">
186 198
 						<img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src="
187 199
 				<?php
188 200
 						switch($_['websiteVerification']) {
@@ -196,13 +208,16 @@  discard block
 block discarded – undo
196 208
 								p(image_path('core', 'actions/verify.svg'));
197 209
 						}
198 210
 						?>"
199
-							<?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
211
+							<?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) {
212
+    print_unescaped(' class="verify-action"') ?>
200 213
 						>
201 214
 						<div class="verification-dialog popovermenu bubble menu">
202 215
 							<div class="verification-dialog-content">
203 216
 								<p class="explainVerification"></p>
204 217
 								<p class="verificationCode"></p>
205
-								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
218
+								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));
219
+}
220
+?></p>
206 221
 							</div>
207 222
 						</div>
208 223
 					</div>
@@ -219,7 +234,10 @@  discard block
 block discarded – undo
219 234
 						<label for="twitter"><?php p($l->t('Twitter')); ?></label>
220 235
 						<span class="icon-password"/>
221 236
 					</h2>
222
-					<div class="verify <?php if ($_['twitter'] === ''  || $_['twitterScope'] !== 'public') p('hidden'); ?>">
237
+					<div class="verify <?php if ($_['twitter'] === ''  || $_['twitterScope'] !== 'public') {
238
+    p('hidden');
239
+}
240
+?>">
223 241
 						<img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src="
224 242
 				<?php
225 243
 						switch($_['twitterVerification']) {
@@ -233,13 +251,16 @@  discard block
 block discarded – undo
233 251
 								p(image_path('core', 'actions/verify.svg'));
234 252
 						}
235 253
 						?>"
236
-							<?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
254
+							<?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) {
255
+    print_unescaped(' class="verify-action"') ?>
237 256
 						>
238 257
 						<div class="verification-dialog popovermenu bubble menu">
239 258
 							<div class="verification-dialog-content">
240 259
 								<p class="explainVerification"></p>
241 260
 								<p class="verificationCode"></p>
242
-								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
261
+								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));
262
+}
263
+?></p>
243 264
 							</div>
244 265
 						</div>
245 266
 					</div>
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
 ?>
39 39
 
40 40
 <div id="quota" class="section">
41
-	<div style="width:<?php p($_['usage_relative']);?>%"
42
-		<?php if($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>>
41
+	<div style="width:<?php p($_['usage_relative']); ?>%"
42
+		<?php if ($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>>
43 43
 		<p id="quotatext">
44 44
 			<?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
45 45
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>',
46
-					[$_['usage'], $_['total_space']]));?>
46
+					[$_['usage'], $_['total_space']])); ?>
47 47
 			<?php else: ?>
48 48
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)',
49
-					[$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
49
+					[$_['usage'], $_['total_space'], $_['usage_relative']])); ?>
50 50
 			<?php endif ?>
51 51
 		</p>
52 52
 	</div>
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 				</div>
81 81
 			</div>
82 82
 			<span class="icon-checkmark hidden"/>
83
-			<?php if($_['lookupServerUploadEnabled']) { ?>
83
+			<?php if ($_['lookupServerUploadEnabled']) { ?>
84 84
 				<input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>">
85 85
 			<?php } ?>
86 86
 		</form>
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 					<span class="icon-password"/>
95 95
 				</h2>
96 96
 				<input type="text" id="displayname" name="displayname"
97
-					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
97
+					<?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
98 98
 					   value="<?php p($_['displayName']) ?>"
99 99
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
100
-				<?php if(!$_['displayNameChangeSupported']) { ?>
101
-					<span><?php if(isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span>
100
+				<?php if (!$_['displayNameChangeSupported']) { ?>
101
+					<span><?php if (isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span>
102 102
 				<?php } ?>
103 103
 				<span class="icon-checkmark hidden"/>
104
-				<?php if($_['lookupServerUploadEnabled']) { ?>
104
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
105 105
 					<input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>">
106 106
 				<?php } ?>
107 107
 			</form>
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
 					<label for="email"><?php p($l->t('Email')); ?></label>
113 113
 					<span class="icon-password"/>
114 114
 				</h2>
115
-				<div class="verify <?php if ($_['email'] === ''  || $_['emailScope'] !== 'public') p('hidden'); ?>">
115
+				<div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') p('hidden'); ?>">
116 116
 					<img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src="
117 117
 				<?php
118
-					switch($_['emailVerification']) {
118
+					switch ($_['emailVerification']) {
119 119
 						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
120 120
 							p(image_path('core', 'actions/verifying.svg'));
121 121
 							break;
@@ -128,23 +128,23 @@  discard block
 block discarded – undo
128 128
 					?>">
129 129
 				</div>
130 130
 				<input type="email" name="email" id="email" value="<?php p($_['email']); ?>"
131
-					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
131
+					<?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
132 132
 					   placeholder="<?php p($l->t('Your email address')); ?>"
133 133
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
134
-				<?php if(!$_['displayNameChangeSupported']) { ?>
135
-					<span><?php if(isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span>
134
+				<?php if (!$_['displayNameChangeSupported']) { ?>
135
+					<span><?php if (isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span>
136 136
 				<?php } ?>
137
-				<?php if($_['displayNameChangeSupported']) { ?>
137
+				<?php if ($_['displayNameChangeSupported']) { ?>
138 138
 					<br />
139 139
 					<em><?php p($l->t('For password reset and notifications')); ?></em>
140 140
 				<?php } ?>
141 141
 				<span class="icon-checkmark hidden"/>
142
-				<?php if($_['lookupServerUploadEnabled']) { ?>
142
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
143 143
 					<input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>">
144 144
 				<?php } ?>
145 145
 			</form>
146 146
 		</div>
147
-		<?php if($_['lookupServerUploadEnabled']) { ?>
147
+		<?php if ($_['lookupServerUploadEnabled']) { ?>
148 148
 			<div class="personal-settings-setting-box">
149 149
 				<form id="phoneform" class="section">
150 150
 					<h2>
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 						<label for="website"><?php p($l->t('Website')); ?></label>
180 180
 						<span class="icon-password"/>
181 181
 					</h2>
182
-					<div class="verify <?php if ($_['website'] === ''  || $_['websiteScope'] !== 'public') p('hidden'); ?>">
182
+					<div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>">
183 183
 						<img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src="
184 184
 				<?php
185
-						switch($_['websiteVerification']) {
185
+						switch ($_['websiteVerification']) {
186 186
 							case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
187 187
 								p(image_path('core', 'actions/verifying.svg'));
188 188
 								break;
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 								p(image_path('core', 'actions/verify.svg'));
194 194
 						}
195 195
 						?>"
196
-							<?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
196
+							<?php if ($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
197 197
 						>
198 198
 						<div class="verification-dialog popovermenu bubble menu">
199 199
 							<div class="verification-dialog-content">
200 200
 								<p class="explainVerification"></p>
201 201
 								<p class="verificationCode"></p>
202
-								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
202
+								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
203 203
 							</div>
204 204
 						</div>
205 205
 					</div>
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 						<label for="twitter"><?php p($l->t('Twitter')); ?></label>
217 217
 						<span class="icon-password"/>
218 218
 					</h2>
219
-					<div class="verify <?php if ($_['twitter'] === ''  || $_['twitterScope'] !== 'public') p('hidden'); ?>">
219
+					<div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') p('hidden'); ?>">
220 220
 						<img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src="
221 221
 				<?php
222
-						switch($_['twitterVerification']) {
222
+						switch ($_['twitterVerification']) {
223 223
 							case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
224 224
 								p(image_path('core', 'actions/verifying.svg'));
225 225
 								break;
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 								p(image_path('core', 'actions/verify.svg'));
231 231
 						}
232 232
 						?>"
233
-							<?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
233
+							<?php if ($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
234 234
 						>
235 235
 						<div class="verification-dialog popovermenu bubble menu">
236 236
 							<div class="verification-dialog-content">
237 237
 								<p class="explainVerification"></p>
238 238
 								<p class="verificationCode"></p>
239
-								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
239
+								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
240 240
 							</div>
241 241
 						</div>
242 242
 					</div>
@@ -261,19 +261,19 @@  discard block
 block discarded – undo
261 261
 </div>
262 262
 
263 263
 <?php
264
-if($_['passwordChangeSupported']) {
264
+if ($_['passwordChangeSupported']) {
265 265
 	script('jquery-showpassword');
266 266
 	?>
267 267
 	<form id="passwordform" class="section">
268
-		<h2 class="inlineblock"><?php p($l->t('Password'));?></h2>
268
+		<h2 class="inlineblock"><?php p($l->t('Password')); ?></h2>
269 269
 		<div id="password-error-msg" class="msg success inlineblock" style="display: none;">Saved</div>
270 270
 		<br>
271 271
 		<label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label>
272 272
 		<input type="password" id="pass1" name="oldpassword"
273
-			   placeholder="<?php p($l->t('Current password'));?>"
273
+			   placeholder="<?php p($l->t('Current password')); ?>"
274 274
 			   autocomplete="off" autocapitalize="none" autocorrect="off" />
275 275
 		<div class="personal-show-container">
276
-			<label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label>
276
+			<label for="pass2" class="hidden-visually"><?php p($l->t('New password')); ?>: </label>
277 277
 			<input type="password" id="pass2" name="newpassword"
278 278
 				   placeholder="<?php p($l->t('New password')); ?>"
279 279
 				   data-typetoggle="#personal-show"
@@ -290,27 +290,27 @@  discard block
 block discarded – undo
290 290
 <?php if (isset($_['activelanguage'])) { ?>
291 291
 <form id="language" class="section">
292 292
 	<h2>
293
-		<label for="languageinput"><?php p($l->t('Language'));?></label>
293
+		<label for="languageinput"><?php p($l->t('Language')); ?></label>
294 294
 	</h2>
295
-	<select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language'));?>">
296
-		<option value="<?php p($_['activelanguage']['code']);?>">
297
-			<?php p($_['activelanguage']['name']);?>
295
+	<select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language')); ?>">
296
+		<option value="<?php p($_['activelanguage']['code']); ?>">
297
+			<?php p($_['activelanguage']['name']); ?>
298 298
 		</option>
299
-		<?php foreach($_['commonlanguages'] as $language):?>
300
-			<option value="<?php p($language['code']);?>">
301
-				<?php p($language['name']);?>
299
+		<?php foreach ($_['commonlanguages'] as $language):?>
300
+			<option value="<?php p($language['code']); ?>">
301
+				<?php p($language['name']); ?>
302 302
 			</option>
303
-		<?php endforeach;?>
303
+		<?php endforeach; ?>
304 304
 		<optgroup label="––––––––––"></optgroup>
305
-		<?php foreach($_['languages'] as $language):?>
306
-			<option value="<?php p($language['code']);?>">
307
-				<?php p($language['name']);?>
305
+		<?php foreach ($_['languages'] as $language):?>
306
+			<option value="<?php p($language['code']); ?>">
307
+				<?php p($language['name']); ?>
308 308
 			</option>
309
-		<?php endforeach;?>
309
+		<?php endforeach; ?>
310 310
 	</select>
311 311
 	<a href="https://www.transifex.com/nextcloud/nextcloud/"
312 312
 	   target="_blank" rel="noreferrer">
313
-		<em><?php p($l->t('Help translate'));?></em>
313
+		<em><?php p($l->t('Help translate')); ?></em>
314 314
 	</a>
315 315
 </form>
316 316
 <?php } ?>
Please login to merge, or discard this patch.
settings/templates/settings/personal/sync-clients.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,15 +42,15 @@
 block discarded – undo
42 42
 
43 43
 	<p>
44 44
 		<?php print_unescaped(str_replace(
45
-			[
46
-				'{contributeopen}',
47
-				'{linkclose}',
48
-			],
49
-			[
50
-				'<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">',
51
-				'</a>',
52
-			],
53
-			$l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?>
45
+            [
46
+                '{contributeopen}',
47
+                '{linkclose}',
48
+            ],
49
+            [
50
+                '<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">',
51
+                '</a>',
52
+            ],
53
+            $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?>
54 54
 	</p>
55 55
 
56 56
 	<?php if(OC_APP::isEnabled('firstrunwizard')) {?>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
 ?>
27 27
 
28 28
 <div id="clientsbox" class="section clientsbox">
29
-	<h2><?php p($l->t('Get the apps to sync your files'));?></h2>
29
+	<h2><?php p($l->t('Get the apps to sync your files')); ?></h2>
30 30
 	<a href="<?php p($_['clients']['desktop']); ?>" rel="noreferrer" target="_blank">
31 31
 		<img src="<?php print_unescaped(image_path('core', 'desktopapp.svg')); ?>"
32
-			 alt="<?php p($l->t('Desktop client'));?>" />
32
+			 alt="<?php p($l->t('Desktop client')); ?>" />
33 33
 	</a>
34 34
 	<a href="<?php p($_['clients']['android']); ?>" rel="noreferrer" target="_blank">
35 35
 		<img src="<?php print_unescaped(image_path('core', 'googleplay.png')); ?>"
36
-			 alt="<?php p($l->t('Android app'));?>" />
36
+			 alt="<?php p($l->t('Android app')); ?>" />
37 37
 	</a>
38 38
 	<a href="<?php p($_['clients']['ios']); ?>" rel="noreferrer" target="_blank">
39 39
 		<img src="<?php print_unescaped(image_path('core', 'appstore.svg')); ?>"
40
-			 alt="<?php p($l->t('iOS app'));?>" />
40
+			 alt="<?php p($l->t('iOS app')); ?>" />
41 41
 	</a>
42 42
 
43 43
 	<p>
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			$l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?>
54 54
 	</p>
55 55
 
56
-	<?php if(OC_APP::isEnabled('firstrunwizard')) {?>
57
-		<p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again'));?></a></p>
56
+	<?php if (OC_APP::isEnabled('firstrunwizard')) {?>
57
+		<p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again')); ?></a></p>
58 58
 	<?php }?>
59 59
 </div>
Please login to merge, or discard this patch.
lib/private/Settings/Manager.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -265,6 +265,9 @@  discard block
 block discarded – undo
265 265
 		return $this->mapper->has($table, $className);
266 266
 	}
267 267
 
268
+	/**
269
+	 * @param string $type
270
+	 */
268 271
 	private function setupSettingsEntry($settingsClassName, $type) {
269 272
 		if (!class_exists($settingsClassName)) {
270 273
 			$this->log->debug('Could not find ' . $type . ' section class ' . $settingsClassName);
@@ -294,6 +297,9 @@  discard block
 block discarded – undo
294 297
 		}
295 298
 	}
296 299
 
300
+	/**
301
+	 * @param string $type
302
+	 */
297 303
 	private function getSectionTableForType($type) {
298 304
 		if($type === 'admin') {
299 305
 			return Mapper::TABLE_ADMIN_SECTIONS;
Please login to merge, or discard this patch.
Indentation   +486 added lines, -486 removed lines patch added patch discarded remove patch
@@ -42,490 +42,490 @@
 block discarded – undo
42 42
 use OCP\Settings\ISection;
43 43
 
44 44
 class Manager implements IManager {
45
-	/** @var ILogger */
46
-	private $log;
47
-	/** @var IDBConnection */
48
-	private $dbc;
49
-	/** @var Mapper */
50
-	private $mapper;
51
-	/** @var IL10N */
52
-	private $l;
53
-	/** @var IConfig */
54
-	private $config;
55
-	/** @var EncryptionManager */
56
-	private $encryptionManager;
57
-	/** @var IUserManager */
58
-	private $userManager;
59
-	/** @var ILockingProvider */
60
-	private $lockingProvider;
61
-	/** @var IRequest */
62
-	private $request;
63
-	/** @var IURLGenerator */
64
-	private $url;
65
-	/** @var AccountManager */
66
-	private $accountManager;
67
-	/** @var IGroupManager */
68
-	private $groupManager;
69
-	/** @var IFactory */
70
-	private $l10nFactory;
71
-	/** @var \OC_Defaults */
72
-	private $defaults;
73
-	/** @var IAppManager */
74
-	private $appManager;
75
-
76
-	/**
77
-	 * @param ILogger $log
78
-	 * @param IDBConnection $dbc
79
-	 * @param IL10N $l
80
-	 * @param IConfig $config
81
-	 * @param EncryptionManager $encryptionManager
82
-	 * @param IUserManager $userManager
83
-	 * @param ILockingProvider $lockingProvider
84
-	 * @param IRequest $request
85
-	 * @param Mapper $mapper
86
-	 * @param IURLGenerator $url
87
-	 * @param AccountManager $accountManager
88
-	 * @param IGroupManager $groupManager
89
-	 * @param IFactory $l10nFactory
90
-	 * @param \OC_Defaults $defaults
91
-	 */
92
-	public function __construct(
93
-		ILogger $log,
94
-		IDBConnection $dbc,
95
-		IL10N $l,
96
-		IConfig $config,
97
-		EncryptionManager $encryptionManager,
98
-		IUserManager $userManager,
99
-		ILockingProvider $lockingProvider,
100
-		IRequest $request,
101
-		Mapper $mapper,
102
-		IURLGenerator $url,
103
-		AccountManager $accountManager,
104
-		IGroupManager $groupManager,
105
-		IFactory $l10nFactory,
106
-		\OC_Defaults $defaults,
107
-		IAppManager $appManager
108
-	) {
109
-		$this->log = $log;
110
-		$this->dbc = $dbc;
111
-		$this->mapper = $mapper;
112
-		$this->l = $l;
113
-		$this->config = $config;
114
-		$this->encryptionManager = $encryptionManager;
115
-		$this->userManager = $userManager;
116
-		$this->lockingProvider = $lockingProvider;
117
-		$this->request = $request;
118
-		$this->url = $url;
119
-		$this->accountManager = $accountManager;
120
-		$this->groupManager = $groupManager;
121
-		$this->l10nFactory = $l10nFactory;
122
-		$this->defaults = $defaults;
123
-		$this->appManager = $appManager;
124
-	}
125
-
126
-	/**
127
-	 * @inheritdoc
128
-	 */
129
-	public function setupSettings(array $settings) {
130
-		if (isset($settings[IManager::KEY_ADMIN_SECTION])) {
131
-			$this->setupSectionEntry($settings[IManager::KEY_ADMIN_SECTION], 'admin');
132
-		}
133
-		if (isset($settings[IManager::KEY_ADMIN_SETTINGS])) {
134
-			$this->setupSettingsEntry($settings[IManager::KEY_ADMIN_SETTINGS], 'admin');
135
-		}
136
-
137
-		if (isset($settings[IManager::KEY_PERSONAL_SECTION])) {
138
-			$this->setupSectionEntry($settings[IManager::KEY_PERSONAL_SECTION], 'personal');
139
-		}
140
-		if (isset($settings[IManager::KEY_PERSONAL_SETTINGS])) {
141
-			$this->setupSettingsEntry($settings[IManager::KEY_PERSONAL_SETTINGS], 'personal');
142
-		}
143
-	}
144
-
145
-	/**
146
-	 * attempts to remove an apps section and/or settings entry. A listener is
147
-	 * added centrally making sure that this method is called ones an app was
148
-	 * disabled.
149
-	 *
150
-	 * @param string $appId
151
-	 * @since 9.1.0
152
-	 */
153
-	public function onAppDisabled($appId) {
154
-		$appInfo = \OC_App::getAppInfo($appId); // hello static legacy
155
-
156
-		if (isset($appInfo['settings'][IManager::KEY_ADMIN_SECTION])) {
157
-			$this->mapper->remove(Mapper::TABLE_ADMIN_SECTIONS, trim($appInfo['settings'][IManager::KEY_ADMIN_SECTION], '\\'));
158
-		}
159
-		if (isset($appInfo['settings'][IManager::KEY_ADMIN_SETTINGS])) {
160
-			$this->mapper->remove(Mapper::TABLE_ADMIN_SETTINGS, trim($appInfo['settings'][IManager::KEY_ADMIN_SETTINGS], '\\'));
161
-		}
162
-
163
-		if (isset($appInfo['settings'][IManager::KEY_PERSONAL_SECTION])) {
164
-			$this->mapper->remove(Mapper::TABLE_PERSONAL_SECTIONS, trim($appInfo['settings'][IManager::KEY_PERSONAL_SECTION], '\\'));
165
-		}
166
-		if (isset($appInfo['settings'][IManager::KEY_PERSONAL_SETTINGS])) {
167
-			$this->mapper->remove(Mapper::TABLE_PERSONAL_SETTINGS, trim($appInfo['settings'][IManager::KEY_PERSONAL_SETTINGS], '\\'));
168
-		}
169
-	}
170
-
171
-	public function checkForOrphanedClassNames() {
172
-		$tables = [Mapper::TABLE_ADMIN_SECTIONS, Mapper::TABLE_ADMIN_SETTINGS, Mapper::TABLE_PERSONAL_SECTIONS, Mapper::TABLE_PERSONAL_SETTINGS];
173
-		foreach ($tables as $table) {
174
-			$classes = $this->mapper->getClasses($table);
175
-			foreach ($classes as $className) {
176
-				try {
177
-					\OC::$server->query($className);
178
-				} catch (QueryException $e) {
179
-					$this->mapper->remove($table, $className);
180
-				}
181
-			}
182
-		}
183
-	}
184
-
185
-	/**
186
-	 * @param string $sectionClassName
187
-	 * @param string $type either 'admin' or 'personal'
188
-	 */
189
-	private function setupSectionEntry($sectionClassName, $type) {
190
-		if (!class_exists($sectionClassName)) {
191
-			$this->log->debug('Could not find ' . ucfirst($type) . ' section class ' . $sectionClassName);
192
-			return;
193
-		}
194
-		try {
195
-			$section = $this->query($sectionClassName);
196
-		} catch (QueryException $e) {
197
-			// cancel
198
-			return;
199
-		}
200
-
201
-		if (!$section instanceof ISection) {
202
-			$this->log->error(
203
-				ucfirst($type) .' section instance must implement \OCP\ISection. Invalid class: {class}',
204
-				['class' => $sectionClassName]
205
-			);
206
-			return;
207
-		}
208
-		$table = $this->getSectionTableForType($type);
209
-		if(!$this->hasSection(get_class($section), $table)) {
210
-			$this->addSection($section, $table);
211
-		} else {
212
-			$this->updateSection($section, $table);
213
-		}
214
-	}
215
-
216
-	private function addSection(ISection $section, $table) {
217
-		$this->mapper->add($table, [
218
-			'id' => $section->getID(),
219
-			'class' => get_class($section),
220
-			'priority' => $section->getPriority(),
221
-		]);
222
-	}
223
-
224
-	private function addSettings(ISettings $settings, $table) {
225
-		$this->mapper->add($table, [
226
-			'class' => get_class($settings),
227
-			'section' => $settings->getSection(),
228
-			'priority' => $settings->getPriority(),
229
-		]);
230
-	}
231
-
232
-	private function updateSettings(ISettings $settings, $table) {
233
-		$this->mapper->update(
234
-			$table,
235
-			'class',
236
-			get_class($settings),
237
-			[
238
-				'section' => $settings->getSection(),
239
-				'priority' => $settings->getPriority(),
240
-			]
241
-		);
242
-	}
243
-
244
-	private function updateSection(ISection $section, $table) {
245
-		$this->mapper->update(
246
-			$table,
247
-			'class',
248
-			get_class($section),
249
-			[
250
-				'id' => $section->getID(),
251
-				'priority' => $section->getPriority(),
252
-			]
253
-		);
254
-	}
255
-
256
-	/**
257
-	 * @param string $className
258
-	 * @param string $table
259
-	 * @return bool
260
-	 */
261
-	private function hasSection($className, $table) {
262
-		return $this->mapper->has($table, $className);
263
-	}
264
-
265
-	/**
266
-	 * @param string $className
267
-	 * @return bool
268
-	 */
269
-	private function hasSettings($className, $table) {
270
-		return $this->mapper->has($table, $className);
271
-	}
272
-
273
-	private function setupSettingsEntry($settingsClassName, $type) {
274
-		if (!class_exists($settingsClassName)) {
275
-			$this->log->debug('Could not find ' . $type . ' section class ' . $settingsClassName);
276
-			return;
277
-		}
278
-
279
-		try {
280
-			/** @var ISettings $settings */
281
-			$settings = $this->query($settingsClassName);
282
-		} catch (QueryException $e) {
283
-			// cancel
284
-			return;
285
-		}
286
-
287
-		if (!$settings instanceof ISettings) {
288
-			$this->log->error(
289
-				ucfirst($type) . ' section instance must implement \OCP\Settings\ISettings. Invalid class: {class}',
290
-				['class' => $settingsClassName]
291
-			);
292
-			return;
293
-		}
294
-		$table = $this->getSettingsTableForType($type);
295
-		if (!$this->hasSettings(get_class($settings), $table)) {
296
-			$this->addSettings($settings, $table);
297
-		} else {
298
-			$this->updateSettings($settings, $table);
299
-		}
300
-	}
301
-
302
-	private function getSectionTableForType($type) {
303
-		if($type === 'admin') {
304
-			return Mapper::TABLE_ADMIN_SECTIONS;
305
-		} else if($type === 'personal') {
306
-			return Mapper::TABLE_PERSONAL_SECTIONS;
307
-		}
308
-		throw new \InvalidArgumentException('"admin" or "personal" expected');
309
-	}
310
-
311
-	private function getSettingsTableForType($type) {
312
-		if($type === 'admin') {
313
-			return Mapper::TABLE_ADMIN_SETTINGS;
314
-		} else if($type === 'personal') {
315
-			return Mapper::TABLE_PERSONAL_SETTINGS;
316
-		}
317
-		throw new \InvalidArgumentException('"admin" or "personal" expected');
318
-	}
319
-
320
-	private function query($className) {
321
-		try {
322
-			return \OC::$server->query($className);
323
-		} catch (QueryException $e) {
324
-			$this->log->logException($e);
325
-			throw $e;
326
-		}
327
-	}
328
-
329
-	/**
330
-	 * @inheritdoc
331
-	 */
332
-	public function getAdminSections() {
333
-		// built-in sections
334
-		$sections = [
335
-			0 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('settings', 'admin.svg'))],
336
-			5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
337
-			10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
338
-			45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
339
-			98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
340
-			99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
341
-		];
342
-
343
-		$rows = $this->mapper->getAdminSectionsFromDB();
344
-
345
-		foreach ($rows as $row) {
346
-			if (!isset($sections[$row['priority']])) {
347
-				$sections[$row['priority']] = [];
348
-			}
349
-			try {
350
-				$sections[$row['priority']][] = $this->query($row['class']);
351
-			} catch (QueryException $e) {
352
-				// skip
353
-			}
354
-		}
355
-
356
-		ksort($sections);
357
-
358
-		return $sections;
359
-	}
360
-
361
-	/**
362
-	 * @param string $section
363
-	 * @return ISection[]
364
-	 */
365
-	private function getBuiltInAdminSettings($section) {
366
-		$forms = [];
367
-		try {
368
-			if ($section === 'server') {
369
-				/** @var ISettings $form */
370
-				$form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
371
-				$forms[$form->getPriority()] = [$form];
372
-				$form = new Admin\ServerDevNotice();
373
-				$forms[$form->getPriority()] = [$form];
374
-			}
375
-			if ($section === 'encryption') {
376
-				/** @var ISettings $form */
377
-				$form = new Admin\Encryption($this->encryptionManager, $this->userManager);
378
-				$forms[$form->getPriority()] = [$form];
379
-			}
380
-			if ($section === 'sharing') {
381
-				/** @var ISettings $form */
382
-				$form = new Admin\Sharing($this->config);
383
-				$forms[$form->getPriority()] = [$form];
384
-			}
385
-			if ($section === 'additional') {
386
-				/** @var ISettings $form */
387
-				$form = new Admin\Additional($this->config);
388
-				$forms[$form->getPriority()] = [$form];
389
-			}
390
-			if ($section === 'tips-tricks') {
391
-				/** @var ISettings $form */
392
-				$form = new Admin\TipsTricks($this->config);
393
-				$forms[$form->getPriority()] = [$form];
394
-			}
395
-		} catch (QueryException $e) {
396
-			// skip
397
-		}
398
-		return $forms;
399
-	}
400
-
401
-	/**
402
-	 * @param string $section
403
-	 * @return ISection[]
404
-	 */
405
-	private function getBuiltInPersonalSettings($section) {
406
-		$forms = [];
407
-		try {
408
-			if ($section === 'personal-info') {
409
-				/** @var ISettings $form */
410
-				$form = new Personal\PersonalInfo(
411
-					$this->config,
412
-					$this->userManager,
413
-					$this->groupManager,
414
-					$this->accountManager,
415
-					$this->appManager,
416
-					$this->l10nFactory,
417
-					$this->l
418
-				);
419
-				$forms[$form->getPriority()] = [$form];
420
-			}
421
-			if($section === 'security') {
422
-				/** @var ISettings $form */
423
-				$form = new Personal\Security();
424
-				$forms[$form->getPriority()] = [$form];
425
-			}
426
-			if($section === 'sync-clients') {
427
-				/** @var ISettings $form */
428
-				$form = new Personal\SyncClients($this->config, $this->defaults);
429
-				$forms[$form->getPriority()] = [$form];
430
-			}
431
-			if ($section === 'additional') {
432
-				/** @var ISettings $form */
433
-				$form = new Personal\Additional($this->config);
434
-				$forms[$form->getPriority()] = [$form];
435
-			}
436
-		} catch (QueryException $e) {
437
-			// skip
438
-		}
439
-		return $forms;
440
-	}
441
-
442
-	/**
443
-	 * @inheritdoc
444
-	 */
445
-	public function getAdminSettings($section) {
446
-		$settings = $this->getBuiltInAdminSettings($section);
447
-		$dbRows = $this->mapper->getAdminSettingsFromDB($section);
448
-
449
-		foreach ($dbRows as $row) {
450
-			if (!isset($settings[$row['priority']])) {
451
-				$settings[$row['priority']] = [];
452
-			}
453
-			try {
454
-				$settings[$row['priority']][] = $this->query($row['class']);
455
-			} catch (QueryException $e) {
456
-				// skip
457
-			}
458
-		}
459
-
460
-		ksort($settings);
461
-		return $settings;
462
-	}
463
-
464
-	/**
465
-	 * @inheritdoc
466
-	 */
467
-	public function getPersonalSections() {
468
-		$sections = [
469
-			0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
470
-			5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
471
-			15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))],
472
-		];
473
-
474
-		$legacyForms = \OC_App::getForms('personal');
475
-		if(count($legacyForms) > 0 && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
476
-			$sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
477
-		}
478
-
479
-		$rows = $this->mapper->getPersonalSectionsFromDB();
480
-
481
-		foreach ($rows as $row) {
482
-			if (!isset($sections[$row['priority']])) {
483
-				$sections[$row['priority']] = [];
484
-			}
485
-			try {
486
-				$sections[$row['priority']][] = $this->query($row['class']);
487
-			} catch (QueryException $e) {
488
-				// skip
489
-			}
490
-		}
491
-
492
-		ksort($sections);
493
-
494
-		return $sections;
495
-	}
496
-
497
-	/**
498
-	 * @param $forms
499
-	 * @return bool
500
-	 */
501
-	private function hasLegacyPersonalSettingsToRender($forms) {
502
-		foreach ($forms as $form) {
503
-			if(trim($form) !== '') {
504
-				return true;
505
-			}
506
-		}
507
-		return false;
508
-	}
509
-
510
-	/**
511
-	 * @inheritdoc
512
-	 */
513
-	public function getPersonalSettings($section) {
514
-		$settings = $this->getBuiltInPersonalSettings($section);
515
-		$dbRows = $this->mapper->getPersonalSettingsFromDB($section);
516
-
517
-		foreach ($dbRows as $row) {
518
-			if (!isset($settings[$row['priority']])) {
519
-				$settings[$row['priority']] = [];
520
-			}
521
-			try {
522
-				$settings[$row['priority']][] = $this->query($row['class']);
523
-			} catch (QueryException $e) {
524
-				// skip
525
-			}
526
-		}
527
-
528
-		ksort($settings);
529
-		return $settings;
530
-	}
45
+    /** @var ILogger */
46
+    private $log;
47
+    /** @var IDBConnection */
48
+    private $dbc;
49
+    /** @var Mapper */
50
+    private $mapper;
51
+    /** @var IL10N */
52
+    private $l;
53
+    /** @var IConfig */
54
+    private $config;
55
+    /** @var EncryptionManager */
56
+    private $encryptionManager;
57
+    /** @var IUserManager */
58
+    private $userManager;
59
+    /** @var ILockingProvider */
60
+    private $lockingProvider;
61
+    /** @var IRequest */
62
+    private $request;
63
+    /** @var IURLGenerator */
64
+    private $url;
65
+    /** @var AccountManager */
66
+    private $accountManager;
67
+    /** @var IGroupManager */
68
+    private $groupManager;
69
+    /** @var IFactory */
70
+    private $l10nFactory;
71
+    /** @var \OC_Defaults */
72
+    private $defaults;
73
+    /** @var IAppManager */
74
+    private $appManager;
75
+
76
+    /**
77
+     * @param ILogger $log
78
+     * @param IDBConnection $dbc
79
+     * @param IL10N $l
80
+     * @param IConfig $config
81
+     * @param EncryptionManager $encryptionManager
82
+     * @param IUserManager $userManager
83
+     * @param ILockingProvider $lockingProvider
84
+     * @param IRequest $request
85
+     * @param Mapper $mapper
86
+     * @param IURLGenerator $url
87
+     * @param AccountManager $accountManager
88
+     * @param IGroupManager $groupManager
89
+     * @param IFactory $l10nFactory
90
+     * @param \OC_Defaults $defaults
91
+     */
92
+    public function __construct(
93
+        ILogger $log,
94
+        IDBConnection $dbc,
95
+        IL10N $l,
96
+        IConfig $config,
97
+        EncryptionManager $encryptionManager,
98
+        IUserManager $userManager,
99
+        ILockingProvider $lockingProvider,
100
+        IRequest $request,
101
+        Mapper $mapper,
102
+        IURLGenerator $url,
103
+        AccountManager $accountManager,
104
+        IGroupManager $groupManager,
105
+        IFactory $l10nFactory,
106
+        \OC_Defaults $defaults,
107
+        IAppManager $appManager
108
+    ) {
109
+        $this->log = $log;
110
+        $this->dbc = $dbc;
111
+        $this->mapper = $mapper;
112
+        $this->l = $l;
113
+        $this->config = $config;
114
+        $this->encryptionManager = $encryptionManager;
115
+        $this->userManager = $userManager;
116
+        $this->lockingProvider = $lockingProvider;
117
+        $this->request = $request;
118
+        $this->url = $url;
119
+        $this->accountManager = $accountManager;
120
+        $this->groupManager = $groupManager;
121
+        $this->l10nFactory = $l10nFactory;
122
+        $this->defaults = $defaults;
123
+        $this->appManager = $appManager;
124
+    }
125
+
126
+    /**
127
+     * @inheritdoc
128
+     */
129
+    public function setupSettings(array $settings) {
130
+        if (isset($settings[IManager::KEY_ADMIN_SECTION])) {
131
+            $this->setupSectionEntry($settings[IManager::KEY_ADMIN_SECTION], 'admin');
132
+        }
133
+        if (isset($settings[IManager::KEY_ADMIN_SETTINGS])) {
134
+            $this->setupSettingsEntry($settings[IManager::KEY_ADMIN_SETTINGS], 'admin');
135
+        }
136
+
137
+        if (isset($settings[IManager::KEY_PERSONAL_SECTION])) {
138
+            $this->setupSectionEntry($settings[IManager::KEY_PERSONAL_SECTION], 'personal');
139
+        }
140
+        if (isset($settings[IManager::KEY_PERSONAL_SETTINGS])) {
141
+            $this->setupSettingsEntry($settings[IManager::KEY_PERSONAL_SETTINGS], 'personal');
142
+        }
143
+    }
144
+
145
+    /**
146
+     * attempts to remove an apps section and/or settings entry. A listener is
147
+     * added centrally making sure that this method is called ones an app was
148
+     * disabled.
149
+     *
150
+     * @param string $appId
151
+     * @since 9.1.0
152
+     */
153
+    public function onAppDisabled($appId) {
154
+        $appInfo = \OC_App::getAppInfo($appId); // hello static legacy
155
+
156
+        if (isset($appInfo['settings'][IManager::KEY_ADMIN_SECTION])) {
157
+            $this->mapper->remove(Mapper::TABLE_ADMIN_SECTIONS, trim($appInfo['settings'][IManager::KEY_ADMIN_SECTION], '\\'));
158
+        }
159
+        if (isset($appInfo['settings'][IManager::KEY_ADMIN_SETTINGS])) {
160
+            $this->mapper->remove(Mapper::TABLE_ADMIN_SETTINGS, trim($appInfo['settings'][IManager::KEY_ADMIN_SETTINGS], '\\'));
161
+        }
162
+
163
+        if (isset($appInfo['settings'][IManager::KEY_PERSONAL_SECTION])) {
164
+            $this->mapper->remove(Mapper::TABLE_PERSONAL_SECTIONS, trim($appInfo['settings'][IManager::KEY_PERSONAL_SECTION], '\\'));
165
+        }
166
+        if (isset($appInfo['settings'][IManager::KEY_PERSONAL_SETTINGS])) {
167
+            $this->mapper->remove(Mapper::TABLE_PERSONAL_SETTINGS, trim($appInfo['settings'][IManager::KEY_PERSONAL_SETTINGS], '\\'));
168
+        }
169
+    }
170
+
171
+    public function checkForOrphanedClassNames() {
172
+        $tables = [Mapper::TABLE_ADMIN_SECTIONS, Mapper::TABLE_ADMIN_SETTINGS, Mapper::TABLE_PERSONAL_SECTIONS, Mapper::TABLE_PERSONAL_SETTINGS];
173
+        foreach ($tables as $table) {
174
+            $classes = $this->mapper->getClasses($table);
175
+            foreach ($classes as $className) {
176
+                try {
177
+                    \OC::$server->query($className);
178
+                } catch (QueryException $e) {
179
+                    $this->mapper->remove($table, $className);
180
+                }
181
+            }
182
+        }
183
+    }
184
+
185
+    /**
186
+     * @param string $sectionClassName
187
+     * @param string $type either 'admin' or 'personal'
188
+     */
189
+    private function setupSectionEntry($sectionClassName, $type) {
190
+        if (!class_exists($sectionClassName)) {
191
+            $this->log->debug('Could not find ' . ucfirst($type) . ' section class ' . $sectionClassName);
192
+            return;
193
+        }
194
+        try {
195
+            $section = $this->query($sectionClassName);
196
+        } catch (QueryException $e) {
197
+            // cancel
198
+            return;
199
+        }
200
+
201
+        if (!$section instanceof ISection) {
202
+            $this->log->error(
203
+                ucfirst($type) .' section instance must implement \OCP\ISection. Invalid class: {class}',
204
+                ['class' => $sectionClassName]
205
+            );
206
+            return;
207
+        }
208
+        $table = $this->getSectionTableForType($type);
209
+        if(!$this->hasSection(get_class($section), $table)) {
210
+            $this->addSection($section, $table);
211
+        } else {
212
+            $this->updateSection($section, $table);
213
+        }
214
+    }
215
+
216
+    private function addSection(ISection $section, $table) {
217
+        $this->mapper->add($table, [
218
+            'id' => $section->getID(),
219
+            'class' => get_class($section),
220
+            'priority' => $section->getPriority(),
221
+        ]);
222
+    }
223
+
224
+    private function addSettings(ISettings $settings, $table) {
225
+        $this->mapper->add($table, [
226
+            'class' => get_class($settings),
227
+            'section' => $settings->getSection(),
228
+            'priority' => $settings->getPriority(),
229
+        ]);
230
+    }
231
+
232
+    private function updateSettings(ISettings $settings, $table) {
233
+        $this->mapper->update(
234
+            $table,
235
+            'class',
236
+            get_class($settings),
237
+            [
238
+                'section' => $settings->getSection(),
239
+                'priority' => $settings->getPriority(),
240
+            ]
241
+        );
242
+    }
243
+
244
+    private function updateSection(ISection $section, $table) {
245
+        $this->mapper->update(
246
+            $table,
247
+            'class',
248
+            get_class($section),
249
+            [
250
+                'id' => $section->getID(),
251
+                'priority' => $section->getPriority(),
252
+            ]
253
+        );
254
+    }
255
+
256
+    /**
257
+     * @param string $className
258
+     * @param string $table
259
+     * @return bool
260
+     */
261
+    private function hasSection($className, $table) {
262
+        return $this->mapper->has($table, $className);
263
+    }
264
+
265
+    /**
266
+     * @param string $className
267
+     * @return bool
268
+     */
269
+    private function hasSettings($className, $table) {
270
+        return $this->mapper->has($table, $className);
271
+    }
272
+
273
+    private function setupSettingsEntry($settingsClassName, $type) {
274
+        if (!class_exists($settingsClassName)) {
275
+            $this->log->debug('Could not find ' . $type . ' section class ' . $settingsClassName);
276
+            return;
277
+        }
278
+
279
+        try {
280
+            /** @var ISettings $settings */
281
+            $settings = $this->query($settingsClassName);
282
+        } catch (QueryException $e) {
283
+            // cancel
284
+            return;
285
+        }
286
+
287
+        if (!$settings instanceof ISettings) {
288
+            $this->log->error(
289
+                ucfirst($type) . ' section instance must implement \OCP\Settings\ISettings. Invalid class: {class}',
290
+                ['class' => $settingsClassName]
291
+            );
292
+            return;
293
+        }
294
+        $table = $this->getSettingsTableForType($type);
295
+        if (!$this->hasSettings(get_class($settings), $table)) {
296
+            $this->addSettings($settings, $table);
297
+        } else {
298
+            $this->updateSettings($settings, $table);
299
+        }
300
+    }
301
+
302
+    private function getSectionTableForType($type) {
303
+        if($type === 'admin') {
304
+            return Mapper::TABLE_ADMIN_SECTIONS;
305
+        } else if($type === 'personal') {
306
+            return Mapper::TABLE_PERSONAL_SECTIONS;
307
+        }
308
+        throw new \InvalidArgumentException('"admin" or "personal" expected');
309
+    }
310
+
311
+    private function getSettingsTableForType($type) {
312
+        if($type === 'admin') {
313
+            return Mapper::TABLE_ADMIN_SETTINGS;
314
+        } else if($type === 'personal') {
315
+            return Mapper::TABLE_PERSONAL_SETTINGS;
316
+        }
317
+        throw new \InvalidArgumentException('"admin" or "personal" expected');
318
+    }
319
+
320
+    private function query($className) {
321
+        try {
322
+            return \OC::$server->query($className);
323
+        } catch (QueryException $e) {
324
+            $this->log->logException($e);
325
+            throw $e;
326
+        }
327
+    }
328
+
329
+    /**
330
+     * @inheritdoc
331
+     */
332
+    public function getAdminSections() {
333
+        // built-in sections
334
+        $sections = [
335
+            0 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('settings', 'admin.svg'))],
336
+            5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
337
+            10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
338
+            45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
339
+            98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
340
+            99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
341
+        ];
342
+
343
+        $rows = $this->mapper->getAdminSectionsFromDB();
344
+
345
+        foreach ($rows as $row) {
346
+            if (!isset($sections[$row['priority']])) {
347
+                $sections[$row['priority']] = [];
348
+            }
349
+            try {
350
+                $sections[$row['priority']][] = $this->query($row['class']);
351
+            } catch (QueryException $e) {
352
+                // skip
353
+            }
354
+        }
355
+
356
+        ksort($sections);
357
+
358
+        return $sections;
359
+    }
360
+
361
+    /**
362
+     * @param string $section
363
+     * @return ISection[]
364
+     */
365
+    private function getBuiltInAdminSettings($section) {
366
+        $forms = [];
367
+        try {
368
+            if ($section === 'server') {
369
+                /** @var ISettings $form */
370
+                $form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
371
+                $forms[$form->getPriority()] = [$form];
372
+                $form = new Admin\ServerDevNotice();
373
+                $forms[$form->getPriority()] = [$form];
374
+            }
375
+            if ($section === 'encryption') {
376
+                /** @var ISettings $form */
377
+                $form = new Admin\Encryption($this->encryptionManager, $this->userManager);
378
+                $forms[$form->getPriority()] = [$form];
379
+            }
380
+            if ($section === 'sharing') {
381
+                /** @var ISettings $form */
382
+                $form = new Admin\Sharing($this->config);
383
+                $forms[$form->getPriority()] = [$form];
384
+            }
385
+            if ($section === 'additional') {
386
+                /** @var ISettings $form */
387
+                $form = new Admin\Additional($this->config);
388
+                $forms[$form->getPriority()] = [$form];
389
+            }
390
+            if ($section === 'tips-tricks') {
391
+                /** @var ISettings $form */
392
+                $form = new Admin\TipsTricks($this->config);
393
+                $forms[$form->getPriority()] = [$form];
394
+            }
395
+        } catch (QueryException $e) {
396
+            // skip
397
+        }
398
+        return $forms;
399
+    }
400
+
401
+    /**
402
+     * @param string $section
403
+     * @return ISection[]
404
+     */
405
+    private function getBuiltInPersonalSettings($section) {
406
+        $forms = [];
407
+        try {
408
+            if ($section === 'personal-info') {
409
+                /** @var ISettings $form */
410
+                $form = new Personal\PersonalInfo(
411
+                    $this->config,
412
+                    $this->userManager,
413
+                    $this->groupManager,
414
+                    $this->accountManager,
415
+                    $this->appManager,
416
+                    $this->l10nFactory,
417
+                    $this->l
418
+                );
419
+                $forms[$form->getPriority()] = [$form];
420
+            }
421
+            if($section === 'security') {
422
+                /** @var ISettings $form */
423
+                $form = new Personal\Security();
424
+                $forms[$form->getPriority()] = [$form];
425
+            }
426
+            if($section === 'sync-clients') {
427
+                /** @var ISettings $form */
428
+                $form = new Personal\SyncClients($this->config, $this->defaults);
429
+                $forms[$form->getPriority()] = [$form];
430
+            }
431
+            if ($section === 'additional') {
432
+                /** @var ISettings $form */
433
+                $form = new Personal\Additional($this->config);
434
+                $forms[$form->getPriority()] = [$form];
435
+            }
436
+        } catch (QueryException $e) {
437
+            // skip
438
+        }
439
+        return $forms;
440
+    }
441
+
442
+    /**
443
+     * @inheritdoc
444
+     */
445
+    public function getAdminSettings($section) {
446
+        $settings = $this->getBuiltInAdminSettings($section);
447
+        $dbRows = $this->mapper->getAdminSettingsFromDB($section);
448
+
449
+        foreach ($dbRows as $row) {
450
+            if (!isset($settings[$row['priority']])) {
451
+                $settings[$row['priority']] = [];
452
+            }
453
+            try {
454
+                $settings[$row['priority']][] = $this->query($row['class']);
455
+            } catch (QueryException $e) {
456
+                // skip
457
+            }
458
+        }
459
+
460
+        ksort($settings);
461
+        return $settings;
462
+    }
463
+
464
+    /**
465
+     * @inheritdoc
466
+     */
467
+    public function getPersonalSections() {
468
+        $sections = [
469
+            0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
470
+            5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
471
+            15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))],
472
+        ];
473
+
474
+        $legacyForms = \OC_App::getForms('personal');
475
+        if(count($legacyForms) > 0 && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
476
+            $sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
477
+        }
478
+
479
+        $rows = $this->mapper->getPersonalSectionsFromDB();
480
+
481
+        foreach ($rows as $row) {
482
+            if (!isset($sections[$row['priority']])) {
483
+                $sections[$row['priority']] = [];
484
+            }
485
+            try {
486
+                $sections[$row['priority']][] = $this->query($row['class']);
487
+            } catch (QueryException $e) {
488
+                // skip
489
+            }
490
+        }
491
+
492
+        ksort($sections);
493
+
494
+        return $sections;
495
+    }
496
+
497
+    /**
498
+     * @param $forms
499
+     * @return bool
500
+     */
501
+    private function hasLegacyPersonalSettingsToRender($forms) {
502
+        foreach ($forms as $form) {
503
+            if(trim($form) !== '') {
504
+                return true;
505
+            }
506
+        }
507
+        return false;
508
+    }
509
+
510
+    /**
511
+     * @inheritdoc
512
+     */
513
+    public function getPersonalSettings($section) {
514
+        $settings = $this->getBuiltInPersonalSettings($section);
515
+        $dbRows = $this->mapper->getPersonalSettingsFromDB($section);
516
+
517
+        foreach ($dbRows as $row) {
518
+            if (!isset($settings[$row['priority']])) {
519
+                $settings[$row['priority']] = [];
520
+            }
521
+            try {
522
+                $settings[$row['priority']][] = $this->query($row['class']);
523
+            } catch (QueryException $e) {
524
+                // skip
525
+            }
526
+        }
527
+
528
+        ksort($settings);
529
+        return $settings;
530
+    }
531 531
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	private function setupSectionEntry($sectionClassName, $type) {
190 190
 		if (!class_exists($sectionClassName)) {
191
-			$this->log->debug('Could not find ' . ucfirst($type) . ' section class ' . $sectionClassName);
191
+			$this->log->debug('Could not find '.ucfirst($type).' section class '.$sectionClassName);
192 192
 			return;
193 193
 		}
194 194
 		try {
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 
201 201
 		if (!$section instanceof ISection) {
202 202
 			$this->log->error(
203
-				ucfirst($type) .' section instance must implement \OCP\ISection. Invalid class: {class}',
203
+				ucfirst($type).' section instance must implement \OCP\ISection. Invalid class: {class}',
204 204
 				['class' => $sectionClassName]
205 205
 			);
206 206
 			return;
207 207
 		}
208 208
 		$table = $this->getSectionTableForType($type);
209
-		if(!$this->hasSection(get_class($section), $table)) {
209
+		if (!$this->hasSection(get_class($section), $table)) {
210 210
 			$this->addSection($section, $table);
211 211
 		} else {
212 212
 			$this->updateSection($section, $table);
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
 	private function setupSettingsEntry($settingsClassName, $type) {
274 274
 		if (!class_exists($settingsClassName)) {
275
-			$this->log->debug('Could not find ' . $type . ' section class ' . $settingsClassName);
275
+			$this->log->debug('Could not find '.$type.' section class '.$settingsClassName);
276 276
 			return;
277 277
 		}
278 278
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
 		if (!$settings instanceof ISettings) {
288 288
 			$this->log->error(
289
-				ucfirst($type) . ' section instance must implement \OCP\Settings\ISettings. Invalid class: {class}',
289
+				ucfirst($type).' section instance must implement \OCP\Settings\ISettings. Invalid class: {class}',
290 290
 				['class' => $settingsClassName]
291 291
 			);
292 292
 			return;
@@ -300,18 +300,18 @@  discard block
 block discarded – undo
300 300
 	}
301 301
 
302 302
 	private function getSectionTableForType($type) {
303
-		if($type === 'admin') {
303
+		if ($type === 'admin') {
304 304
 			return Mapper::TABLE_ADMIN_SECTIONS;
305
-		} else if($type === 'personal') {
305
+		} else if ($type === 'personal') {
306 306
 			return Mapper::TABLE_PERSONAL_SECTIONS;
307 307
 		}
308 308
 		throw new \InvalidArgumentException('"admin" or "personal" expected');
309 309
 	}
310 310
 
311 311
 	private function getSettingsTableForType($type) {
312
-		if($type === 'admin') {
312
+		if ($type === 'admin') {
313 313
 			return Mapper::TABLE_ADMIN_SETTINGS;
314
-		} else if($type === 'personal') {
314
+		} else if ($type === 'personal') {
315 315
 			return Mapper::TABLE_PERSONAL_SETTINGS;
316 316
 		}
317 317
 		throw new \InvalidArgumentException('"admin" or "personal" expected');
@@ -418,12 +418,12 @@  discard block
 block discarded – undo
418 418
 				);
419 419
 				$forms[$form->getPriority()] = [$form];
420 420
 			}
421
-			if($section === 'security') {
421
+			if ($section === 'security') {
422 422
 				/** @var ISettings $form */
423 423
 				$form = new Personal\Security();
424 424
 				$forms[$form->getPriority()] = [$form];
425 425
 			}
426
-			if($section === 'sync-clients') {
426
+			if ($section === 'sync-clients') {
427 427
 				/** @var ISettings $form */
428 428
 				$form = new Personal\SyncClients($this->config, $this->defaults);
429 429
 				$forms[$form->getPriority()] = [$form];
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		];
473 473
 
474 474
 		$legacyForms = \OC_App::getForms('personal');
475
-		if(count($legacyForms) > 0 && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
475
+		if (count($legacyForms) > 0 && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
476 476
 			$sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
477 477
 		}
478 478
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 	 */
501 501
 	private function hasLegacyPersonalSettingsToRender($forms) {
502 502
 		foreach ($forms as $form) {
503
-			if(trim($form) !== '') {
503
+			if (trim($form) !== '') {
504 504
 				return true;
505 505
 			}
506 506
 		}
Please login to merge, or discard this patch.
lib/private/Settings/Personal/Additional.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,31 +29,31 @@
 block discarded – undo
29 29
 
30 30
 class Additional implements ISettings {
31 31
 
32
-	/**
33
-	 * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
34
-	 * @since 9.1
35
-	 */
36
-	public function getForm() {
37
-		return new TemplateResponse('settings', 'settings/empty');
38
-	}
32
+    /**
33
+     * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
34
+     * @since 9.1
35
+     */
36
+    public function getForm() {
37
+        return new TemplateResponse('settings', 'settings/empty');
38
+    }
39 39
 
40
-	/**
41
-	 * @return string the section ID, e.g. 'sharing'
42
-	 * @since 9.1
43
-	 */
44
-	public function getSection() {
45
-		return 'additional';
46
-	}
40
+    /**
41
+     * @return string the section ID, e.g. 'sharing'
42
+     * @since 9.1
43
+     */
44
+    public function getSection() {
45
+        return 'additional';
46
+    }
47 47
 
48
-	/**
49
-	 * @return int whether the form should be rather on the top or bottom of
50
-	 * the admin section. The forms are arranged in ascending order of the
51
-	 * priority values. It is required to return a value between 0 and 100.
52
-	 *
53
-	 * E.g.: 70
54
-	 * @since 9.1
55
-	 */
56
-	public function getPriority() {
57
-		return '5';
58
-	}
48
+    /**
49
+     * @return int whether the form should be rather on the top or bottom of
50
+     * the admin section. The forms are arranged in ascending order of the
51
+     * priority values. It is required to return a value between 0 and 100.
52
+     *
53
+     * E.g.: 70
54
+     * @since 9.1
55
+     */
56
+    public function getPriority() {
57
+        return '5';
58
+    }
59 59
 }
Please login to merge, or discard this patch.