Completed
Pull Request — master (#9029)
by Julius
17:06
created
lib/private/Settings/Admin/Mail.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -30,57 +30,57 @@
 block discarded – undo
30 30
 use OCP\Settings\ISettings;
31 31
 
32 32
 class Mail implements ISettings {
33
-	/** @var IConfig */
34
-	private $config;
33
+    /** @var IConfig */
34
+    private $config;
35 35
 
36
-	/**
37
-	 * @param IConfig $config
38
-	 */
39
-	public function __construct(IConfig $config) {
40
-		$this->config = $config;
41
-	}
36
+    /**
37
+     * @param IConfig $config
38
+     */
39
+    public function __construct(IConfig $config) {
40
+        $this->config = $config;
41
+    }
42 42
 
43
-	/**
44
-	 * @return TemplateResponse
45
-	 */
46
-	public function getForm() {
47
-		$parameters = [
48
-			// Mail
49
-			'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'),
50
-			'mail_domain'           => $this->config->getSystemValue('mail_domain', ''),
51
-			'mail_from_address'     => $this->config->getSystemValue('mail_from_address', ''),
52
-			'mail_smtpmode'         => $this->config->getSystemValue('mail_smtpmode', ''),
53
-			'mail_smtpsecure'       => $this->config->getSystemValue('mail_smtpsecure', ''),
54
-			'mail_smtphost'         => $this->config->getSystemValue('mail_smtphost', ''),
55
-			'mail_smtpport'         => $this->config->getSystemValue('mail_smtpport', ''),
56
-			'mail_smtpauthtype'     => $this->config->getSystemValue('mail_smtpauthtype', ''),
57
-			'mail_smtpauth'         => $this->config->getSystemValue('mail_smtpauth', false),
58
-			'mail_smtpname'         => $this->config->getSystemValue('mail_smtpname', ''),
59
-			'mail_smtppassword'     => $this->config->getSystemValue('mail_smtppassword', ''),
60
-		];
43
+    /**
44
+     * @return TemplateResponse
45
+     */
46
+    public function getForm() {
47
+        $parameters = [
48
+            // Mail
49
+            'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'),
50
+            'mail_domain'           => $this->config->getSystemValue('mail_domain', ''),
51
+            'mail_from_address'     => $this->config->getSystemValue('mail_from_address', ''),
52
+            'mail_smtpmode'         => $this->config->getSystemValue('mail_smtpmode', ''),
53
+            'mail_smtpsecure'       => $this->config->getSystemValue('mail_smtpsecure', ''),
54
+            'mail_smtphost'         => $this->config->getSystemValue('mail_smtphost', ''),
55
+            'mail_smtpport'         => $this->config->getSystemValue('mail_smtpport', ''),
56
+            'mail_smtpauthtype'     => $this->config->getSystemValue('mail_smtpauthtype', ''),
57
+            'mail_smtpauth'         => $this->config->getSystemValue('mail_smtpauth', false),
58
+            'mail_smtpname'         => $this->config->getSystemValue('mail_smtpname', ''),
59
+            'mail_smtppassword'     => $this->config->getSystemValue('mail_smtppassword', ''),
60
+        ];
61 61
 
62
-		if ($parameters['mail_smtppassword'] !== '') {
63
-			$parameters['mail_smtppassword'] = '********';
64
-		}
62
+        if ($parameters['mail_smtppassword'] !== '') {
63
+            $parameters['mail_smtppassword'] = '********';
64
+        }
65 65
 
66
-		return new TemplateResponse('settings', 'settings/admin/additional-mail', $parameters, '');
67
-	}
66
+        return new TemplateResponse('settings', 'settings/admin/additional-mail', $parameters, '');
67
+    }
68 68
 
69
-	/**
70
-	 * @return string the section ID, e.g. 'sharing'
71
-	 */
72
-	public function getSection() {
73
-		return 'server';
74
-	}
69
+    /**
70
+     * @return string the section ID, e.g. 'sharing'
71
+     */
72
+    public function getSection() {
73
+        return 'server';
74
+    }
75 75
 
76
-	/**
77
-	 * @return int whether the form should be rather on the top or bottom of
78
-	 * the admin section. The forms are arranged in ascending order of the
79
-	 * priority values. It is required to return a value between 0 and 100.
80
-	 *
81
-	 * E.g.: 70
82
-	 */
83
-	public function getPriority() {
84
-		return 10;
85
-	}
76
+    /**
77
+     * @return int whether the form should be rather on the top or bottom of
78
+     * the admin section. The forms are arranged in ascending order of the
79
+     * priority values. It is required to return a value between 0 and 100.
80
+     *
81
+     * E.g.: 70
82
+     */
83
+    public function getPriority() {
84
+        return 10;
85
+    }
86 86
 }
Please login to merge, or discard this patch.
lib/private/Settings/Admin/Overview.php 2 patches
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -37,123 +37,123 @@
 block discarded – undo
37 37
 use OCP\Settings\ISettings;
38 38
 
