1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @copyright Copyright (c) 2016 Arthur Schiwon <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @author Arthur Schiwon <[email protected]> |
6
|
|
|
* @author Christoph Wurst <[email protected]> |
7
|
|
|
* @author Daniel Kesselberg <[email protected]> |
8
|
|
|
* @author Joas Schilling <[email protected]> |
9
|
|
|
* @author Julius Härtl <[email protected]> |
10
|
|
|
* @author Lukas Reschke <[email protected]> |
11
|
|
|
* @author Roeland Jago Douma <[email protected]> |
12
|
|
|
* |
13
|
|
|
* @license GNU AGPL version 3 or any later version |
14
|
|
|
* |
15
|
|
|
* This program is free software: you can redistribute it and/or modify |
16
|
|
|
* it under the terms of the GNU Affero General Public License as |
17
|
|
|
* published by the Free Software Foundation, either version 3 of the |
18
|
|
|
* License, or (at your option) any later version. |
19
|
|
|
* |
20
|
|
|
* This program is distributed in the hope that it will be useful, |
21
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
22
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23
|
|
|
* GNU Affero General Public License for more details. |
24
|
|
|
* |
25
|
|
|
* You should have received a copy of the GNU Affero General Public License |
26
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
27
|
|
|
* |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
namespace OCA\Settings\Settings\Admin; |
31
|
|
|
|
32
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
33
|
|
|
use OCP\IConfig; |
34
|
|
|
use OCP\Settings\ISettings; |
35
|
|
|
|
36
|
|
|
class Mail implements ISettings { |
37
|
|
|
/** @var IConfig */ |
38
|
|
|
private $config; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param IConfig $config |
42
|
|
|
*/ |
43
|
|
|
public function __construct(IConfig $config) { |
44
|
|
|
$this->config = $config; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return TemplateResponse |
49
|
|
|
*/ |
50
|
|
|
public function getForm() { |
51
|
|
|
$parameters = [ |
52
|
|
|
// Mail |
53
|
|
|
'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'), |
54
|
|
|
'mail_domain' => $this->config->getSystemValue('mail_domain', ''), |
55
|
|
|
'mail_from_address' => $this->config->getSystemValue('mail_from_address', ''), |
56
|
|
|
'mail_smtpmode' => $this->config->getSystemValue('mail_smtpmode', ''), |
57
|
|
|
'mail_smtpsecure' => $this->config->getSystemValue('mail_smtpsecure', ''), |
58
|
|
|
'mail_smtphost' => $this->config->getSystemValue('mail_smtphost', ''), |
59
|
|
|
'mail_smtpport' => $this->config->getSystemValue('mail_smtpport', ''), |
60
|
|
|
'mail_smtpauthtype' => $this->config->getSystemValue('mail_smtpauthtype', ''), |
61
|
|
|
'mail_smtpauth' => $this->config->getSystemValue('mail_smtpauth', false), |
62
|
|
|
'mail_smtpname' => $this->config->getSystemValue('mail_smtpname', ''), |
63
|
|
|
'mail_smtppassword' => $this->config->getSystemValue('mail_smtppassword', ''), |
64
|
|
|
'mail_sendmailmode' => $this->config->getSystemValue('mail_sendmailmode', 'smtp'), |
65
|
|
|
]; |
66
|
|
|
|
67
|
|
|
if ($parameters['mail_smtppassword'] !== '') { |
68
|
|
|
$parameters['mail_smtppassword'] = '********'; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
if ($parameters['mail_smtpmode'] === '' || $parameters['mail_smtpmode'] === 'php') { |
72
|
|
|
$parameters['mail_smtpmode'] = 'smtp'; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
return new TemplateResponse('settings', 'settings/admin/additional-mail', $parameters, ''); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @return string the section ID, e.g. 'sharing' |
80
|
|
|
*/ |
81
|
|
|
public function getSection() { |
82
|
|
|
return 'server'; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return int whether the form should be rather on the top or bottom of |
87
|
|
|
* the admin section. The forms are arranged in ascending order of the |
88
|
|
|
* priority values. It is required to return a value between 0 and 100. |
89
|
|
|
* |
90
|
|
|
* E.g.: 70 |
91
|
|
|
*/ |
92
|
|
|
public function getPriority() { |
93
|
|
|
return 10; |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|