source: companies/serpro/emailadmin/inc/class.defaultimap.inc.php @ 903

Revision 903, 2.8 KB checked in by niltonneto, 15 years ago (diff)

Importacao inicial do Expresso do Serpro

Line 
1<?php
2        /***************************************************************************\
3        * EGroupWare - EMailAdmin                                                   *
4        * http://www.egroupware.org                                                 *
5        * Written by : Lars Kneschke [lkneschke@linux-at-work.de]                   *
6        * -------------------------------------------------                         *
7        * This program is free software; you can redistribute it and/or modify it   *
8        * under the terms of the GNU General Public License as published by the     *
9        * Free Software Foundation; either version 2 of the License, or (at your    *
10        * option) any later version.                                                *
11        \***************************************************************************/
12
13        class defaultimap
14        {
15                var $profileData;
16               
17                function defaultimap($_profileData)
18                {
19                        $this->profileData = $_profileData;
20                        if (function_exists('mb_convert_encoding')) $this->mbAvailable = TRUE;
21                }
22               
23                function addAccount($_hookValues)
24                {
25                        return true;
26                }
27               
28                function deleteAccount($_hookValues)
29                {
30                        return true;
31                }
32               
33                function encodeFolderName($_folderName)
34                {
35                        if($this->mbAvailable)
36                        {
37                                return mb_convert_encoding( $_folderName, "UTF7-IMAP", $GLOBALS['phpgw']->translation->charset());
38                        }
39                       
40                        // if not
41                        // can only encode from ISO 8559-1
42                        return imap_utf7_encode($_folderName);
43                }
44
45                function getMailboxString($_folderName='')
46                {
47                        if($this->profileData['imapTLSEncryption'] == 'yes' &&
48                           $this->profileData['imapTLSAuthentication'] == 'yes')
49                        {
50                                if(empty($this->profileData['imapPort']))
51                                        $port = '993';
52                                else
53                                        $port = $this->profileData['imapPort'];
54                                       
55                                $mailboxString = sprintf("{%s:%s/imap/ssl}%s",
56                                        $this->profileData['imapServer'],
57                                        $port,
58                                        $_folderName);
59                        }
60                        // don't check cert
61                        elseif($this->profileData['imapTLSEncryption'] == 'yes')
62                        {
63                                if(empty($this->profileData['imapPort']))
64                                        $port = '993';
65                                else
66                                        $port = $this->profileData['imapPort'];
67                                       
68                                $mailboxString = sprintf("{%s:%s/imap/ssl/novalidate-cert}%s",
69                                        $this->profileData['imapServer'],
70                                        $port,
71                                        $_folderName);
72                        }
73                        // no tls
74                        else
75                        {
76                                if(empty($this->profileData['imapPort']))
77                                        $port = '143';
78                                else
79                                        $port = $this->profileData['imapPort'];
80                                       
81                                if($this->profileData['imapoldcclient'] == 'yes')
82                                {
83                                        $mailboxString = sprintf("{%s:%s/imap}%s",
84                                                $this->profileData['imapServer'],
85                                                $port,
86                                                $_folderName);
87                                }
88                                else
89                                {
90                                        $mailboxString = sprintf("{%s:%s/imap/notls}%s",
91                                                $this->profileData['imapServer'],
92                                                $port,
93                                                $_folderName);
94                                }
95                        }
96
97                        return $this->encodeFolderName($mailboxString);
98                }
99
100                function updateAccount($_hookValues)
101                {
102                        return true;
103                }
104        }
105?>
Note: See TracBrowser for help on using the repository browser.