Completed
Pull Request — master (#7363)
by Björn
38:02 queued 22:37
created
lib/private/Template/JSConfigHelper.php 1 patch
Indentation   +214 added lines, -214 removed lines patch added patch discarded remove patch
@@ -40,244 +40,244 @@
 block discarded – undo
40 40
 
41 41
 class JSConfigHelper {
42 42
 
43
-	/** @var IL10N */
44
-	private $l;
43
+    /** @var IL10N */
44
+    private $l;
45 45
 
46
-	/** @var Defaults */
47
-	private $defaults;
46
+    /** @var Defaults */
47
+    private $defaults;
48 48
 
49
-	/** @var IAppManager */
50
-	private $appManager;
49
+    /** @var IAppManager */
50
+    private $appManager;
51 51
 
52
-	/** @var ISession */
53
-	private $session;
52
+    /** @var ISession */
53
+    private $session;
54 54
 
55
-	/** @var IUser|null */
56
-	private $currentUser;
55
+    /** @var IUser|null */
56
+    private $currentUser;
57 57
 
58
-	/** @var IConfig */
59
-	private $config;
58
+    /** @var IConfig */
59
+    private $config;
60 60
 
61
-	/** @var IGroupManager */
62
-	private $groupManager;
61
+    /** @var IGroupManager */
62
+    private $groupManager;
63 63
 
64
-	/** @var IniGetWrapper */
65
-	private $iniWrapper;
64
+    /** @var IniGetWrapper */
65
+    private $iniWrapper;
66 66
 
67
-	/** @var IURLGenerator */
68
-	private $urlGenerator;
67
+    /** @var IURLGenerator */
68
+    private $urlGenerator;
69 69
 
70
-	/** @var CapabilitiesManager */
71
-	private $capabilitiesManager;
70
+    /** @var CapabilitiesManager */
71
+    private $capabilitiesManager;
72 72
 
73
-	/**
74
-	 * @param IL10N $l
75
-	 * @param Defaults $defaults
76
-	 * @param IAppManager $appManager
77
-	 * @param ISession $session
78
-	 * @param IUser|null $currentUser
79
-	 * @param IConfig $config
80
-	 * @param IGroupManager $groupManager
81
-	 * @param IniGetWrapper $iniWrapper
82
-	 * @param IURLGenerator $urlGenerator
83
-	 * @param CapabilitiesManager $capabilitiesManager
84
-	 */
85
-	public function __construct(IL10N $l,
86
-								Defaults $defaults,
87
-								IAppManager $appManager,
88
-								ISession $session,
89
-								$currentUser,
90
-								IConfig $config,
91
-								IGroupManager $groupManager,
92
-								IniGetWrapper $iniWrapper,
93
-								IURLGenerator $urlGenerator,
94
-								CapabilitiesManager $capabilitiesManager) {
95
-		$this->l = $l;
96
-		$this->defaults = $defaults;
97
-		$this->appManager = $appManager;
98
-		$this->session = $session;
99
-		$this->currentUser = $currentUser;
100
-		$this->config = $config;
101
-		$this->groupManager = $groupManager;
102
-		$this->iniWrapper = $iniWrapper;
103
-		$this->urlGenerator = $urlGenerator;
104
-		$this->capabilitiesManager = $capabilitiesManager;
105
-	}
73
+    /**
74
+     * @param IL10N $l
75
+     * @param Defaults $defaults
76
+     * @param IAppManager $appManager
77
+     * @param ISession $session
78
+     * @param IUser|null $currentUser
79
+     * @param IConfig $config
80
+     * @param IGroupManager $groupManager
81
+     * @param IniGetWrapper $iniWrapper
82
+     * @param IURLGenerator $urlGenerator
83
+     * @param CapabilitiesManager $capabilitiesManager
84
+     */
85
+    public function __construct(IL10N $l,
86
+                                Defaults $defaults,
87
+                                IAppManager $appManager,
88
+                                ISession $session,
89
+                                $currentUser,
90
+                                IConfig $config,
91
+                                IGroupManager $groupManager,
92
+                                IniGetWrapper $iniWrapper,
93
+                                IURLGenerator $urlGenerator,
94
+                                CapabilitiesManager $capabilitiesManager) {
95
+        $this->l = $l;
96
+        $this->defaults = $defaults;
97
+        $this->appManager = $appManager;
98
+        $this->session = $session;
99
+        $this->currentUser = $currentUser;
100
+        $this->config = $config;
101
+        $this->groupManager = $groupManager;
102
+        $this->iniWrapper = $iniWrapper;
103
+        $this->urlGenerator = $urlGenerator;
104
+        $this->capabilitiesManager = $capabilitiesManager;
105
+    }
106 106
 
107
-	public function getConfig() {
107
+    public function getConfig() {
108 108
 
109
-		if ($this->currentUser !== null) {
110
-			$uid = $this->currentUser->getUID();
111
-		} else {
112
-			$uid = null;
113
-		}
109
+        if ($this->currentUser !== null) {
110
+            $uid = $this->currentUser->getUID();
111
+        } else {
112
+            $uid = null;
113
+        }
114 114
 
115
-		// Get the config
116
-		$apps_paths = [];
115
+        // Get the config
116
+        $apps_paths = [];
117 117
 
118
-		if ($this->currentUser === null) {
119
-			$apps = $this->appManager->getInstalledApps();
120
-		} else {
121
-			$apps = $this->appManager->getEnabledAppsForUser($this->currentUser);
122
-		}
118
+        if ($this->currentUser === null) {
119
+            $apps = $this->appManager->getInstalledApps();
120
+        } else {
121
+            $apps = $this->appManager->getEnabledAppsForUser($this->currentUser);
122
+        }
123 123
 
124
-		foreach($apps as $app) {
125
-			$apps_paths[$app] = \OC_App::getAppWebPath($app);
126
-		}
124
+        foreach($apps as $app) {
125
+            $apps_paths[$app] = \OC_App::getAppWebPath($app);
126
+        }
127 127
 
128 128
 
129
-		$enableLinkPasswordByDefault = $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no');
130
-		$enableLinkPasswordByDefault = ($enableLinkPasswordByDefault === 'yes') ? true : false;
131
-		$defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes';
132
-		$defaultExpireDate = $enforceDefaultExpireDate = null;
133
-		if ($defaultExpireDateEnabled) {
134
-			$defaultExpireDate = (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
135
-			$enforceDefaultExpireDate = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes';
136
-		}
137
-		$outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes';
129
+        $enableLinkPasswordByDefault = $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no');
130
+        $enableLinkPasswordByDefault = ($enableLinkPasswordByDefault === 'yes') ? true : false;
131
+        $defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes';
132
+        $defaultExpireDate = $enforceDefaultExpireDate = null;
133
+        if ($defaultExpireDateEnabled) {
134
+            $defaultExpireDate = (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
135
+            $enforceDefaultExpireDate = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes';
136
+        }
137
+        $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes';
138 138
 
139
-		$countOfDataLocation = 0;
140
-		$dataLocation = str_replace(\OC::$SERVERROOT .'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation);
141
-		if($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) {
142
-			$dataLocation = false;
143
-		}
139
+        $countOfDataLocation = 0;
140
+        $dataLocation = str_replace(\OC::$SERVERROOT .'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation);
141
+        if($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) {
142
+            $dataLocation = false;
143
+        }
144 144
 
145
-		if ($this->currentUser instanceof IUser) {
146
-			$lastConfirmTimestamp = $this->session->get('last-password-confirm');
147
-			if (!is_int($lastConfirmTimestamp)) {
148
-				$lastConfirmTimestamp = 0;
149
-			}
150
-		} else {
151
-			$lastConfirmTimestamp = 0;
152
-		}
145
+        if ($this->currentUser instanceof IUser) {
146
+            $lastConfirmTimestamp = $this->session->get('last-password-confirm');
147
+            if (!is_int($lastConfirmTimestamp)) {
148
+                $lastConfirmTimestamp = 0;
149
+            }
150
+        } else {
151
+            $lastConfirmTimestamp = 0;
152
+        }
153 153
 
154
-		$capabilities = $this->capabilitiesManager->getCapabilities();
154
+        $capabilities = $this->capabilitiesManager->getCapabilities();
155 155
 
156
-		$array = [
157
-			"oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false',
158
-			"oc_isadmin" => $this->groupManager->isAdmin($uid) ? 'true' : 'false',
159
-			"oc_dataURL" => is_string($dataLocation) ? "\"".$dataLocation."\"" : 'false',
160
-			"oc_webroot" => "\"".\OC::$WEBROOT."\"",
161
-			"oc_appswebroots" =>  str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution
162
-			"datepickerFormatDate" => json_encode($this->l->l('jsdate', null)),
163
-			'nc_lastLogin' => $lastConfirmTimestamp,
164
-			"dayNames" =>  json_encode([
165
-				(string)$this->l->t('Sunday'),
166
-				(string)$this->l->t('Monday'),
167
-				(string)$this->l->t('Tuesday'),
168
-				(string)$this->l->t('Wednesday'),
169
-				(string)$this->l->t('Thursday'),
170
-				(string)$this->l->t('Friday'),
171
-				(string)$this->l->t('Saturday')
172
-			]),
173
-			"dayNamesShort" =>  json_encode([
174
-				(string)$this->l->t('Sun.'),
175
-				(string)$this->l->t('Mon.'),
176
-				(string)$this->l->t('Tue.'),
177
-				(string)$this->l->t('Wed.'),
178
-				(string)$this->l->t('Thu.'),
179
-				(string)$this->l->t('Fri.'),
180
-				(string)$this->l->t('Sat.')
181
-			]),
182
-			"dayNamesMin" =>  json_encode([
183
-				(string)$this->l->t('Su'),
184
-				(string)$this->l->t('Mo'),
185
-				(string)$this->l->t('Tu'),
186
-				(string)$this->l->t('We'),
187
-				(string)$this->l->t('Th'),
188
-				(string)$this->l->t('Fr'),
189
-				(string)$this->l->t('Sa')
190
-			]),
191
-			"monthNames" => json_encode([
192
-				(string)$this->l->t('January'),
193
-				(string)$this->l->t('February'),
194
-				(string)$this->l->t('March'),
195
-				(string)$this->l->t('April'),
196
-				(string)$this->l->t('May'),
197
-				(string)$this->l->t('June'),
198
-				(string)$this->l->t('July'),
199
-				(string)$this->l->t('August'),
200
-				(string)$this->l->t('September'),
201
-				(string)$this->l->t('October'),
202
-				(string)$this->l->t('November'),
203
-				(string)$this->l->t('December')
204
-			]),
205
-			"monthNamesShort" => json_encode([
206
-				(string)$this->l->t('Jan.'),
207
-				(string)$this->l->t('Feb.'),
208
-				(string)$this->l->t('Mar.'),
209
-				(string)$this->l->t('Apr.'),
210
-				(string)$this->l->t('May.'),
211
-				(string)$this->l->t('Jun.'),
212
-				(string)$this->l->t('Jul.'),
213
-				(string)$this->l->t('Aug.'),
214
-				(string)$this->l->t('Sep.'),
215
-				(string)$this->l->t('Oct.'),
216
-				(string)$this->l->t('Nov.'),
217
-				(string)$this->l->t('Dec.')
218
-			]),
219
-			"firstDay" => json_encode($this->l->l('firstday', null)) ,
220
-			"oc_config" => json_encode([
221
-				'session_lifetime'	=> min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')),
222
-				'session_keepalive'	=> $this->config->getSystemValue('session_keepalive', true),
223
-				'version'			=> implode('.', \OCP\Util::getVersion()),
224
-				'versionstring'		=> \OC_Util::getVersionString(),
225
-				'enable_avatars'	=> true, // here for legacy reasons - to not crash existing code that relies on this value
226
-				'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null),
227
-				'modRewriteWorking'	=> ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'),
228
-				'sharing.maxAutocompleteResults' => intval($this->config->getSystemValue('sharing.maxAutocompleteResults', 0)),
229
-				'sharing.minSearchStringLength' => intval($this->config->getSystemValue('sharing.minSearchStringLength', 0)),
230
-				'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX,
231
-			]),
232
-			"oc_appconfig" => json_encode([
233
-				'core' => [
234
-					'defaultExpireDateEnabled' => $defaultExpireDateEnabled,
235
-					'defaultExpireDate' => $defaultExpireDate,
236
-					'defaultExpireDateEnforced' => $enforceDefaultExpireDate,
237
-					'enforcePasswordForPublicLink' => \OCP\Util::isPublicLinkPasswordRequired(),
238
-					'enableLinkPasswordByDefault' => $enableLinkPasswordByDefault,
239
-					'sharingDisabledForUser' => \OCP\Util::isSharingDisabledForUser(),
240
-					'resharingAllowed' => \OC\Share\Share::isResharingAllowed(),
241
-					'remoteShareAllowed' => $outgoingServer2serverShareEnabled,
242
-					'federatedCloudShareDoc' => $this->urlGenerator->linkToDocs('user-sharing-federated'),
243
-					'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing()
244
-				]
245
-			]),
246
-			"oc_defaults" => json_encode([
247
-				'entity' => $this->defaults->getEntity(),
248
-				'name' => $this->defaults->getName(),
249
-				'title' => $this->defaults->getTitle(),
250
-				'baseUrl' => $this->defaults->getBaseUrl(),
251
-				'syncClientUrl' => $this->defaults->getSyncClientUrl(),
252
-				'docBaseUrl' => $this->defaults->getDocBaseUrl(),
253
-				'docPlaceholderUrl' => $this->defaults->buildDocLinkToKey('PLACEHOLDER'),
254
-				'slogan' => $this->defaults->getSlogan(),
255
-				'logoClaim' => '',
256
-				'shortFooter' => $this->defaults->getShortFooter(),
257
-				'longFooter' => $this->defaults->getLongFooter(),
258
-				'folder' => \OC_Util::getTheme(),
259
-			]),
260
-			"oc_capabilities" => json_encode($capabilities),
261
-		];
156
+        $array = [
157
+            "oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false',
158
+            "oc_isadmin" => $this->groupManager->isAdmin($uid) ? 'true' : 'false',
159
+            "oc_dataURL" => is_string($dataLocation) ? "\"".$dataLocation."\"" : 'false',
160
+            "oc_webroot" => "\"".\OC::$WEBROOT."\"",
161
+            "oc_appswebroots" =>  str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution
162
+            "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)),
163
+            'nc_lastLogin' => $lastConfirmTimestamp,
164
+            "dayNames" =>  json_encode([
165
+                (string)$this->l->t('Sunday'),
166
+                (string)$this->l->t('Monday'),
167
+                (string)$this->l->t('Tuesday'),
168
+                (string)$this->l->t('Wednesday'),
169
+                (string)$this->l->t('Thursday'),
170
+                (string)$this->l->t('Friday'),
171
+                (string)$this->l->t('Saturday')
172
+            ]),
173
+            "dayNamesShort" =>  json_encode([
174
+                (string)$this->l->t('Sun.'),
175
+                (string)$this->l->t('Mon.'),
176
+                (string)$this->l->t('Tue.'),
177
+                (string)$this->l->t('Wed.'),
178
+                (string)$this->l->t('Thu.'),
179
+                (string)$this->l->t('Fri.'),
180
+                (string)$this->l->t('Sat.')
181
+            ]),
182
+            "dayNamesMin" =>  json_encode([
183
+                (string)$this->l->t('Su'),
184
+                (string)$this->l->t('Mo'),
185
+                (string)$this->l->t('Tu'),
186
+                (string)$this->l->t('We'),
187
+                (string)$this->l->t('Th'),
188
+                (string)$this->l->t('Fr'),
189
+                (string)$this->l->t('Sa')
190
+            ]),
191
+            "monthNames" => json_encode([
192
+                (string)$this->l->t('January'),
193
+                (string)$this->l->t('February'),
194
+                (string)$this->l->t('March'),
195
+                (string)$this->l->t('April'),
196
+                (string)$this->l->t('May'),
197
+                (string)$this->l->t('June'),
198
+                (string)$this->l->t('July'),
199
+                (string)$this->l->t('August'),
200
+                (string)$this->l->t('September'),
201
+                (string)$this->l->t('October'),
202
+                (string)$this->l->t('November'),
203
+                (string)$this->l->t('December')
204
+            ]),
205
+            "monthNamesShort" => json_encode([
206
+                (string)$this->l->t('Jan.'),
207
+                (string)$this->l->t('Feb.'),
208
+                (string)$this->l->t('Mar.'),
209
+                (string)$this->l->t('Apr.'),
210
+                (string)$this->l->t('May.'),
211
+                (string)$this->l->t('Jun.'),
212
+                (string)$this->l->t('Jul.'),
213
+                (string)$this->l->t('Aug.'),
214
+                (string)$this->l->t('Sep.'),
215
+                (string)$this->l->t('Oct.'),
216
+                (string)$this->l->t('Nov.'),
217
+                (string)$this->l->t('Dec.')
218
+            ]),
219
+            "firstDay" => json_encode($this->l->l('firstday', null)) ,
220
+            "oc_config" => json_encode([
221
+                'session_lifetime'	=> min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')),
222
+                'session_keepalive'	=> $this->config->getSystemValue('session_keepalive', true),
223
+                'version'			=> implode('.', \OCP\Util::getVersion()),
224
+                'versionstring'		=> \OC_Util::getVersionString(),
225
+                'enable_avatars'	=> true, // here for legacy reasons - to not crash existing code that relies on this value
226
+                'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null),
227
+                'modRewriteWorking'	=> ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'),
228
+                'sharing.maxAutocompleteResults' => intval($this->config->getSystemValue('sharing.maxAutocompleteResults', 0)),
229
+                'sharing.minSearchStringLength' => intval($this->config->getSystemValue('sharing.minSearchStringLength', 0)),
230
+                'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX,
231
+            ]),
232
+            "oc_appconfig" => json_encode([
233
+                'core' => [
234
+                    'defaultExpireDateEnabled' => $defaultExpireDateEnabled,
235
+                    'defaultExpireDate' => $defaultExpireDate,
236
+                    'defaultExpireDateEnforced' => $enforceDefaultExpireDate,
237
+                    'enforcePasswordForPublicLink' => \OCP\Util::isPublicLinkPasswordRequired(),
238
+                    'enableLinkPasswordByDefault' => $enableLinkPasswordByDefault,
239
+                    'sharingDisabledForUser' => \OCP\Util::isSharingDisabledForUser(),
240
+                    'resharingAllowed' => \OC\Share\Share::isResharingAllowed(),
241
+                    'remoteShareAllowed' => $outgoingServer2serverShareEnabled,
242
+                    'federatedCloudShareDoc' => $this->urlGenerator->linkToDocs('user-sharing-federated'),
243
+                    'allowGroupSharing' => \OC::$server->getShareManager()->allowGroupSharing()
244
+                ]
245
+            ]),
246
+            "oc_defaults" => json_encode([
247
+                'entity' => $this->defaults->getEntity(),
248
+                'name' => $this->defaults->getName(),
249
+                'title' => $this->defaults->getTitle(),
250
+                'baseUrl' => $this->defaults->getBaseUrl(),
251
+                'syncClientUrl' => $this->defaults->getSyncClientUrl(),
252
+                'docBaseUrl' => $this->defaults->getDocBaseUrl(),
253
+                'docPlaceholderUrl' => $this->defaults->buildDocLinkToKey('PLACEHOLDER'),
254
+                'slogan' => $this->defaults->getSlogan(),
255
+                'logoClaim' => '',
256
+                'shortFooter' => $this->defaults->getShortFooter(),
257
+                'longFooter' => $this->defaults->getLongFooter(),
258
+                'folder' => \OC_Util::getTheme(),
259
+            ]),
260
+            "oc_capabilities" => json_encode($capabilities),
261
+        ];
262 262
 
263
-		if ($this->currentUser !== null) {
264
-			$array['oc_userconfig'] = json_encode([
265
-				'avatar' => [
266
-					'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0),
267
-				]
268
-			]);
269
-		}
263
+        if ($this->currentUser !== null) {
264
+            $array['oc_userconfig'] = json_encode([
265
+                'avatar' => [
266
+                    'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0),
267
+                ]
268
+            ]);
269
+        }
270 270
 
271
-		// Allow hooks to modify the output values
272
-		\OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array));
271
+        // Allow hooks to modify the output values
272
+        \OC_Hook::emit('\OCP\Config', 'js', array('array' => &$array));
273 273
 
274
-		$result = '';
274
+        $result = '';
275 275
 
276
-		// Echo it
277
-		foreach ($array as  $setting => $value) {
278
-			$result .= 'var '. $setting . '='. $value . ';' . PHP_EOL;
279
-		}
276
+        // Echo it
277
+        foreach ($array as  $setting => $value) {
278
+            $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL;
279
+        }
280 280
 
281
-		return $result;
282
-	}
281
+        return $result;
282
+    }
283 283
 }
Please login to merge, or discard this patch.
lib/private/TemplateLayout.php 1 patch
Indentation   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -45,228 +45,228 @@
 block discarded – undo
45 45
 
46 46
 class TemplateLayout extends \OC_Template {
47 47
 
48
-	private static $versionHash = '';
48
+    private static $versionHash = '';
49 49
 
50
-	/**
51
-	 * @var \OCP\IConfig
52
-	 */
53
-	private $config;
50
+    /**
51
+     * @var \OCP\IConfig
52
+     */
53
+    private $config;
54 54
 
55
-	/**
56
-	 * @param string $renderAs
57
-	 * @param string $appId application id
58
-	 */
59
-	public function __construct( $renderAs, $appId = '' ) {
55
+    /**
56
+     * @param string $renderAs
57
+     * @param string $appId application id
58
+     */
59
+    public function __construct( $renderAs, $appId = '' ) {
60 60
 
61
-		// yes - should be injected ....
62
-		$this->config = \OC::$server->getConfig();
61
+        // yes - should be injected ....
62
+        $this->config = \OC::$server->getConfig();
63 63
 
64 64
 
65
-		// Decide which page we show
66
-		if($renderAs == 'user') {
67
-			parent::__construct( 'core', 'layout.user' );
68
-			if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
69
-				$this->assign('bodyid', 'body-settings');
70
-			}else{
71
-				$this->assign('bodyid', 'body-user');
72
-			}
65
+        // Decide which page we show
66
+        if($renderAs == 'user') {
67
+            parent::__construct( 'core', 'layout.user' );
68
+            if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
69
+                $this->assign('bodyid', 'body-settings');
70
+            }else{
71
+                $this->assign('bodyid', 'body-user');
72
+            }
73 73
 
74
-			// Code integrity notification
75
-			$integrityChecker = \OC::$server->getIntegrityCodeChecker();
76
-			if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
77
-				\OCP\Util::addScript('core', 'integritycheck-failed-notification');
78
-			}
74
+            // Code integrity notification
75
+            $integrityChecker = \OC::$server->getIntegrityCodeChecker();
76
+            if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
77
+                \OCP\Util::addScript('core', 'integritycheck-failed-notification');
78
+            }
79 79
 
80
-			// Add navigation entry
81
-			$this->assign( 'application', '');
82
-			$this->assign( 'appid', $appId );
83
-			$navigation = \OC_App::getNavigation();
84
-			$this->assign( 'navigation', $navigation);
85
-			$settingsNavigation = \OC_App::getSettingsNavigation();
86
-			$this->assign( 'settingsnavigation', $settingsNavigation);
87
-			foreach($navigation as $entry) {
88
-				if ($entry['active']) {
89
-					$this->assign( 'application', $entry['name'] );
90
-					break;
91
-				}
92
-			}
80
+            // Add navigation entry
81
+            $this->assign( 'application', '');
82
+            $this->assign( 'appid', $appId );
83
+            $navigation = \OC_App::getNavigation();
84
+            $this->assign( 'navigation', $navigation);
85
+            $settingsNavigation = \OC_App::getSettingsNavigation();
86
+            $this->assign( 'settingsnavigation', $settingsNavigation);
87
+            foreach($navigation as $entry) {
88
+                if ($entry['active']) {
89
+                    $this->assign( 'application', $entry['name'] );
90
+                    break;
91
+                }
92
+            }
93 93
 
94
-			foreach($settingsNavigation as $entry) {
95
-				if ($entry['active']) {
96
-					$this->assign( 'application', $entry['name'] );
97
-					break;
98
-				}
99
-			}
100
-			$userDisplayName = \OC_User::getDisplayName();
101
-			$this->assign('user_displayname', $userDisplayName);
102
-			$this->assign('user_uid', \OC_User::getUser());
94
+            foreach($settingsNavigation as $entry) {
95
+                if ($entry['active']) {
96
+                    $this->assign( 'application', $entry['name'] );
97
+                    break;
98
+                }
99
+            }
100
+            $userDisplayName = \OC_User::getDisplayName();
101
+            $this->assign('user_displayname', $userDisplayName);
102
+            $this->assign('user_uid', \OC_User::getUser());
103 103
 
104
-			if (\OC_User::getUser() === false) {
105
-				$this->assign('userAvatarSet', false);
106
-			} else {
107
-				$this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
108
-				$this->assign('userAvatarVersion', \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
109
-			}
104
+            if (\OC_User::getUser() === false) {
105
+                $this->assign('userAvatarSet', false);
106
+            } else {
107
+                $this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
108
+                $this->assign('userAvatarVersion', \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
109
+            }
110 110
 
111
-		} else if ($renderAs == 'error') {
112
-			parent::__construct('core', 'layout.guest', '', false);
113
-			$this->assign('bodyid', 'body-login');
114
-		} else if ($renderAs == 'guest') {
115
-			parent::__construct('core', 'layout.guest');
116
-			$this->assign('bodyid', 'body-login');
117
-		} else {
118
-			parent::__construct('core', 'layout.base');
111
+        } else if ($renderAs == 'error') {
112
+            parent::__construct('core', 'layout.guest', '', false);
113
+            $this->assign('bodyid', 'body-login');
114
+        } else if ($renderAs == 'guest') {
115
+            parent::__construct('core', 'layout.guest');
116
+            $this->assign('bodyid', 'body-login');
117
+        } else {
118
+            parent::__construct('core', 'layout.base');
119 119
 
120
-		}
121
-		// Send the language to our layouts
122
-		$this->assign('language', \OC::$server->getL10NFactory()->findLanguage());
120
+        }
121
+        // Send the language to our layouts
122
+        $this->assign('language', \OC::$server->getL10NFactory()->findLanguage());
123 123
 
124
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
125
-			if (empty(self::$versionHash)) {
126
-				$v = \OC_App::getAppVersions();
127
-				$v['core'] = implode('.', \OCP\Util::getVersion());
128
-				self::$versionHash = md5(implode(',', $v));
129
-			}
130
-		} else {
131
-			self::$versionHash = md5('not installed');
132
-		}
124
+        if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
125
+            if (empty(self::$versionHash)) {
126
+                $v = \OC_App::getAppVersions();
127
+                $v['core'] = implode('.', \OCP\Util::getVersion());
128
+                self::$versionHash = md5(implode(',', $v));
129
+            }
130
+        } else {
131
+            self::$versionHash = md5('not installed');
132
+        }
133 133
 
134
-		// Add the js files
135
-		$jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
136
-		$this->assign('jsfiles', array());
137
-		if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
138
-			if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
139
-				$jsConfigHelper = new JSConfigHelper(
140
-					\OC::$server->getL10N('core'),
141
-					\OC::$server->query(Defaults::class),
142
-					\OC::$server->getAppManager(),
143
-					\OC::$server->getSession(),
144
-					\OC::$server->getUserSession()->getUser(),
145
-					\OC::$server->getConfig(),
146
-					\OC::$server->getGroupManager(),
147
-					\OC::$server->getIniWrapper(),
148
-					\OC::$server->getURLGenerator(),
149
-					\OC::$server->getCapabilitiesManager()
150
-				);
151
-				$this->assign('inline_ocjs', $jsConfigHelper->getConfig());
152
-			} else {
153
-				$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
154
-			}
155
-		}
156
-		foreach($jsFiles as $info) {
157
-			$web = $info[1];
158
-			$file = $info[2];
159
-			$this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
160
-		}
134
+        // Add the js files
135
+        $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
136
+        $this->assign('jsfiles', array());
137
+        if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
138
+            if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
139
+                $jsConfigHelper = new JSConfigHelper(
140
+                    \OC::$server->getL10N('core'),
141
+                    \OC::$server->query(Defaults::class),
142
+                    \OC::$server->getAppManager(),
143
+                    \OC::$server->getSession(),
144
+                    \OC::$server->getUserSession()->getUser(),
145
+                    \OC::$server->getConfig(),
146
+                    \OC::$server->getGroupManager(),
147
+                    \OC::$server->getIniWrapper(),
148
+                    \OC::$server->getURLGenerator(),
149
+                    \OC::$server->getCapabilitiesManager()
150
+                );
151
+                $this->assign('inline_ocjs', $jsConfigHelper->getConfig());
152
+            } else {
153
+                $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
154
+            }
155
+        }
156
+        foreach($jsFiles as $info) {
157
+            $web = $info[1];
158
+            $file = $info[2];
159
+            $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
160
+        }
161 161
 
