forked from DSI-Universite-Rennes2/user_imap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
50 lines (44 loc) · 1.81 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* ownCloud - user_imap
*
* @author Dominik Schmidt
* @copyright 2011 Dominik Schmidt [email protected]
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
$params = array('imap_host', 'imap_port', 'imap_ssl_novalidate');
OCP\Util::addscript('user_imap', 'settings');
if ($_POST) {
foreach($params as $param){
if(isset($_POST[$param])){
OCP\Config::setAppValue('user_imap', $param, $_POST[$param]);
}
elseif('imap_ssl_novalidate' == $param) {
// unchecked checkboxes are not included in the post paramters
OCP\Config::setAppValue('user_imap', $param, 0);
}
}
}
// fill template
$tmpl = new OCP\Template( 'user_imap', 'settings');
foreach($params as $param){
$value = htmlentities(OCP\Config::getAppValue('user_imap', $param,''));
$tmpl->assign($param, $value);
}
// settings with default values
$tmpl->assign( 'imap_host', OCP\Config::getAppValue('user_imap', 'imap_host', OC_USER_BACKEND_IMAP_DEFAULT_HOST));
$tmpl->assign( 'imap_port', OCP\Config::getAppValue('user_imap', 'imap_port', OC_USER_BACKEND_IMAP_DEFAULT_PORT));
return $tmpl->fetchPage();