Completed
Pull Request — master (#4890)
by Blizzz
19:09 queued 04:19
created
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/app-passwords.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@
 block discarded – undo
21 21
  *
22 22
  */
23 23
 script('settings', [
24
-	'authtoken',
25
-	'authtoken_collection',
26
-	'authtoken_view',
27
-	'settings/authtoken-init'
24
+    'authtoken',
25
+    'authtoken_collection',
26
+    'authtoken_view',
27
+    'settings/authtoken-init'
28 28
 ]);
29 29
 
30 30
 ?>
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@
 block discarded – undo
30 30
 ?>
31 31
 
32 32
 <div id="apppasswords" class="section">
33
-	<h2><?php p($l->t('App passwords'));?></h2>
34
-	<p class="settings-hint"><?php p($l->t('Here you can generate individual passwords for apps so you don’t have to give out your password. You can revoke them individually too.'));?></p>
33
+	<h2><?php p($l->t('App passwords')); ?></h2>
34
+	<p class="settings-hint"><?php p($l->t('Here you can generate individual passwords for apps so you don’t have to give out your password. You can revoke them individually too.')); ?></p>
35 35
 	<table class="icon-loading">
36 36
 		<thead class="hidden-when-empty">
37 37
 		<tr>
38
-			<th><?php p($l->t('Name'));?></th>
39
-			<th><?php p($l->t('Last activity'));?></th>
38
+			<th><?php p($l->t('Name')); ?></th>
39
+			<th><?php p($l->t('Last activity')); ?></th>
40 40
 			<th></th>
41 41
 		</tr>
42 42
 		</thead>
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.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 ?>
42 42
 
43 43
 <div id="quota" class="section">
44
-	<div style="width:<?php p($_['usage_relative']);?>%"
45
-		<?php if($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>>
44
+	<div style="width:<?php p($_['usage_relative']); ?>%"
45
+		<?php if ($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>>
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>
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 				</div>
84 84
 			</div>
85 85
 			<span class="icon-checkmark hidden"/>
86
-			<?php if($_['lookupServerUploadEnabled']) { ?>
86
+			<?php if ($_['lookupServerUploadEnabled']) { ?>
87 87
 				<input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>">
88 88
 			<?php } ?>
89 89
 		</form>
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
 					<span class="icon-password"/>
98 98
 				</h2>
99 99
 				<input type="text" id="displayname" name="displayname"
100
-					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
100
+					<?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
101 101
 					   value="<?php p($_['displayName']) ?>"
102 102
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
103
-				<?php if(!$_['displayNameChangeSupported']) { ?>
104
-					<span><?php if(isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span>
103
+				<?php if (!$_['displayNameChangeSupported']) { ?>
104
+					<span><?php if (isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span>
105 105
 				<?php } ?>
106 106
 				<span class="icon-checkmark hidden"/>
107
-				<?php if($_['lookupServerUploadEnabled']) { ?>
107
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
108 108
 					<input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>">
109 109
 				<?php } ?>
110 110
 			</form>
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 					<label for="email"><?php p($l->t('Email')); ?></label>
116 116
 					<span class="icon-password"/>
117 117
 				</h2>
118
-				<div class="verify <?php if ($_['email'] === ''  || $_['emailScope'] !== 'public') p('hidden'); ?>">
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']) {
121
+					switch ($_['emailVerification']) {
122 122
 						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
123 123
 							p(image_path('core', 'actions/verifying.svg'));
124 124
 							break;
@@ -131,23 +131,23 @@  discard block
 block discarded – undo
131 131
 					?>">
132 132
 				</div>
133 133
 				<input type="email" name="email" id="email" value="<?php p($_['email']); ?>"
134
-					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
134
+					<?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
135 135
 					   placeholder="<?php p($l->t('Your email address')); ?>"
136 136
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
137
-				<?php if(!$_['displayNameChangeSupported']) { ?>
138
-					<span><?php if(isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span>
137
+				<?php if (!$_['displayNameChangeSupported']) { ?>
138
+					<span><?php if (isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span>
139 139
 				<?php } ?>
140
-				<?php if($_['displayNameChangeSupported']) { ?>
140
+				<?php if ($_['displayNameChangeSupported']) { ?>
141 141
 					<br />
142 142
 					<em><?php p($l->t('For password reset and notifications')); ?></em>
143 143
 				<?php } ?>
144 144
 				<span class="icon-checkmark hidden"/>
145
-				<?php if($_['lookupServerUploadEnabled']) { ?>
145
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
146 146
 					<input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>">
147 147
 				<?php } ?>
148 148
 			</form>
149 149
 		</div>
150
-		<?php if($_['lookupServerUploadEnabled']) { ?>
150
+		<?php if ($_['lookupServerUploadEnabled']) { ?>
151 151
 			<div class="personal-settings-setting-box">
152 152
 				<form id="phoneform" class="section">
153 153
 					<h2>
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 						<label for="website"><?php p($l->t('Website')); ?></label>
183 183
 						<span class="icon-password"/>
184 184
 					</h2>
185
-					<div class="verify <?php if ($_['website'] === ''  || $_['websiteScope'] !== 'public') p('hidden'); ?>">
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']) {
188
+						switch ($_['websiteVerification']) {
189 189
 							case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
190 190
 								p(image_path('core', 'actions/verifying.svg'));
191 191
 								break;
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
 								p(image_path('core', 'actions/verify.svg'));
197 197
 						}
198 198
 						?>"
199
-							<?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
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">
202 202
 							<div class="verification-dialog-content">
203 203
 								<p class="explainVerification"></p>
204 204
 								<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>
205
+								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
206 206
 							</div>
207 207
 						</div>
208 208
 					</div>
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 						<label for="twitter"><?php p($l->t('Twitter')); ?></label>
220 220
 						<span class="icon-password"/>
221 221
 					</h2>
222
-					<div class="verify <?php if ($_['twitter'] === ''  || $_['twitterScope'] !== 'public') p('hidden'); ?>">
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']) {
225
+						switch ($_['twitterVerification']) {
226 226
 							case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
227 227
 								p(image_path('core', 'actions/verifying.svg'));
228 228
 								break;
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
 								p(image_path('core', 'actions/verify.svg'));
234 234
 						}
235 235
 						?>"
236
-							<?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
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">
239 239
 							<div class="verification-dialog-content">
240 240
 								<p class="explainVerification"></p>
241 241
 								<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>
242
+								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
243 243
 							</div>
244 244
 						</div>
245 245
 					</div>
@@ -264,19 +264,19 @@  discard block
 block discarded – undo
264 264
 </div>
265 265
 
266 266
 <?php
267
-if($_['passwordChangeSupported']) {
267
+if ($_['passwordChangeSupported']) {
268 268
 	script('jquery-showpassword');
269 269
 	?>
270 270
 	<form id="passwordform" class="section">
271
-		<h2 class="inlineblock"><?php p($l->t('Password'));?></h2>
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>
273 273
 		<br>
274 274
 		<label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label>
275 275
 		<input type="password" id="pass1" name="oldpassword"
276
-			   placeholder="<?php p($l->t('Current password'));?>"
276
+			   placeholder="<?php p($l->t('Current password')); ?>"
277 277
 			   autocomplete="off" autocapitalize="none" autocorrect="off" />
278 278
 		<div class="personal-show-container">
279
-			<label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label>
279
+			<label for="pass2" class="hidden-visually"><?php p($l->t('New password')); ?>: </label>
280 280
 			<input type="password" id="pass2" name="newpassword"
281 281
 				   placeholder="<?php p($l->t('New password')); ?>"
282 282
 				   data-typetoggle="#personal-show"
@@ -292,26 +292,26 @@  discard block
 block discarded – undo
292 292
 
293 293
 <form id="language" class="section">
294 294
 	<h2>
295
-		<label for="languageinput"><?php p($l->t('Language'));?></label>
295
+		<label for="languageinput"><?php p($l->t('Language')); ?></label>
296 296
 	</h2>
297
-	<select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language'));?>">
298
-		<option value="<?php p($_['activelanguage']['code']);?>">
299
-			<?php p($_['activelanguage']['name']);?>
297
+	<select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language')); ?>">
298
+		<option value="<?php p($_['activelanguage']['code']); ?>">
299
+			<?php p($_['activelanguage']['name']); ?>
300 300
 		</option>
301
-		<?php foreach($_['commonlanguages'] as $language):?>
302
-			<option value="<?php p($language['code']);?>">
303
-				<?php p($language['name']);?>
301
+		<?php foreach ($_['commonlanguages'] as $language):?>
302
+			<option value="<?php p($language['code']); ?>">
303
+				<?php p($language['name']); ?>
304 304
 			</option>
305
-		<?php endforeach;?>
305
+		<?php endforeach; ?>
306 306
 		<optgroup label="––––––––––"></optgroup>
307
-		<?php foreach($_['languages'] as $language):?>
308
-			<option value="<?php p($language['code']);?>">
309
-				<?php p($language['name']);?>
307
+		<?php foreach ($_['languages'] as $language):?>
308
+			<option value="<?php p($language['code']); ?>">
309
+				<?php p($language['name']); ?>
310 310
 			</option>
311
-		<?php endforeach;?>
311
+		<?php endforeach; ?>
312 312
 	</select>
313 313
 	<a href="https://www.transifex.com/nextcloud/nextcloud/"
314 314
 	   target="_blank" rel="noreferrer">
315
-		<em><?php p($l->t('Help translate'));?></em>
315
+		<em><?php p($l->t('Help translate')); ?></em>
316 316
 	</a>
317 317
 </form>
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.
settings/templates/settings/personal/sessions.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@
 block discarded – undo
22 22
  */
23 23
 
24 24
 script('settings', [
25
-	'authtoken',
26
-	'authtoken_collection',
27
-	'authtoken_view',
28
-	'settings/authtoken-init'
25
+    'authtoken',
26
+    'authtoken_collection',
27
+    'authtoken_view',
28
+    'settings/authtoken-init'
29 29
 ]);
30 30
 
31 31
 ?>
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@
 block discarded – undo
32 32
 
33 33
 
34 34
 <div id="sessions" class="section">
35
-	<h2><?php p($l->t('Sessions'));?></h2>
36
-<p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.'));?></p>
35
+	<h2><?php p($l->t('Sessions')); ?></h2>
36
+<p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.')); ?></p>
37 37
 <table class="icon-loading">
38 38
 	<thead class="token-list-header">
39 39
 	<tr>
40
-		<th><?php p($l->t('Device'));?></th>
41
-		<th><?php p($l->t('Last activity'));?></th>
40
+		<th><?php p($l->t('Device')); ?></th>
41
+		<th><?php p($l->t('Last activity')); ?></th>
42 42
 		<th></th>
43 43
 	</tr>
44 44
 	</thead>
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/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.
lib/private/Settings/Mapper.php 2 patches
Indentation   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -26,189 +26,189 @@
 block discarded – undo
26 26
 use OCP\IDBConnection;
27 27
 
28 28
 class Mapper {
29
-	const TABLE_ADMIN_SETTINGS = 'admin_settings';
30
-	const TABLE_ADMIN_SECTIONS = 'admin_sections';
31
-	const TABLE_PERSONAL_SETTINGS = 'personal_settings';
32
-	const TABLE_PERSONAL_SECTIONS = 'personal_sections';
33
-
34
-	/** @var IDBConnection */
35
-	private $dbc;
36
-
37
-	/**
38
-	 * @param IDBConnection $dbc
39
-	 */
40
-	public function __construct(IDBConnection $dbc) {
41
-		$this->dbc = $dbc;
42
-	}
43
-
44
-	/**
45
-	 * Get the configured admin settings from the database for the provided section
46
-	 *
47
-	 * @param string $section
48
-	 * @return array[] [['class' => string, 'priority' => int], ...]
49
-	 */
50
-	public function getAdminSettingsFromDB($section) {
51
-		return $this->getSettingsFromDB(self::TABLE_ADMIN_SETTINGS, $section);
52
-	}
53
-
54
-	/**
55
-	 * Get the configured personal settings from the database for the provided section
56
-	 *
57
-	 * @param string $section
58
-	 * @return array[] [['class' => string, 'priority' => int], ...]
59
-	 */
60
-	public function getPersonalSettingsFromDB($section) {
61
-		return $this->getSettingsFromDB(self::TABLE_PERSONAL_SETTINGS, $section);
62
-	}
63
-
64
-	/**
65
-	 * Get the configured settings from the database for the provided table and section
66
-	 *
67
-	 * @param $table
68
-	 * @param $section
69
-	 * @return array
70
-	 */
71
-	private function getSettingsFromDB($table, $section) {
72
-		$query = $this->dbc->getQueryBuilder();
73
-		$query->select(['class', 'priority'])
74
-			->from($table)
75
-			->where($query->expr()->eq('section', $this->dbc->getQueryBuilder()->createParameter('section')))
76
-			->setParameter('section', $section);
77
-
78
-		$result = $query->execute();
79
-		return $result->fetchAll();
80
-	}
81
-
82
-	/**
83
-	 * Get the configured admin sections from the database
84
-	 *
85
-	 * @return array[] [['class' => string, 'priority' => int], ...]
86
-	 */
87
-	public function getAdminSectionsFromDB() {
88
-		return $this->getSectionsFromDB('admin');
89
-	}
90
-
91
-	/**
92
-	 * Get the configured admin sections from the database
93
-	 *
94
-	 * @return array[] [['class' => string, 'priority' => int], ...]
95
-	 */
96
-	public function getPersonalSectionsFromDB() {
97
-		return $this->getSectionsFromDB('personal');
98
-	}
99
-
100
-	/**
101
-	 * Get the configured sections from the database by table
102
-	 *
103
-	 * @param string $type either 'personal' or 'admin'
104
-	 * @return array[] [['class' => string, 'priority' => int], ...]
105
-	 */
106
-	public function getSectionsFromDB($type) {
107
-		if($type === 'admin') {
108
-			$sectionsTable = self::TABLE_ADMIN_SECTIONS;
109
-			$settingsTable = self::TABLE_ADMIN_SETTINGS;
110
-		} else if($type === 'personal') {
111
-			$sectionsTable = self::TABLE_PERSONAL_SECTIONS;
112
-			$settingsTable = self::TABLE_PERSONAL_SETTINGS;
113
-		} else {
114
-			throw new \InvalidArgumentException('"admin" or "personal" expected');
115
-		}
116
-		$query = $this->dbc->getQueryBuilder();
117
-		$query->selectDistinct('s.class')
118
-			->addSelect('s.priority')
119
-			->from($sectionsTable, 's')
120
-			->from($settingsTable, 'f')
121
-			->where($query->expr()->eq('s.id', 'f.section'));
122
-		$result = $query->execute();
123
-		return array_map(function ($row) {
124
-			$row['priority'] = (int)$row['priority'];
125
-			return $row;
126
-		}, $result->fetchAll());
127
-	}
128
-
129
-	/**
130
-	 * @param string $table one of the Mapper::TABLE_* constants
131
-	 * @param array $values
132
-	 */
133
-	public function add($table, array $values) {
134
-		$query = $this->dbc->getQueryBuilder();
135
-		$values = array_map(function ($value) use ($query) {
136
-			return $query->createNamedParameter($value);
137
-		}, $values);
138
-		$query->insert($table)->values($values);
139
-		$query->execute();
140
-	}
141
-
142
-	/**
143
-	 * returns the registered classes in the given table
144
-	 *
145
-	 * @param string $table one of the Mapper::TABLE_* constants
146
-	 * @return string[]
147
-	 */
148
-	public function getClasses($table) {
149
-		$q = $this->dbc->getQueryBuilder();
150
-		$resultStatement = $q->select('class')
151
-			->from($table)
152
-			->execute();
153
-		$data = $resultStatement->fetchAll();
154
-		$resultStatement->closeCursor();
155
-
156
-		return array_map(function ($row) {
157
-			return $row['class'];
158
-		}, $data);
159
-	}
160
-
161
-	/**
162
-	 * Check if a class is configured in the database
163
-	 *
164
-	 * @param string $table one of the Mapper::TABLE_* constants
165
-	 * @param string $className
166
-	 * @return bool
167
-	 */
168
-	public function has($table, $className) {
169
-		$query = $this->dbc->getQueryBuilder();
170
-		$query->select('class')
171
-			->from($table)
172
-			->where($query->expr()->eq('class', $query->createNamedParameter($className)))
173
-			->setMaxResults(1);
174
-
175
-		$result = $query->execute();
176
-		$row = $result->fetch();
177
-		$result->closeCursor();
178
-
179
-		return (bool)$row;
180
-	}
181
-
182
-	/**
183
-	 * deletes an settings or admin entry from the given table
184
-	 *
185
-	 * @param string $table one of the Mapper::TABLE_* constants
186
-	 * @param string $className
187
-	 */
188
-	public function remove($table, $className) {
189
-		$query = $this->dbc->getQueryBuilder();
190
-		$query->delete($table)
191
-			->where($query->expr()->eq('class', $query->createNamedParameter($className)));
192
-
193
-		$query->execute();
194
-	}
195
-
196
-	/**
197
-	 * @param string $table one of the Mapper::TABLE_* constants
198
-	 * @param string $idCol
199
-	 * @param string $id
200
-	 * @param array $values
201
-	 */
202
-	public function update($table, $idCol, $id, $values) {
203
-		$query = $this->dbc->getQueryBuilder();
204
-		$query->update($table);
205
-		foreach ($values as $key => $value) {
206
-			$query->set($key, $query->createNamedParameter($value));
207
-		}
208
-		$query
209
-			->where($query->expr()->eq($idCol, $query->createParameter($idCol)))
210
-			->setParameter($idCol, $id)
211
-			->execute();
212
-	}
29
+    const TABLE_ADMIN_SETTINGS = 'admin_settings';
30
+    const TABLE_ADMIN_SECTIONS = 'admin_sections';
31
+    const TABLE_PERSONAL_SETTINGS = 'personal_settings';
32
+    const TABLE_PERSONAL_SECTIONS = 'personal_sections';
33
+
34
+    /** @var IDBConnection */
35
+    private $dbc;
36
+
37
+    /**
38
+     * @param IDBConnection $dbc
39
+     */
40
+    public function __construct(IDBConnection $dbc) {
41
+        $this->dbc = $dbc;
42
+    }
43
+
44
+    /**
45
+     * Get the configured admin settings from the database for the provided section
46
+     *
47
+     * @param string $section
48
+     * @return array[] [['class' => string, 'priority' => int], ...]
49
+     */
50
+    public function getAdminSettingsFromDB($section) {
51
+        return $this->getSettingsFromDB(self::TABLE_ADMIN_SETTINGS, $section);
52
+    }
53
+
54
+    /**
55
+     * Get the configured personal settings from the database for the provided section
56
+     *
57
+     * @param string $section
58
+     * @return array[] [['class' => string, 'priority' => int], ...]
59
+     */
60
+    public function getPersonalSettingsFromDB($section) {
61
+        return $this->getSettingsFromDB(self::TABLE_PERSONAL_SETTINGS, $section);
62
+    }
63
+
64
+    /**
65
+     * Get the configured settings from the database for the provided table and section
66
+     *
67
+     * @param $table
68
+     * @param $section
69
+     * @return array
70
+     */
71
+    private function getSettingsFromDB($table, $section) {
72
+        $query = $this->dbc->getQueryBuilder();
73
+        $query->select(['class', 'priority'])
74
+            ->from($table)
75
+            ->where($query->expr()->eq('section', $this->dbc->getQueryBuilder()->createParameter('section')))
76
+            ->setParameter('section', $section);
77
+
78
+        $result = $query->execute();
79
+        return $result->fetchAll();
80
+    }
81
+
82
+    /**
83
+     * Get the configured admin sections from the database
84
+     *
85
+     * @return array[] [['class' => string, 'priority' => int], ...]
86
+     */
87
+    public function getAdminSectionsFromDB() {
88
+        return $this->getSectionsFromDB('admin');
89
+    }
90
+
91
+    /**
92
+     * Get the configured admin sections from the database
93
+     *
94
+     * @return array[] [['class' => string, 'priority' => int], ...]
95
+     */
96
+    public function getPersonalSectionsFromDB() {
97
+        return $this->getSectionsFromDB('personal');
98
+    }
99
+
100
+    /**
101
+     * Get the configured sections from the database by table
102
+     *
103
+     * @param string $type either 'personal' or 'admin'
104
+     * @return array[] [['class' => string, 'priority' => int], ...]
105
+     */
106
+    public function getSectionsFromDB($type) {
107
+        if($type === 'admin') {
108
+            $sectionsTable = self::TABLE_ADMIN_SECTIONS;
109
+            $settingsTable = self::TABLE_ADMIN_SETTINGS;
110
+        } else if($type === 'personal') {
111
+            $sectionsTable = self::TABLE_PERSONAL_SECTIONS;
112
+            $settingsTable = self::TABLE_PERSONAL_SETTINGS;
113
+        } else {
114
+            throw new \InvalidArgumentException('"admin" or "personal" expected');
115
+        }
116
+        $query = $this->dbc->getQueryBuilder();
117
+        $query->selectDistinct('s.class')
118
+            ->addSelect('s.priority')
119
+            ->from($sectionsTable, 's')
120
+            ->from($settingsTable, 'f')
121
+            ->where($query->expr()->eq('s.id', 'f.section'));
122
+        $result = $query->execute();
123
+        return array_map(function ($row) {
124
+            $row['priority'] = (int)$row['priority'];
125
+            return $row;
126
+        }, $result->fetchAll());
127
+    }
128
+
129
+    /**
130
+     * @param string $table one of the Mapper::TABLE_* constants
131
+     * @param array $values
132
+     */
133
+    public function add($table, array $values) {
134
+        $query = $this->dbc->getQueryBuilder();
135
+        $values = array_map(function ($value) use ($query) {
136
+            return $query->createNamedParameter($value);
137
+        }, $values);
138
+        $query->insert($table)->values($values);
139
+        $query->execute();
140
+    }
141
+
142
+    /**
143
+     * returns the registered classes in the given table
144
+     *
145
+     * @param string $table one of the Mapper::TABLE_* constants
146
+     * @return string[]
147
+     */
148
+    public function getClasses($table) {
149
+        $q = $this->dbc->getQueryBuilder();
150
+        $resultStatement = $q->select('class')
151
+            ->from($table)
152
+            ->execute();
153
+        $data = $resultStatement->fetchAll();
154
+        $resultStatement->closeCursor();
155
+
156
+        return array_map(function ($row) {
157
+            return $row['class'];
158
+        }, $data);
159
+    }
160
+
161
+    /**
162
+     * Check if a class is configured in the database
163
+     *
164
+     * @param string $table one of the Mapper::TABLE_* constants
165
+     * @param string $className
166
+     * @return bool
167
+     */
168
+    public function has($table, $className) {
169
+        $query = $this->dbc->getQueryBuilder();
170
+        $query->select('class')
171
+            ->from($table)
172
+            ->where($query->expr()->eq('class', $query->createNamedParameter($className)))
173
+            ->setMaxResults(1);
174
+
175
+        $result = $query->execute();
176
+        $row = $result->fetch();
177
+        $result->closeCursor();
178
+
179
+        return (bool)$row;
180
+    }
181
+
182
+    /**
183
+     * deletes an settings or admin entry from the given table
184
+     *
185
+     * @param string $table one of the Mapper::TABLE_* constants
186
+     * @param string $className
187
+     */
188
+    public function remove($table, $className) {
189
+        $query = $this->dbc->getQueryBuilder();
190
+        $query->delete($table)
191
+            ->where($query->expr()->eq('class', $query->createNamedParameter($className)));
192
+
193
+        $query->execute();
194
+    }
195
+
196
+    /**
197
+     * @param string $table one of the Mapper::TABLE_* constants
198
+     * @param string $idCol
199
+     * @param string $id
200
+     * @param array $values
201
+     */
202
+    public function update($table, $idCol, $id, $values) {
203
+        $query = $this->dbc->getQueryBuilder();
204
+        $query->update($table);
205
+        foreach ($values as $key => $value) {
206
+            $query->set($key, $query->createNamedParameter($value));
207
+        }
208
+        $query
209
+            ->where($query->expr()->eq($idCol, $query->createParameter($idCol)))
210
+            ->setParameter($idCol, $id)
211
+            ->execute();
212
+    }
213 213
 
214 214
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 	 * @return array[] [['class' => string, 'priority' => int], ...]
105 105
 	 */
106 106
 	public function getSectionsFromDB($type) {
107
-		if($type === 'admin') {
107
+		if ($type === 'admin') {
108 108
 			$sectionsTable = self::TABLE_ADMIN_SECTIONS;
109 109
 			$settingsTable = self::TABLE_ADMIN_SETTINGS;
110
-		} else if($type === 'personal') {
110
+		} else if ($type === 'personal') {
111 111
 			$sectionsTable = self::TABLE_PERSONAL_SECTIONS;
112 112
 			$settingsTable = self::TABLE_PERSONAL_SETTINGS;
113 113
 		} else {
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 			->from($settingsTable, 'f')
121 121
 			->where($query->expr()->eq('s.id', 'f.section'));
122 122
 		$result = $query->execute();
123
-		return array_map(function ($row) {
124
-			$row['priority'] = (int)$row['priority'];
123
+		return array_map(function($row) {
124
+			$row['priority'] = (int) $row['priority'];
125 125
 			return $row;
126 126
 		}, $result->fetchAll());
127 127
 	}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function add($table, array $values) {
134 134
 		$query = $this->dbc->getQueryBuilder();
135
-		$values = array_map(function ($value) use ($query) {
135
+		$values = array_map(function($value) use ($query) {
136 136
 			return $query->createNamedParameter($value);
137 137
 		}, $values);
138 138
 		$query->insert($table)->values($values);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		$data = $resultStatement->fetchAll();
154 154
 		$resultStatement->closeCursor();
155 155
 
156
-		return array_map(function ($row) {
156
+		return array_map(function($row) {
157 157
 			return $row['class'];
158 158
 		}, $data);
159 159
 	}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		$row = $result->fetch();
177 177
 		$result->closeCursor();
178 178
 
179
-		return (bool)$row;
179
+		return (bool) $row;
180 180
 	}
181 181
 
182 182
 	/**
Please login to merge, or discard this patch.
settings/Controller/PersonalSettingsController.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -31,75 +31,75 @@
 block discarded – undo
31 31
 use OCP\Template;
32 32
 
33 33
 class PersonalSettingsController extends Controller {
34
-	use CommonSettingsTrait;
34
+    use CommonSettingsTrait;
35 35
 
36
-	/** @var INavigationManager */
37
-	private $navigationManager;
36
+    /** @var INavigationManager */
37
+    private $navigationManager;
38 38
 
39
-	public function __construct(
40
-		$appName,
41
-		IRequest $request,
42
-		INavigationManager $navigationManager,
43
-		ISettingsManager $settingsManager
44
-	) {
45
-		parent::__construct($appName, $request);
46
-		$this->navigationManager = $navigationManager;
47
-		$this->settingsManager = $settingsManager;
48
-	}
39
+    public function __construct(
40
+        $appName,
41
+        IRequest $request,
42
+        INavigationManager $navigationManager,
43
+        ISettingsManager $settingsManager
44
+    ) {
45
+        parent::__construct($appName, $request);
46
+        $this->navigationManager = $navigationManager;
47
+        $this->settingsManager = $settingsManager;
48
+    }
49 49
 
50
-	/**
51
-	 * @param string $section
52
-	 * @return TemplateResponse
53
-	 *
54
-	 * @NoCSRFRequired
55
-	 * @NoAdminRequired
56
-	 * @NoSubadminRequired
57
-	 */
58
-	public function index($section) {
59
-		$this->navigationManager->setActiveEntry('personal');
60
-		return $this->getIndexResponse($section);
61
-	}
50
+    /**
51
+     * @param string $section
52
+     * @return TemplateResponse
53
+     *
54
+     * @NoCSRFRequired
55
+     * @NoAdminRequired
56
+     * @NoSubadminRequired
57
+     */
58
+    public function index($section) {
59
+        $this->navigationManager->setActiveEntry('personal');
60
+        return $this->getIndexResponse($section);
61
+    }
62 62
 
63
-	/**
64
-	 * @param string $section
65
-	 * @return array
66
-	 */
67
-	protected function getSettings($section) {
68
-		$settings = $this->settingsManager->getPersonalSettings($section);
69
-		$formatted = $this->formatSettings($settings);
70
-		if($section === 'additional') {
71
-			$formatted['content'] .= $this->getLegacyForms();
72
-		}
73
-		return $formatted;
74
-	}
63
+    /**
64
+     * @param string $section
65
+     * @return array
66
+     */
67
+    protected function getSettings($section) {
68
+        $settings = $this->settingsManager->getPersonalSettings($section);
69
+        $formatted = $this->formatSettings($settings);
70
+        if($section === 'additional') {
71
+            $formatted['content'] .= $this->getLegacyForms();
72
+        }
73
+        return $formatted;
74
+    }
75 75
 
76
-	/**
77
-	 * @return bool|string
78
-	 */
79
-	private function getLegacyForms() {
80
-		$forms = \OC_App::getForms('personal');
76
+    /**
77
+     * @return bool|string
78
+     */
79
+    private function getLegacyForms() {
80
+        $forms = \OC_App::getForms('personal');
81 81
 
82
-		$forms = array_map(function ($form) {
83
-			if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
84
-				$sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]);
85
-				$sectionName = str_replace('</h2>', '', $sectionName);
86
-				$anchor = strtolower($sectionName);
87
-				$anchor = str_replace(' ', '-', $anchor);
82
+        $forms = array_map(function ($form) {
83
+            if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
84
+                $sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]);
85
+                $sectionName = str_replace('</h2>', '', $sectionName);
86
+                $anchor = strtolower($sectionName);
87
+                $anchor = str_replace(' ', '-', $anchor);
88 88
 
89
-				return array(
90
-					'anchor' => $anchor,
91
-					'section-name' => $sectionName,
92
-					'form' => $form
93
-				);
94
-			}
95
-			return array(
96
-				'form' => $form
97
-			);
98
-		}, $forms);
89
+                return array(
90
+                    'anchor' => $anchor,
91
+                    'section-name' => $sectionName,
92
+                    'form' => $form
93
+                );
94
+            }
95
+            return array(
96
+                'form' => $form
97
+            );
98
+        }, $forms);
99 99
 
100
-		$out = new Template('settings', 'settings/additional');
101
-		$out->assign('forms', $forms);
100
+        $out = new Template('settings', 'settings/additional');
101
+        $out->assign('forms', $forms);
102 102
 
103
-		return $out->fetchPage();
104
-	}
103
+        return $out->fetchPage();
104
+    }
105 105
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	protected function getSettings($section) {
68 68
 		$settings = $this->settingsManager->getPersonalSettings($section);
69 69
 		$formatted = $this->formatSettings($settings);
70
-		if($section === 'additional') {
70
+		if ($section === 'additional') {
71 71
 			$formatted['content'] .= $this->getLegacyForms();
72 72
 		}
73 73
 		return $formatted;
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	private function getLegacyForms() {
80 80
 		$forms = \OC_App::getForms('personal');
81 81
 
82
-		$forms = array_map(function ($form) {
82
+		$forms = array_map(function($form) {
83 83
 			if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
84
-				$sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]);
84
+				$sectionName = str_replace('<h2'.$regs['class'].'>', '', $regs[0]);
85 85
 				$sectionName = str_replace('</h2>', '', $sectionName);
86 86
 				$anchor = strtolower($sectionName);
87 87
 				$anchor = str_replace(' ', '-', $anchor);
Please login to merge, or discard this patch.
settings/Controller/AdminSettingsController.php 2 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -35,83 +35,83 @@
 block discarded – undo
35 35
  * @package OC\Settings\Controller
36 36
  */
37 37
 class AdminSettingsController extends Controller {
38
-	use CommonSettingsTrait;
38
+    use CommonSettingsTrait;
39 39
 
40
-	/** @var INavigationManager */
41
-	private $navigationManager;
42
-	/** @var ISettingsManager */
43
-	private $settingsManager;
40
+    /** @var INavigationManager */
41
+    private $navigationManager;
42
+    /** @var ISettingsManager */
43
+    private $settingsManager;
44 44
 
45
-	/**
46
-	 * @param string $appName
47
-	 * @param IRequest $request
48
-	 * @param INavigationManager $navigationManager
49
-	 * @param ISettingsManager $settingsManager
50
-	 */
51
-	public function __construct(
52
-		$appName,
53
-		IRequest $request,
54
-		INavigationManager $navigationManager,
55
-		ISettingsManager $settingsManager
56
-	) {
57
-		parent::__construct($appName, $request);
58
-		$this->navigationManager = $navigationManager;
59
-		$this->settingsManager = $settingsManager;
60
-	}
45
+    /**
46
+     * @param string $appName
47
+     * @param IRequest $request
48
+     * @param INavigationManager $navigationManager
49
+     * @param ISettingsManager $settingsManager
50
+     */
51
+    public function __construct(
52
+        $appName,
53
+        IRequest $request,
54
+        INavigationManager $navigationManager,
55
+        ISettingsManager $settingsManager
56
+    ) {
57
+        parent::__construct($appName, $request);
58
+        $this->navigationManager = $navigationManager;
59
+        $this->settingsManager = $settingsManager;
60
+    }
61 61
 
62
-	/**
63
-	 * @param string $section
64
-	 * @return TemplateResponse
65
-	 *
66
-	 * @NoCSRFRequired
67
-	 */
68
-	public function index($section) {
69
-		$this->navigationManager->setActiveEntry('admin');
70
-		return $this->getIndexResponse($section);
71
-	}
62
+    /**
63
+     * @param string $section
64
+     * @return TemplateResponse
65
+     *
66
+     * @NoCSRFRequired
67
+     */
68
+    public function index($section) {
69
+        $this->navigationManager->setActiveEntry('admin');
70
+        return $this->getIndexResponse($section);
71
+    }
72 72
 
73
-	/**
74
-	 * @param string $section
75
-	 * @return array
76
-	 */
77
-	protected function getSettings($section) {
78
-		$settings = $this->settingsManager->getAdminSettings($section);
79
-		$formatted = $this->formatSettings($settings);
80
-		if($section === 'additional') {
81
-			$formatted['content'] .= $this->getLegacyForms();
82
-		}
83
-		return $formatted;
84
-	}
73
+    /**
74
+     * @param string $section
75
+     * @return array
76
+     */
77
+    protected function getSettings($section) {
78
+        $settings = $this->settingsManager->getAdminSettings($section);
79
+        $formatted = $this->formatSettings($settings);
80
+        if($section === 'additional') {
81
+            $formatted['content'] .= $this->getLegacyForms();
82
+        }
83
+        return $formatted;
84
+    }
85 85
 
86
-	/**
87
-	 * @return bool|string
88
-	 */
89
-	private function getLegacyForms() {
90
-		$forms = \OC_App::getForms('admin');
86
+    /**
87
+     * @return bool|string
88
+     */
89
+    private function getLegacyForms() {
90
+        $forms = \OC_App::getForms('admin');
91 91
 
92
-		$forms = array_map(function ($form) {
93
-			if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
94
-				$sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]);
95
-				$sectionName = str_replace('</h2>', '', $sectionName);
96
-				$anchor = strtolower($sectionName);
97
-				$anchor = str_replace(' ', '-', $anchor);
92
+        $forms = array_map(function ($form) {
93
+            if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
94
+                $sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]);
95
+                $sectionName = str_replace('</h2>', '', $sectionName);
96
+                $anchor = strtolower($sectionName);
97
+                $anchor = str_replace(' ', '-', $anchor);
98 98
 
99
-				return array(
100
-					'anchor' => $anchor,
101
-					'section-name' => $sectionName,
102
-					'form' => $form
103
-				);
104
-			}
105
-			return array(
106
-				'form' => $form
107
-			);
108
-		}, $forms);
99
+                return array(
100
+                    'anchor' => $anchor,
101
+                    'section-name' => $sectionName,
102
+                    'form' => $form
103
+                );
104
+            }
105
+            return array(
106
+                'form' => $form
107
+            );
108
+        }, $forms);
109 109
 
110
-		$out = new Template('settings', 'settings/additional');
111
-		$out->assign('forms', $forms);
110
+        $out = new Template('settings', 'settings/additional');
111
+        $out->assign('forms', $forms);
112 112
 
113
-		return $out->fetchPage();
114
-	}
113
+        return $out->fetchPage();
114
+    }
115 115
 
116 116
 
117 117
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	protected function getSettings($section) {
78 78
 		$settings = $this->settingsManager->getAdminSettings($section);
79 79
 		$formatted = $this->formatSettings($settings);
80
-		if($section === 'additional') {
80
+		if ($section === 'additional') {
81 81
 			$formatted['content'] .= $this->getLegacyForms();
82 82
 		}
83 83
 		return $formatted;
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	private function getLegacyForms() {
90 90
 		$forms = \OC_App::getForms('admin');
91 91
 
92
-		$forms = array_map(function ($form) {
92
+		$forms = array_map(function($form) {
93 93
 			if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
94
-				$sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]);
94
+				$sectionName = str_replace('<h2'.$regs['class'].'>', '', $regs[0]);
95 95
 				$sectionName = str_replace('</h2>', '', $sectionName);
96 96
 				$anchor = strtolower($sectionName);
97 97
 				$anchor = str_replace(' ', '-', $anchor);
Please login to merge, or discard this patch.