162
-		try {
163
-			$pathInfo = \OC::$server->getRequest()->getPathInfo();
164
-		} catch (\Exception $e) {
165
-			$pathInfo = '';
166
-		}
162
+        try {
163
+            $pathInfo = \OC::$server->getRequest()->getPathInfo();
164
+        } catch (\Exception $e) {
165
+            $pathInfo = '';
166
+        }
167 167
 
168
-		// Do not initialise scss appdata until we have a fully installed instance
169
-		// Do not load scss for update, errors, installation or login page
170
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)
171
-			&& !\OCP\Util::needUpgrade()
172
-			&& $pathInfo !== ''
173
-			&& !preg_match('/^\/login/', $pathInfo)) {
174
-			$cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
175
-		} else {
176
-			// If we ignore the scss compiler,
177
-			// we need to load the guest css fallback
178
-			\OC_Util::addStyle('guest');
179
-			$cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false);
180
-		}
168
+        // Do not initialise scss appdata until we have a fully installed instance
169
+        // Do not load scss for update, errors, installation or login page
170
+        if(\OC::$server->getSystemConfig()->getValue('installed', false)
171
+            && !\OCP\Util::needUpgrade()
172
+            && $pathInfo !== ''
173
+            && !preg_match('/^\/login/', $pathInfo)) {
174
+            $cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
175
+        } else {
176
+            // If we ignore the scss compiler,
177
+            // we need to load the guest css fallback
178
+            \OC_Util::addStyle('guest');
179
+            $cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false);
180
+        }
181 181
 
