mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 10:53:39 +01:00
encode the foldernames with the right charset
This commit is contained in:
parent
0f34f340ab
commit
e4aa934a45
105
emailadmin/inc/class.defaultimap.inc.php
Normal file
105
emailadmin/inc/class.defaultimap.inc.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/***************************************************************************\
|
||||
* EGroupWare - EMailAdmin *
|
||||
* http://www.egroupware.org *
|
||||
* Written by : Lars Kneschke [lkneschke@linux-at-work.de] *
|
||||
* ------------------------------------------------- *
|
||||
* 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. *
|
||||
\***************************************************************************/
|
||||
/* $Id$ */
|
||||
|
||||
class defaultimap
|
||||
{
|
||||
var $profileData;
|
||||
|
||||
function defaultimap($_profileData)
|
||||
{
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user