39 39
 class Overview implements ISettings {
40
-	/** @var IDBConnection|Connection */
41
-	private $db;
42
-	/** @var IRequest */
43
-	private $request;
44
-	/** @var IConfig */
45
-	private $config;
46
-	/** @var ILockingProvider */
47
-	private $lockingProvider;
48
-	/** @var IL10N */
49
-	private $l;
40
+    /** @var IDBConnection|Connection */
41
+    private $db;
42
+    /** @var IRequest */
43
+    private $request;
44
+    /** @var IConfig */
45
+    private $config;
46
+    /** @var ILockingProvider */
47
+    private $lockingProvider;
48
+    /** @var IL10N */
49
+    private $l;
50 50
 
51
-	/**
52
-	 * @param IDBConnection $db
53
-	 * @param IRequest $request
54
-	 * @param IConfig $config
55
-	 * @param ILockingProvider $lockingProvider
56
-	 * @param IL10N $l
57
-	 */
58
-	public function __construct(IDBConnection $db,
59
-								IRequest $request,
60
-								IConfig $config,
61
-								ILockingProvider $lockingProvider,
62
-								IL10N $l) {
63
-		$this->db = $db;
64
-		$this->request = $request;
65
-		$this->config = $config;
66
-		$this->lockingProvider = $lockingProvider;
67
-		$this->l = $l;
68
-	}
51
+    /**
52
+     * @param IDBConnection $db
53
+     * @param IRequest $request
54
+     * @param IConfig $config
55
+     * @param ILockingProvider $lockingProvider
56
+     * @param IL10N $l
57
+     */
58
+    public function __construct(IDBConnection $db,
59
+                                IRequest $request,
60
+                                IConfig $config,
61
+                                ILockingProvider $lockingProvider,
62
+                                IL10N $l) {
63
+        $this->db = $db;
64
+        $this->request = $request;
65
+        $this->config = $config;
66
+        $this->lockingProvider = $lockingProvider;
67
+        $this->l = $l;
68
+    }
69 69
 
70
-	/**
71
-	 * @return TemplateResponse
72
-	 */
73
-	public function getForm() {
74
-		try {
75
-			if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) {
76
-				$invalidTransactionIsolationLevel = false;
77
-			} else {
78
-				$invalidTransactionIsolationLevel = $this->db->getTransactionIsolation() !== Connection::TRANSACTION_READ_COMMITTED;
79
-			}
80
-		} catch (DBALException $e) {
81
-			// ignore
82
-			$invalidTransactionIsolationLevel = false;
83
-		}
70
+    /**
71
+     * @return TemplateResponse
72
+     */
73
+    public function getForm() {
74
+        try {
75
+            if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) {
76
+                $invalidTransactionIsolationLevel = false;
77
+            } else {
78
+                $invalidTransactionIsolationLevel = $this->db->getTransactionIsolation() !== Connection::TRANSACTION_READ_COMMITTED;
79
+            }
80
+        } catch (DBALException $e) {
81
+            // ignore
82
+            $invalidTransactionIsolationLevel = false;
83
+        }
84 84
 
85
-		$envPath = getenv('PATH');
85
+        $envPath = getenv('PATH');
86 86
 
87
-		// warn if outdated version of a memcache module is used
88
-		$caches = [
89
-			'apcu'	=> ['name' => $this->l->t('APCu'), 'version' => '4.0.6'],
90
-			'redis'	=> ['name' => $this->l->t('Redis'), 'version' => '2.2.5'],
91
-		];
92
-		$outdatedCaches = [];
93
-		foreach ($caches as $php_module => $data) {
94
-			$isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<');
95
-			if ($isOutdated) {
96
-				$outdatedCaches[$php_module] = $data;
97
-			}
98
-		}
87
+        // warn if outdated version of a memcache module is used
88
+        $caches = [
89
+            'apcu'	=> ['name' => $this->l->t('APCu'), 'version' => '4.0.6'],
90
+            'redis'	=> ['name' => $this->l->t('Redis'), 'version' => '2.2.5'],
91
+        ];
92
+        $outdatedCaches = [];
93
+        foreach ($caches as $php_module => $data) {
94
+            $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<');
95
+            if ($isOutdated) {
96
+                $outdatedCaches[$php_module] = $data;
97
+            }
98
+        }
99 99
 
100
-		if ($this->lockingProvider instanceof NoopLockingProvider) {
101
-			$fileLockingType = 'none';
102
-		} else if ($this->lockingProvider instanceof DBLockingProvider) {
103
-			$fileLockingType = 'db';
104
-		} else {
105
-			$fileLockingType = 'cache';
106
-		}
100
+        if ($this->lockingProvider instanceof NoopLockingProvider) {
101
+            $fileLockingType = 'none';
102
+        } else if ($this->lockingProvider instanceof DBLockingProvider) {
103
+            $fileLockingType = 'db';
104
+        } else {
105
+            $fileLockingType = 'cache';
106
+        }
107 107
 
108
-		$suggestedOverwriteCliUrl = '';
109
-		if ($this->config->getSystemValue('overwrite.cli.url', '') === '') {
110
-			$suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
111
-			if (!$this->config->getSystemValue('config_is_read_only', false)) {
112
-				// Set the overwrite URL when it was not set yet.
113
-				$this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl);
114
-				$suggestedOverwriteCliUrl = '';
115
-			}
116
-		}
108
+        $suggestedOverwriteCliUrl = '';
109
+        if ($this->config->getSystemValue('overwrite.cli.url', '') === '') {
110
+            $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
111
+            if (!$this->config->getSystemValue('config_is_read_only', false)) {
112
+                // Set the overwrite URL when it was not set yet.
113
+                $this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl);
114
+                $suggestedOverwriteCliUrl = '';
115
+            }
116
+        }
117 117
 
118
-		$parameters = [
119
-			// Diagnosis
120
-			'readOnlyConfigEnabled'            => \OC_Helper::isReadOnlyConfigEnabled(),
121
-			'isLocaleWorking'                  => \OC_Util::isSetLocaleWorking(),
122
-			'isAnnotationsWorking'             => \OC_Util::isAnnotationsWorking(),
123
-			'checkForWorkingWellKnownSetup'    => $this->config->getSystemValue('check_for_working_wellknown_setup', true),
124
-			'has_fileinfo'                     => \OC_Util::fileInfoLoaded(),
125
-			'invalidTransactionIsolationLevel' => $invalidTransactionIsolationLevel,
126
-			'getenvServerNotWorking'           => empty($envPath),
127
-			'OutdatedCacheWarning'             => $outdatedCaches,
128
-			'fileLockingType'                  => $fileLockingType,
129
-			'suggestedOverwriteCliUrl'         => $suggestedOverwriteCliUrl,
118
+        $parameters = [
119
+            // Diagnosis
120
+            'readOnlyConfigEnabled'            => \OC_Helper::isReadOnlyConfigEnabled(),
121
+            'isLocaleWorking'                  => \OC_Util::isSetLocaleWorking(),
122
+            'isAnnotationsWorking'             => \OC_Util::isAnnotationsWorking(),
123
+            'checkForWorkingWellKnownSetup'    => $this->config->getSystemValue('check_for_working_wellknown_setup', true),
124
+            'has_fileinfo'                     => \OC_Util::fileInfoLoaded(),
125
+            'invalidTransactionIsolationLevel' => $invalidTransactionIsolationLevel,
126
+            'getenvServerNotWorking'           => empty($envPath),
127
+            'OutdatedCacheWarning'             => $outdatedCaches,
128
+            'fileLockingType'                  => $fileLockingType,
129
+            'suggestedOverwriteCliUrl'         => $suggestedOverwriteCliUrl,
130 130
 
131
-			// Background jobs
132
-			'backgroundjobs_mode' => $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'),
133
-			'lastcron'            => $this->config->getAppValue('core', 'lastcron', false),
134
-			'cronErrors'		  => $this->config->getAppValue('core', 'cronErrors'),
135
-			'cli_based_cron_possible' => function_exists('posix_getpwuid'),
136
-			'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '',
137
-		];
131
+            // Background jobs
132
+            'backgroundjobs_mode' => $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'),
133
+            'lastcron'            => $this->config->getAppValue('core', 'lastcron', false),
134
+            'cronErrors'		  => $this->config->getAppValue('core', 'cronErrors'),
135
+            'cli_based_cron_possible' => function_exists('posix_getpwuid'),
136
+            'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '',
137
+        ];
138 138
 
139
-		return new TemplateResponse('settings', 'settings/admin/overview', $parameters, '');
140
-	}
139
+        return new TemplateResponse('settings', 'settings/admin/overview', $parameters, '');
140
+    }
141 141
 
142
-	/**
143
-	 * @return string the section ID, e.g. 'sharing'
144
-	 */
145
-	public function getSection() {
146
-		return 'overview';
147
-	}
142
+    /**
143
+     * @return string the section ID, e.g. 'sharing'
144
+     */
145
+    public function getSection() {
146
+        return 'overview';
147
+    }
148 148
 