182
-		$this->assign('cssfiles', array());
183
-		$this->assign('printcssfiles', []);
184
-		$this->assign('versionHash', self::$versionHash);
185
-		foreach($cssFiles as $info) {
186
-			$web = $info[1];
187
-			$file = $info[2];
182
+        $this->assign('cssfiles', array());
183
+        $this->assign('printcssfiles', []);
184
+        $this->assign('versionHash', self::$versionHash);
185
+        foreach($cssFiles as $info) {
186
+            $web = $info[1];
187
+            $file = $info[2];
188 188
 
189
-			if (substr($file, -strlen('print.css')) === 'print.css') {
190
-				$this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
191
-			} else {
192
-				$this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix()  );
193
-			}
194
-		}
195
-	}
189
+            if (substr($file, -strlen('print.css')) === 'print.css') {
190
+                $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
191
+            } else {
192
+                $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix()  );
193
+            }
194
+        }
195
+    }
196 196
 
197
-	protected function getVersionHashSuffix() {
198
-		if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
199
-			// allows chrome workspace mapping in debug mode
200
-			return "";
201
-		}
202
-		if ($this->config->getSystemValue('installed', false) && \OC::$server->getAppManager()->isInstalled('theming')) {
203
-			return '?v=' . self::$versionHash . '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
204
-		}
205
-		return '?v=' . self::$versionHash;
206
-	}
197
+    protected function getVersionHashSuffix() {
198
+        if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
199
+            // allows chrome workspace mapping in debug mode
200
+            return "";
201
+        }
202
+        if ($this->config->getSystemValue('installed', false) && \OC::$server->getAppManager()->isInstalled('theming')) {
203
+            return '?v=' . self::$versionHash . '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
204
+        }
205
+        return '?v=' . self::$versionHash;
206
+    }
207 207
 
208
-	/**
209
-	 * @param array $styles
210
-	 * @return array
211
-	 */
212
-	static public function findStylesheetFiles($styles, $compileScss = true) {
213
-		// Read the selected theme from the config file
214
-		$theme = \OC_Util::getTheme();
208
+    /**
209
+     * @param array $styles
210
+     * @return array
211
+     */
212
+    static public function findStylesheetFiles($styles, $compileScss = true) {
213
+        // Read the selected theme from the config file
214
+        $theme = \OC_Util::getTheme();
215 215
 
216
-		if($compileScss) {
217
-			$SCSSCacher = \OC::$server->query(SCSSCacher::class);
218
-		} else {
219
-			$SCSSCacher = null;
220
-		}
216
+        if($compileScss) {
217
+            $SCSSCacher = \OC::$server->query(SCSSCacher::class);
218
+        } else {
219
+            $SCSSCacher = null;
220
+        }
221 221
 
222
-		$locator = new \OC\Template\CSSResourceLocator(
223
-			\OC::$server->getLogger(),
224
-			$theme,
225
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
226
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
227
-			$SCSSCacher
228
-		);
229
-		$locator->find($styles);
230
-		return $locator->getResources();
231
-	}
222
+        $locator = new \OC\Template\CSSResourceLocator(
223
+            \OC::$server->getLogger(),
224
+            $theme,
225
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
226
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
227
+            $SCSSCacher
228
+        );
229
+        $locator->find($styles);
230
+        return $locator->getResources();
231
+    }
232 232
 
233
-	/**
234
-	 * @param array $scripts
235
-	 * @return array
236
-	 */
237
-	static public function findJavascriptFiles($scripts) {
238
-		// Read the selected theme from the config file
239
-		$theme = \OC_Util::getTheme();
233
+    /**
234
+     * @param array $scripts
235
+     * @return array
236
+     */
237
+    static public function findJavascriptFiles($scripts) {
238
+        // Read the selected theme from the config file
239
+        $theme = \OC_Util::getTheme();
240 240
 
241
-		$locator = new \OC\Template\JSResourceLocator(
242
-			\OC::$server->getLogger(),
243
-			$theme,
244
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
245
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
246
-			new JSCombiner(
247
-				\OC::$server->getAppDataDir('js'),
248
-				\OC::$server->getURLGenerator(),
249
-				\OC::$server->getMemCacheFactory()->create('JS'),
250
-				\OC::$server->getSystemConfig(),
251
-				\OC::$server->getLogger()
252
-			)
253
-			);
254
-		$locator->find($scripts);
255
-		return $locator->getResources();
256
-	}
241
+        $locator = new \OC\Template\JSResourceLocator(
242
+            \OC::$server->getLogger(),
243
+            $theme,
244
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
245
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
246
+            new JSCombiner(
247
+                \OC::$server->getAppDataDir('js'),
248
+                \OC::$server->getURLGenerator(),
249
+                \OC::$server->getMemCacheFactory()->create('JS'),
250
+                \OC::$server->getSystemConfig(),
251
+                \OC::$server->getLogger()
252
+            )
253
+            );
254
+        $locator->find($scripts);
255
+        return $locator->getResources();
256
+    }
257 257
 
258
-	/**
259
-	 * Converts the absolute file path to a relative path from \OC::$SERVERROOT
260
-	 * @param string $filePath Absolute path
261
-	 * @return string Relative path
262
-	 * @throws \Exception If $filePath is not under \OC::$SERVERROOT
263
-	 */
264
-	public static function convertToRelativePath($filePath) {
265
-		$relativePath = explode(\OC::$SERVERROOT, $filePath);
266
-		if(count($relativePath) !== 2) {
267
-			throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
268
-		}
258
+    /**
259
+     * Converts the absolute file path to a relative path from \OC::$SERVERROOT
260
+     * @param string $filePath Absolute path
261
+     * @return string Relative path
262
+     * @throws \Exception If $filePath is not under \OC::$SERVERROOT
263
+     */
264
+    public static function convertToRelativePath($filePath) {
265
+        $relativePath = explode(\OC::$SERVERROOT, $filePath);
266
+        if(count($relativePath) !== 2) {
267
+            throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
268
+        }
269 269
 
270
-		return $relativePath[1];
271
-	}
270
+        return $relativePath[1];
271
+    }
272 272
 }
Please login to merge, or discard this patch.
lib/private/Settings/Admin/Sharing.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -35,90 +35,90 @@
 block discarded – undo
35 35
 use OCP\Util;
36 36
 
37 37
 class Sharing implements ISettings {
38
-	/** @var IConfig */
39
-	private $config;
38
+    /** @var IConfig */
39
+    private $config;
40 40
 
41
-	/** @var IL10N */
42
-	private $l;
41
+    /** @var IL10N */
42
+    private $l;
43 43
 
44
-	/**
45
-	 * @param IConfig $config
46
-	 */
47
-	public function __construct(IConfig $config, IL10N $l) {
48
-		$this->config = $config;
49
-		$this->l = $l;
50
-	}
44
+    /**
45
+     * @param IConfig $config
46
+     */
47
+    public function __construct(IConfig $config, IL10N $l) {
48
+        $this->config = $config;
49
+        $this->l = $l;
50
+    }
51 51
 
52
-	/**
53
-	 * @return TemplateResponse
54
-	 */
55
-	public function getForm() {
56
-		$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
57
-		$excludeGroupsList = !is_null(json_decode($excludedGroups))
58
-			? implode('|', json_decode($excludedGroups, true)) : '';
52
+    /**
53
+     * @return TemplateResponse
54
+     */
55
+    public function getForm() {
56
+        $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
57
+        $excludeGroupsList = !is_null(json_decode($excludedGroups))
58
+            ? implode('|', json_decode($excludedGroups, true)) : '';
59 59
 
60
-		$permList = [
61
-			[
62
-				'id' => 'cancreate',
63
-				'label' => $this->l->t('Create'),
64
-				'value' => Constants::PERMISSION_CREATE
65
-			],
66
-			[
67
-				'id' => 'canupdate',
68
-				'label' => $this->l->t('Change'),
69
-				'value' => Constants::PERMISSION_UPDATE
70
-			],
71
-			[
72
-				'id' => 'candelete',
73
-				'label' => $this->l->t('Delete'),
74
-				'value' => Constants::PERMISSION_DELETE
75
-			],
76
-			[
77
-				'id' => 'canshare',
78
-				'label' => $this->l->t('Share'),
79
-				'value' => Constants::PERMISSION_SHARE
80
-			],
81
-		];
60
+        $permList = [
61
+            [
62
+                'id' => 'cancreate',
63
+                'label' => $this->l->t('Create'),
64
+                'value' => Constants::PERMISSION_CREATE
65
+            ],
66
+            [
67
+                'id' => 'canupdate',
68
+                'label' => $this->l->t('Change'),
69
+                'value' => Constants::PERMISSION_UPDATE
70
+            ],
71
+            [
72
+                'id' => 'candelete',
73
+                'label' => $this->l->t('Delete'),
74
+                'value' => Constants::PERMISSION_DELETE
75
+            ],
76
+            [
77
+                'id' => 'canshare',
78
+                'label' => $this->l->t('Share'),
79
+                'value' => Constants::PERMISSION_SHARE
80
+            ],
81
+        ];
82 82
 
83
-		$parameters = [
84
-			// Built-In Sharing
85
-			'allowGroupSharing'                    => $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes'),
86
-			'allowLinks'                           => $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'),
87
-			'allowPublicUpload'                    => $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'),
88
-			'allowResharing'                       => $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes'),
89
-			'allowShareDialogUserEnumeration'      => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes'),
90
-			'enforceLinkPassword'                  => Util::isPublicLinkPasswordRequired(),
91
-			'onlyShareWithGroupMembers'            => Share::shareWithGroupMembersOnly(),
92
-			'shareAPIEnabled'                      => $this->config->getAppValue('core', 'shareapi_enabled', 'yes'),
93
-			'shareDefaultExpireDateSet'            => $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no'),
94
-			'shareExpireAfterNDays'                => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'),
95
-			'shareEnforceExpireDate'               => $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'),
96
-			'shareExcludeGroups'                   => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false,
97
-			'shareExcludedGroupsList'              => $excludeGroupsList,
98
-			'publicShareDisclaimerText'            => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null),
99
-			'enableLinkPasswordByDefault'          => $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'),
100
-			'shareApiDefaultPermissions'           => $this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL),
101
-			'shareApiDefaultPermissionsCheckboxes' => $permList,
102
-		];
83
+        $parameters = [
84
+            // Built-In Sharing
85
+            'allowGroupSharing'                    => $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes'),
86
+            'allowLinks'                           => $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'),
87
+            'allowPublicUpload'                    => $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'),
88
+            'allowResharing'                       => $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes'),
89
+            'allowShareDialogUserEnumeration'      => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes'),
90
+            'enforceLinkPassword'                  => Util::isPublicLinkPasswordRequired(),
91
+            'onlyShareWithGroupMembers'            => Share::shareWithGroupMembersOnly(),
92
+            'shareAPIEnabled'                      => $this->config->getAppValue('core', 'shareapi_enabled', 'yes'),
93
+            'shareDefaultExpireDateSet'            => $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no'),
94
+            'shareExpireAfterNDays'                => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'),
95
+            'shareEnforceExpireDate'               => $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'),
96
+            'shareExcludeGroups'                   => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false,
97
+            'shareExcludedGroupsList'              => $excludeGroupsList,
98
+            'publicShareDisclaimerText'            => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null),
99
+            'enableLinkPasswordByDefault'          => $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'),
100
+            'shareApiDefaultPermissions'           => $this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL),
101
+            'shareApiDefaultPermissionsCheckboxes' => $permList,
102
+        ];
103 103
 
