class_serviceCyrus.inc 4.13 KB
Newer Older
1
2
3
4
<?php
/*
  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
  Copyright (C) 2003-2010  Cajus Pollmeier
5
  Copyright (C) 2011-2016  FusionDirectory
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program 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 General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/

22
class serviceCyrus extends simpleMailMethodService
23
{
24
  static function plInfo (): array
25
  {
26
    return [
27
28
      'plShortName'     => _('Cyrus (IMAP/POP3)'),
      'plDescription'   => _('Cyrus (IMAP/POP3)').' ('._('Services').')',
29
      'plIcon'          => 'geticon.php?context=applications&icon=cyrus&size=16',
30
      'plObjectClass'   => ['fdCyrusServer'],
31

32
      'plProvidedAcls'  => parent::generatePlProvidedAcls(static::getAttributesInfo())
33
    ];
34
35
36
37
38
  }

  /*!
   *  \brief The main function : information about attributes
   */
39
  static function getAttributesInfo (): array
40
  {
41
42
    return  [
      'cyrus' => [
43
        'name'  => _('Cyrus settings'),
44
        'attrs' => [
45
          new CompositeAttribute(
46
47
            _('Connect URL for Cyrus server'),
            'fdCyrusConnect',
48
            [
49
50
51
52
53
54
55
              new StringAttribute(
                _('Hostname'), _('Hostname of the Cyrus server'),
                'cyrusConnectURL', TRUE
              ),
              new IntAttribute(
                _('Port'), _('Port number on which Cyrus server should be contacted'),
                'cyrusConnectPort', TRUE,
56
                0 /*min*/, FALSE /*max*/, 143
57
58
59
60
              ),
              new SelectAttribute(
                _('Option'), _('Options for contacting Cyrus server'),
                'cyrusConnectOptions1', TRUE,
61
                ['notls', 'tls', 'ssl'], 'notls'
62
63
64
65
              ),
              new SelectAttribute(
                _('Valide certificats'), _('Weither or not to validate server certificate on connexion'),
                'cyrusConnectOptions2', FALSE,
66
67
                ['', '/validate-cert', '/novalidate-cert'], '',
                ['', 'validate',       'no-validate']
68
              )
69
            ],
70
            '/^{(.*):(\\d+)\\/([^\\/]+)(.*)}$/',
71
72
            '{%s:%d/%s%s}'
          ),
73
          new StringAttribute(
74
75
76
            _('Admin user'), _('Imap server admin user'),
            'fdCyrusAdmin', TRUE
          ),
77
          new StringAttribute(
78
79
80
            _('Password'), _('Admin user password'),
            'fdCyrusPassword', TRUE
          ),
81
82
83
84
85
          new BooleanAttribute(
            _('Use UNIX style'), _('Determines if "foo/bar" or "foo.bar" should be used as namespaces in IMAP'),
            'fdCyrusUseSlashes', FALSE,
            ($config->get_cfg_value('CyrusUseSlashes') === 'TRUE')
          ),
86
87
88
        ]
      ],
      'sieve' => [
89
        'name'  => _('Sieve settings'),
90
        'attrs' => [
91
          new CompositeAttribute(
92
93
            _('Sieve connect URL for Cyrus server'),
            'fdCyrusSieveServer',
94
            [
95
96
97
98
99
100
101
              new StringAttribute(
                _('Hostname'), _('Hostname of the Cyrus sieve server'),
                'cyrusSieveConnectURL', TRUE
              ),
              new IntAttribute(
                _('Port'), _('Port number on which Cyrus sieve server should be contacted'),
                'cyrusSieveConnectPort', TRUE,
102
                0 /*min*/, FALSE /*max*/, 4190
103
104
105
106
              ),
              new SelectAttribute(
                _('Option'), _('Options for contacting Cyrus sieve server'),
                'cyrusSieveConnectOptions', TRUE,
107
                ['notls', 'tls', 'ssl'], 'notls'
108
              ),
109
            ],
110
            '/^{(.*):(\\d+)\\/([^\\/]+)}$/',
111
112
            '{%s:%d/%s}'
          )
113
114
115
        ]
      ]
    ];
116
117
  }
}