149
-	/**
150
-	 * @return int whether the form should be rather on the top or bottom of
151
-	 * the admin section. The forms are arranged in ascending order of the
152
-	 * priority values. It is required to return a value between 0 and 100.
153
-	 *
154
-	 * E.g.: 70
155
-	 */
156
-	public function getPriority() {
157
-		return 10;
158
-	}
149
+    /**
150
+     * @return int whether the form should be rather on the top or bottom of
151
+     * the admin section. The forms are arranged in ascending order of the
152
+     * priority values. It is required to return a value between 0 and 100.
153
+     *
154
+     * E.g.: 70
155
+     */
156
+    public function getPriority() {
157
+        return 10;
158
+    }
159 159
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 		$suggestedOverwriteCliUrl = '';
109 109
 		if ($this->config->getSystemValue('overwrite.cli.url', '') === '') {
110
-			$suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
110
+			$suggestedOverwriteCliUrl = $this->request->getServerProtocol().'://'.$this->request->getInsecureServerHost().\OC::$WEBROOT;
111 111
 			if (!$this->config->getSystemValue('config_is_read_only', false)) {
112 112
 				// Set the overwrite URL when it was not set yet.
113 113
 				$this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 			'lastcron'            => $this->config->getAppValue('core', 'lastcron', false),
134 134
 			'cronErrors'		  => $this->config->getAppValue('core', 'cronErrors'),
135 135
 			'cli_based_cron_possible' => function_exists('posix_getpwuid'),
136
-			'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '',
136
+			'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir.'config.php'))['name'] : '',
137 137
 		];
138 138
 
139 139
 		return new TemplateResponse('settings', 'settings/admin/overview', $parameters, '');
Please login to merge, or discard this patch.
lib/private/Settings/Manager.php 1 patch
Indentation   +355 added lines, -355 removed lines patch added patch discarded remove patch
@@ -49,359 +49,359 @@
 block discarded – undo
49 49
 use OCP\Util;
50 50
 
51 51
 class Manager implements IManager {
52
-	/** @var ILogger */
53
-	private $log;
54
-	/** @var IDBConnection */
55
-	private $dbc;
56
-	/** @var IL10N */
57
-	private $l;
58
-	/** @var IConfig */
59
-	private $config;
60
-	/** @var EncryptionManager */
61
-	private $encryptionManager;
62
-	/** @var IUserManager */
63
-	private $userManager;
64
-	/** @var ILockingProvider */
65
-	private $lockingProvider;
66
-	/** @var IRequest */
67
-	private $request;
68
-	/** @var IURLGenerator */
69
-	private $url;
70
-	/** @var AccountManager */
71
-	private $accountManager;
72
-	/** @var IGroupManager */
73
-	private $groupManager;
74
-	/** @var IFactory */
75
-	private $l10nFactory;
76
-	/** @var IAppManager */
77
-	private $appManager;
78
-
79
-	/**
80
-	 * @param ILogger $log
81
-	 * @param IDBConnection $dbc
82
-	 * @param IL10N $l
83
-	 * @param IConfig $config
84
-	 * @param EncryptionManager $encryptionManager
85
-	 * @param IUserManager $userManager
86
-	 * @param ILockingProvider $lockingProvider
87
-	 * @param IRequest $request
88
-	 * @param IURLGenerator $url
89
-	 * @param AccountManager $accountManager
90
-	 * @param IGroupManager $groupManager
91
-	 * @param IFactory $l10nFactory
92
-	 * @param IAppManager $appManager
93
-	 */
94
-	public function __construct(
95
-		ILogger $log,
96
-		IDBConnection $dbc,
97
-		IL10N $l,
98
-		IConfig $config,
99
-		EncryptionManager $encryptionManager,
100
-		IUserManager $userManager,
101
-		ILockingProvider $lockingProvider,
102
-		IRequest $request,
103
-		IURLGenerator $url,
104
-		AccountManager $accountManager,
105
-		IGroupManager $groupManager,
106
-		IFactory $l10nFactory,
107
-		IAppManager $appManager
108
-	) {
109
-		$this->log = $log;
110
-		$this->dbc = $dbc;
111
-		$this->l = $l;
112
-		$this->config = $config;
113
-		$this->encryptionManager = $encryptionManager;
114
-		$this->userManager = $userManager;
115
-		$this->lockingProvider = $lockingProvider;
116
-		$this->request = $request;
117
-		$this->url = $url;
118
-		$this->accountManager = $accountManager;
119
-		$this->groupManager = $groupManager;
120
-		$this->l10nFactory = $l10nFactory;
121
-		$this->appManager = $appManager;
122
-	}
123
-
124
-	/** @var array */
125
-	protected $sectionClasses = [];
126
-
127
-	/** @var array */
128
-	protected $sections = [];
129
-
130
-	/**
131
-	 * @param string $type 'admin' or 'personal'
132
-	 * @param string $section Class must implement OCP\Settings\ISection
133
-	 * @return void
134
-	 */
135
-	public function registerSection(string $type, string $section) {
136
-		$this->sectionClasses[$section] = $type;
137
-	}
138
-
139
-	/**
140
-	 * @param string $type 'admin' or 'personal'
141
-	 * @return ISection[]
142
-	 */
143
-	protected function getSections(string $type): array {
144
-		if (!isset($this->sections[$type])) {
145
-			$this->sections[$type] = [];
146
-		}
147
-
148
-		foreach ($this->sectionClasses as $class => $sectionType) {
149
-			try {
150
-				/** @var ISection $section */
151
-				$section = \OC::$server->query($class);
152
-			} catch (QueryException $e) {
153
-				$this->log->logException($e, ['level' => Util::INFO]);
154
-				continue;
155
-			}
156
-
157
-			if (!$section instanceof ISection) {
158
-				$this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => Util::INFO]);
159
-				continue;
160
-			}
161
-
162
-			$this->sections[$sectionType][$section->getID()] = $section;
163
-
164
-			unset($this->sectionClasses[$class]);
165
-		}
166
-
167
-		return $this->sections[$type];
168
-	}
169
-
170
-	/** @var array */
171
-	protected $settingClasses = [];
172
-
173
-	/** @var array */
174
-	protected $settings = [];
175
-
176
-	/**
177
-	 * @param string $type 'admin' or 'personal'
178
-	 * @param string $setting Class must implement OCP\Settings\ISetting
179
-	 * @return void
180
-	 */
181
-	public function registerSetting(string $type, string $setting) {
182
-		$this->settingClasses[$setting] = $type;
183
-	}
184
-
185
-	/**
186
-	 * @param string $type 'admin' or 'personal'
187
-	 * @param string $section
188
-	 * @return ISettings[]
189
-	 */
190
-	protected function getSettings(string $type, string $section): array {
191
-		if (!isset($this->settings[$type])) {
192
-			$this->settings[$type] = [];
193
-		}
194
-		if (!isset($this->settings[$type][$section])) {
195
-			$this->settings[$type][$section] = [];
196
-		}
197
-
198
-		foreach ($this->settingClasses as $class => $settingsType) {
199
-			try {
200
-				/** @var ISettings $setting */
201
-				$setting = \OC::$server->query($class);
202
-			} catch (QueryException $e) {
203
-				$this->log->logException($e, ['level' => Util::INFO]);
204
-				continue;
205
-			}
206
-
207
-			if (!$setting instanceof ISettings) {
208
-				$this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => Util::INFO]);
209
-				continue;
210
-			}
211
-
212
-			if (!isset($this->settings[$settingsType][$setting->getSection()])) {
213
-				$this->settings[$settingsType][$setting->getSection()] = [];
214
-			}
215
-			$this->settings[$settingsType][$setting->getSection()][] = $setting;
216
-
217
-			unset($this->settingClasses[$class]);
218
-		}
219
-
220
-		return $this->settings[$type][$section];
221
-	}
222
-
223
-	/**
224
-	 * @inheritdoc
225
-	 */
226
-	public function getAdminSections(): array {
227
-		// built-in sections
228
-		$sections = [
229
-			0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))],
230
-			1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('settings', 'admin.svg'))],
231
-			5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
232
-			10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
233
-			45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
234
-			98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
235
-			99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
236
-		];
237
-
238
-		$appSections = $this->getSections('admin');
239
-
240
-		foreach ($appSections as $section) {
241
-			/** @var ISection $section */
242
-			if (!isset($sections[$section->getPriority()])) {
243
-				$sections[$section->getPriority()] = [];
244
-			}
245
-
246
-			$sections[$section->getPriority()][] = $section;
247
-		}
248
-
249
-		ksort($sections);
250
-
251
-		return $sections;
252
-	}
253
-
254
-	/**
255
-	 * @param string $section
256
-	 * @return ISection[]
257
-	 */
258
-	private function getBuiltInAdminSettings($section): array {
259
-		$forms = [];
260
-
261
-		if ($section === 'overview') {
262
-			/** @var ISettings $form */
263
-			$form = new Admin\Overview($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
264
-			$forms[$form->getPriority()] = [$form];
265
-			$form = new Admin\ServerDevNotice();
266
-			$forms[$form->getPriority()] = [$form];
267
-		}
268
-		if ($section === 'server') {
269
-			/** @var ISettings $form */
270
-			$form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
271
-			$forms[$form->getPriority()] = [$form];
272
-			$form = new Admin\Mail($this->config);
273
-			$forms[$form->getPriority()] = [$form];
274
-		}
275
-		if ($section === 'encryption') {
276
-			/** @var ISettings $form */
277
-			$form = new Admin\Encryption($this->encryptionManager, $this->userManager);
278
-			$forms[$form->getPriority()] = [$form];
279
-		}
280
-		if ($section === 'sharing') {
281
-			/** @var ISettings $form */
282
-			$form = new Admin\Sharing($this->config, $this->l);
283
-			$forms[$form->getPriority()] = [$form];
284
-		}
285
-		if ($section === 'tips-tricks') {
286
-			/** @var ISettings $form */
287
-			$form = new Admin\TipsTricks($this->config);
288
-			$forms[$form->getPriority()] = [$form];
289
-		}
290
-
291
-		return $forms;
292
-	}
293
-
294
-	/**
295
-	 * @param string $section
296
-	 * @return ISection[]
297
-	 */
298
-	private function getBuiltInPersonalSettings($section): array {
299
-		$forms = [];
300
-
301
-		if ($section === 'personal-info') {
302
-			/** @var ISettings $form */
303
-			$form = new Personal\PersonalInfo(
304
-				$this->config,
305
-				$this->userManager,
306
-				$this->groupManager,
307
-				$this->accountManager,
308
-				$this->appManager,
309
-				$this->l10nFactory,
310
-				$this->l
311
-			);
312
-			$forms[$form->getPriority()] = [$form];
313
-		}
314
-		if($section === 'security') {
315
-			/** @var ISettings $form */
316
-			$form = new Personal\Security();
317
-			$forms[$form->getPriority()] = [$form];
318
-		}
319
-		if ($section === 'additional') {
320
-			/** @var ISettings $form */
321
-			$form = new Personal\Additional();
322
-			$forms[$form->getPriority()] = [$form];
323
-		}
324
-
325
-		return $forms;
326
-	}
327
-
328
-	/**
329
-	 * @inheritdoc
330
-	 */
331
-	public function getAdminSettings($section): array {
332
-		$settings = $this->getBuiltInAdminSettings($section);
333
-		$appSettings = $this->getSettings('admin', $section);
334
-
335
-		foreach ($appSettings as $setting) {
336
-			if (!isset($settings[$setting->getPriority()])) {
337
-				$settings[$setting->getPriority()] = [];
338
-			}
339
-			$settings[$setting->getPriority()][] = $setting;
340
-		}
341
-
342
-		ksort($settings);
343
-		return $settings;
344
-	}
345
-
346
-	/**
347
-	 * @inheritdoc
348
-	 */
349
-	public function getPersonalSections(): array {
350
-		$sections = [
351
-			0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
352
-			5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
353
-			15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))],
354
-		];
355
-
356
-		$legacyForms = \OC_App::getForms('personal');
357
-		if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
358
-			$sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
359
-		}
360
-
361
-		$appSections = $this->getSections('personal');
362
-
363
-		foreach ($appSections as $section) {
364
-			/** @var ISection $section */
365
-			if (!isset($sections[$section->getPriority()])) {
366
-				$sections[$section->getPriority()] = [];
367
-			}
368
-
369
-			$sections[$section->getPriority()][] = $section;
370
-		}
371
-
372
-		ksort($sections);
373
-
374
-		return $sections;
375
-	}
376
-
377
-	/**
378
-	 * @param string[] $forms
379
-	 * @return bool
380
-	 */
381
-	private function hasLegacyPersonalSettingsToRender(array $forms): bool {
382
-		foreach ($forms as $form) {
383
-			if(trim($form) !== '') {
384
-				return true;
385
-			}
386
-		}
387
-		return false;
388
-	}
389
-
390
-	/**
391
-	 * @inheritdoc
392
-	 */
393
-	public function getPersonalSettings($section): array {
394
-		$settings = $this->getBuiltInPersonalSettings($section);
395
-		$appSettings = $this->getSettings('personal', $section);
396
-
397
-		foreach ($appSettings as $setting) {
398
-			if (!isset($settings[$setting->getPriority()])) {
399
-				$settings[$setting->getPriority()] = [];
400
-			}
401
-			$settings[$setting->getPriority()][] = $setting;
402
-		}
403
-
404
-		ksort($settings);
405
-		return $settings;
406
-	}
52
+    /** @var ILogger */
53
+    private $log;
54
+    /** @var IDBConnection */
55
+    private $dbc;
56
+    /** @var IL10N */
57
+    private $l;
58
+    /** @var IConfig */
59
+    private $config;
60
+    /** @var EncryptionManager */
61
+    private $encryptionManager;
62
+    /** @var IUserManager */
63
+    private $userManager;
64
+    /** @var ILockingProvider */
65
+    private $lockingProvider;
66
+    /** @var IRequest */
67
+    private $request;
68
+    /** @var IURLGenerator */
69
+    private $url;
70
+    /** @var AccountManager */
71
+    private $accountManager;
72
+    /** @var IGroupManager */
73
+    private $groupManager;
74
+    /** @var IFactory */
75
+    private $l10nFactory;
76
+    /** @var IAppManager */
77
+    private $appManager;
78
+
79
+    /**
80
+     * @param ILogger $log
81
+     * @param IDBConnection $dbc
82
+     * @param IL10N $l
83
+     * @param IConfig $config
84
+     * @param EncryptionManager $encryptionManager
85
+     * @param IUserManager $userManager
86
+     * @param ILockingProvider $lockingProvider
87
+     * @param IRequest $request
88
+     * @param IURLGenerator $url
89
+     * @param AccountManager $accountManager
90
+     * @param IGroupManager $groupManager
91
+     * @param IFactory $l10nFactory
92
+     * @param IAppManager $appManager
93
+     */
94
+    public function __construct(
95
+        ILogger $log,
96
+        IDBConnection $dbc,
97
+        IL10N $l,
98
+        IConfig $config,
99
+        EncryptionManager $encryptionManager,
100
+        IUserManager $userManager,
101
+        ILockingProvider $lockingProvider,
102
+        IRequest $request,
103
+        IURLGenerator $url,
104
+        AccountManager $accountManager,
105
+        IGroupManager $groupManager,
106
+        IFactory $l10nFactory,
107
+        IAppManager $appManager
108
+    ) {
109
+        $this->log = $log;
110
+        $this->dbc = $dbc;
111
+        $this->l = $l;
112
+        $this->config = $config;
113
+        $this->encryptionManager = $encryptionManager;
114
+        $this->userManager = $userManager;
115
+        $this->lockingProvider = $lockingProvider;
116
+        $this->request = $request;
117
+        $this->url = $url;
118
+        $this->accountManager = $accountManager;
119
+        $this->groupManager = $groupManager;
120
+        $this->l10nFactory = $l10nFactory;
121
+        $this->appManager = $appManager;
122
+    }
123
+
124
+    /** @var array */
125
+    protected $sectionClasses = [];
126
+
127
+    /** @var array */
128
+    protected $sections = [];
129
+
130
+    /**
131
+     * @param string $type 'admin' or 'personal'
132
+     * @param string $section Class must implement OCP\Settings\ISection
133
+     * @return void
134
+     */
135
+    public function registerSection(string $type, string $section) {
136
+        $this->sectionClasses[$section] = $type;
137
+    }
138
+
139
+    /**
140
+     * @param string $type 'admin' or 'personal'
141
+     * @return ISection[]
142
+     */
143
+    protected function getSections(string $type): array {
144
+        if (!isset($this->sections[$type])) {
145
+            $this->sections[$type] = [];
146
+        }
147
+
148
+        foreach ($this->sectionClasses as $class => $sectionType) {
149
+            try {
150
+                /** @var ISection $section */
151
+                $section = \OC::$server->query($class);
152
+            } catch (QueryException $e) {
153
+                $this->log->logException($e, ['level' => Util::INFO]);
154
+                continue;
155
+            }
156
+
157
+            if (!$section instanceof ISection) {
158
+                $this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => Util::INFO]);
159
+                continue;
160
+            }
161
+
162
+            $this->sections[$sectionType][$section->getID()] = $section;
163
+
164
+            unset($this->sectionClasses[$class]);
165
+        }
166
+
167
+        return $this->sections[$type];
168
+    }
169
+
170
+    /** @var array */
171
+    protected $settingClasses = [];
172
+
173
+    /** @var array */
174
+    protected $settings = [];
175
+
176
+    /**
177
+     * @param string $type 'admin' or 'personal'
178
+     * @param string $setting Class must implement OCP\Settings\ISetting
179
+     * @return void
180
+     */
181
+    public function registerSetting(string $type, string $setting) {
182
+        $this->settingClasses[$setting] = $type;
183
+    }
184
+
185
+    /**
186
+     * @param string $type 'admin' or 'personal'
187
+     * @param string $section
188
+     * @return ISettings[]
189
+     */
190
+    protected function getSettings(string $type, string $section): array {
191
+        if (!isset($this->settings[$type])) {
192
+            $this->settings[$type] = [];
193
+        }
194
+        if (!isset($this->settings[$type][$section])) {
195
+            $this->settings[$type][$section] = [];
196
+        }
197
+
198
+        foreach ($this->settingClasses as $class => $settingsType) {
199
+            try {
200
+                /** @var ISettings $setting */
201
+                $setting = \OC::$server->query($class);
202
+            } catch (QueryException $e) {
203
+                $this->log->logException($e, ['level' => Util::INFO]);
204
+                continue;
205
+            }
206
+
207
+            if (!$setting instanceof ISettings) {
208
+                $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => Util::INFO]);
209
+                continue;
210
+            }
211
+
212
+            if (!isset($this->settings[$settingsType][$setting->getSection()])) {
213
+                $this->settings[$settingsType][$setting->getSection()] = [];
214
+            }
215
+            $this->settings[$settingsType][$setting->getSection()][] = $setting;
216
+
217
+            unset($this->settingClasses[$class]);
218
+        }
219
+
220
+        return $this->settings[$type][$section];
221
+    }
222
+
223
+    /**
224
+     * @inheritdoc
225
+     */
226
+    public function getAdminSections(): array {
227
+        // built-in sections
228
+        $sections = [
229
+            0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))],
230
+            1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('settings', 'admin.svg'))],
231
+            5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
232
+            10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
233
+            45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
234
+            98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
235
+            99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
236
+        ];
237
+
238
+        $appSections = $this->getSections('admin');
239
+
240
+        foreach ($appSections as $section) {
241
+            /** @var ISection $section */
242
+            if (!isset($sections[$section->getPriority()])) {
243
+                $sections[$section->getPriority()] = [];
244
+            }
245
+
246
+            $sections[$section->getPriority()][] = $section;
247
+        }
248
+
249
+        ksort($sections);
250
+
251
+        return $sections;
252
+    }
253
+
254
+    /**
255
+     * @param string $section
256
+     * @return ISection[]
257
+     */
258
+    private function getBuiltInAdminSettings($section): array {
259
+        $forms = [];
260
+
261
+        if ($section === 'overview') {
262
+            /** @var ISettings $form */
263
+            $form = new Admin\Overview($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
264
+            $forms[$form->getPriority()] = [$form];
265
+            $form = new Admin\ServerDevNotice();
266
+            $forms[$form->getPriority()] = [$form];
267
+        }
268
+        if ($section === 'server') {
269
+            /** @var ISettings $form */
270
+            $form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l);
271
+            $forms[$form->getPriority()] = [$form];
272
+            $form = new Admin\Mail($this->config);
273
+            $forms[$form->getPriority()] = [$form];
274
+        }
275
+        if ($section === 'encryption') {
276
+            /** @var ISettings $form */
277
+            $form = new Admin\Encryption($this->encryptionManager, $this->userManager);
278
+            $forms[$form->getPriority()] = [$form];
279
+        }
280
+        if ($section === 'sharing') {
281
+            /** @var ISettings $form */
282
+            $form = new Admin\Sharing($this->config, $this->l);
283
+            $forms[$form->getPriority()] = [$form];
284
+        }
285
+        if ($section === 'tips-tricks') {
286
+            /** @var ISettings $form */
287
+            $form = new Admin\TipsTricks($this->config);
288
+            $forms[$form->getPriority()] = [$form];
289
+        }
290
+
291
+        return $forms;
292
+    }
293
+
294
+    /**
295
+     * @param string $section
296
+     * @return ISection[]
297
+     */
298
+    private function getBuiltInPersonalSettings($section): array {
299
+        $forms = [];
300
+
301
+        if ($section === 'personal-info') {
302
+            /** @var ISettings $form */
303
+            $form = new Personal\PersonalInfo(
304
+                $this->config,
305
+                $this->userManager,
306
+                $this->groupManager,
307
+                $this->accountManager,
308
+                $this->appManager,
309
+                $this->l10nFactory,
310
+                $this->l
311
+            );
312
+            $forms[$form->getPriority()] = [$form];
313
+        }
314
+        if($section === 'security') {
315
+            /** @var ISettings $form */
316
+            $form = new Personal\Security();
317
+            $forms[$form->getPriority()] = [$form];
318
+        }
319
+        if ($section === 'additional') {
320
+            /** @var ISettings $form */
321
+            $form = new Personal\Additional();
322
+            $forms[$form->getPriority()] = [$form];
323
+        }
324
+
325
+        return $forms;
326
+    }
327
+
328
+    /**
329
+     * @inheritdoc
330
+     */
331
+    public function getAdminSettings($section): array {
332
+        $settings = $this->getBuiltInAdminSettings($section);
333
+        $appSettings = $this->getSettings('admin', $section);
334
+
335
+        foreach ($appSettings as $setting) {
336
+            if (!isset($settings[$setting->getPriority()])) {
337
+                $settings[$setting->getPriority()] = [];
338
+            }
339
+            $settings[$setting->getPriority()][] = $setting;
340
+        }
341
+
342
+        ksort($settings);
343
+        return $settings;
344
+    }
345
+
346
+    /**
347
+     * @inheritdoc
348
+     */
349
+    public function getPersonalSections(): array {
350
+        $sections = [
351
+            0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
352
+            5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
353
+            15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))],
354
+        ];
355
+
356
+        $legacyForms = \OC_App::getForms('personal');
357
+        if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
358
+            $sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
359
+        }
360
+
361
+        $appSections = $this->getSections('personal');
362
+
363
+        foreach ($appSections as $section) {
364
+            /** @var ISection $section */
365
+            if (!isset($sections[$section->getPriority()])) {
366
+                $sections[$section->getPriority()] = [];
367
+            }
368
+
369
+            $sections[$section->getPriority()][] = $section;
370
+        }
371
+
372
+        ksort($sections);
373
+
374
+        return $sections;
375
+    }
376
+
377
+    /**
378
+     * @param string[] $forms
379
+     * @return bool
380
+     */
381
+    private function hasLegacyPersonalSettingsToRender(array $forms): bool {
382
+        foreach ($forms as $form) {
383
+            if(trim($form) !== '') {
384
+                return true;
385
+            }
386
+        }
387
+        return false;
388
+    }
389
+
390
+    /**
391
+     * @inheritdoc
392
+     */
393
+    public function getPersonalSettings($section): array {
394
+        $settings = $this->getBuiltInPersonalSettings($section);
395
+        $appSettings = $this->getSettings('personal', $section);
396
+
397
+        foreach ($appSettings as $setting) {
398
+            if (!isset($settings[$setting->getPriority()])) {
399
+                $settings[$setting->getPriority()] = [];
400
+            }
401
+            $settings[$setting->getPriority()][] = $setting;
402
+        }
403
+
404
+        ksort($settings);
405
+        return $settings;
406
+    }
407 407
 }
