Completed
Pull Request — master (#10053)
by Julius
200:32 queued 176:09
created
settings/templates/settings/personal/security.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 script('settings', [
25
-	'security_password',
26
-	'authtoken',
27
-	'authtoken_collection',
28
-	'authtoken_view',
29
-	'settings/authtoken-init'
25
+    'security_password',
26
+    'authtoken',
27
+    'authtoken_collection',
28
+    'authtoken_view',
29
+    'settings/authtoken-init'
30 30
 ]);
31 31
 
32 32
 if($_['passwordChangeSupported']) {
33
-	script('jquery-showpassword');
34
-	vendor_script('strengthify/jquery.strengthify');
35
-	vendor_style('strengthify/strengthify');
33
+    script('jquery-showpassword');
34
+    vendor_script('strengthify/jquery.strengthify');
35
+    vendor_style('strengthify/strengthify');
36 36
 }
37 37
 
38 38
 ?>
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 
62 62
 			</form>
63 63
 			<?php
64
-		}
65
-		?>
64
+        }
65
+        ?>
66 66
 	</div>
67 67
 	<span class="msg"></span>
68 68
 </div>
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	'settings/authtoken-init'
30 30
 ]);
31 31
 
32
-if($_['passwordChangeSupported']) {
32
+if ($_['passwordChangeSupported']) {
33 33
 	script('jquery-showpassword');
34 34
 	vendor_script('strengthify/jquery.strengthify');
35 35
 	vendor_style('strengthify/strengthify');
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
 ?>
39 39
 
40 40
 <div id="security-password" class="section">
41
-	<h2 class="inlineblock"><?php p($l->t('Password'));?></h2>
41
+	<h2 class="inlineblock"><?php p($l->t('Password')); ?></h2>
42 42
 	<span id="password-error-msg" class="msg success hidden">Saved</span>
43 43
 	<div class="personal-settings-setting-box personal-settings-password-box">
44
-		<?php if($_['passwordChangeSupported']) { ?>
44
+		<?php if ($_['passwordChangeSupported']) { ?>
45 45
 			<form id="passwordform">
46 46
 				<label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label>
47 47
 				<input type="password" id="pass1" name="oldpassword"
48
-					   placeholder="<?php p($l->t('Current password'));?>"
48
+					   placeholder="<?php p($l->t('Current password')); ?>"
49 49
 					   autocomplete="off" autocapitalize="none" autocorrect="off" />
50 50
 
51 51
 				<div class="personal-show-container">
52
-					<label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label>
52
+					<label for="pass2" class="hidden-visually"><?php p($l->t('New password')); ?>: </label>
53 53
 					<input type="password" id="pass2" name="newpassword"
54 54
 						   placeholder="<?php p($l->t('New password')); ?>"
55 55
 						   data-typetoggle="#personal-show"
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 </div>
69 69
 
70 70
 <div id="security" class="section">
71
-	<h2><?php p($l->t('Devices & sessions'));?></h2>
72
-	<p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.'));?></p>
71
+	<h2><?php p($l->t('Devices & sessions')); ?></h2>
72
+	<p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.')); ?></p>
73 73
 	<table class="icon-loading">
74 74
 		<thead class="token-list-header">
75 75
 			<tr>
76 76
 				<th></th>
77
-				<th><?php p($l->t('Device'));?></th>
78
-				<th><?php p($l->t('Last activity'));?></th>
77
+				<th><?php p($l->t('Device')); ?></th>
78
+				<th><?php p($l->t('Last activity')); ?></th>
79 79
 				<th></th>
80 80
 			</tr>
81 81
 		</thead>
Please login to merge, or discard this patch.
settings/templates/settings/personal/personal.info.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 /** @var array $_ */
27 27
 
28 28
 script('settings', [
29
-	'usersettings',
30
-	'federationsettingsview',
31
-	'federationscopemenu',
32
-	'settings/personalInfo',
29
+    'usersettings',
30
+    'federationsettingsview',
31
+    'federationscopemenu',
32
+    'settings/personalInfo',
33 33
 ]);
34 34
 vendor_script('jcrop/js/jquery.Jcrop');
35 35
 vendor_style('jcrop/css/jquery.Jcrop');
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 					<p class="quotatext">
88 88
 						<?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
89 89
 							<?php print_unescaped($l->t('You are using <strong>%s</strong>',
90
-								[$_['usage']]));?>
90
+                                [$_['usage']]));?>
91 91
 						<?php else: ?>
92 92
 							<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)',
93
-								[$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
93
+                                [$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
94 94
 						<?php endif ?>
95 95
 					</p>
96 96
 				</div>
@@ -137,17 +137,17 @@  discard block
 block discarded – undo
137 137
 				<div class="verify <?php if ($_['email'] === ''  || $_['emailScope'] !== 'public') p('hidden'); ?>">
138 138
 					<img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src="
139 139
 				<?php
140
-					switch($_['emailVerification']) {
141
-						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
142
-							p(image_path('core', 'actions/verifying.svg'));
143
-							break;
144
-						case \OC\Accounts\AccountManager::VERIFIED:
145
-							p(image_path('core', 'actions/verified.svg'));
146
-							break;
147
-						default:
148
-							p(image_path('core', 'actions/verify.svg'));
149
-					}
150
-					?>">
140
+                    switch($_['emailVerification']) {
141
+                        case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
142
+                            p(image_path('core', 'actions/verifying.svg'));
143
+                            break;
144
+                        case \OC\Accounts\AccountManager::VERIFIED:
145
+                            p(image_path('core', 'actions/verified.svg'));
146
+                            break;
147
+                        default:
148
+                            p(image_path('core', 'actions/verify.svg'));
149
+                    }
150
+                    ?>">
151 151
 				</div>
152 152
 				<input type="email" name="email" id="email" value="<?php p($_['email']); ?>"
153 153
 					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
@@ -225,17 +225,17 @@  discard block
 block discarded – undo
225 225
 				<div class="verify <?php if ($_['website'] === ''  || $_['websiteScope'] !== 'public') p('hidden'); ?>">
226 226
 					<img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src="
227 227
 					<?php
228
-					switch($_['websiteVerification']) {
229
-						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
230
-							p(image_path('core', 'actions/verifying.svg'));
231
-							break;
232
-						case \OC\Accounts\AccountManager::VERIFIED:
233
-							p(image_path('core', 'actions/verified.svg'));
234
-							break;
235
-						default:
236
-							p(image_path('core', 'actions/verify.svg'));
237
-					}
238
-					?>"
228
+                    switch($_['websiteVerification']) {
229
+                        case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
230
+                            p(image_path('core', 'actions/verifying.svg'));
231
+                            break;
232
+                        case \OC\Accounts\AccountManager::VERIFIED:
233
+                            p(image_path('core', 'actions/verified.svg'));
234
+                            break;
235
+                        default:
236
+                            p(image_path('core', 'actions/verify.svg'));
237
+                    }
238
+                    ?>"
239 239
 					<?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
240 240
 					>
241 241
 					<div class="verification-dialog popovermenu bubble menu">
@@ -274,17 +274,17 @@  discard block
 block discarded – undo
274 274
 				<div class="verify <?php if ($_['twitter'] === ''  || $_['twitterScope'] !== 'public') p('hidden'); ?>">
275 275
 					<img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src="
276 276
 					<?php
277
-					switch($_['twitterVerification']) {
278
-						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
279
-							p(image_path('core', 'actions/verifying.svg'));
280
-							break;
281
-						case \OC\Accounts\AccountManager::VERIFIED:
282
-							p(image_path('core', 'actions/verified.svg'));
283
-							break;
284
-						default:
285
-							p(image_path('core', 'actions/verify.svg'));
286
-					}
287
-					?>"
277
+                    switch($_['twitterVerification']) {
278
+                        case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
279
+                            p(image_path('core', 'actions/verifying.svg'));
280
+                            break;
281
+                        case \OC\Accounts\AccountManager::VERIFIED:
282
+                            p(image_path('core', 'actions/verified.svg'));
283
+                            break;
284
+                        default:
285
+                            p(image_path('core', 'actions/verify.svg'));
286
+                    }
287
+                    ?>"
288 288
 					<?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
289 289
 					>
290 290
 					<div class="verification-dialog popovermenu bubble menu">
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 					</div>
70 70
 				</div>
71 71
 				<span class="icon-checkmark hidden"></span>
72
-				<?php if($_['lookupServerUploadEnabled']) { ?>
72
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
73 73
 				<input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>">
74 74
 				<?php } ?>
75 75
 			</form>
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 					<p class="quotatext">
88 88
 						<?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
89 89
 							<?php print_unescaped($l->t('You are using <strong>%s</strong>',
90
-								[$_['usage']]));?>
90
+								[$_['usage']])); ?>
91 91
 						<?php else: ?>
92 92
 							<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)',