104
-		return new TemplateResponse('settings', 'settings/admin/sharing', $parameters, '');
105
-	}
104
+        return new TemplateResponse('settings', 'settings/admin/sharing', $parameters, '');
105
+    }
106 106
 
107
-	/**
108
-	 * @return string the section ID, e.g. 'sharing'
109
-	 */
110
-	public function getSection() {
111
-		return 'sharing';
112
-	}
107
+    /**
108
+     * @return string the section ID, e.g. 'sharing'
109
+     */
110
+    public function getSection() {
111
+        return 'sharing';
112
+    }
113 113
 
114
-	/**
115
-	 * @return int whether the form should be rather on the top or bottom of
116
-	 * the admin section. The forms are arranged in ascending order of the
117
-	 * priority values. It is required to return a value between 0 and 100.
118
-	 *
119
-	 * E.g.: 70
120
-	 */
121
-	public function getPriority() {
122
-		return 0;
123
-	}
114
+    /**
115
+     * @return int whether the form should be rather on the top or bottom of
116
+     * the admin section. The forms are arranged in ascending order of the
117
+     * priority values. It is required to return a value between 0 and 100.
118
+     *
119
+     * E.g.: 70
120
+     */
121
+    public function getPriority() {
122
+        return 0;
123
+    }
124 124
 }
Please login to merge, or discard this patch.
lib/private/Settings/Manager.php 1 patch
Indentation   +501 added lines, -501 removed lines patch added patch discarded remove patch
@@ -49,505 +49,505 @@
 block discarded – undo
49 49
 use OCP\Settings\ISection;
50 50
 
