Completed
Push — master ( 94010e...d161d4 )
by Morris
17:23
created

Mail::getPriority()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2016 Arthur Schiwon <[email protected]>
4
 *
5
 * @author Arthur Schiwon <[email protected]>
6
 * @author Joas Schilling <[email protected]>
7
 * @author Lukas Reschke <[email protected]>
8
 *
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
namespace OC\Settings\Admin;
27
28
use OCP\AppFramework\Http\TemplateResponse;
29
use OCP\IConfig;
30
use OCP\Settings\ISettings;
31
32
class Mail implements ISettings {
33
	/** @var IConfig */
34
	private $config;
35
36
	/**
37
	 * @param IConfig $config
38
	 */
39
	public function __construct(IConfig $config) {
40
		$this->config = $config;
41
	}
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
		];
61
62
		if ($parameters['mail_smtppassword'] !== '') {
63
			$parameters['mail_smtppassword'] = '********';
64
		}
65
66
		return new TemplateResponse('settings', 'settings/admin/additional-mail', $parameters, '');
67
	}
68
69
	/**
70
	 * @return string the section ID, e.g. 'sharing'
71
	 */
72
	public function getSection() {
73
		return 'server';
74
	}
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
	}
86
}
87