Please login to merge, or discard this patch.
apps/files/lib/Settings/Admin.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -32,56 +32,56 @@
 block discarded – undo
32 32
 
33 33
 class Admin implements ISettings {
34 34
 
35
-	/** @var IniGetWrapper */
36
-	private $iniWrapper;
35
+    /** @var IniGetWrapper */
36
+    private $iniWrapper;
37 37
 
38
-	/** @var IRequest */
39
-	private $request;
38
+    /** @var IRequest */
39
+    private $request;
40 40
 
41
-	public function __construct(IniGetWrapper $iniWrapper, IRequest $request) {
42
-		$this->iniWrapper = $iniWrapper;
43
-		$this->request = $request;
44
-	}
41
+    public function __construct(IniGetWrapper $iniWrapper, IRequest $request) {
42
+        $this->iniWrapper = $iniWrapper;
43
+        $this->request = $request;
44
+    }
45 45
 
46
-	/**
47
-	 * @return TemplateResponse
48
-	 */
49
-	public function getForm() {
50
-		$htaccessWorking  = (getenv('htaccessWorking') === 'true');
51
-		$htaccessWritable = is_writable(\OC::$SERVERROOT.'/.htaccess');
52
-		$userIniWritable  = is_writable(\OC::$SERVERROOT.'/.user.ini');
46
+    /**
47
+     * @return TemplateResponse
48
+     */
49
+    public function getForm() {
50
+        $htaccessWorking  = (getenv('htaccessWorking') === 'true');
51
+        $htaccessWritable = is_writable(\OC::$SERVERROOT.'/.htaccess');
52
+        $userIniWritable  = is_writable(\OC::$SERVERROOT.'/.user.ini');
53 53
 
54
-		$upload_max_filesize = $this->iniWrapper->getBytes('upload_max_filesize');
55
-		$post_max_size = $this->iniWrapper->getBytes('post_max_size');
56
-		$maxUploadFilesize = Util::humanFileSize(min($upload_max_filesize, $post_max_size));
54
+        $upload_max_filesize = $this->iniWrapper->getBytes('upload_max_filesize');
55
+        $post_max_size = $this->iniWrapper->getBytes('post_max_size');
56
+        $maxUploadFilesize = Util::humanFileSize(min($upload_max_filesize, $post_max_size));
57 57
 
58
-		$parameters = [
59
-			'uploadChangable'              => ($htaccessWorking and $htaccessWritable) or $userIniWritable,
60
-			'uploadMaxFilesize'            => $maxUploadFilesize,
61
-			// max possible makes only sense on a 32 bit system
62
-			'displayMaxPossibleUploadSize' => PHP_INT_SIZE === 4,
63
-			'maxPossibleUploadSize'        => Util::humanFileSize(PHP_INT_MAX),
64
-		];
58
+        $parameters = [
59
+            'uploadChangable'              => ($htaccessWorking and $htaccessWritable) or $userIniWritable,
60
+            'uploadMaxFilesize'            => $maxUploadFilesize,
61
+            // max possible makes only sense on a 32 bit system
62
+            'displayMaxPossibleUploadSize' => PHP_INT_SIZE === 4,
63
+            'maxPossibleUploadSize'        => Util::humanFileSize(PHP_INT_MAX),
64
+        ];
65 65
 
66
-		return new TemplateResponse('files', 'admin', $parameters, '');
67
-	}
66
+        return new TemplateResponse('files', 'admin', $parameters, '');
67
+    }
68 68
 
69
-	/**
70
-	 * @return string the section ID, e.g. 'sharing'
71
-	 */
72
-	public function getSection() {
73
-		return 'server';
74
-	}
69
+    /**
70
+     * @return string the section ID, e.g. 'sharing'
71
+     */
72
+    public function getSection() {
73
+        return 'server';
74
+    }
75 75
 
76
-	/**
77
-	 * @return int whether the form should be rather on the top or bottom of
78
-	 * the admin section. The forms are arranged in ascending order of the
79
-	 * priority values. It is required to return a value between 0 and 100.
80
-	 *
81
-	 * E.g.: 70
82
-	 */
83
-	public function getPriority() {
84
-		return 5;
85
-	}
76
+    /**
77
+     * @return int whether the form should be rather on the top or bottom of
78
+     * the admin section. The forms are arranged in ascending order of the
79
+     * priority values. It is required to return a value between 0 and 100.
80
+     *
81
+     * E.g.: 70
82
+     */
83
+    public function getPriority() {
84
+        return 5;
85
+    }
86 86
 
87 87
 }