51 51
 class Manager implements IManager {
52
-	/** @var ILogger */
53
-	private $log;
54
-	/** @var IDBConnection */
55
-	private $dbc;
56
-	/** @var Mapper */
57
-	private $mapper;
58
-	/** @var IL10N */
59
-	private $l;
60
-	/** @var IConfig */
61
-	private $config;
62
-	/** @var EncryptionManager */
63
-	private $encryptionManager;
64
-	/** @var IUserManager */
65
-	private $userManager;
66
-	/** @var ILockingProvider */
67
-	private $lockingProvider;
68
-	/** @var IRequest */
69
-	private $request;
70
-	/** @var IURLGenerator */
71
-	private $url;
72
-	/** @var AccountManager */
73
-	private $accountManager;
74
-	/** @var IGroupManager */
75
-	private $groupManager;
76
-	/** @var IFactory */
77
-	private $l10nFactory;
78
-	/** @var \OC_Defaults */
79
-	private $defaults;
80
-	/** @var IAppManager */
81
-	private $appManager;
82
-
83
-	/**
84
-	 * @param ILogger $log
85
-	 * @param IDBConnection $dbc
86
-	 * @param IL10N $l
87
-	 * @param IConfig $config
88
-	 * @param EncryptionManager $encryptionManager
89
-	 * @param IUserManager $userManager
90
-	 * @param ILockingProvider $lockingProvider
91
-	 * @param IRequest $request
92
-	 * @param Mapper $mapper
93
-	 * @param IURLGenerator $url
94
-	 * @param AccountManager $accountManager
95
-	 * @param IGroupManager $groupManager
96
-	 * @param IFactory $l10nFactory
97
-	 * @param \OC_Defaults $defaults
98
-	 */
99
-	public function __construct(
100
-		ILogger $log,
101
-		IDBConnection $dbc,
102
-		IL10N $l,
103
-		IConfig $config,
104
-		EncryptionManager $encryptionManager,
105
-		IUserManager $userManager,
106
-		ILockingProvider $lockingProvider,
107
-		IRequest $request,
108
-		Mapper $mapper,
109
-		IURLGenerator $url,
110
-		AccountManager $accountManager,
111
-		IGroupManager $groupManager,
112
-		IFactory $l10nFactory,
113
-		\OC_Defaults $defaults,
114
-		IAppManager $appManager
115
-	) {
116
-		$this->log = $log;
117
-		$this->dbc = $dbc;
118
-		$this->mapper = $mapper;
119
-		$this->l = $l;
120
-		$this->config = $config;
121
-		$this->encryptionManager = $encryptionManager;
122
-		$this->userManager = $userManager;
123
-		$this->lockingProvider = $lockingProvider;
124
-		$this->request = $request;
125
-		$this->url = $url;
126
-		$this->accountManager = $accountManager;
127
-		$this->groupManager = $groupManager;
128
-		$this->l10nFactory = $l10nFactory;
129
-		$this->defaults = $defaults;
130
-		$this->appManager = $appManager;
131
-	}
132
-
133
-	/**
134
-	 * @inheritdoc
135
-	 */
136
-	public function setupSettings(array $settings) {
137
-		if (!empty($settings[IManager::KEY_ADMIN_SECTION])) {
138
-			foreach ($settings[IManager::KEY_ADMIN_SECTION] as $className) {
139
-				$this->setupSectionEntry($className, 'admin');
140
-			}
141
-		}
142
-		if (!empty($settings[IManager::KEY_ADMIN_SETTINGS])) {
143
-			foreach ($settings[IManager::KEY_ADMIN_SETTINGS] as $className) {
144
-				$this->setupSettingsEntry($className, 'admin');
145
-			}
146
-		}
147
-
148
-		if (!empty($settings[IManager::KEY_PERSONAL_SECTION])) {
149
-			foreach ($settings[IManager::KEY_PERSONAL_SECTION] as $className) {
150
-				$this->setupSectionEntry($className, 'personal');
151
-			}
152
-		}
153
-		if (!empty($settings[IManager::KEY_PERSONAL_SETTINGS])) {
154
-			foreach ($settings[IManager::KEY_PERSONAL_SETTINGS] as $className) {
155
-				$this->setupSettingsEntry($className, 'personal');
156
-			}
157
-		}
158
-	}
159
-
160
-	/**
161
-	 * attempts to remove an apps section and/or settings entry. A listener is
162
-	 * added centrally making sure that this method is called ones an app was
163
-	 * disabled.
164
-	 *
165
-	 * @param string $appId
166
-	 * @since 9.1.0
167
-	 */
168
-	public function onAppDisabled($appId) {
169
-		$appInfo = \OC_App::getAppInfo($appId); // hello static legacy
170
-
171
-		if (!empty($appInfo['settings'][IManager::KEY_ADMIN_SECTION])) {
172
-			foreach ($appInfo['settings'][IManager::KEY_ADMIN_SECTION] as $className) {
173
-				$this->mapper->remove(Mapper::TABLE_ADMIN_SECTIONS, trim($className, '\\'));
174
-			}
175
-		}
176
-		if (!empty($appInfo['settings'][IManager::KEY_ADMIN_SETTINGS])) {
177
-			foreach ($appInfo['settings'][IManager::KEY_ADMIN_SETTINGS] as $className) {
178
-				$this->mapper->remove(Mapper::TABLE_ADMIN_SETTINGS, trim($className, '\\'));
179
-			}
180
-		}
181
-
182
-		if (!empty($appInfo['settings'][IManager::KEY_PERSONAL_SECTION])) {
183
-			foreach ($appInfo['settings'][IManager::KEY_PERSONAL_SECTION] as $className) {
184
-				$this->mapper->remove(Mapper::TABLE_PERSONAL_SECTIONS, trim($className, '\\'));
185
-			}
186
-		}
187
-		if (!empty($appInfo['settings'][IManager::KEY_PERSONAL_SETTINGS])) {
188
-			foreach ($appInfo['settings'][IManager::KEY_PERSONAL_SETTINGS] as $className) {
189
-				$this->mapper->remove(Mapper::TABLE_PERSONAL_SETTINGS, trim($className, '\\'));
190
-			}
191
-		}
192
-	}
193
-
194
-	public function checkForOrphanedClassNames() {
195
-		$tables = [Mapper::TABLE_ADMIN_SECTIONS, Mapper::TABLE_ADMIN_SETTINGS, Mapper::TABLE_PERSONAL_SECTIONS, Mapper::TABLE_PERSONAL_SETTINGS];
196
-		foreach ($tables as $table) {
197
-			$classes = $this->mapper->getClasses($table);
198
-			foreach ($classes as $className) {
199
-				try {
200
-					\OC::$server->query($className);
201
-				} catch (QueryException $e) {
202
-					$this->mapper->remove($table, $className);
203
-				}
204
-			}
205
-		}
206
-	}
207
-
208
-	/**
209
-	 * @param string $sectionClassName
210
-	 * @param string $type either 'admin' or 'personal'
211
-	 */
212
-	private function setupSectionEntry($sectionClassName, $type) {
213
-		if (!class_exists($sectionClassName)) {
214
-			$this->log->debug('Could not find ' . ucfirst($type) . ' section class ' . $sectionClassName);
215
-			return;
216
-		}
217
-		try {
218
-			$section = $this->query($sectionClassName);
219
-		} catch (QueryException $e) {
220
-			// cancel
221
-			return;
222
-		}
223
-
224
-		if (!$section instanceof ISection) {
225
-			$this->log->error(
226
-				ucfirst($type) .' section instance must implement \OCP\ISection. Invalid class: {class}',
227
-				['class' => $sectionClassName]
228
-			);
229
-			return;
230
-		}
231
-		$table = $this->getSectionTableForType($type);
232
-		if(!$this->hasSection(get_class($section), $table)) {
233
-			$this->addSection($section, $table);
234
-		} else {
235
-			$this->updateSection($section, $table);
236
-		}
237
-	}
238
-
239
-	private function addSection(ISection $section, $table) {
240
-		$this->mapper->add($table, [
241
-			'id' => $section->getID(),
242
-			'class' => get_class($section),
243
-			'priority' => $section->getPriority(),
244
-		]);
245
-	}
246
-
247
-	private function addSettings(ISettings $settings, $table) {
248
-		$this->mapper->add($table, [
249
-			'class' => get_class($settings),
250
-			'section' => $settings->getSection(),
251
-			'priority' => $settings->getPriority(),
252
-		]);
253
-	}
254
-
255
-	private function updateSettings(ISettings $settings, $table) {
256
-		$this->mapper->update(
257
-			$table,
258
-			'class',
259
-			get_class($settings),
260
-			[
261
-				'section' => $settings->getSection(),
262
-				'priority' => $settings->getPriority(),
263
-			]
264
-		);
265
-	}
266
-
267
-	private function updateSection(ISection $section, $table) {
268
-		$this->mapper->update(
269
-			$table,
270
-			'class',
271
-			get_class($section),
272
-			[
273
-				'id' => $section->getID(),
274
-				'priority' => $section->getPriority(),
275
-			]
276
-		);
277
-	}
278
-
279
-	/**
280
-	 * @param string $className
281
-	 * @param string $table
282
-	 * @return bool
283
-	 */
284
-	private function hasSection($className, $table) {
285
-		return $this->mapper->has($table, $className);
286
-	}
287
-
288
-	/**
289
-	 * @param string $className
290
-	 * @return bool
291
-	 */
292
-	private function hasSettings($className, $table) {
293
-		return $this->mapper->has($table, $className);
294
-	}
295
-
296
-	private function setupSettingsEntry($settingsClassName, $type) {
297
-		if (!class_exists($settingsClassName)) {
298
-			$this->log->debug('Could not find ' . $type . ' section class ' . $settingsClassName);
299
-			return;
300
-		}
301
-
302
-		try {
303
-			/** @var ISettings $settings */
304
-			$settings = $this->query($settingsClassName);
305
-		} catch (QueryException $e) {
306
-			// cancel
307
-			return;
308
-		}
309
-
310
-		if (!$settings instanceof ISettings) {
311
-			$this->log->error(
312
-				ucfirst($type) . ' section instance must implement \OCP\Settings\ISettings. Invalid class: {class}',
313
-				['class' => $settingsClassName]
314
-			);
315
-			return;
316
-		}
317
-		$table = $this->getSettingsTableForType($type);
318
-		if (!$this->hasSettings(get_class($settings), $table)) {
319
-			$this->addSettings($settings, $table);
320
-		} else {
321
-			$this->updateSettings($settings, $table);
322
-		}
323
-	}
324
-
325
-	private function getSectionTableForType($type) {
326
-		if($type === 'admin') {
327
-			return Mapper::TABLE_ADMIN_SECTIONS;
328
-		} else if($type === 'personal') {
329
-			return Mapper::TABLE_PERSONAL_SECTIONS;
330
-		}
331
-		throw new \InvalidArgumentException('"admin" or "personal" expected');
332
-	}
333
-
334
-	private function getSettingsTableForType($type) {
335
-		if($type === 'admin') {
336
-			return Mapper::TABLE_ADMIN_SETTINGS;
337
-		} else if($type === 'personal') {
338
-			return Mapper::TABLE_PERSONAL_SETTINGS;
339
-		}
340
-		throw new \InvalidArgumentException('"admin" or "personal" expected');
341
-	}
342
-
343
-	private function query($className) {
344
-		try {
345
-			return \OC::$server->query($className);
346
-		} catch (QueryException $e) {
347
-			$this->log->logException($e);
348
-			throw $e;
349
-		}
350
-	}
351
-
352
-	/**
353
-	 * @inheritdoc
354
-	 */
355
-	public function getAdminSections() {
356
-		// built-in sections
357
-		$sections = [
358
-			0 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('settings', 'admin.svg'))],
359
-			5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
360
-			10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
361
-			45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
362
-			98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
363
-			99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
364
-		];
365
-
366
-		$rows = $this->mapper->getAdminSectionsFromDB();
367
-
368
-		foreach ($rows as $row) {
369
-			if (!isset($sections[$row['priority']])) {
370
-				$sections[$row['priority']] = [];
371
-			}
372
-			try {
373
-				$sections[$row['priority']][] = $this->query($row['class']);
374
-			} catch (QueryException $e) {
375
-				// skip
376
-			}
377
-		}
378
-
379
-		ksort($sections);
380
-
381
-		return $sections;
382
-	}
383
-
384
-	/**
385
-	 * @param string $section
386
-	 * @return ISection[]
387
-	 */
388
-	private function getBuiltInAdminSettings($section) {
389
-		$forms = [];
390
-		try {
391
-			if ($section === 'server') {
392
-				/** @var ISettings $form */
393
-				$form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
394
-				$forms[$form->getPriority()] = [$form];
395
-				$form = new Admin\ServerDevNotice();
396
-				$forms[$form->getPriority()] = [$form];
397
-			}
398
-			if ($section === 'encryption') {
399
-				/** @var ISettings $form */
400
-				$form = new Admin\Encryption($this->encryptionManager, $this->userManager);
401
-				$forms[$form->getPriority()] = [$form];
402
-			}
403
-			if ($section === 'sharing') {
404
-				/** @var ISettings $form */
405
-				$form = new Admin\Sharing($this->config, $this->l);
406
-				$forms[$form->getPriority()] = [$form];
407
-			}
408
-			if ($section === 'additional') {
409
-				/** @var ISettings $form */
410
-				$form = new Admin\Additional($this->config);
411
-				$forms[$form->getPriority()] = [$form];
412
-			}
413
-			if ($section === 'tips-tricks') {
414
-				/** @var ISettings $form */
415
-				$form = new Admin\TipsTricks($this->config);
416
-				$forms[$form->getPriority()] = [$form];
417
-			}
418
-		} catch (QueryException $e) {
419
-			// skip
420
-		}
421
-		return $forms;
422
-	}
423
-
424
-	/**
425
-	 * @param string $section
426
-	 * @return ISection[]
427
-	 */
428
-	private function getBuiltInPersonalSettings($section) {
429
-		$forms = [];
430
-		try {
431
-			if ($section === 'personal-info') {
432
-				/** @var ISettings $form */
433
-				$form = new Personal\PersonalInfo(
434
-					$this->config,
435
-					$this->userManager,
436
-					$this->groupManager,
437
-					$this->accountManager,
438
-					$this->appManager,
439
-					$this->l10nFactory,
440
-					$this->l
441
-				);
442
-				$forms[$form->getPriority()] = [$form];
443
-			}
444
-			if($section === 'security') {
445
-				/** @var ISettings $form */
446
-				$form = new Personal\Security();
447
-				$forms[$form->getPriority()] = [$form];
448
-			}
449
-			if ($section === 'additional') {
450
-				/** @var ISettings $form */
451
-				$form = new Personal\Additional($this->config);
452
-				$forms[$form->getPriority()] = [$form];
453
-			}
454
-		} catch (QueryException $e) {
455
-			// skip
456
-		}
457
-		return $forms;
458
-	}
459
-
460
-	/**
461
-	 * @inheritdoc
462
-	 */
463
-	public function getAdminSettings($section) {
464
-		$settings = $this->getBuiltInAdminSettings($section);
465
-		$dbRows = $this->mapper->getAdminSettingsFromDB($section);
466
-
467
-		foreach ($dbRows as $row) {
468
-			if (!isset($settings[$row['priority']])) {
469
-				$settings[$row['priority']] = [];
470
-			}
471
-			try {
472
-				$settings[$row['priority']][] = $this->query($row['class']);
473
-			} catch (QueryException $e) {
474
-				// skip
475
-			} catch (AutoloadNotAllowedException $e) {
476
-				// skip error and remove remnant of disabled app
477
-				$this->log->warning('Orphan setting entry will be removed from admin_settings: ' . json_encode($row));
478
-				$this->mapper->remove(Mapper::TABLE_ADMIN_SETTINGS, $row['class']);
479
-			}
480
-		}
481
-
482
-		ksort($settings);
483
-		return $settings;
484
-	}
485
-
486
-	/**
487
-	 * @inheritdoc
488
-	 */
489
-	public function getPersonalSections() {
490
-		$sections = [
491
-			0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
492
-			5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
493
-			15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))],
494
-		];
495
-
496
-		$legacyForms = \OC_App::getForms('personal');
497
-		if(count($legacyForms) > 0 && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
498
-			$sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
499
-		}
500
-
501
-		$rows = $this->mapper->getPersonalSectionsFromDB();
502
-
503
-		foreach ($rows as $row) {
504
-			if (!isset($sections[$row['priority']])) {
505
-				$sections[$row['priority']] = [];
506
-			}
507
-			try {
508
-				$sections[$row['priority']][] = $this->query($row['class']);
509
-			} catch (QueryException $e) {
510
-				// skip
511
-			}
512
-		}
513
-
514
-		ksort($sections);
515
-
516
-		return $sections;
517
-	}
518
-
519
-	/**
520
-	 * @param $forms
521
-	 * @return bool
522
-	 */
523
-	private function hasLegacyPersonalSettingsToRender($forms) {
524
-		foreach ($forms as $form) {
525
-			if(trim($form) !== '') {
526
-				return true;
527
-			}
528
-		}
529
-		return false;
530
-	}
531
-
532
-	/**
533
-	 * @inheritdoc
534
-	 */
535
-	public function getPersonalSettings($section) {
536
-		$settings = $this->getBuiltInPersonalSettings($section);
537
-		$dbRows = $this->mapper->getPersonalSettingsFromDB($section);
538
-
539
-		foreach ($dbRows as $row) {
540
-			if (!isset($settings[$row['priority']])) {
541
-				$settings[$row['priority']] = [];
542
-			}
543
-			try {
544
-				$settings[$row['priority']][] = $this->query($row['class']);
545
-			} catch (QueryException $e) {
546
-				// skip
547
-			}
548
-		}
549
-
550
-		ksort($settings);
551
-		return $settings;
552
-	}
52
+    /** @var ILogger */
53
+    private $log;
54
+    /** @var IDBConnection */
55
+    private $dbc;
56
+    /** @var Mapper */
57
+    private $mapper;
58
+    /** @var IL10N */
59
+    private $l;
60
+    /** @var IConfig */
61
+    private $config;
62
+    /** @var EncryptionManager */
63
+    private $encryptionManager;
64
+    /** @var IUserManager */
65
+    private $userManager;
66
+    /** @var ILockingProvider */
67
+    private $lockingProvider;
68
+    /** @var IRequest */
69
+    private $request;
70
+    /** @var IURLGenerator */
71
+    private $url;
72
+    /** @var AccountManager */
73
+    private $accountManager;
74
+    /** @var IGroupManager */
75
+    private $groupManager;
76
+    /** @var IFactory */
77
+    private $l10nFactory;
78
+    /** @var \OC_Defaults */
79
+    private $defaults;
80
+    /** @var IAppManager */
81
+    private $appManager;
82
+
83
+    /**
84
+     * @param ILogger $log
85
+     * @param IDBConnection $dbc
86
+     * @param IL10N $l
87
+     * @param IConfig $config
88
+     * @param EncryptionManager $encryptionManager
89
+     * @param IUserManager $userManager
90
+     * @param ILockingProvider $lockingProvider
91
+     * @param IRequest $request
92
+     * @param Mapper $mapper
93
+     * @param IURLGenerator $url
94
+     * @param AccountManager $accountManager
95
+     * @param IGroupManager $groupManager
96
+     * @param IFactory $l10nFactory
97
+     * @param \OC_Defaults $defaults
98
+     */
99
+    public function __construct(
100
+        ILogger $log,
101
+        IDBConnection $dbc,
102
+        IL10N $l,
103
+        IConfig $config,
104
+        EncryptionManager $encryptionManager,
105
+        IUserManager $userManager,
106
+        ILockingProvider $lockingProvider,
107
+        IRequest $request,
108
+        Mapper $mapper,
109
+        IURLGenerator $url,
110
+        AccountManager $accountManager,
111
+        IGroupManager $groupManager,
112
+        IFactory $l10nFactory,
113
+        \OC_Defaults $defaults,
114
+        IAppManager $appManager
115
+    ) {
116
+        $this->log = $log;
117
+        $this->dbc = $dbc;
118
+        $this->mapper = $mapper;
119
+        $this->l = $l;
120
+        $this->config = $config;
121
+        $this->encryptionManager = $encryptionManager;
122
+        $this->userManager = $userManager;
123
+        $this->lockingProvider = $lockingProvider;
124
+        $this->request = $request;
125
+        $this->url = $url;
126
+        $this->accountManager = $accountManager;
127
+        $this->groupManager = $groupManager;
128
+        $this->l10nFactory = $l10nFactory;
129
+        $this->defaults = $defaults;
130
+        $this->appManager = $appManager;
131
+    }
132
+
133
+    /**
134
+     * @inheritdoc
135
+     */
136
+    public function setupSettings(array $settings) {
137
+        if (!empty($settings[IManager::KEY_ADMIN_SECTION])) {
138
+            foreach ($settings[IManager::KEY_ADMIN_SECTION] as $className) {
139
+                $this->setupSectionEntry($className, 'admin');
140
+            }
141
+        }
142
+        if (!empty($settings[IManager::KEY_ADMIN_SETTINGS])) {
143
+            foreach ($settings[IManager::KEY_ADMIN_SETTINGS] as $className) {
144
+                $this->setupSettingsEntry($className, 'admin');
145
+            }
146
+        }
147
+
148
+        if (!empty($settings[IManager::KEY_PERSONAL_SECTION])) {
149
+            foreach ($settings[IManager::KEY_PERSONAL_SECTION] as $className) {
150
+                $this->setupSectionEntry($className, 'personal');
151
+            }
152
+        }
153
+        if (!empty($settings[IManager::KEY_PERSONAL_SETTINGS])) {
154
+            foreach ($settings[IManager::KEY_PERSONAL_SETTINGS] as $className) {
155
+                $this->setupSettingsEntry($className, 'personal');
156
+            }
157
+        }
158
+    }
159
+
160
+    /**
161
+     * attempts to remove an apps section and/or settings entry. A listener is
162
+     * added centrally making sure that this method is called ones an app was
163
+     * disabled.
164
+     *
165
+     * @param string $appId
166
+     * @since 9.1.0
167
+     */
168
+    public function onAppDisabled($appId) {
169
+        $appInfo = \OC_App::getAppInfo($appId); // hello static legacy
170
+
171
+        if (!empty($appInfo['settings'][IManager::KEY_ADMIN_SECTION])) {
172
+            foreach ($appInfo['settings'][IManager::KEY_ADMIN_SECTION] as $className) {
173
+                $this->mapper->remove(Mapper::TABLE_ADMIN_SECTIONS, trim($className, '\\'));
174
+            }
175
+        }
176
+        if (!empty($appInfo['settings'][IManager::KEY_ADMIN_SETTINGS])) {
177
+            foreach ($appInfo['settings'][IManager::KEY_ADMIN_SETTINGS] as $className) {
178
+                $this->mapper->remove(Mapper::TABLE_ADMIN_SETTINGS, trim($className, '\\'));
179
+            }
180
+        }
181
+
182
+        if (!empty($appInfo['settings'][IManager::KEY_PERSONAL_SECTION])) {
183
+            foreach ($appInfo['settings'][IManager::KEY_PERSONAL_SECTION] as $className) {
184
+                $this->mapper->remove(Mapper::TABLE_PERSONAL_SECTIONS, trim($className, '\\'));
185
+            }
186
+        }
187
+        if (!empty($appInfo['settings'][IManager::KEY_PERSONAL_SETTINGS])) {
188
+            foreach ($appInfo['settings'][IManager::KEY_PERSONAL_SETTINGS] as $className) {
189
+                $this->mapper->remove(Mapper::TABLE_PERSONAL_SETTINGS, trim($className, '\\'));
190
+            }
191
+        }
192
+    }
193
+
194
+    public function checkForOrphanedClassNames() {
195
+        $tables = [Mapper::TABLE_ADMIN_SECTIONS, Mapper::TABLE_ADMIN_SETTINGS, Mapper::TABLE_PERSONAL_SECTIONS, Mapper::TABLE_PERSONAL_SETTINGS];
196
+        foreach ($tables as $table) {
197
+            $classes = $this->mapper->getClasses($table);
198
+            foreach ($classes as $className) {
199
+                try {
200
+                    \OC::$server->query($className);
201
+                } catch (QueryException $e) {
202
+                    $this->mapper->remove($table, $className);
203
+                }
204
+            }
205
+        }
206
+    }
207
+
208
+    /**
209
+     * @param string $sectionClassName
210
+     * @param string $type either 'admin' or 'personal'
211
+     */
212
+    private function setupSectionEntry($sectionClassName, $type) {
213
+        if (!class_exists($sectionClassName)) {
214
+            $this->log->debug('Could not find ' . ucfirst($type) . ' section class ' . $sectionClassName);
215
+            return;
216
+        }
217
+        try {
218
+            $section = $this->query($sectionClassName);
219
+        } catch (QueryException $e) {
220
+            // cancel
221
+            return;
222
+        }
223
+
224
+        if (!$section instanceof ISection) {
225
+            $this->log->error(
226
+                ucfirst($type) .' section instance must implement \OCP\ISection. Invalid class: {class}',
227
+                ['class' => $sectionClassName]
228
+            );
229
+            return;
230
+        }
231
+        $table = $this->getSectionTableForType($type);
232
+        if(!$this->hasSection(get_class($section), $table)) {
233
+            $this->addSection($section, $table);
234
+        } else {
235
+            $this->updateSection($section, $table);
236
+        }
237
+    }
238
+
239
+    private function addSection(ISection $section, $table) {
240
+        $this->mapper->add($table, [
241
+            'id' => $section->getID(),
242
+            'class' => get_class($section),
243
+            'priority' => $section->getPriority(),
244
+        ]);
245
+    }
246
+
247
+    private function addSettings(ISettings $settings, $table) {
248
+        $this->mapper->add($table, [
249
+            'class' => get_class($settings),
250
+            'section' => $settings->getSection(),
251
+            'priority' => $settings->getPriority(),
252
+        ]);
253
+    }
254
+
255
+    private function updateSettings(ISettings $settings, $table) {
256
+        $this->mapper->update(
257
+            $table,
258
+            'class',
259
+            get_class($settings),
260
+            [
261
+                'section' => $settings->getSection(),
262
+                'priority' => $settings->getPriority(),
263
+            ]
264
+        );
265
+    }
266
+
267
+    private function updateSection(ISection $section, $table) {
268
+        $this->mapper->update(
269
+            $table,
270
+            'class',
271
+            get_class($section),
272
+            [
273
+                'id' => $section->getID(),
274
+                'priority' => $section->getPriority(),
275
+            ]
276
+        );
277
+    }
278
+
279
+    /**
280
+     * @param string $className
281
+     * @param string $table
282
+     * @return bool
283
+     */
284
+    private function hasSection($className, $table) {
285
+        return $this->mapper->has($table, $className);
286
+    }
287
+
288
+    /**
289
+     * @param string $className
290
+     * @return bool
291
+     */
292
+    private function hasSettings($className, $table) {
293
+        return $this->mapper->has($table, $className);
294
+    }
295
+
296
+    private function setupSettingsEntry($settingsClassName, $type) {
297
+        if (!class_exists($settingsClassName)) {
298
+            $this->log->debug('Could not find ' . $type . ' section class ' . $settingsClassName);
299
+            return;
300
+        }
301
+
302
+        try {
303
+            /** @var ISettings $settings */
304
+            $settings = $this->query($settingsClassName);
305
+        } catch (QueryException $e) {
306
+            // cancel
307
+            return;
308
+        }
309
+
310
+        if (!$settings instanceof ISettings) {
311
+            $this->log->error(
312
+                ucfirst($type) . ' section instance must implement \OCP\Settings\ISettings. Invalid class: {class}',
313
+                ['class' => $settingsClassName]
314
+            );
315
+            return;
316
+        }
317
+        $table = $this->getSettingsTableForType($type);
318
+        if (!$this->hasSettings(get_class($settings), $table)) {
319
+            $this->addSettings($settings, $table);
320
+        } else {
321
+            $this->updateSettings($settings, $table);
322
+        }
323
+    }
324
+
325
+    private function getSectionTableForType($type) {
326
+        if($type === 'admin') {
327
+            return Mapper::TABLE_ADMIN_SECTIONS;
328
+        } else if($type === 'personal') {
329
+            return Mapper::TABLE_PERSONAL_SECTIONS;
330
+        }
331
+        throw new \InvalidArgumentException('"admin" or "personal" expected');
332
+    }
333
+
334
+    private function getSettingsTableForType($type) {
335
+        if($type === 'admin') {
336
+            return Mapper::TABLE_ADMIN_SETTINGS;
337
+        } else if($type === 'personal') {
338
+            return Mapper::TABLE_PERSONAL_SETTINGS;
339
+        }
340
+        throw new \InvalidArgumentException('"admin" or "personal" expected');
341
+    }
342
+
343
+    private function query($className) {
344
+        try {
345
+            return \OC::$server->query($className);
346
+        } catch (QueryException $e) {
347
+            $this->log->logException($e);
348
+            throw $e;
349
+        }
350
+    }
351
+
352
+    /**
353
+     * @inheritdoc
354
+     */
355
+    public function getAdminSections() {
356
+        // built-in sections
357
+        $sections = [
358
+            0 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('settings', 'admin.svg'))],
359
+            5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
360
+            10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
361
+            45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
362
+            98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
363
+            99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
364
+        ];
365
+
366
+        $rows = $this->mapper->getAdminSectionsFromDB();
367
+
368
+        foreach ($rows as $row) {
369
+            if (!isset($sections[$row['priority']])) {
370
+                $sections[$row['priority']] = [];
371
+            }
372
+            try {
373
+                $sections[$row['priority']][] = $this->query($row['class']);
374
+            } catch (QueryException $e) {
375
+                // skip
376
+            }
377
+        }
378
+
379
+        ksort($sections);
380
+
381
+        return $sections;
382
+    }
383
+
384
+    /**
385
+     * @param string $section
386
+     * @return ISection[]
387
+     */
388
+    private function getBuiltInAdminSettings($section) {
389
+        $forms = [];
390
+        try {
391
+            if ($section === 'server') {
392
+                /** @var ISettings $form */
393
+                $form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
394
+                $forms[$form->getPriority()] = [$form];
395
+                $form = new Admin\ServerDevNotice();
396
+                $forms[$form->getPriority()] = [$form];
397
+            }
398
+            if ($section === 'encryption') {
399
+                /** @var ISettings $form */
400
+                $form = new Admin\Encryption($this->encryptionManager, $this->userManager);
401
+                $forms[$form->getPriority()] = [$form];
402
+            }
403
+            if ($section === 'sharing') {
404
+                /** @var ISettings $form */
405
+                $form = new Admin\Sharing($this->config, $this->l);
406
+                $forms[$form->getPriority()] = [$form];
407
+            }
408
+            if ($section === 'additional') {
409
+                /** @var ISettings $form */
410
+                $form = new Admin\Additional($this->config);
411
+                $forms[$form->getPriority()] = [$form];
412
+            }
413
+            if ($section === 'tips-tricks') {
414
+                /** @var ISettings $form */
415
+                $form = new Admin\TipsTricks($this->config);
416
+                $forms[$form->getPriority()] = [$form];
417
+            }
418
+        } catch (QueryException $e) {
419
+            // skip
420
+        }
421
+        return $forms;
422
+    }
423
+
424
+    /**
425
+     * @param string $section
426
+     * @return ISection[]
427
+     */
428
+    private function getBuiltInPersonalSettings($section) {
429
+        $forms = [];
430
+        try {
431
+            if ($section === 'personal-info') {
432
+                /** @var ISettings $form */
433
+                $form = new Personal\PersonalInfo(
434
+                    $this->config,
435
+                    $this->userManager,
436
+                    $this->groupManager,
437
+                    $this->accountManager,
438
+                    $this->appManager,
439
+                    $this->l10nFactory,
440
+                    $this->l
441
+                );
442
+                $forms[$form->getPriority()] = [$form];
443
+            }
444
+            if($section === 'security') {
445
+                /** @var ISettings $form */
446
+                $form = new Personal\Security();
447
+                $forms[$form->getPriority()] = [$form];
448
+            }
449
+            if ($section === 'additional') {
450
+                /** @var ISettings $form */
451
+                $form = new Personal\Additional($this->config);
452
+                $forms[$form->getPriority()] = [$form];
453
+            }
454
+        } catch (QueryException $e) {
455
+            // skip
456
+        }
457
+        return $forms;
458
+    }
459
+
460
+    /**
461
+     * @inheritdoc
462
+     */
463
+    public function getAdminSettings($section) {
464
+        $settings = $this->getBuiltInAdminSettings($section);
465
+        $dbRows = $this->mapper->getAdminSettingsFromDB($section);
466
+
467
+        foreach ($dbRows as $row) {
468
+            if (!isset($settings[$row['priority']])) {
469
+                $settings[$row['priority']] = [];
470
+            }
471
+            try {
472
+                $settings[$row['priority']][] = $this->query($row['class']);
473
+            } catch (QueryException $e) {
474
+                // skip
475
+            } catch (AutoloadNotAllowedException $e) {
476
+                // skip error and remove remnant of disabled app
477
+                $this->log->warning('Orphan setting entry will be removed from admin_settings: ' . json_encode($row));
478
+                $this->mapper->remove(Mapper::TABLE_ADMIN_SETTINGS, $row['class']);
479
+            }
480
+        }
481
+
482
+        ksort($settings);
483
+        return $settings;
484
+    }
485
+
486
+    /**
487
+     * @inheritdoc
488
+     */
489
+    public function getPersonalSections() {
490
+        $sections = [
491
+            0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
492
+            5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
493
+            15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))],
494
+        ];
495
+
496
+        $legacyForms = \OC_App::getForms('personal');
497
+        if(count($legacyForms) > 0 && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
498
+            $sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
499
+        }
500
+
501
+        $rows = $this->mapper->getPersonalSectionsFromDB();
502
+
503
+        foreach ($rows as $row) {
504
+            if (!isset($sections[$row['priority']])) {
505
+                $sections[$row['priority']] = [];
506
+            }
507
+            try {
508
+                $sections[$row['priority']][] = $this->query($row['class']);
509
+            } catch (QueryException $e) {
510
+                // skip
511
+            }
512
+        }
513
+
514
+        ksort($sections);
515
+
516
+        return $sections;
517
+    }
518
+
519
+    /**
520
+     * @param $forms
521
+     * @return bool
522
+     */
523
+    private function hasLegacyPersonalSettingsToRender($forms) {
524
+        foreach ($forms as $form) {
525
+            if(trim($form) !== '') {
526
+                return true;
527
+            }
528
+        }
529
+        return false;
530
+    }
531
+
532
+    /**
533
+     * @inheritdoc
534
+     */
535
+    public function getPersonalSettings($section) {
536
+        $settings = $this->getBuiltInPersonalSettings($section);
537
+        $dbRows = $this->mapper->getPersonalSettingsFromDB($section);
538
+
539
+        foreach ($dbRows as $row) {
540
+            if (!isset($settings[$row['priority']])) {
541
+                $settings[$row['priority']] = [];
542
+            }
543
+            try {
544
+                $settings[$row['priority']][] = $this->query($row['class']);
545
+            } catch (QueryException $e) {
546
+                // skip
547
+            }
548
+        }
549
+
550
+        ksort($settings);
551
+        return $settings;
552
+    }
553 553
 }
