1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Viktar Dubiniuk <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (c) 2018, ownCloud GmbH |
6
|
|
|
* @license AGPL-3.0 |
7
|
|
|
* |
8
|
|
|
* This code is free software: you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
10
|
|
|
* as published by the Free Software Foundation. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU Affero General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
19
|
|
|
* |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace OC\Settings\Controller; |
23
|
|
|
|
24
|
|
|
use \OCP\AppFramework\Controller; |
25
|
|
|
use OCP\IRequest; |
26
|
|
|
use OCP\IL10N; |
27
|
|
|
use OCP\IConfig; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @package OC\Settings\Controller |
31
|
|
|
*/ |
32
|
|
|
class LegalSettingsController extends Controller { |
33
|
|
|
/** |
34
|
|
|
* @var \OCP\IL10N |
35
|
|
|
*/ |
36
|
|
|
private $l10n; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var \OCP\IConfig |
40
|
|
|
*/ |
41
|
|
|
private $config; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param string $appName |
45
|
|
|
* @param IRequest $request |
46
|
|
|
* @param IL10N $l10n |
47
|
|
|
* @param IConfig $config |
48
|
|
|
*/ |
49
|
|
|
public function __construct($appName, |
50
|
|
|
IRequest $request, |
51
|
|
|
IL10N $l10n, |
52
|
|
|
IConfig $config |
53
|
|
|
) { |
54
|
|
|
parent::__construct($appName, $request); |
55
|
|
|
$this->l10n = $l10n; |
56
|
|
|
$this->config = $config; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Store imprint URL |
61
|
|
|
* |
62
|
|
|
* @param string $imprintUrl |
63
|
|
|
* |
64
|
|
|
* @return array |
65
|
|
|
*/ |
66
|
|
View Code Duplication |
public function setImprintUrl($imprintUrl) { |
67
|
|
|
$this->config->setAppValue( |
68
|
|
|
'core', |
69
|
|
|
'legal.imprint_url', |
70
|
|
|
$imprintUrl |
71
|
|
|
); |
72
|
|
|
|
73
|
|
|
return [ |
74
|
|
|
'data' => |
75
|
|
|
[ |
76
|
|
|
'message' => (string) $this->l10n->t('Saved') |
77
|
|
|
], |
78
|
|
|
'status' => 'success' |
79
|
|
|
]; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Store privacy policy URL |
84
|
|
|
* |
85
|
|
|
* @param string $privacyPolicy |
86
|
|
|
* |
87
|
|
|
* @return array |
88
|
|
|
*/ |
89
|
|
View Code Duplication |
public function setPrivacyPolicyUrl($privacyPolicy) { |
90
|
|
|
$this->config->setAppValue( |
91
|
|
|
'core', |
92
|
|
|
'legal.privacy_policy_url', |
93
|
|
|
$privacyPolicy |
94
|
|
|
); |
95
|
|
|
|
96
|
|
|
return [ |
97
|
|
|
'data' => |
98
|
|
|
[ |
99
|
|
|
'message' => (string) $this->l10n->t('Saved') |
100
|
|
|
], |
101
|
|
|
'status' => 'success' |
102
|
|
|
]; |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|