93
-								[$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
93
+								[$_['usage'], $_['total_space'], $_['usage_relative']])); ?>
94 94
 						<?php endif ?>
95 95
 					</p>
96 96
 				</div>
97
-				<progress value="<?php p($_['usage_relative']); ?>" max="100"<?php if($_['usage_relative'] > 80): ?> class="warn" <?php endif; ?>></progress>
97
+				<progress value="<?php p($_['usage_relative']); ?>" max="100"<?php if ($_['usage_relative'] > 80): ?> class="warn" <?php endif; ?>></progress>
98 98
 			</div>
99 99
 		</div>
100 100
 	</div>
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
 					</div>
112 112
 				</h2>
113 113
 				<input type="text" id="displayname" name="displayname"
114
-					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
114
+					<?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
115 115
 					   value="<?php p($_['displayName']) ?>"
116 116
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
117
-				<?php if(!$_['displayNameChangeSupported']) { ?>
118
-					<span><?php if(isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span>
117
+				<?php if (!$_['displayNameChangeSupported']) { ?>
118
+					<span><?php if (isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span>
119 119
 				<?php } ?>
120 120
 				<span class="icon-checkmark hidden"></span>
121 121
 				<span class="icon-error hidden" ></span>
122
-				<?php if($_['lookupServerUploadEnabled']) { ?>
122
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
123 123
 					<input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>">
124 124
 				<?php } ?>
125 125
 			</form>
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 						</span>
135 135
 					</div>
136 136
 				</h2>
137
-				<div class="verify <?php if ($_['email'] === ''  || $_['emailScope'] !== 'public') p('hidden'); ?>">
137
+				<div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') p('hidden'); ?>">
138 138
 					<img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src="
139 139
 				<?php
140
-					switch($_['emailVerification']) {
140
+					switch ($_['emailVerification']) {
141 141
 						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
142 142
 							p(image_path('core', 'actions/verifying.svg'));
143 143
 							break;
@@ -150,18 +150,18 @@  discard block
 block discarded – undo
150 150
 					?>">
151 151
 				</div>
152 152
 				<input type="email" name="email" id="email" value="<?php p($_['email']); ?>"
153
-					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
153
+					<?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
154 154
 					   placeholder="<?php p($l->t('Your email address')); ?>"
155 155
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
156 156
 			   	<span class="icon-checkmark hidden"></span>
157 157
 				<span class="icon-error hidden" ></span>
158
-				<?php if(!$_['displayNameChangeSupported']) { ?>
159
-					<span><?php if(isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span>
158
+				<?php if (!$_['displayNameChangeSupported']) { ?>
159
+					<span><?php if (isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span>
160 160
 				<?php } ?>
161
-				<?php if($_['displayNameChangeSupported']) { ?>
161
+				<?php if ($_['displayNameChangeSupported']) { ?>
162 162
 					<em><?php p($l->t('For password reset and notifications')); ?></em>
163 163
 				<?php } ?>
164
-				<?php if($_['lookupServerUploadEnabled']) { ?>
164
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
165 165
 					<input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>">
166 166
 				<?php } ?>
167 167
 			</form>
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
 						</span>
178 178
 					</div>
179 179
 				</h2>
180
-				<input type="tel" id="phone" name="phone" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
180
+				<input type="tel" id="phone" name="phone" <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
181 181
 					   value="<?php p($_['phone']) ?>"
182 182
 					   placeholder="<?php p($l->t('Your phone number')); ?>"
183 183
 				       autocomplete="on" autocapitalize="none" autocorrect="off" />
184 184
 				<span class="icon-checkmark hidden"></span>
185
-				<?php if($_['lookupServerUploadEnabled']) { ?>
185
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
186 186
 				<input type="hidden" id="phonescope" value="<?php p($_['phoneScope']) ?>">
187 187
 				<?php } ?>
188 188
 			</form>
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 						</span>
200 200
 					</div>
201 201
 				</h2>
202
-				<input type="text" id="address" name="address" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"');  ?>
202
+				<input type="text" id="address" name="address" <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
203 203
 					   placeholder="<?php p($l->t('Your postal address')); ?>"
204 204
 					   value="<?php p($_['address']) ?>"
205 205
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
206 206
 				<span class="icon-checkmark hidden"></span>
207
-				<?php if($_['lookupServerUploadEnabled']) { ?>
207
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
208 208
 				<input type="hidden" id="addressscope" value="<?php p($_['addressScope']) ?>">
209 209
 				<?php } ?>
210 210
 			</form>
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 						</span>
222 222
 					</div>
223 223
 				</h2>
224
-				<?php if($_['lookupServerUploadEnabled']) { ?>
225
-				<div class="verify <?php if ($_['website'] === ''  || $_['websiteScope'] !== 'public') p('hidden'); ?>">
224
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
225
+				<div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>">
226 226
 					<img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src="
227 227
 					<?php
228
-					switch($_['websiteVerification']) {
228
+					switch ($_['websiteVerification']) {
229 229
 						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
230 230
 							p(image_path('core', 'actions/verifying.svg'));
231 231
 							break;
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
 							p(image_path('core', 'actions/verify.svg'));
237 237
 					}
238 238
 					?>"
239
-					<?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
239
+					<?php if ($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
240 240
 					>
241 241
 					<div class="verification-dialog popovermenu bubble menu">
242 242
 						<div class="verification-dialog-content">
243 243
 							<p class="explainVerification"></p>
244 244
 							<p class="verificationCode"></p>
245
-							<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
245
+							<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
246 246
 						</div>
247 247
 					</div>
248 248
 				</div>
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
 				<input type="url" name="website" id="website" value="<?php p($_['website']); ?>"
251 251
 				       placeholder="<?php p($l->t('Link https://…')); ?>"
252 252
 				       autocomplete="on" autocapitalize="none" autocorrect="off"
253
-					   <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"');  ?>
253
+					   <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
254 254
 				/>
255 255
 				<span class="icon-checkmark hidden"></span>
256
-				<?php if($_['lookupServerUploadEnabled']) { ?>
256
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
257 257
 				<input type="hidden" id="websitescope" value="<?php p($_['websiteScope']) ?>">
258 258
 				<?php } ?>
259 259
 			</form>
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 						</span>
271 271
 					</div>
272 272
 				</h2>
273
-				<?php if($_['lookupServerUploadEnabled']) { ?>
274
-				<div class="verify <?php if ($_['twitter'] === ''  || $_['twitterScope'] !== 'public') p('hidden'); ?>">
273
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
274
+				<div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') p('hidden'); ?>">
275 275
 					<img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src="
276 276
 					<?php
277
-					switch($_['twitterVerification']) {
277
+					switch ($_['twitterVerification']) {
278 278
 						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
279 279
 							p(image_path('core', 'actions/verifying.svg'));
280 280
 							break;
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
 							p(image_path('core', 'actions/verify.svg'));
286 286
 					}
287 287
 					?>"
288
-					<?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
288
+					<?php if ($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
289 289
 					>
290 290
 					<div class="verification-dialog popovermenu bubble menu">
291 291
 						<div class="verification-dialog-content">
292 292
 							<p class="explainVerification"></p>
293 293
 							<p class="verificationCode"></p>
294
-							<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
294
+							<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
295 295
 						</div>
296 296
 					</div>
297 297
 				</div>
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 				<input type="text" name="twitter" id="twitter" value="<?php p($_['twitter']); ?>"
300 300
 					   placeholder="<?php p($l->t('Twitter handle @…')); ?>"
301 301
 					   autocomplete="on" autocapitalize="none" autocorrect="off"
302
-					   <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"');  ?>
302
+					   <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
303 303
 				/>
304 304
 				<span class="icon-checkmark hidden"></span>
305
-				<?php if($_['lookupServerUploadEnabled']) { ?>
305
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
306 306
 				<input type="hidden" id="twitterscope" value="<?php p($_['twitterScope']) ?>">
307 307
 				<?php } ?>
308 308
 			</form>
@@ -315,27 +315,27 @@  discard block
 block discarded – undo
315 315
 			<?php if (isset($_['activelanguage'])) { ?>
316 316
 				<form id="language" class="section">
317 317
 					<h2>
318
-						<label for="languageinput"><?php p($l->t('Language'));?></label>
318
+						<label for="languageinput"><?php p($l->t('Language')); ?></label>
319 319
 					</h2>
320
-					<select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language'));?>">
321
-						<option value="<?php p($_['activelanguage']['code']);?>">
322
-							<?php p($_['activelanguage']['name']);?>
320
+					<select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language')); ?>">
321
+						<option value="<?php p($_['activelanguage']['code']); ?>">
322
+							<?php p($_['activelanguage']['name']); ?>
323 323
 						</option>
324
-						<?php foreach($_['commonlanguages'] as $language):?>
325
-							<option value="<?php p($language['code']);?>">
326
-								<?php p($language['name']);?>
324
+						<?php foreach ($_['commonlanguages'] as $language):?>
325
+							<option value="<?php p($language['code']); ?>">
326
+								<?php p($language['name']); ?>
327 327
 							</option>
328
-						<?php endforeach;?>
328
+						<?php endforeach; ?>
329 329
 						<optgroup label="––––––––––"></optgroup>
330
-						<?php foreach($_['languages'] as $language):?>
331
-							<option value="<?php p($language['code']);?>">
332
-								<?php p($language['name']);?>
330
+						<?php foreach ($_['languages'] as $language):?>
331
+							<option value="<?php p($language['code']); ?>">
332
+								<?php p($language['name']); ?>
333 333
 							</option>
334
-						<?php endforeach;?>
334
+						<?php endforeach; ?>
335 335
 					</select>
336 336
 					<a href="https://www.transifex.com/nextcloud/nextcloud/"
337 337
 					   target="_blank" rel="noreferrer noopener">
338
-						<em><?php p($l->t('Help translate'));?></em>
338
+						<em><?php p($l->t('Help translate')); ?></em>
339 339
 					</a>
340 340
 				</form>
341 341
 			<?php } ?>
@@ -344,27 +344,27 @@  discard block
 block discarded – undo
344 344
 			<?php if (isset($_['activelocale'])) { ?>
345 345
 				<form id="locale" class="section">
346 346
 					<h2>
347
-						<label for="localeinput"><?php p($l->t('Locale'));?></label>
347
+						<label for="localeinput"><?php p($l->t('Locale')); ?></label>
348 348
 					</h2>
349
-					<select id="localeinput" name="lang" data-placeholder="<?php p($l->t('Locale'));?>">
350
-						<option value="<?php p($_['activelocale']['code']);?>">
351
-							<?php p($_['activelocale']['name']);?>
349
+					<select id="localeinput" name="lang" data-placeholder="<?php p($l->t('Locale')); ?>">
350
+						<option value="<?php p($_['activelocale']['code']); ?>">
351
+							<?php p($_['activelocale']['name']); ?>
352 352
 						</option>
353 353
 						<optgroup label="––––––––––"></optgroup>
354
-						<?php foreach($_['localesForLanguage'] as $locale):?>
355
-							<option value="<?php p($locale['code']);?>">
356
-								<?php p($locale['name']);?>
354
+						<?php foreach ($_['localesForLanguage'] as $locale):?>
355
+							<option value="<?php p($locale['code']); ?>">
356
+								<?php p($locale['name']); ?>
357 357
 							</option>
358
-						<?php endforeach;?>
358
+						<?php endforeach; ?>
359 359
 						<optgroup label="––––––––––"></optgroup>
360
-						<option value="<?php p($_['activelocale']['code']);?>">
361
-							<?php p($_['activelocale']['name']);?>
360
+						<option value="<?php p($_['activelocale']['code']); ?>">
361
+							<?php p($_['activelocale']['name']); ?>
362 362
 						</option>
363
-						<?php foreach($_['locales'] as $locale):?>
364
-							<option value="<?php p($locale['code']);?>">
365
-								<?php p($locale['name']);?>
363
+						<?php foreach ($_['locales'] as $locale):?>
364
+							<option value="<?php p($locale['code']); ?>">
365
+								<?php p($locale['name']); ?>
366 366
 							</option>
367
-						<?php endforeach;?>
367
+						<?php endforeach; ?>
368 368
 					</select>
369 369
 					<div id="localeexample" class="personal-info icon-timezone">
370 370
 						<p id="localeexample-time"></p>
Please login to merge, or discard this patch.
lib/private/Settings/Manager.php 2 patches
Indentation   +350 added lines, -350 removed lines patch added patch discarded remove patch
@@ -49,354 +49,354 @@
 block discarded – undo
49 49
 use OCP\Util;
50 50
 
51 51
 class Manager implements IManager {
52
-	/** @var ILogger */
53
-	private $log;
54
-	/** @var IDBConnection */
55
-	private $dbc;
56
-	/** @var IL10N */
57
-	private $l;
58
-	/** @var IConfig */
59
-	private $config;
60
-	/** @var EncryptionManager */
61
-	private $encryptionManager;
62
-	/** @var IUserManager */
63
-	private $userManager;
64
-	/** @var ILockingProvider */
65
-	private $lockingProvider;
66
-	/** @var IRequest */
67
-	private $request;
68
-	/** @var IURLGenerator */
69
-	private $url;
70
-	/** @var AccountManager */
71
-	private $accountManager;
72
-	/** @var IGroupManager */
73
-	private $groupManager;
74
-	/** @var IFactory */
75
-	private $l10nFactory;
76
-	/** @var IAppManager */
77
-	private $appManager;
78
-
79
-	/**
80
-	 * @param ILogger $log
81
-	 * @param IDBConnection $dbc
82
-	 * @param IL10N $l
83
-	 * @param IConfig $config
84
-	 * @param EncryptionManager $encryptionManager
85
-	 * @param IUserManager $userManager
86
-	 * @param ILockingProvider $lockingProvider
87
-	 * @param IRequest $request
88
-	 * @param IURLGenerator $url
89
-	 * @param AccountManager $accountManager
90
-	 * @param IGroupManager $groupManager
91
-	 * @param IFactory $l10nFactory
92
-	 * @param IAppManager $appManager
93
-	 */
94
-	public function __construct(
95
-		ILogger $log,
96
-		IDBConnection $dbc,
97
-		IL10N $l,
98
-		IConfig $config,
99
-		EncryptionManager $encryptionManager,
100
-		IUserManager $userManager,
101
-		ILockingProvider $lockingProvider,
102
-		IRequest $request,
103
-		IURLGenerator $url,
104
-		AccountManager $accountManager,
105
-		IGroupManager $groupManager,
106
-		IFactory $l10nFactory,
107
-		IAppManager $appManager
108
-	) {
109
-		$this->log = $log;
110
-		$this->dbc = $dbc;
111
-		$this->l = $l;
112
-		$this->config = $config;
113
-		$this->encryptionManager = $encryptionManager;
114
-		$this->userManager = $userManager;
115
-		$this->lockingProvider = $lockingProvider;
116
-		$this->request = $request;
117
-		$this->url = $url;
118
-		$this->accountManager = $accountManager;
119
-		$this->groupManager = $groupManager;
120
-		$this->l10nFactory = $l10nFactory;
121
-		$this->appManager = $appManager;
122
-	}
123
-
124
-	/** @var array */
125
-	protected $sectionClasses = [];
126
-
127
-	/** @var array */
128
-	protected $sections = [];
129
-
130
-	/**
131
-	 * @param string $type 'admin' or 'personal'
132
-	 * @param string $section Class must implement OCP\Settings\ISection
133
-	 * @return void
134
-	 */
135
-	public function registerSection(string $type, string $section) {
136
-		$this->sectionClasses[$section] = $type;
137
-	}
138
-
139
-	/**
140
-	 * @param string $type 'admin' or 'personal'
141
-	 * @return ISection[]
142
-	 */
143
-	protected function getSections(string $type): array {
144
-		if (!isset($this->sections[$type])) {
145
-			$this->sections[$type] = [];
146
-		}
147
-
148
-		foreach ($this->sectionClasses as $class => $sectionType) {
149
-			try {
150
-				/** @var ISection $section */
151
-				$section = \OC::$server->query($class);
152
-			} catch (QueryException $e) {
153
-				$this->log->logException($e, ['level' => ILogger::INFO]);
154
-				continue;
155
-			}
156
-
157
-			if (!$section instanceof ISection) {
158
-				$this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => ILogger::INFO]);
159
-				continue;
160
-			}
161
-
162
-			$this->sections[$sectionType][$section->getID()] = $section;
163
-
164
-			unset($this->sectionClasses[$class]);
165
-		}
166
-
167
-		return $this->sections[$type];
168
-	}
169
-
170
-	/** @var array */
171
-	protected $settingClasses = [];
172
-
173
-	/** @var array */
174
-	protected $settings = [];
175
-
176
-	/**
177
-	 * @param string $type 'admin' or 'personal'
178
-	 * @param string $setting Class must implement OCP\Settings\ISetting
179
-	 * @return void
180
-	 */
181
-	public function registerSetting(string $type, string $setting) {
182
-		$this->settingClasses[$setting] = $type;
183
-	}
184
-
185
-	/**
186
-	 * @param string $type 'admin' or 'personal'
187
-	 * @param string $section
188
-	 * @return ISettings[]
189
-	 */
190
-	protected function getSettings(string $type, string $section): array {
191
-		if (!isset($this->settings[$type])) {
192
-			$this->settings[$type] = [];
193
-		}
194
-		if (!isset($this->settings[$type][$section])) {
195
-			$this->settings[$type][$section] = [];
196
-		}
197
-
198
-		foreach ($this->settingClasses as $class => $settingsType) {
199
-			try {
200
-				/** @var ISettings $setting */
201
-				$setting = \OC::$server->query($class);
202
-			} catch (QueryException $e) {
203
-				$this->log->logException($e, ['level' => ILogger::INFO]);
204
-				continue;
205
-			}
206
-
207
-			if (!$setting instanceof ISettings) {
208
-				$this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => ILogger::INFO]);
209
-				continue;
210
-			}
211
-
212
-			if (!isset($this->settings[$settingsType][$setting->getSection()])) {
213
-				$this->settings[$settingsType][$setting->getSection()] = [];
214
-			}
215
-			$this->settings[$settingsType][$setting->getSection()][] = $setting;
216
-
217
-			unset($this->settingClasses[$class]);
218
-		}
219
-
220
-		return $this->settings[$type][$section];
221
-	}
222
-
223
-	/**
224
-	 * @inheritdoc
225
-	 */
226
-	public function getAdminSections(): array {
227
-		// built-in sections
228
-		$sections = [
229
-			0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))],
230
-			1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
231
-			5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
232
-			10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
233
-			45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
234
-			50 => [new Section('groupware', $this->l->t('Groupware'), 0, $this->url->imagePath('core', 'places/contacts-dark.svg'))],
235
-			98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
236
-		];
237
-
238
-		$appSections = $this->getSections('admin');
239
-
240
-		foreach ($appSections as $section) {
241
-			/** @var ISection $section */
242
-			if (!isset($sections[$section->getPriority()])) {
243
-				$sections[$section->getPriority()] = [];
244
-			}
245
-
246
-			$sections[$section->getPriority()][] = $section;
247
-		}
248
-
249
-		ksort($sections);
250
-
251
-		return $sections;
252
-	}
253
-
254
-	/**
255
-	 * @param string $section
256
-	 * @return ISection[]
257
-	 */
258
-	private function getBuiltInAdminSettings($section): array {
259
-		$forms = [];
260
-
261
-		if ($section === 'overview') {
262
-			/** @var ISettings $form */
263
-			$form = new Admin\Overview($this->config);
264
-			$forms[$form->getPriority()] = [$form];
265
-			$form = new Admin\ServerDevNotice();
266
-			$forms[$form->getPriority()] = [$form];
267
-		}
268
-		if ($section === 'server') {
269
-			/** @var ISettings $form */
270
-			$form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
271
-			$forms[$form->getPriority()] = [$form];
272
-			$form = new Admin\Mail($this->config);
273
-			$forms[$form->getPriority()] = [$form];
274
-		}
275
-		if ($section === 'encryption') {
276
-			/** @var ISettings $form */
277
-			$form = new Admin\Encryption($this->encryptionManager, $this->userManager);
278
-			$forms[$form->getPriority()] = [$form];
279
-		}
280
-		if ($section === 'sharing') {
281
-			/** @var ISettings $form */
282
-			$form = new Admin\Sharing($this->config, $this->l);
283
-			$forms[$form->getPriority()] = [$form];
284
-		}
285
-
286
-		return $forms;
287
-	}
288
-
289
-	/**
290
-	 * @param string $section
291
-	 * @return ISection[]
292
-	 */
293
-	private function getBuiltInPersonalSettings($section): array {
294
-		$forms = [];
295
-
296
-		if ($section === 'personal-info') {
297
-			/** @var ISettings $form */
298
-			$form = new Personal\PersonalInfo(
299
-				$this->config,
300
-				$this->userManager,
301
-				$this->groupManager,
302
-				$this->accountManager,
303
-				$this->appManager,
304
-				$this->l10nFactory,
305
-				$this->l
306
-			);
307
-			$forms[$form->getPriority()] = [$form];
308
-		}
309
-		if($section === 'security') {
310
-			/** @var ISettings $form */
311
-			$form = new Personal\Security($this->userManager);
312
-			$forms[$form->getPriority()] = [$form];
313
-		}
314
-		if ($section === 'additional') {
315
-			/** @var ISettings $form */
316
-			$form = new Personal\Additional();
317
-			$forms[$form->getPriority()] = [$form];
318
-		}
319
-
320
-		return $forms;
321
-	}
322
-
323
-	/**
324
-	 * @inheritdoc
325
-	 */
326
-	public function getAdminSettings($section): array {
327
-		$settings = $this->getBuiltInAdminSettings($section);
328
-		$appSettings = $this->getSettings('admin', $section);
329
-
330
-		foreach ($appSettings as $setting) {
331
-			if (!isset($settings[$setting->getPriority()])) {
332
-				$settings[$setting->getPriority()] = [];
333
-			}
334
-			$settings[$setting->getPriority()][] = $setting;
335
-		}
336
-
337
-		ksort($settings);
338
-		return $settings;
339
-	}
340
-
341
-	/**
342
-	 * @inheritdoc
343
-	 */
344
-	public function getPersonalSections(): array {
345
-		$sections = [
346
-			0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
347
-			5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
348
-			15 => [new Section('sync-clients', $this->l->t('Mobile & desktop'), 0, $this->url->imagePath('core', 'clients/phone.svg'))],
349
-		];
350
-
351
-		$legacyForms = \OC_App::getForms('personal');
352
-		if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
353
-			$sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
354
-		}
355
-
356
-		$appSections = $this->getSections('personal');
357
-
358
-		foreach ($appSections as $section) {
359
-			/** @var ISection $section */
360
-			if (!isset($sections[$section->getPriority()])) {
361
-				$sections[$section->getPriority()] = [];
362
-			}
363
-
364
-			$sections[$section->getPriority()][] = $section;
365
-		}
366
-
367
-		ksort($sections);
368
-
369
-		return $sections;
370
-	}
371
-
372
-	/**
373
-	 * @param string[] $forms
374
-	 * @return bool
375
-	 */
376
-	private function hasLegacyPersonalSettingsToRender(array $forms): bool {
377
-		foreach ($forms as $form) {
378
-			if(trim($form) !== '') {
379
-				return true;
380
-			}
381
-		}
382
-		return false;
383
-	}
384
-
385
-	/**
386
-	 * @inheritdoc
387
-	 */
388
-	public function getPersonalSettings($section): array {
389
-		$settings = $this->getBuiltInPersonalSettings($section);
390
-		$appSettings = $this->getSettings('personal', $section);
391
-
392
-		foreach ($appSettings as $setting) {
393
-			if (!isset($settings[$setting->getPriority()])) {
394
-				$settings[$setting->getPriority()] = [];
395
-			}
396
-			$settings[$setting->getPriority()][] = $setting;
397
-		}
398
-
399
-		ksort($settings);
400
-		return $settings;
401
-	}
52
+    /** @var ILogger */
53
+    private $log;
54
+    /** @var IDBConnection */
55
+    private $dbc;
56
+    /** @var IL10N */
57
+    private $l;
58
+    /** @var IConfig */
59
+    private $config;
60
+    /** @var EncryptionManager */
61
+    private $encryptionManager;
62
+    /** @var IUserManager */
63
+    private $userManager;
64
+    /** @var ILockingProvider */
65
+    private $lockingProvider;
66
+    /** @var IRequest */
67
+    private $request;
68
+    /** @var IURLGenerator */
69
+    private $url;
70
+    /** @var AccountManager */
71
+    private $accountManager;
72
+    /** @var IGroupManager */
73
+    private $groupManager;
74
+    /** @var IFactory */
75
+    private $l10nFactory;
76
+    /** @var IAppManager */
77
+    private $appManager;
78
+
79
+    /**
80
+     * @param ILogger $log
81
+     * @param IDBConnection $dbc
82
+     * @param IL10N $l
83
+     * @param IConfig $config
84
+     * @param EncryptionManager $encryptionManager
85
+     * @param IUserManager $userManager
86
+     * @param ILockingProvider $lockingProvider
87
+     * @param IRequest $request
88
+     * @param IURLGenerator $url
89
+     * @param AccountManager $accountManager
90
+     * @param IGroupManager $groupManager
91
+     * @param IFactory $l10nFactory
92
+     * @param IAppManager $appManager
93
+     */
94
+    public function __construct(
95
+        ILogger $log,
96
+        IDBConnection $dbc,
97
+        IL10N $l,
98
+        IConfig $config,
99
+        EncryptionManager $encryptionManager,
100
+        IUserManager $userManager,
101
+        ILockingProvider $lockingProvider,
102
+        IRequest $request,
103
+        IURLGenerator $url,
104
+        AccountManager $accountManager,
105
+        IGroupManager $groupManager,
106
+        IFactory $l10nFactory,
107
+        IAppManager $appManager
108
+    ) {
109
+        $this->log = $log;
110
+        $this->dbc = $dbc;
111
+        $this->l = $l;
112
+        $this->config = $config;
113
+        $this->encryptionManager = $encryptionManager;
114
+        $this->userManager = $userManager;
115
+        $this->lockingProvider = $lockingProvider;
116
+        $this->request = $request;
117
+        $this->url = $url;
118
+        $this->accountManager = $accountManager;
119
+        $this->groupManager = $groupManager;
120
+        $this->l10nFactory = $l10nFactory;
121
+        $this->appManager = $appManager;
122
+    }
123
+
124
+    /** @var array */
125
+    protected $sectionClasses = [];
126
+
127
+    /** @var array */
128
+    protected $sections = [];
129
+
130
+    /**
131
+     * @param string $type 'admin' or 'personal'
132
+     * @param string $section Class must implement OCP\Settings\ISection
133
+     * @return void
134
+     */
135
+    public function registerSection(string $type, string $section) {
136
+        $this->sectionClasses[$section] = $type;
137
+    }
138
+
139
+    /**
140
+     * @param string $type 'admin' or 'personal'
141
+     * @return ISection[]
142
+     */
143
+    protected function getSections(string $type): array {
144
+        if (!isset($this->sections[$type])) {
145
+            $this->sections[$type] = [];
146
+        }
147
+
148
+        foreach ($this->sectionClasses as $class => $sectionType) {
149
+            try {
150
+                /** @var ISection $section */
151
+                $section = \OC::$server->query($class);
152
+            } catch (QueryException $e) {
153
+                $this->log->logException($e, ['level' => ILogger::INFO]);
154
+                continue;
155
+            }
156
+
157
+            if (!$section instanceof ISection) {
158
+                $this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => ILogger::INFO]);
159
+                continue;
160
+            }
161
+
162
+            $this->sections[$sectionType][$section->getID()] = $section;
163
+
164
+            unset($this->sectionClasses[$class]);
165
+        }
166
+
167
+        return $this->sections[$type];
168
+    }
169
+
170
+    /** @var array */
171
+    protected $settingClasses = [];
172
+
173
+    /** @var array */
174
+    protected $settings = [];
175
+
176
+    /**
177
+     * @param string $type 'admin' or 'personal'
178
+     * @param string $setting Class must implement OCP\Settings\ISetting
179
+     * @return void
180
+     */
181
+    public function registerSetting(string $type, string $setting) {
182
+        $this->settingClasses[$setting] = $type;
183
+    }
184
+
185
+    /**
186
+     * @param string $type 'admin' or 'personal'
187
+     * @param string $section
188
+     * @return ISettings[]
189
+     */
190
+    protected function getSettings(string $type, string $section): array {
191
+        if (!isset($this->settings[$type])) {
192
+            $this->settings[$type] = [];
193
+        }
194
+        if (!isset($this->settings[$type][$section])) {
195
+            $this->settings[$type][$section] = [];
196
+        }
197
+
198
+        foreach ($this->settingClasses as $class => $settingsType) {
199
+            try {
200
+                /** @var ISettings $setting */
201
+                $setting = \OC::$server->query($class);
202
+            } catch (QueryException $e) {
203
+                $this->log->logException($e, ['level' => ILogger::INFO]);
204
+                continue;
205
+            }
206
+
207
+            if (!$setting instanceof ISettings) {
208
+                $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => ILogger::INFO]);
209
+                continue;
210
+            }
211
+
212
+            if (!isset($this->settings[$settingsType][$setting->getSection()])) {
213
+                $this->settings[$settingsType][$setting->getSection()] = [];
214
+            }
215
+            $this->settings[$settingsType][$setting->getSection()][] = $setting;
216
+
217
+            unset($this->settingClasses[$class]);
218
+        }
219
+
220
+        return $this->settings[$type][$section];
221
+    }
222
+
223
+    /**
224
+     * @inheritdoc
225
+     */
226
+    public function getAdminSections(): array {
227
+        // built-in sections
228
+        $sections = [
229
+            0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))],
230
+            1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
231
+            5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
232
+            10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
233
+            45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
234
+            50 => [new Section('groupware', $this->l->t('Groupware'), 0, $this->url->imagePath('core', 'places/contacts-dark.svg'))],
235
+            98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
236
+        ];
237
+
238
+        $appSections = $this->getSections('admin');
239
+
240
+        foreach ($appSections as $section) {
241
+            /** @var ISection $section */
242
+            if (!isset($sections[$section->getPriority()])) {
243
+                $sections[$section->getPriority()] = [];
244
+            }
245
+
246
+            $sections[$section->getPriority()][] = $section;
247
+        }
248
+
249
+        ksort($sections);
250
+
251
+        return $sections;
252
+    }
253
+
254
+    /**
255
+     * @param string $section
256
+     * @return ISection[]
257
+     */
258
+    private function getBuiltInAdminSettings($section): array {
259
+        $forms = [];
260
+
261
+        if ($section === 'overview') {
262
+            /** @var ISettings $form */
263
+            $form = new Admin\Overview($this->config);
264
+            $forms[$form->getPriority()] = [$form];
265
+            $form = new Admin\ServerDevNotice();
266
+            $forms[$form->getPriority()] = [$form];
267
+        }
268
+        if ($section === 'server') {
269
+            /** @var ISettings $form */
270
+            $form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
271
+            $forms[$form->getPriority()] = [$form];
272
+            $form = new Admin\Mail($this->config);
273
+            $forms[$form->getPriority()] = [$form];
274
+        }
275
+        if ($section === 'encryption') {
276
+            /** @var ISettings $form */
277
+            $form = new Admin\Encryption($this->encryptionManager, $this->userManager);
278
+            $forms[$form->getPriority()] = [$form];
279
+        }
280
+        if ($section === 'sharing') {
281
+            /** @var ISettings $form */
282
+            $form = new Admin\Sharing($this->config, $this->l);
283
+            $forms[$form->getPriority()] = [$form];
284
+        }
285
+
286
+        return $forms;
287
+    }
288
+
289
+    /**
290
+     * @param string $section
291
+     * @return ISection[]
292
+     */
293
+    private function getBuiltInPersonalSettings($section): array {
294
+        $forms = [];
295
+
296
+        if ($section === 'personal-info') {
297
+            /** @var ISettings $form */
298
+            $form = new Personal\PersonalInfo(
299
+                $this->config,
300
+                $this->userManager,
301
+                $this->groupManager,
302
+                $this->accountManager,
303
+                $this->appManager,
304
+                $this->l10nFactory,
305
+                $this->l
306
+            );
307
+            $forms[$form->getPriority()] = [$form];
308
+        }
309
+        if($section === 'security') {
310
+            /** @var ISettings $form */
311
+            $form = new Personal\Security($this->userManager);
312
+            $forms[$form->getPriority()] = [$form];
313
+        }
314
+        if ($section === 'additional') {
315
+            /** @var ISettings $form */
316
+            $form = new Personal\Additional();
317
+            $forms[$form->getPriority()] = [$form];
318
+        }
319
+
320
+        return $forms;
321
+    }
322
+
323
+    /**
324
+     * @inheritdoc
325
+     */
326
+    public function getAdminSettings($section): array {
327
+        $settings = $this->getBuiltInAdminSettings($section);
328
+        $appSettings = $this->getSettings('admin', $section);
329
+
330
+        foreach ($appSettings as $setting) {
331
+            if (!isset($settings[$setting->getPriority()])) {
332
+                $settings[$setting->getPriority()] = [];
333
+            }
334
+            $settings[$setting->getPriority()][] = $setting;
335
+        }
336
+
337
+        ksort($settings);
338
+        return $settings;
339
+    }
340
+
341
+    /**
342
+     * @inheritdoc
343
+     */
344
+    public function getPersonalSections(): array {
345
+        $sections = [
346
+            0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
347
+            5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
348
+            15 => [new Section('sync-clients', $this->l->t('Mobile & desktop'), 0, $this->url->imagePath('core', 'clients/phone.svg'))],
349
+        ];
350
+
351
+        $legacyForms = \OC_App::getForms('personal');
352
+        if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
353
+            $sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
354
+        }
355
+
356
+        $appSections = $this->getSections('personal');
357
+
358
+        foreach ($appSections as $section) {
359
+            /** @var ISection $section */
360
+            if (!isset($sections[$section->getPriority()])) {
361
+                $sections[$section->getPriority()] = [];
362
+            }
363
+
364
+            $sections[$section->getPriority()][] = $section;
365
+        }
366
+
367
+        ksort($sections);
368
+
369
+        return $sections;
370
+    }
371
+
372
+    /**
373
+     * @param string[] $forms
374
+     * @return bool
375
+     */
376
+    private function hasLegacyPersonalSettingsToRender(array $forms): bool {
377
+        foreach ($forms as $form) {
378
+            if(trim($form) !== '') {
379
+                return true;
380
+            }
381
+        }
382
+        return false;
383
+    }
384
+
385
+    /**
386
+     * @inheritdoc
387
+     */
388
+    public function getPersonalSettings($section): array {
389
+        $settings = $this->getBuiltInPersonalSettings($section);
390
+        $appSettings = $this->getSettings('personal', $section);
391
+
392
+        foreach ($appSettings as $setting) {
393
+            if (!isset($settings[$setting->getPriority()])) {
394
+                $settings[$setting->getPriority()] = [];
395
+            }
396
+            $settings[$setting->getPriority()][] = $setting;
397
+        }
398
+
399
+        ksort($settings);
400
+        return $settings;
401
+    }
402 402
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 			);
307 307
 			$forms[$form->getPriority()] = [$form];