Please login to merge, or discard this patch.
apps/files_sharing/lib/Capabilities.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -33,72 +33,72 @@
 block discarded – undo
33 33
  */
34 34
 class Capabilities implements ICapability {
35 35
 
36
-	/** @var IConfig */
37
-	private $config;
36
+    /** @var IConfig */
37
+    private $config;
38 38
 
39
-	public function __construct(IConfig $config) {
40
-		$this->config = $config;
41
-	}
39
+    public function __construct(IConfig $config) {
40
+        $this->config = $config;
41
+    }
42 42
 
43
-	/**
44
-	 * Return this classes capabilities
45
-	 *
46
-	 * @return array
47
-	 */
48
-	public function getCapabilities() {
49
-		$res = [];
43
+    /**
44
+     * Return this classes capabilities
45
+     *
46
+     * @return array
47
+     */
48
+    public function getCapabilities() {
49
+        $res = [];
50 50
 
51
-		if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
52
-			$res['api_enabled'] = false;
53
-			$res['public'] = ['enabled' => false];
54
-			$res['user'] = ['send_mail' => false];
55
-			$res['resharing'] = false;
56
-		} else {
57
-			$res['api_enabled'] = true;
51
+        if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
52
+            $res['api_enabled'] = false;
53
+            $res['public'] = ['enabled' => false];
54
+            $res['user'] = ['send_mail' => false];
55
+            $res['resharing'] = false;
56
+        } else {
57
+            $res['api_enabled'] = true;
58 58
 
59
-			$public = [];
60
-			$public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes';
61
-			if ($public['enabled']) {
62
-				$public['password'] = [];
63
-				$public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes');
59
+            $public = [];
60
+            $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes';
61
+            if ($public['enabled']) {
62
+                $public['password'] = [];
63
+                $public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes');
64 64
 
65
-				$public['expire_date'] = [];
66
-				$public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes';
67
-				if ($public['expire_date']['enabled']) {
68
-					$public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
69
-					$public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes';
70
-				}
65
+                $public['expire_date'] = [];
66
+                $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes';
67
+                if ($public['expire_date']['enabled']) {
68
+                    $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
69
+                    $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes';
70
+                }
71 71
 
72
-				$public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes';
73
-				$public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes';
74
-				$public['upload_files_drop'] = $public['upload'];
75
-			}
76
-			$res['public'] = $public;
72
+                $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes';
73
+                $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes';
74
+                $public['upload_files_drop'] = $public['upload'];
75
+            }
76
+            $res['public'] = $public;
77 77
 
78
-			$res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes';
78
+            $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes';
79 79
 
80
-			$res['user']['send_mail'] = false;
81
-			$res['user']['expire_date']['enabled'] = true;
80
+            $res['user']['send_mail'] = false;
81
+            $res['user']['expire_date']['enabled'] = true;
82 82
 
83
-			// deprecated in favour of 'group', but we need to keep it for now
84
-			// in order to stay compatible with older clients
85
-			$res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
83
+            // deprecated in favour of 'group', but we need to keep it for now
84
+            // in order to stay compatible with older clients
85
+            $res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
86 86
 
87
-			$res['group'] = [];
88
-			$res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
89
-			$res['group']['expire_date']['enabled'] = true;
90
-			$res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL);
91
-		}
87
+            $res['group'] = [];
88
+            $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
89
+            $res['group']['expire_date']['enabled'] = true;
90
+            $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL);
91
+        }
92 92
 