Please login to merge, or discard this patch.
apps/dav/lib/Settings/CalDAVSettings.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,41 +29,41 @@
 block discarded – undo
29 29
 
30 30
 class CalDAVSettings implements ISettings {
31 31
 
32
-	/** @var IConfig */
33
-	private $config;
32
+    /** @var IConfig */
33
+    private $config;
34 34
 
35
-	/**
36
-	 * CalDAVSettings constructor.
37
-	 *
38
-	 * @param IConfig $config
39
-	 */
40
-	public function __construct(IConfig $config) {
41
-		$this->config = $config;
42
-	}
35
+    /**
36
+     * CalDAVSettings constructor.
37
+     *
38
+     * @param IConfig $config
39
+     */
40
+    public function __construct(IConfig $config) {
41
+        $this->config = $config;
42
+    }
43 43
 
44
-	/**
45
-	 * @return TemplateResponse
46
-	 */
47
-	public function getForm() {
48
-		$parameters = [
49
-			'send_invitations' => $this->config->getAppValue('dav', 'sendInvitations', 'yes'),
50
-			'generate_birthday_calendar' => $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes'),
51
-		];
44
+    /**
45
+     * @return TemplateResponse
46
+     */
47
+    public function getForm() {
48
+        $parameters = [
49
+            'send_invitations' => $this->config->getAppValue('dav', 'sendInvitations', 'yes'),
50
+            'generate_birthday_calendar' => $this->config->getAppValue('dav', 'generateBirthdayCalendar', 'yes'),
51
+        ];
52 52
 
53
-		return new TemplateResponse('dav', 'settings-admin-caldav', $parameters);
54
-	}
53
+        return new TemplateResponse('dav', 'settings-admin-caldav', $parameters);
54
+    }
55 55
 
56
-	/**
57
-	 * @return string
58
-	 */
59
-	public function getSection() {
60
-		return 'server';
61
-	}
56
+    /**
57
+     * @return string
58
+     */
59
+    public function getSection() {
60
+        return 'server';
61
+    }
62 62
 
63
-	/**
64
-	 * @return int
65
-	 */
66
-	public function getPriority() {
67
-		return 20;
68
-	}
63
+    /**
64
+     * @return int
65
+     */
66
+    public function getPriority() {
67
+        return 20;
68
+    }
69 69
 }
