From e4aa934a455b1b2fa387a1d14a0f3dda719ab72a Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Sun, 22 Aug 2004 21:22:06 +0000 Subject: [PATCH] encode the foldernames with the right charset --- emailadmin/inc/class.defaultimap.inc.php | 105 +++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 emailadmin/inc/class.defaultimap.inc.php diff --git a/emailadmin/inc/class.defaultimap.inc.php b/emailadmin/inc/class.defaultimap.inc.php new file mode 100644 index 0000000000..cf64dacf06 --- /dev/null +++ b/emailadmin/inc/class.defaultimap.inc.php @@ -0,0 +1,105 @@ +profileData = $_profileData; + } + + function addAccount($_hookValues) + { + return true; + } + + function deleteAccount($_hookValues) + { + return true; + } + + function encodeFolderName($_folderName) + { + if($this->mbAvailable) + { + return mb_convert_encoding( $_folderName, "UTF7-IMAP", $GLOBALS['phpgw']->translation->charset()); + } + + // if not + // can only encode from ISO 8559-1 + return imap_utf7_encode($_folderName); + } + + function getMailboxString($_folderName='') + { + if($this->profileData['imapTLSEncryption'] == 'yes' && + $this->profileData['imapTLSAuthentication'] == 'yes') + { + if(empty($this->profileData['imapPort'])) + $port = '993'; + else + $port = $this->profileData['imapPort']; + + $mailboxString = sprintf("{%s:%s/imap/ssl}%s", + $this->profileData['imapServer'], + $port, + $_folderName); + } + // don't check cert + elseif($this->profileData['imapTLSEncryption'] == 'yes') + { + if(empty($this->profileData['imapPort'])) + $port = '993'; + else + $port = $this->profileData['imapPort']; + + $mailboxString = sprintf("{%s:%s/imap/ssl/novalidate-cert}%s", + $this->profileData['imapServer'], + $port, + $_folderName); + } + // no tls + else + { + if(empty($this->profileData['imapPort'])) + $port = '143'; + else + $port = $this->profileData['imapPort']; + + if($this->profileData['imapoldcclient'] == 'yes') + { + $mailboxString = sprintf("{%s:%s/imap}%s", + $this->profileData['imapServer'], + $port, + $_folderName); + } + else + { + $mailboxString = sprintf("{%s:%s/imap/notls}%s", + $this->profileData['imapServer'], + $port, + $_folderName); + } + } + + return $this->encodeFolderName($mailboxString); + } + + function updateAccount($_hookValues) + { + return true; + } + } +?>