93
-		//Federated sharing
94
-		$res['federation'] = [
95
-			'outgoing'  => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes',
96
-			'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes',
97
-			'expire_date' => ['enabled' => true]
98
-		];
93
+        //Federated sharing
94
+        $res['federation'] = [
95
+            'outgoing'  => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes',
96
+            'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes',
97
+            'expire_date' => ['enabled' => true]
98
+        ];
99 99
 
100
-		return [
101
-			'files_sharing' => $res,
102
-		];
103
-	}
100
+        return [
101
+            'files_sharing' => $res,
102
+        ];
103
+    }
104 104
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
 			$res['group'] = [];
88 88
 			$res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
89 89
 			$res['group']['expire_date']['enabled'] = true;
90
-			$res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL);
90
+			$res['default_permissions'] = (int) $this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL);
91 91
 		}
92 92
 
93 93
 		//Federated sharing
Please login to merge, or discard this patch.
settings/templates/settings/admin/sharing.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,93 +27,93 @@
 block discarded – undo
27 27
 ?>
28 28
 
29 29
 <div class="section" id="shareAPI">
30
-	<h2><?php p($l->t('Sharing'));?></h2>
30
+	<h2><?php p($l->t('Sharing')); ?></h2>
31 31
 	<a target="_blank" rel="noreferrer noopener" class="icon-info"
32
-	   title="<?php p($l->t('Open documentation'));?>"
32
+	   title="<?php p($l->t('Open documentation')); ?>"
33 33
 	   href="<?php p(link_to_docs('admin-sharing')); ?>"></a>
34
-        <p class="settings-hint"><?php p($l->t('As admin you can fine-tune the sharing behavior. Please see the documentation for more information.'));?></p>
34
+        <p class="settings-hint"><?php p($l->t('As admin you can fine-tune the sharing behavior. Please see the documentation for more information.')); ?></p>
35 35
 	<p id="enable">
36 36
 		<input type="checkbox" name="shareapi_enabled" id="shareAPIEnabled" class="checkbox"
37 37
 			   value="1" <?php if ($_['shareAPIEnabled'] === 'yes') print_unescaped('checked="checked"'); ?> />
38
-		<label for="shareAPIEnabled"><?php p($l->t('Allow apps to use the Share API'));?></label><br/>
38
+		<label for="shareAPIEnabled"><?php p($l->t('Allow apps to use the Share API')); ?></label><br/>
39 39
 	</p>
40
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
40
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
41 41
 		<input type="checkbox" name="shareapi_allow_links" id="allowLinks" class="checkbox"
42 42
 			   value="1" <?php if ($_['allowLinks'] === 'yes') print_unescaped('checked="checked"'); ?> />
43
-		<label for="allowLinks"><?php p($l->t('Allow users to share via link'));?></label><br/>
43
+		<label for="allowLinks"><?php p($l->t('Allow users to share via link')); ?></label><br/>
44 44
 	</p>
45 45
 
46 46
 	<p id="publicLinkSettings" class="indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
47 47
 		<input type="checkbox" name="shareapi_allow_public_upload" id="allowPublicUpload" class="checkbox"
48 48
 			   value="1" <?php if ($_['allowPublicUpload'] == 'yes') print_unescaped('checked="checked"'); ?> />
49
-		<label for="allowPublicUpload"><?php p($l->t('Allow public uploads'));?></label><br/>
49
+		<label for="allowPublicUpload"><?php p($l->t('Allow public uploads')); ?></label><br/>
50 50
 		<input type="checkbox" name="shareapi_enable_link_password_by_default" id="enableLinkPasswordByDefault" class="checkbox"
51 51
 			   value="1" <?php if ($_['enableLinkPasswordByDefault'] === 'yes') print_unescaped('checked="checked"'); ?> />
52
-		<label for="enableLinkPasswordByDefault"><?php p($l->t('Always ask for a password'));?></label><br/>
52
+		<label for="enableLinkPasswordByDefault"><?php p($l->t('Always ask for a password')); ?></label><br/>
53 53
 		<input type="checkbox" name="shareapi_enforce_links_password" id="enforceLinkPassword" class="checkbox"
54 54
 			   value="1" <?php if ($_['enforceLinkPassword']) print_unescaped('checked="checked"'); ?> />
55
-		<label for="enforceLinkPassword"><?php p($l->t('Enforce password protection'));?></label><br/>
55
+		<label for="enforceLinkPassword"><?php p($l->t('Enforce password protection')); ?></label><br/>
56 56
 
57 57
 		<input type="checkbox" name="shareapi_default_expire_date" id="shareapiDefaultExpireDate" class="checkbox"
58 58
 			   value="1" <?php if ($_['shareDefaultExpireDateSet'] === 'yes') print_unescaped('checked="checked"'); ?> />
59
-		<label for="shareapiDefaultExpireDate"><?php p($l->t('Set default expiration date'));?></label><br/>
59
+		<label for="shareapiDefaultExpireDate"><?php p($l->t('Set default expiration date')); ?></label><br/>
60 60
 
61 61
 	</p>
62
-	<p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden');?>">
63
-		<?php p($l->t( 'Expire after ' )); ?>
62
+	<p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
63
+		<?php p($l->t('Expire after ')); ?>
64 64
 		<input type="text" name='shareapi_expire_after_n_days' id="shareapiExpireAfterNDays" placeholder="<?php p('7')?>"
65 65
 			   value='<?php p($_['shareExpireAfterNDays']) ?>' />
66
-		<?php p($l->t( 'days' )); ?>
66
+		<?php p($l->t('days')); ?>
67 67
 		<input type="checkbox" name="shareapi_enforce_expire_date" id="shareapiEnforceExpireDate" class="checkbox"
68 68
 			   value="1" <?php if ($_['shareEnforceExpireDate'] === 'yes') print_unescaped('checked="checked"'); ?> />
69
-		<label for="shareapiEnforceExpireDate"><?php p($l->t('Enforce expiration date'));?></label><br/>
69
+		<label for="shareapiEnforceExpireDate"><?php p($l->t('Enforce expiration date')); ?></label><br/>
70 70
 	</p>
71
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
71
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
72 72
 		<input type="checkbox" name="shareapi_allow_resharing" id="allowResharing" class="checkbox"
73 73
 			   value="1" <?php if ($_['allowResharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
74
-		<label for="allowResharing"><?php p($l->t('Allow resharing'));?></label><br/>
74
+		<label for="allowResharing"><?php p($l->t('Allow resharing')); ?></label><br/>
75 75
 	</p>
76
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
76
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
77 77
 		<input type="checkbox" name="shareapi_allow_group_sharing" id="allowGroupSharing" class="checkbox"
78 78
 			   value="1" <?php if ($_['allowGroupSharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
79
-		<label for="allowGroupSharing"><?php p($l->t('Allow sharing with groups'));?></label><br />
79
+		<label for="allowGroupSharing"><?php p($l->t('Allow sharing with groups')); ?></label><br />
80 80
 	</p>
81
-	<p class="nocheckbox <?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
81
+	<p class="nocheckbox <?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
82 82
 		<input type="hidden" name="shareapi_default_permissions" id="shareApiDefaultPermissions" class="checkbox"
83 83
 			   value="<?php p($_['shareApiDefaultPermissions']) ?>" />
84
-		<?php p($l->t('Default user and group share permissions'));?>
84
+		<?php p($l->t('Default user and group share permissions')); ?>
85 85
 	</p>
86 86
 	<p id="shareApiDefaultPermissionsSection" class="indent <?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
87 87
 		<?php foreach ($_['shareApiDefaultPermissionsCheckboxes'] as $perm): ?>
88 88
 			<input type="checkbox" name="shareapi_default_permission_<?php p($perm['id']) ?>" id="shareapi_default_permission_<?php p($perm['id']) ?>"
89 89
 				   class="noautosave checkbox" value="<?php p($perm['value']) ?>" <?php if (($_['shareApiDefaultPermissions'] & $perm['value']) !== 0) print_unescaped('checked="checked"'); ?> />
90
-			<label for="shareapi_default_permission_<?php p($perm['id']) ?>"><?php p($perm['label']);?></label>
90
+			<label for="shareapi_default_permission_<?php p($perm['id']) ?>"><?php p($perm['label']); ?></label>
91 91
 		<?php endforeach ?>
92 92
 	</p>
93
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
93
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
94 94
 		<input type="checkbox" name="shareapi_only_share_with_group_members" id="onlyShareWithGroupMembers" class="checkbox"
95 95
 			   value="1" <?php if ($_['onlyShareWithGroupMembers']) print_unescaped('checked="checked"'); ?> />
96
-		<label for="onlyShareWithGroupMembers"><?php p($l->t('Restrict users to only share with users in their groups'));?></label><br/>
96
+		<label for="onlyShareWithGroupMembers"><?php p($l->t('Restrict users to only share with users in their groups')); ?></label><br/>
97 97
 	</p>
98
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
98
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
99 99
 		<input type="checkbox" name="shareapi_exclude_groups" id="shareapiExcludeGroups" class="checkbox"
100 100
 			   value="1" <?php if ($_['shareExcludeGroups']) print_unescaped('checked="checked"'); ?> />
101
-		<label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing'));?></label><br/>
101
+		<label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing')); ?></label><br/>
102 102
 	</p>
103 103
 	<p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
104 104
 		<input name="shareapi_exclude_groups_list" type="hidden" id="excludedGroups" value="<?php p($_['shareExcludedGroupsList']) ?>" style="width: 400px" class="noJSAutoUpdate"/>
105 105
 		<br />
106 106
 		<em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em>
107 107
 	</p>
108
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
108
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
109 109
 		<input type="checkbox" name="shareapi_allow_share_dialog_user_enumeration" value="1" id="shareapi_allow_share_dialog_user_enumeration" class="checkbox"
110 110
 			<?php if ($_['allowShareDialogUserEnumeration'] === 'yes') print_unescaped('checked="checked"'); ?> />
111
-		<label for="shareapi_allow_share_dialog_user_enumeration"><?php p($l->t('Allow username autocompletion in share dialog. If this is disabled the full username or email address needs to be entered.'));?></label><br />
111
+		<label for="shareapi_allow_share_dialog_user_enumeration"><?php p($l->t('Allow username autocompletion in share dialog. If this is disabled the full username or email address needs to be entered.')); ?></label><br />
112 112
 	</p>
113 113
 	<p>
114 114
 		<input type="checkbox" id="publicShareDisclaimer" class="checkbox noJSAutoUpdate"
115 115
 			<?php if ($_['publicShareDisclaimerText'] !== null) print_unescaped('checked="checked"'); ?> />
116
-		<label for="publicShareDisclaimer"><?php p($l->t('Show disclaimer text on the public link upload page. (Only shown when the file list is hidden.)'));?></label>
116
+		<label for="publicShareDisclaimer"><?php p($l->t('Show disclaimer text on the public link upload page. (Only shown when the file list is hidden.)')); ?></label>
117 117
 		<span id="publicShareDisclaimerStatus" class="msg" style="display:none"></span>
118 118
 		<br/>
119 119
 		<textarea placeholder="<?php p($l->t('This text will be shown on the public link upload page when the file list is hidden.')) ?>" id="publicShareDisclaimerText" <?php if ($_['publicShareDisclaimerText'] === null) { print_unescaped('class="hidden"'); } ?>><?php p($_['publicShareDisclaimerText']) ?></textarea>
Please login to merge, or discard this patch.
Braces   +100 added lines, -25 removed lines patch added patch discarded remove patch
@@ -34,85 +34,160 @@
 block discarded – undo
34 34
         <p class="settings-hint"><?php p($l->t('As admin you can fine-tune the sharing behavior. Please see the documentation for more information.'));?></p>
35 35
 	<p id="enable">
36 36
 		<input type="checkbox" name="shareapi_enabled" id="shareAPIEnabled" class="checkbox"
37
-			   value="1" <?php if ($_['shareAPIEnabled'] === 'yes') print_unescaped('checked="checked"'); ?> />
37
+			   value="1" <?php if ($_['shareAPIEnabled'] === 'yes') {
38
+    print_unescaped('checked="checked"');
39
+}
40
+?> />
38 41
 		<label for="shareAPIEnabled"><?php p($l->t('Allow apps to use the Share API'));?></label><br/>
39 42
 	</p>
40
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
43
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
44
+    p('hidden');
45
+}
46
+?>">
41 47
 		<input type="checkbox" name="shareapi_allow_links" id="allowLinks" class="checkbox"
42
-			   value="1" <?php if ($_['allowLinks'] === 'yes') print_unescaped('checked="checked"'); ?> />
48
+			   value="1" <?php if ($_['allowLinks'] === 'yes') {
49
+    print_unescaped('checked="checked"');
50
+}
51
+?> />
43 52
 		<label for="allowLinks"><?php p($l->t('Allow users to share via link'));?></label><br/>
44 53
 	</p>
45 54
 
46
-	<p id="publicLinkSettings" class="indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
55
+	<p id="publicLinkSettings" class="indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareAPIEnabled'] === 'no') {
56
+    p('hidden');
57
+}
58
+?>">
47 59
 		<input type="checkbox" name="shareapi_allow_public_upload" id="allowPublicUpload" class="checkbox"
48
-			   value="1" <?php if ($_['allowPublicUpload'] == 'yes') print_unescaped('checked="checked"'); ?> />
60
+			   value="1" <?php if ($_['allowPublicUpload'] == 'yes') {
61
+    print_unescaped('checked="checked"');
62
+}
63
+?> />
49 64
 		<label for="allowPublicUpload"><?php p($l->t('Allow public uploads'));?></label><br/>
50 65
 		<input type="checkbox" name="shareapi_enable_link_password_by_default" id="enableLinkPasswordByDefault" class="checkbox"
51
-			   value="1" <?php if ($_['enableLinkPasswordByDefault'] === 'yes') print_unescaped('checked="checked"'); ?> />
66
+			   value="1" <?php if ($_['enableLinkPasswordByDefault'] === 'yes') {
67
+    print_unescaped('checked="checked"');
68
+}
69
+?> />
52 70
 		<label for="enableLinkPasswordByDefault"><?php p($l->t('Always ask for a password'));?></label><br/>
53 71
 		<input type="checkbox" name="shareapi_enforce_links_password" id="enforceLinkPassword" class="checkbox"
54
-			   value="1" <?php if ($_['enforceLinkPassword']) print_unescaped('checked="checked"'); ?> />
72
+			   value="1" <?php if ($_['enforceLinkPassword']) {
73
+    print_unescaped('checked="checked"');
74
+}
75
+?> />
55 76
 		<label for="enforceLinkPassword"><?php p($l->t('Enforce password protection'));?></label><br/>
56 77
 
57 78
 		<input type="checkbox" name="shareapi_default_expire_date" id="shareapiDefaultExpireDate" class="checkbox"
58
-			   value="1" <?php if ($_['shareDefaultExpireDateSet'] === 'yes') print_unescaped('checked="checked"'); ?> />
79
+			   value="1" <?php if ($_['shareDefaultExpireDateSet'] === 'yes') {
80
+    print_unescaped('checked="checked"');
81
+}
82
+?> />
59 83
 		<label for="shareapiDefaultExpireDate"><?php p($l->t('Set default expiration date'));?></label><br/>
60 84
 
61 85
 	</p>
62
-	<p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden');?>">
86
+	<p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') {
87
+    p('hidden');
88
+}
89
+?>">
63 90
 		<?php p($l->t( 'Expire after ' )); ?>
64 91
 		<input type="text" name='shareapi_expire_after_n_days' id="shareapiExpireAfterNDays" placeholder="<?php p('7')?>"
65 92
 			   value='<?php p($_['shareExpireAfterNDays']) ?>' />
66 93
 		<?php p($l->t( 'days' )); ?>
67 94
 		<input type="checkbox" name="shareapi_enforce_expire_date" id="shareapiEnforceExpireDate" class="checkbox"
68
-			   value="1" <?php if ($_['shareEnforceExpireDate'] === 'yes') print_unescaped('checked="checked"'); ?> />
95
+			   value="1" <?php if ($_['shareEnforceExpireDate'] === 'yes') {
96
+    print_unescaped('checked="checked"');
97
+}
98
+?> />
69 99
 		<label for="shareapiEnforceExpireDate"><?php p($l->t('Enforce expiration date'));?></label><br/>
70 100
 	</p>
71
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
101
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
102
+    p('hidden');
103
+}
104
+?>">
72 105
 		<input type="checkbox" name="shareapi_allow_resharing" id="allowResharing" class="checkbox"