Please login to merge, or discard this patch.
apps/updatenotification/lib/Settings/Admin.php 1 patch
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -35,114 +35,114 @@
 block discarded – undo
35 35
 use OCP\Util;
36 36
 
37 37
 class Admin implements ISettings {
38
-	/** @var IConfig */
39
-	private $config;
40
-	/** @var UpdateChecker */
41
-	private $updateChecker;
42
-	/** @var IGroupManager */
43
-	private $groupManager;
44
-	/** @var IDateTimeFormatter */
45
-	private $dateTimeFormatter;
46
-
47
-	/**
48
-	 * @param IConfig $config
49
-	 * @param UpdateChecker $updateChecker
50
-	 * @param IGroupManager $groupManager
51
-	 * @param IDateTimeFormatter $dateTimeFormatter
52
-	 */
53
-	public function __construct(IConfig $config,
54
-								UpdateChecker $updateChecker,
55
-								IGroupManager $groupManager,
56
-								IDateTimeFormatter $dateTimeFormatter) {
57
-		$this->config = $config;
58
-		$this->updateChecker = $updateChecker;
59
-		$this->groupManager = $groupManager;
60
-		$this->dateTimeFormatter = $dateTimeFormatter;
61
-	}
62
-
63
-	/**
64
-	 * @return TemplateResponse
65
-	 */
66
-	public function getForm(): TemplateResponse {
67
-		$lastUpdateCheckTimestamp = $this->config->getAppValue('core', 'lastupdatedat');
68
-		$lastUpdateCheck = $this->dateTimeFormatter->formatDateTime($lastUpdateCheckTimestamp);
69
-
70
-		$channels = [
71
-			'daily',
72
-			'beta',
73
-			'stable',
74
-			'production',
75
-		];
76
-		$currentChannel = Util::getChannel();
77
-		if ($currentChannel === 'git') {
78
-			$channels[] = 'git';
79
-		}
80
-
81
-		$updateState = $this->updateChecker->getUpdateState();
82
-
83
-		$notifyGroups = json_decode($this->config->getAppValue('updatenotification', 'notify_groups', '["admin"]'), true);
84
-
85
-		$defaultUpdateServerURL = 'https://updates.nextcloud.com/updater_server/';
86
-		$updateServerURL = $this->config->getSystemValue('updater.server.url', $defaultUpdateServerURL);
87
-
88
-		$params = [
89
-			'isNewVersionAvailable' => !empty($updateState['updateAvailable']),
90
-			'isUpdateChecked' => $lastUpdateCheckTimestamp > 0,
91
-			'lastChecked' => $lastUpdateCheck,
92
-			'currentChannel' => $currentChannel,
93
-			'channels' => $channels,
94
-			'newVersionString' => empty($updateState['updateVersion']) ? '' : $updateState['updateVersion'],
95
-			'downloadLink' => empty($updateState['downloadLink']) ? '' : $updateState['downloadLink'],
96
-			'updaterEnabled' => empty($updateState['updaterEnabled']) ? false : $updateState['updaterEnabled'],
97
-			'versionIsEol' => empty($updateState['versionIsEol']) ? false : $updateState['versionIsEol'],
98
-			'isDefaultUpdateServerURL' => $updateServerURL === $defaultUpdateServerURL,
99
-			'updateServerURL' => $updateServerURL,
100
-			'notifyGroups' => $this->getSelectedGroups($notifyGroups),
101
-			'withSettings' => true,
102
-		];
103
-
104
-		$params = [
105
-			'json' => json_encode($params),
106
-			'withSettings' => true,
107
-		];
108
-
109
-		return new TemplateResponse('updatenotification', 'admin', $params, '');
110
-	}
111
-
112
-	/**
113
-	 * @param array $groupIds
114
-	 * @return array
115
-	 */
116
-	protected function getSelectedGroups(array $groupIds): array {
117
-		$result = [];
118
-		foreach ($groupIds as $groupId) {
119
-			$group = $this->groupManager->get($groupId);
120
-
121
-			if ($group === null) {
122
-				continue;
123
-			}
124
-
125
-			$result[] = ['value' => $group->getGID(), 'label' => $group->getDisplayName()];
126
-		}
127
-
128
-		return $result;
129
-	}
130
-
131
-	/**
132
-	 * @return string the section ID, e.g. 'sharing'
133
-	 */
134
-	public function getSection(): string {
135
-		return 'server';
136
-	}
137
-
138
-	/**
139
-	 * @return int whether the form should be rather on the top or bottom of
140
-	 * the admin section. The forms are arranged in ascending order of the
141
-	 * priority values. It is required to return a value between 0 and 100.
142
-	 *
143
-	 * E.g.: 70
144
-	 */
145
-	public function getPriority(): int {
146
-		return 90;
147
-	}
38
+    /** @var IConfig */
39
+    private $config;
40
+    /** @var UpdateChecker */
41
+    private $updateChecker;
42
+    /** @var IGroupManager */
43
+    private $groupManager;
44
+    /** @var IDateTimeFormatter */
45
+    private $dateTimeFormatter;
46
+
47
+    /**
48
+     * @param IConfig $config
49
+     * @param UpdateChecker $updateChecker
50
+     * @param IGroupManager $groupManager
51
+     * @param IDateTimeFormatter $dateTimeFormatter
52
+     */
53
+    public function __construct(IConfig $config,
54
+                                UpdateChecker $updateChecker,
55
+                                IGroupManager $groupManager,
56
+                                IDateTimeFormatter $dateTimeFormatter) {
57
+        $this->config = $config;
58
+        $this->updateChecker = $updateChecker;
59
+        $this->groupManager = $groupManager;
60
+        $this->dateTimeFormatter = $dateTimeFormatter;
61
+    }
62
+
63
+    /**
64
+     * @return TemplateResponse
65
+     */
66
+    public function getForm(): TemplateResponse {
67
+        $lastUpdateCheckTimestamp = $this->config->getAppValue('core', 'lastupdatedat');
68
+        $lastUpdateCheck = $this->dateTimeFormatter->formatDateTime($lastUpdateCheckTimestamp);
69
+
70
+        $channels = [
71
+            'daily',
72
+            'beta',
73
+            'stable',
74
+            'production',
75
+        ];
76
+        $currentChannel = Util::getChannel();
77
+        if ($currentChannel === 'git') {
78
+            $channels[] = 'git';
79
+        }
80
+
81
+        $updateState = $this->updateChecker->getUpdateState();
82
+
83
+        $notifyGroups = json_decode($this->config->getAppValue('updatenotification', 'notify_groups', '["admin"]'), true);
84
+
85
+        $defaultUpdateServerURL = 'https://updates.nextcloud.com/updater_server/';
86
+        $updateServerURL = $this->config->getSystemValue('updater.server.url', $defaultUpdateServerURL);
87
+
88
+        $params = [
89
+            'isNewVersionAvailable' => !empty($updateState['updateAvailable']),
90
+            'isUpdateChecked' => $lastUpdateCheckTimestamp > 0,
91
+            'lastChecked' => $lastUpdateCheck,
92
+            'currentChannel' => $currentChannel,
93
+            'channels' => $channels,
94
+            'newVersionString' => empty($updateState['updateVersion']) ? '' : $updateState['updateVersion'],
95
+            'downloadLink' => empty($updateState['downloadLink']) ? '' : $updateState['downloadLink'],
96
+            'updaterEnabled' => empty($updateState['updaterEnabled']) ? false : $updateState['updaterEnabled'],
97
+            'versionIsEol' => empty($updateState['versionIsEol']) ? false : $updateState['versionIsEol'],
98
+            'isDefaultUpdateServerURL' => $updateServerURL === $defaultUpdateServerURL,
99
+            'updateServerURL' => $updateServerURL,
100
+            'notifyGroups' => $this->getSelectedGroups($notifyGroups),
101
+            'withSettings' => true,
102
+        ];
103
+
104
+        $params = [
105
+            'json' => json_encode($params),
106
+            'withSettings' => true,
107
+        ];
108
+
109
+        return new TemplateResponse('updatenotification', 'admin', $params, '');
110
+    }
111
+
112
+    /**
113
+     * @param array $groupIds
114
+     * @return array
115
+     */
116
+    protected function getSelectedGroups(array $groupIds): array {
117
+        $result = [];
118
+        foreach ($groupIds as $groupId) {
119
+            $group = $this->groupManager->get($groupId);
120
+
121
+            if ($group === null) {
122
+                continue;
123
+            }
124
+
125
+            $result[] = ['value' => $group->getGID(), 'label' => $group->getDisplayName()];
126
+        }
127
+
128
+        return $result;
129
+    }
130
+
131
+    /**
132
+     * @return string the section ID, e.g. 'sharing'
133
+     */
134
+    public function getSection(): string {
135
+        return 'server';
136
+    }
137
+
138
+    /**
139
+     * @return int whether the form should be rather on the top or bottom of
140
+     * the admin section. The forms are arranged in ascending order of the
141
+     * priority values. It is required to return a value between 0 and 100.
142
+     *
143
+     * E.g.: 70
144
+     */
145
+    public function getPriority(): int {
146
+        return 90;
147
+    }
148 148
 }