308 308
 		}
309
-		if($section === 'security') {
309
+		if ($section === 'security') {
310 310
 			/** @var ISettings $form */
311 311
 			$form = new Personal\Security($this->userManager);
312 312
 			$forms[$form->getPriority()] = [$form];
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 		];
350 350
 
351 351
 		$legacyForms = \OC_App::getForms('personal');
352
-		if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
352
+		if (!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
353 353
 			$sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
354 354
 		}
355 355
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 */
376 376
 	private function hasLegacyPersonalSettingsToRender(array $forms): bool {
377 377
 		foreach ($forms as $form) {
378
-			if(trim($form) !== '') {
378
+			if (trim($form) !== '') {
379 379
 				return true;
380 380
 			}
381 381
 		}
Please login to merge, or discard this patch.
lib/private/Settings/Personal/Security.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -30,47 +30,47 @@
 block discarded – undo
30 30
 
31 31
 class Security implements ISettings {
32 32
 
33
-	private $userManager;
33
+    private $userManager;
34 34
 
35
-	public function __construct(
36
-		IUserManager $userManager
37
-	) {
38
-		$this->userManager = $userManager;
39
-	}
35
+    public function __construct(
36
+        IUserManager $userManager
37
+    ) {
38
+        $this->userManager = $userManager;
39
+    }
40 40
 
41
-	/**
42
-	 * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
43
-	 * @since 9.1
44
-	 */
45
-	public function getForm() {
46
-		$user = $this->userManager->get(\OC_User::getUser());
47
-		$passwordChangeSupported = false;
48
-		if ($user !== null) {
49
-			$passwordChangeSupported = $user->canChangePassword();
50
-		}
41
+    /**
42
+     * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
43
+     * @since 9.1
44
+     */
45
+    public function getForm() {
46
+        $user = $this->userManager->get(\OC_User::getUser());
47
+        $passwordChangeSupported = false;
48
+        if ($user !== null) {
49
+            $passwordChangeSupported = $user->canChangePassword();
50
+        }
51 51
 
52
-		return new TemplateResponse('settings', 'settings/personal/security', [
53
-			'passwordChangeSupported' => $passwordChangeSupported
54
-		]);
55
-	}
52
+        return new TemplateResponse('settings', 'settings/personal/security', [
53
+            'passwordChangeSupported' => $passwordChangeSupported
54
+        ]);
55
+    }
56 56
 
57
-	/**
58
-	 * @return string the section ID, e.g. 'sharing'
59
-	 * @since 9.1
60
-	 */
61
-	public function getSection() {
62
-		return 'security';
63
-	}
57
+    /**
58
+     * @return string the section ID, e.g. 'sharing'
59
+     * @since 9.1
60
+     */
61
+    public function getSection() {
62
+        return 'security';
63
+    }
64 64
 
65
-	/**
66
-	 * @return int whether the form should be rather on the top or bottom of
67
-	 * the admin section. The forms are arranged in ascending order of the
68
-	 * priority values. It is required to return a value between 0 and 100.
69
-	 *
70
-	 * E.g.: 70
71
-	 * @since 9.1
72
-	 */
73
-	public function getPriority() {
74
-		return 10;
75
-	}
65
+    /**
66
+     * @return int whether the form should be rather on the top or bottom of
67
+     * the admin section. The forms are arranged in ascending order of the
68
+     * priority values. It is required to return a value between 0 and 100.
69
+     *
70
+     * E.g.: 70
71
+     * @since 9.1
72
+     */
73
+    public function getPriority() {
74
+        return 10;
75
+    }
76 76
 }
Please login to merge, or discard this patch.
lib/private/Settings/Personal/PersonalInfo.php 1 patch
Indentation   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -41,240 +41,240 @@
 block discarded – undo
41 41
 
42 42
 class PersonalInfo implements ISettings {
43 43
 
44
-	/** @var IConfig */
45
-	private $config;
46
-	/** @var IUserManager */
47
-	private $userManager;
48
-	/** @var AccountManager */
49
-	private $accountManager;
50
-	/** @var IGroupManager */
51
-	private $groupManager;
52
-	/** @var IAppManager */
53
-	private $appManager;
54
-	/** @var IFactory */
55
-	private $l10nFactory;
56
-	/** @var IL10N */
57
-	private $l;
58
-
59
-	/**
60
-	 * @param IConfig $config
61
-	 * @param IUserManager $userManager
62
-	 * @param IGroupManager $groupManager
63
-	 * @param AccountManager $accountManager
64
-	 * @param IFactory $l10nFactory
65
-	 * @param IL10N $l
66
-	 */
67
-	public function __construct(
68
-		IConfig $config,
69
-		IUserManager $userManager,
70
-		IGroupManager $groupManager,
71
-		AccountManager $accountManager,
72
-		IAppManager $appManager,
73
-		IFactory $l10nFactory,
74
-		IL10N $l
75
-	) {
76
-		$this->config = $config;
77
-		$this->userManager = $userManager;
78
-		$this->accountManager = $accountManager;
79
-		$this->groupManager = $groupManager;
80
-		$this->appManager = $appManager;
81
-		$this->l10nFactory = $l10nFactory;
82
-		$this->l = $l;
83
-	}
84
-
85
-	/**
86
-	 * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
87
-	 * @since 9.1
88
-	 */
89
-	public function getForm() {
90
-		$federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
91
-		$lookupServerUploadEnabled = false;
92
-		if($federatedFileSharingEnabled) {
93
-			$federatedFileSharing = new Application();
94
-			$shareProvider = $federatedFileSharing->getFederatedShareProvider();
95
-			$lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
96
-		}
97
-
98
-		$uid = \OC_User::getUser();
99
-		$user = $this->userManager->get($uid);
100
-		$userData = $this->accountManager->getUser($user);
101
-
102
-		$storageInfo = \OC_Helper::getStorageInfo('/');
103
-		if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) {
104
-			$totalSpace = $this->l->t('Unlimited');
105
-		} else {
106
-			$totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
107
-		}
108
-
109
-		$languageParameters = $this->getLanguages($user);
110
-		$localeParameters = $this->getLocales($user);
111
-		$messageParameters = $this->getMessageParameters($userData);
112
-
113
-		$parameters = [
114
-			'total_space' => $totalSpace,
115
-			'usage' => \OC_Helper::humanFileSize($storageInfo['used']),
116
-			'usage_relative' => round($storageInfo['relative']),
117
-			'quota' => $storageInfo['quota'],
118
-			'avatarChangeSupported' => $user->canChangeAvatar(),
119
-			'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
120
-			'avatarScope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
121
-			'displayNameChangeSupported' => $user->canChangeDisplayName(),
122
-			'displayName' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['value'],
123
-			'displayNameScope' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['scope'],
124
-			'email' => $userData[AccountManager::PROPERTY_EMAIL]['value'],
125
-			'emailScope' => $userData[AccountManager::PROPERTY_EMAIL]['scope'],
126
-			'emailVerification' => $userData[AccountManager::PROPERTY_EMAIL]['verified'],
127
-			'phone' => $userData[AccountManager::PROPERTY_PHONE]['value'],
128
-			'phoneScope' => $userData[AccountManager::PROPERTY_PHONE]['scope'],
129
-			'address' => $userData[AccountManager::PROPERTY_ADDRESS]['value'],
130
-			'addressScope' => $userData[AccountManager::PROPERTY_ADDRESS]['scope'],
131
-			'website' =>  $userData[AccountManager::PROPERTY_WEBSITE]['value'],
132
-			'websiteScope' =>  $userData[AccountManager::PROPERTY_WEBSITE]['scope'],
133
-			'websiteVerification' => $userData[AccountManager::PROPERTY_WEBSITE]['verified'],
134
-			'twitter' => $userData[AccountManager::PROPERTY_TWITTER]['value'],
135
-			'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'],
136
-			'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'],
137
-			'groups' => $this->getGroups($user),
138
-		] + $messageParameters + $languageParameters + $localeParameters;
139
-
140
-
141
-		return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
142
-	}
143
-
144
-	/**
145
-	 * @return string the section ID, e.g. 'sharing'
146
-	 * @since 9.1
147
-	 */
148
-	public function getSection() {
149
-		return 'personal-info';
150
-	}
151
-
152
-	/**
153
-	 * @return int whether the form should be rather on the top or bottom of
154
-	 * the admin section. The forms are arranged in ascending order of the
155
-	 * priority values. It is required to return a value between 0 and 100.
156
-	 *
157
-	 * E.g.: 70
158
-	 * @since 9.1
159
-	 */
160
-	public function getPriority() {
161
-		return 10;
162
-	}
163
-
164
-	/**
165
-	 * returns a sorted list of the user's group GIDs
166
-	 *
167
-	 * @param IUser $user
168
-	 * @return array
169
-	 */
170
-	private function getGroups(IUser $user) {
171
-		$groups = array_map(
172
-			function(IGroup $group) {
173
-				return $group->getDisplayName();
174
-			},
175
-			$this->groupManager->getUserGroups($user)
176
-		);
177
-		sort($groups);
178
-
179
-		return $groups;
180
-	}
181
-
182
-	/**
183
-	 * returns the user language, common language and other languages in an
184
-	 * associative array
185
-	 *
186
-	 * @param IUser $user
187
-	 * @return array
188
-	 */
189
-	private function getLanguages(IUser $user) {
190
-		$forceLanguage = $this->config->getSystemValue('force_language', false);
191
-		if($forceLanguage !== false) {
192
-			return [];
193
-		}
194
-
195
-		$uid = $user->getUID();
196
-
197
-		$userConfLang = $this->config->getUserValue($uid, 'core', 'lang', $this->l10nFactory->findLanguage());
198
-		$languages = $this->l10nFactory->getLanguages();
199
-
200
-		// associate the user language with the proper array
201
-		$userLangIndex = array_search($userConfLang, array_column($languages['commonlanguages'], 'code'));
202
-		$userLang = $languages['commonlanguages'][$userLangIndex];
203
-		// search in the other languages
204
-		if ($userLangIndex === false) {
205
-			$userLangIndex = array_search($userConfLang, array_column($languages['languages'], 'code'));		
206
-			$userLang = $languages['languages'][$userLangIndex];
207
-		}
208
-		// if user language is not available but set somehow: show the actual code as name
209
-		if (!is_array($userLang)) {
210
-			$userLang = [
211
-				'code' => $userConfLang,
212
-				'name' => $userConfLang,
213
-			];
214
-		}
215
-
216
-		return array_merge(
217
-			array('activelanguage' => $userLang),
218
-			$languages
219
-		);
220
-	}
221
-
222
-	private function getLocales(IUser $user) {
223
-		$forceLanguage = $this->config->getSystemValue('force_locale', false);
224
-		if($forceLanguage !== false) {
225
-			return [];
226
-		}
227
-
228
-		$uid = $user->getUID();
229
-
230
-		$userLocaleString = $this->config->getUserValue($uid, 'core', 'locale', 'en_US');
231
-
232
-		$userLang = $this->config->getUserValue($uid, 'core', 'lang', $this->l10nFactory->findLanguage());
233
-
234
-		$localeCodes = $this->l10nFactory->findAvailableLocales();
235
-
236
-		$userLocale = array_filter($localeCodes, function($value) use ($userLocaleString) {
237
-			return $userLocaleString === $value['code'];
238
-		});
239
-
240
-		if (!empty($userLocale))
241
-		{
242
-			$userLocale = reset($userLocale);
243
-		}
244
-
245
-		$localesForLanguage = array_filter($localeCodes, function($localeCode) use ($userLang) {
246
-			return 0 === strpos($localeCode['code'], $userLang);
247
-		});
248
-
249
-		return [
250
-			'activelocaleLang' => $userLocaleString,
251
-			'activelocale' => $userLocale,
252
-			'locales' => $localeCodes,
253
-			'localesForLanguage' => $localesForLanguage,
254
-		];
255
-	}
256
-
257
-	/**
258
-	 * @param array $userData
259
-	 * @return array
260
-	 */
261
-	private function getMessageParameters(array $userData) {
262
-		$needVerifyMessage = [AccountManager::PROPERTY_EMAIL, AccountManager::PROPERTY_WEBSITE, AccountManager::PROPERTY_TWITTER];
263
-		$messageParameters = [];
264
-		foreach ($needVerifyMessage as $property) {
265
-			switch ($userData[$property]['verified']) {
266
-				case AccountManager::VERIFIED:
267
-					$message = $this->l->t('Verifying');
268
-					break;
269
-				case AccountManager::VERIFICATION_IN_PROGRESS:
270
-					$message = $this->l->t('Verifying …');
271
-					break;
272
-				default:
273
-					$message = $this->l->t('Verify');
274
-			}
275
-			$messageParameters[$property . 'Message'] = $message;
276
-		}
277
-		return $messageParameters;
278
-	}
44
+    /** @var IConfig */
45
+    private $config;
46
+    /** @var IUserManager */
47
+    private $userManager;
48
+    /** @var AccountManager */
49
+    private $accountManager;
50
+    /** @var IGroupManager */
51
+    private $groupManager;
52
+    /** @var IAppManager */
53
+    private $appManager;
54
+    /** @var IFactory */
55
+    private $l10nFactory;
56
+    /** @var IL10N */
57
+    private $l;
58
+
59
+    /**
60
+     * @param IConfig $config
61
+     * @param IUserManager $userManager
62
+     * @param IGroupManager $groupManager
63
+     * @param AccountManager $accountManager
64
+     * @param IFactory $l10nFactory
65
+     * @param IL10N $l
66
+     */
67
+    public function __construct(
68
+        IConfig $config,
69
+        IUserManager $userManager,
70
+        IGroupManager $groupManager,
71
+        AccountManager $accountManager,
72
+        IAppManager $appManager,
73
+        IFactory $l10nFactory,
74
+        IL10N $l
75
+    ) {
76
+        $this->config = $config;
77
+        $this->userManager = $userManager;
78
+        $this->accountManager = $accountManager;
79
+        $this->groupManager = $groupManager;
80
+        $this->appManager = $appManager;
81
+        $this->l10nFactory = $l10nFactory;
82
+        $this->l = $l;
83
+    }
84
+
85
+    /**
86
+     * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
87
+     * @since 9.1
88
+     */
89
+    public function getForm() {
90
+        $federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
91
+        $lookupServerUploadEnabled = false;
92
+        if($federatedFileSharingEnabled) {
93
+            $federatedFileSharing = new Application();
94
+            $shareProvider = $federatedFileSharing->getFederatedShareProvider();
95
+            $lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
96
+        }
97
+
98
+        $uid = \OC_User::getUser();
99
+        $user = $this->userManager->get($uid);
100
+        $userData = $this->accountManager->getUser($user);
101
+
102
+        $storageInfo = \OC_Helper::getStorageInfo('/');
103
+        if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) {
104
+            $totalSpace = $this->l->t('Unlimited');
105
+        } else {
106
+            $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
107
+        }
108
+
109
+        $languageParameters = $this->getLanguages($user);
110
+        $localeParameters = $this->getLocales($user);
111
+        $messageParameters = $this->getMessageParameters($userData);
112
+
113
+        $parameters = [
114
+            'total_space' => $totalSpace,
115
+            'usage' => \OC_Helper::humanFileSize($storageInfo['used']),
116
+            'usage_relative' => round($storageInfo['relative']),
117
+            'quota' => $storageInfo['quota'],
118
+            'avatarChangeSupported' => $user->canChangeAvatar(),
119
+            'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
120
+            'avatarScope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
121
+            'displayNameChangeSupported' => $user->canChangeDisplayName(),
122
+            'displayName' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['value'],
123
+            'displayNameScope' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['scope'],
124
+            'email' => $userData[AccountManager::PROPERTY_EMAIL]['value'],
125
+            'emailScope' => $userData[AccountManager::PROPERTY_EMAIL]['scope'],
126
+            'emailVerification' => $userData[AccountManager::PROPERTY_EMAIL]['verified'],
127
+            'phone' => $userData[AccountManager::PROPERTY_PHONE]['value'],
128
+            'phoneScope' => $userData[AccountManager::PROPERTY_PHONE]['scope'],
129
+            'address' => $userData[AccountManager::PROPERTY_ADDRESS]['value'],
130
+            'addressScope' => $userData[AccountManager::PROPERTY_ADDRESS]['scope'],
131
+            'website' =>  $userData[AccountManager::PROPERTY_WEBSITE]['value'],
132
+            'websiteScope' =>  $userData[AccountManager::PROPERTY_WEBSITE]['scope'],
133
+            'websiteVerification' => $userData[AccountManager::PROPERTY_WEBSITE]['verified'],
134
+            'twitter' => $userData[AccountManager::PROPERTY_TWITTER]['value'],
135
+            'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'],
136
+            'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'],
137
+            'groups' => $this->getGroups($user),
138
+        ] + $messageParameters + $languageParameters + $localeParameters;
139
+
140
+
141
+        return new TemplateResponse('settings', 'settings/personal/personal.info', $parameters, '');
142
+    }
143
+
144
+    /**
145
+     * @return string the section ID, e.g. 'sharing'
146
+     * @since 9.1
147
+     */
148
+    public function getSection() {
149
+        return 'personal-info';
150
+    }
151
+
152
+    /**
153
+     * @return int whether the form should be rather on the top or bottom of
154
+     * the admin section. The forms are arranged in ascending order of the
155
+     * priority values. It is required to return a value between 0 and 100.
156
+     *
157
+     * E.g.: 70
158
+     * @since 9.1
159
+     */
160
+    public function getPriority() {
161
+        return 10;
162
+    }
163
+
164
+    /**
165
+     * returns a sorted list of the user's group GIDs
166
+     *
167
+     * @param IUser $user
168
+     * @return array
169
+     */
170
+    private function getGroups(IUser $user) {
171
+        $groups = array_map(
172
+            function(IGroup $group) {
173
+                return $group->getDisplayName();
174
+            },
175
+            $this->groupManager->getUserGroups($user)
176
+        );
177
+        sort($groups);
178
+
179
+        return $groups;
180
+    }
181
+
182
+    /**
183
+     * returns the user language, common language and other languages in an
184
+     * associative array
185
+     *
186
+     * @param IUser $user
187
+     * @return array
188
+     */
189
+    private function getLanguages(IUser $user) {
190
+        $forceLanguage = $this->config->getSystemValue('force_language', false);
191
+        if($forceLanguage !== false) {
192
+            return [];
193
+        }
194
+
195
+        $uid = $user->getUID();
196
+
197
+        $userConfLang = $this->config->getUserValue($uid, 'core', 'lang', $this->l10nFactory->findLanguage());
198
+        $languages = $this->l10nFactory->getLanguages();
199
+
200
+        // associate the user language with the proper array
201
+        $userLangIndex = array_search($userConfLang, array_column($languages['commonlanguages'], 'code'));
202
+        $userLang = $languages['commonlanguages'][$userLangIndex];
203
+        // search in the other languages
204
+        if ($userLangIndex === false) {
205
+            $userLangIndex = array_search($userConfLang, array_column($languages['languages'], 'code'));		
206
+            $userLang = $languages['languages'][$userLangIndex];
207
+        }
208
+        // if user language is not available but set somehow: show the actual code as name
209
+        if (!is_array($userLang)) {
210
+            $userLang = [
211
+                'code' => $userConfLang,
212
+                'name' => $userConfLang,
213
+            ];
214
+        }
215
+
216
+        return array_merge(
217
+            array('activelanguage' => $userLang),
218
+            $languages
219
+        );
220
+    }
221
+
222
+    private function getLocales(IUser $user) {
223
+        $forceLanguage = $this->config->getSystemValue('force_locale', false);
224
+        if($forceLanguage !== false) {
225
+            return [];
226
+        }
227
+
228
+        $uid = $user->getUID();
229
+
230
+        $userLocaleString = $this->config->getUserValue($uid, 'core', 'locale', 'en_US');
231
+
232
+        $userLang = $this->config->getUserValue($uid, 'core', 'lang', $this->l10nFactory->findLanguage());
233
+
234
+        $localeCodes = $this->l10nFactory->findAvailableLocales();
235
+
236
+        $userLocale = array_filter($localeCodes, function($value) use ($userLocaleString) {
237
+            return $userLocaleString === $value['code'];
238
+        });
239
+
240
+        if (!empty($userLocale))
241
+        {
242
+            $userLocale = reset($userLocale);
243
+        }
244
+
245
+        $localesForLanguage = array_filter($localeCodes, function($localeCode) use ($userLang) {
246
+            return 0 === strpos($localeCode['code'], $userLang);
247
+        });
248
+
249
+        return [
250
+            'activelocaleLang' => $userLocaleString,
251
+            'activelocale' => $userLocale,
252
+            'locales' => $localeCodes,
253
+            'localesForLanguage' => $localesForLanguage,
254
+        ];
255
+    }
256
+
257
+    /**
258
+     * @param array $userData
259
+     * @return array
260
+     */
261
+    private function getMessageParameters(array $userData) {
262
+        $needVerifyMessage = [AccountManager::PROPERTY_EMAIL, AccountManager::PROPERTY_WEBSITE, AccountManager::PROPERTY_TWITTER];
263
+        $messageParameters = [];
264
+        foreach ($needVerifyMessage as $property) {
265
+            switch ($userData[$property]['verified']) {
266
+                case AccountManager::VERIFIED:
267
+                    $message = $this->l->t('Verifying');
268
+                    break;
269
+                case AccountManager::VERIFICATION_IN_PROGRESS:
270
+                    $message = $this->l->t('Verifying …');
271
+                    break;
272
+                default:
273
+                    $message = $this->l->t('Verify');
274
+            }
275
+            $messageParameters[$property . 'Message'] = $message;
276
+        }
277
+        return $messageParameters;
278
+    }
279 279
 
280 280
 }
Please login to merge, or discard this patch.