73
-			   value="1" <?php if ($_['allowResharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
106
+			   value="1" <?php if ($_['allowResharing'] === 'yes') {
107
+    print_unescaped('checked="checked"');
108
+}
109
+?> />
74 110
 		<label for="allowResharing"><?php p($l->t('Allow resharing'));?></label><br/>
75 111
 	</p>
76
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
112
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
113
+    p('hidden');
114
+}
115
+?>">
77 116
 		<input type="checkbox" name="shareapi_allow_group_sharing" id="allowGroupSharing" class="checkbox"
78
-			   value="1" <?php if ($_['allowGroupSharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
117
+			   value="1" <?php if ($_['allowGroupSharing'] === 'yes') {
118
+    print_unescaped('checked="checked"');
119
+}
120
+?> />
79 121
 		<label for="allowGroupSharing"><?php p($l->t('Allow sharing with groups'));?></label><br />
80 122
 	</p>
81
-	<p class="nocheckbox <?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
123
+	<p class="nocheckbox <?php if ($_['shareAPIEnabled'] === 'no') {
124
+    p('hidden');
125
+}
126
+?>">
82 127
 		<input type="hidden" name="shareapi_default_permissions" id="shareApiDefaultPermissions" class="checkbox"
83 128
 			   value="<?php p($_['shareApiDefaultPermissions']) ?>" />
84 129
 		<?php p($l->t('Default user and group share permissions'));?>
85 130
 	</p>
86
-	<p id="shareApiDefaultPermissionsSection" class="indent <?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
131
+	<p id="shareApiDefaultPermissionsSection" class="indent <?php if ($_['shareAPIEnabled'] === 'no') {
132
+    p('hidden');
133
+}
134
+?>">
87 135
 		<?php foreach ($_['shareApiDefaultPermissionsCheckboxes'] as $perm): ?>
88 136
 			<input type="checkbox" name="shareapi_default_permission_<?php p($perm['id']) ?>" id="shareapi_default_permission_<?php p($perm['id']) ?>"
89
-				   class="noautosave checkbox" value="<?php p($perm['value']) ?>" <?php if (($_['shareApiDefaultPermissions'] & $perm['value']) !== 0) print_unescaped('checked="checked"'); ?> />
137
+				   class="noautosave checkbox" value="<?php p($perm['value']) ?>" <?php if (($_['shareApiDefaultPermissions'] & $perm['value']) !== 0) {
138
+    print_unescaped('checked="checked"');
139
+}
140
+?> />
90 141
 			<label for="shareapi_default_permission_<?php p($perm['id']) ?>"><?php p($perm['label']);?></label>
91 142
 		<?php endforeach ?>
92 143
 	</p>
93
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
144
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
145
+    p('hidden');
146
+}
147
+?>">
94 148
 		<input type="checkbox" name="shareapi_only_share_with_group_members" id="onlyShareWithGroupMembers" class="checkbox"
95
-			   value="1" <?php if ($_['onlyShareWithGroupMembers']) print_unescaped('checked="checked"'); ?> />
149
+			   value="1" <?php if ($_['onlyShareWithGroupMembers']) {
150
+    print_unescaped('checked="checked"');
151
+}
152
+?> />
96 153
 		<label for="onlyShareWithGroupMembers"><?php p($l->t('Restrict users to only share with users in their groups'));?></label><br/>
97 154
 	</p>
98
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
155
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
156
+    p('hidden');
157
+}
158
+?>">
99 159
 		<input type="checkbox" name="shareapi_exclude_groups" id="shareapiExcludeGroups" class="checkbox"
100
-			   value="1" <?php if ($_['shareExcludeGroups']) print_unescaped('checked="checked"'); ?> />
160
+			   value="1" <?php if ($_['shareExcludeGroups']) {
161
+    print_unescaped('checked="checked"');
162
+}
163
+?> />
101 164
 		<label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing'));?></label><br/>
102 165
 	</p>
103
-	<p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
166
+	<p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') {
167
+    p('hidden');
168
+}
169
+?>">
104 170
 		<input name="shareapi_exclude_groups_list" type="hidden" id="excludedGroups" value="<?php p($_['shareExcludedGroupsList']) ?>" style="width: 400px" class="noJSAutoUpdate"/>
105 171
 		<br />
106 172
 		<em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em>
107 173
 	</p>
108
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
174
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
175
+    p('hidden');
176
+}
177
+?>">
109 178
 		<input type="checkbox" name="shareapi_allow_share_dialog_user_enumeration" value="1" id="shareapi_allow_share_dialog_user_enumeration" class="checkbox"
110
-			<?php if ($_['allowShareDialogUserEnumeration'] === 'yes') print_unescaped('checked="checked"'); ?> />
179
+			<?php if ($_['allowShareDialogUserEnumeration'] === 'yes') {
180
+    print_unescaped('checked="checked"');
181
+}
182
+?> />
111 183
 		<label for="shareapi_allow_share_dialog_user_enumeration"><?php p($l->t('Allow username autocompletion in share dialog. If this is disabled the full username or email address needs to be entered.'));?></label><br />
112 184
 	</p>
113 185
 	<p>
114 186
 		<input type="checkbox" id="publicShareDisclaimer" class="checkbox noJSAutoUpdate"
115
-			<?php if ($_['publicShareDisclaimerText'] !== null) print_unescaped('checked="checked"'); ?> />
187
+			<?php if ($_['publicShareDisclaimerText'] !== null) {
188
+    print_unescaped('checked="checked"');
189
+}
190
+?> />
116 191
 		<label for="publicShareDisclaimer"><?php p($l->t('Show disclaimer text on the public link upload page. (Only shown when the file list is hidden.)'));?></label>
117 192
 		<span id="publicShareDisclaimerStatus" class="msg" style="display:none"></span>
118 193
 		<br/>
Please login to merge, or discard this patch.
core/Controller/OCJSController.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -43,62 +43,62 @@
 block discarded – undo
43 43
 
44 44
 class OCJSController extends Controller {
45 45
 
46
-	/** @var JSConfigHelper */
47
-	private $helper;
46
+    /** @var JSConfigHelper */
47
+    private $helper;
48 48
 
49
-	/**
50
-	 * OCJSController constructor.
51
-	 *
52
-	 * @param string $appName
53
-	 * @param IRequest $request
54
-	 * @param IL10N $l
55
-	 * @param Defaults $defaults
56
-	 * @param IAppManager $appManager
57
-	 * @param ISession $session
58
-	 * @param IUserSession $userSession
59
-	 * @param IConfig $config
60
-	 * @param IGroupManager $groupManager
61
-	 * @param IniGetWrapper $iniWrapper
62
-	 * @param IURLGenerator $urlGenerator
63
-	 * @param CapabilitiesManager $capabilitiesManager
64
-	 */
65
-	public function __construct($appName,
66
-								IRequest $request,
67
-								IL10N $l,
68
-								Defaults $defaults,
69
-								IAppManager $appManager,
70
-								ISession $session,
71
-								IUserSession $userSession,
72
-								IConfig $config,
73
-								IGroupManager $groupManager,
74
-								IniGetWrapper $iniWrapper,
75
-								IURLGenerator $urlGenerator,
76
-								CapabilitiesManager $capabilitiesManager) {
77
-		parent::__construct($appName, $request);
49
+    /**
50
+     * OCJSController constructor.
51
+     *
52
+     * @param string $appName
53
+     * @param IRequest $request
54
+     * @param IL10N $l
55
+     * @param Defaults $defaults
56
+     * @param IAppManager $appManager
57
+     * @param ISession $session
58
+     * @param IUserSession $userSession
59
+     * @param IConfig $config
60
+     * @param IGroupManager $groupManager
61
+     * @param IniGetWrapper $iniWrapper
62
+     * @param IURLGenerator $urlGenerator
63
+     * @param CapabilitiesManager $capabilitiesManager
64
+     */
65
+    public function __construct($appName,
66
+                                IRequest $request,
67
+                                IL10N $l,
68
+                                Defaults $defaults,
69
+                                IAppManager $appManager,
70
+                                ISession $session,
71
+                                IUserSession $userSession,
72
+                                IConfig $config,
73
+                                IGroupManager $groupManager,
74
+                                IniGetWrapper $iniWrapper,
75
+                                IURLGenerator $urlGenerator,
76
+                                CapabilitiesManager $capabilitiesManager) {
77
+        parent::__construct($appName, $request);
78 78
 
79
-		$this->helper = new JSConfigHelper(
80
-			$l,
81
-			$defaults,
82
-			$appManager,
83
-			$session,
84
-			$userSession->getUser(),
85
-			$config,
86
-			$groupManager,
87
-			$iniWrapper,
88
-			$urlGenerator,
89
-			$capabilitiesManager
90
-		);
91
-	}
79
+        $this->helper = new JSConfigHelper(
80
+            $l,
81
+            $defaults,
82
+            $appManager,
83
+            $session,
84
+            $userSession->getUser(),
85
+            $config,
86
+            $groupManager,
87
+            $iniWrapper,
88
+            $urlGenerator,
89
+            $capabilitiesManager
90
+        );
91
+    }
92 92
 
93
-	/**
94
-	 * @NoCSRFRequired
95
-	 * @PublicPage
96
-	 *
97
-	 * @return DataDisplayResponse
98
-	 */
99
-	public function getConfig() {
100
-		$data = $this->helper->getConfig();
93
+    /**
94
+     * @NoCSRFRequired
95
+     * @PublicPage
96
+     *
97
+     * @return DataDisplayResponse
98
+     */
99
+    public function getConfig() {
100
+        $data = $this->helper->getConfig();
101 101
 
102
-		return new DataDisplayResponse($data, Http::STATUS_OK, ['Content-type' => 'text/javascript']);
103
-	}
102
+        return new DataDisplayResponse($data, Http::STATUS_OK, ['Content-type' => 'text/javascript']);
103
+    }
104 104
 }
Please login to merge, or discard this patch.