Please login to merge, or discard this patch.
apps/updatenotification/templates/admin.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 /**
4 4
  * @copyright (c) 2018 Joas Schilling <[email protected]>
5 5
  *
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 style('updatenotification', 'admin');
13 13
 /** @var array $_ */
14 14
 ?>
15
-<?php if($_['withSettings'] === true) { ?>
15
+<?php if ($_['withSettings'] === true) { ?>
16 16
 <div class="section">
17
-	<h2><?php p($l->t('Updates'));?></h2>
17
+	<h2><?php p($l->t('Updates')); ?></h2>
18 18
 	<p><strong><a href="<?php print_unescaped($theme->getBaseUrl()); ?>" rel="noreferrer noopener" target="_blank"><?php p($theme->getTitle()); ?></a> <?php p(OC_Util::getHumanVersion()) ?></strong></p>
19 19
 </div>
20 20
 <?php }?>
Please login to merge, or discard this patch.
apps/updatenotification/composer/composer/autoload_static.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,35 +6,35 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitUpdateNotification
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\UpdateNotification\\' => 23,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\UpdateNotification\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'OCA\\UpdateNotification\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
25
-        'OCA\\UpdateNotification\\Controller\\APIController' => __DIR__ . '/..' . '/../lib/Controller/APIController.php',
26
-        'OCA\\UpdateNotification\\Controller\\AdminController' => __DIR__ . '/..' . '/../lib/Controller/AdminController.php',
27
-        'OCA\\UpdateNotification\\Notification\\BackgroundJob' => __DIR__ . '/..' . '/../lib/Notification/BackgroundJob.php',
28
-        'OCA\\UpdateNotification\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
29
-        'OCA\\UpdateNotification\\ResetTokenBackgroundJob' => __DIR__ . '/..' . '/../lib/ResetTokenBackgroundJob.php',
30
-        'OCA\\UpdateNotification\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php',
31
-        'OCA\\UpdateNotification\\Settings\\AdminOverview' => __DIR__ . '/..' . '/../lib/Settings/AdminOverview.php',
32
-        'OCA\\UpdateNotification\\UpdateChecker' => __DIR__ . '/..' . '/../lib/UpdateChecker.php',
23
+    public static $classMap = array(
24
+        'OCA\\UpdateNotification\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
25
+        'OCA\\UpdateNotification\\Controller\\APIController' => __DIR__.'/..'.'/../lib/Controller/APIController.php',
26
+        'OCA\\UpdateNotification\\Controller\\AdminController' => __DIR__.'/..'.'/../lib/Controller/AdminController.php',
27
+        'OCA\\UpdateNotification\\Notification\\BackgroundJob' => __DIR__.'/..'.'/../lib/Notification/BackgroundJob.php',
28
+        'OCA\\UpdateNotification\\Notification\\Notifier' => __DIR__.'/..'.'/../lib/Notification/Notifier.php',
29
+        'OCA\\UpdateNotification\\ResetTokenBackgroundJob' => __DIR__.'/..'.'/../lib/ResetTokenBackgroundJob.php',
30
+        'OCA\\UpdateNotification\\Settings\\Admin' => __DIR__.'/..'.'/../lib/Settings/Admin.php',
31
+        'OCA\\UpdateNotification\\Settings\\AdminOverview' => __DIR__.'/..'.'/../lib/Settings/AdminOverview.php',
32
+        'OCA\\UpdateNotification\\UpdateChecker' => __DIR__.'/..'.'/../lib/UpdateChecker.php',
33 33
     );
34 34
 
35 35
     public static function getInitializer(ClassLoader $loader)
36 36
     {
37
-        return \Closure::bind(function () use ($loader) {
37
+        return \Closure::bind(function() use ($loader) {
38 38
             $loader->prefixLengthsPsr4 = ComposerStaticInitUpdateNotification::$prefixLengthsPsr4;
39 39
             $loader->prefixDirsPsr4 = ComposerStaticInitUpdateNotification::$prefixDirsPsr4;
40 40
             $loader->classMap = ComposerStaticInitUpdateNotification::$classMap;
Please login to merge, or discard this patch.
apps/updatenotification/composer/composer/autoload_classmap.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\UpdateNotification\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
10
-    'OCA\\UpdateNotification\\Controller\\APIController' => $baseDir . '/../lib/Controller/APIController.php',
11
-    'OCA\\UpdateNotification\\Controller\\AdminController' => $baseDir . '/../lib/Controller/AdminController.php',
12
-    'OCA\\UpdateNotification\\Notification\\BackgroundJob' => $baseDir . '/../lib/Notification/BackgroundJob.php',
13
-    'OCA\\UpdateNotification\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
14
-    'OCA\\UpdateNotification\\ResetTokenBackgroundJob' => $baseDir . '/../lib/ResetTokenBackgroundJob.php',
15
-    'OCA\\UpdateNotification\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php',
16
-    'OCA\\UpdateNotification\\Settings\\AdminOverview' => $baseDir . '/../lib/Settings/AdminOverview.php',
17
-    'OCA\\UpdateNotification\\UpdateChecker' => $baseDir . '/../lib/UpdateChecker.php',
9
+    'OCA\\UpdateNotification\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
10
+    'OCA\\UpdateNotification\\Controller\\APIController' => $baseDir.'/../lib/Controller/APIController.php',
11
+    'OCA\\UpdateNotification\\Controller\\AdminController' => $baseDir.'/../lib/Controller/AdminController.php',
12
+    'OCA\\UpdateNotification\\Notification\\BackgroundJob' => $baseDir.'/../lib/Notification/BackgroundJob.php',
13
+    'OCA\\UpdateNotification\\Notification\\Notifier' => $baseDir.'/../lib/Notification/Notifier.php',
14
+    'OCA\\UpdateNotification\\ResetTokenBackgroundJob' => $baseDir.'/../lib/ResetTokenBackgroundJob.php',
15
+    'OCA\\UpdateNotification\\Settings\\Admin' => $baseDir.'/../lib/Settings/Admin.php',
16
+    'OCA\\UpdateNotification\\Settings\\AdminOverview' => $baseDir.'/../lib/Settings/AdminOverview.php',
17
+    'OCA\\UpdateNotification\\UpdateChecker' => $baseDir.'/../lib/UpdateChecker.php',
18 18
 );
Please login to merge, or discard this patch.