--- ./imp/folders.php-dist 2002-06-06 01:49:03.000000000 +0300 +++ ./imp/folders.php 2003-05-02 11:29:03.000000000 +0300 @@ -16,6 +16,7 @@ require_once IMP_BASE . '/lib/base.php'; require_once IMP_BASE . '/lib/Tree.php'; require_once IMP_BASE . '/lib/Folder.php'; +require_once IMP_BASE . '/lib/imap_utf7_encode_local.php'; /* Redirect back to the mailbox if folder use is not allowed. */ if (!$conf['user']['allow_folders']) { @@ -160,7 +161,7 @@ case CREATE_FOLDER: $new_mailbox = Horde::getFormData('new_mailbox'); if (!empty($new_mailbox)) { - $new_mailbox = imap_utf7_encode($new_mailbox); + $new_mailbox = imap_utf7_encode_local($new_mailbox); $folder_list = Horde::getFormData('folder_list'); if (is_array($folder_list) && count($folder_list) == 1) { @@ -182,7 +183,7 @@ (count($new_names) == count($old_names))) { for ($i = 0; $i < sizeof($new_names); $i++) { IMP_Folder::rename($imp['stream'], $old_names[$i], - IMP::addPreambleString(imap_utf7_encode($new_names[$i])), + IMP::addPreambleString(imap_utf7_encode_local($new_names[$i])), $prefs->getValue('subscribe')); } initializeTree(); --- ./imp/lib/Folder.php-dist 2002-06-06 01:49:05.000000000 +0300 +++ ./imp/lib/Folder.php 2003-05-02 12:05:45.000000000 +0300 @@ -1,6 +1,8 @@ 26) { $pabbrev = substr($plabel, 0, 10) . '...' . substr($plabel, -13, 13); } else { @@ -161,7 +164,7 @@ } $list[$parent] = array('val' => '', 'label' => $plabel, 'abbrev' => $pabbrev); } - $folded = str_repeat(' ', 4 * count($parts)) . imap_utf7_decode($subfolder); + $folded = str_repeat(' ', 4 * count($parts)) . imap_utf7_decode_local($subfolder); if (strlen($folded) > 26) { $abbrev = substr($folded, 0, 10) . '...' . substr($folded, -13, 13); --- ./imp/lib/IMP.php-dist 2002-06-06 01:49:05.000000000 +0300 +++ ./imp/lib/IMP.php 2003-05-02 12:45:19.000000000 +0300 @@ -2,6 +2,7 @@ // $Horde: imp/lib/IMP.php,v 1.198.2.26 2002/06/05 22:49:05 jan Exp $ require_once IMP_BASE . '/lib/constants.php'; +require_once IMP_BASE . '/lib/imap_utf7_decode_local.php'; /** * IMP Base Class. @@ -440,7 +441,7 @@ if ($imp['mailbox'] == '**search') { $imp['label'] = _("Search Results"); } else { - $imp['label'] = @imap_utf7_decode($imp['mailbox']); + $imp['label'] = @imap_utf7_decode_local($imp['mailbox']); if (strcmp($imp['folders'], substr($imp['label'], 0, strlen($imp['folders']))) == 0) { $imp['label'] = substr($imp['label'], strlen($imp['folders'])); } @@ -853,27 +854,38 @@ if (stristr($registry->getCharset(), 'windows-1251')) { if ($charset == 'koi') { $msg = convert_cyr_string($msg, 'k', 'w'); - } else if ($charset == 'iso') { + } elseif ($charset == 'iso') { $msg = convert_cyr_string($msg, 'i', 'w'); - } else if ($charset == 'mac') { + } elseif ($charset == 'mac') { $msg = convert_cyr_string($msg, 'm', 'w'); - } else if ($charset == 'dos') { + } elseif ($charset == 'dos') { $msg = convert_cyr_string($msg, 'a', 'w'); - } else if (stristr($mime->charset, 'koi8-r')) { + } elseif (stristr($mime->charset, 'koi8-r')) { $msg = convert_cyr_string($msg, 'k', 'w'); - } + } } if (stristr($registry->getCharset(), 'koi8-r')) { if ($charset == 'win') { $msg = convert_cyr_string($msg, 'w', 'k'); - } else if ($charset == 'iso') { + } elseif ($charset == 'iso') { $msg = convert_cyr_string($msg, 'i', 'k'); - } else if ($charset == 'mac') { + } elseif ($charset == 'mac') { $msg = convert_cyr_string($msg, 'm', 'k'); - } else if ($charset == 'dos') { + } elseif ($charset == 'dos') { $msg = convert_cyr_string($msg, 'a', 'k'); - } else if (stristr($mime->charset, 'windows-1251')) { + } elseif (stristr($mime->charset, 'windows-1251')) { $msg = convert_cyr_string($msg, 'w', 'k'); +/* + } elseif (stristr($mime->charset, 'utf-8')) { + if (function_exists('mb_convert_encoding')) { + $decoded = @mb_convert_encoding($msg, 'KOI8-R', 'UTF8'); + if ($decoded) { + $msg = $decoded; + } else { + $msg = convert_cyr_string(@mb_convert_encoding($msg, 'ISO-8859-5', 'UTF8'), 'i', 'k'); + } + } +*/ } } @@ -970,7 +982,7 @@ $folder = substr($folder, strlen($prefix)); } - return $decode ? @imap_utf7_decode($folder) : $folder; + return $decode ? @imap_utf7_decode_local($folder) : $folder; } /** --- ./imp/lib/Tree.php-dist 2002-04-12 19:57:55.000000000 +0300 +++ ./imp/lib/Tree.php 2003-05-02 12:05:27.000000000 +0300 @@ -6,6 +6,8 @@ define('TreeElt_IS_DISCOVERED', 32); define('TreeElt_IS_OPEN', 64); +require_once IMP_BASE . '/lib/imap_utf7_decode_local.php'; + /** * The IMP_tree class provides a tree view of the folders in an * IMAP repository. It provides access functions to iterate @@ -205,7 +207,7 @@ } else { $elt['label'] = $elt['value']; } - $elt['label'] = @imap_utf7_decode($elt['label']); + $elt['label'] = @imap_utf7_decode_local($elt['label']); return $elt; } --- ./imp/identities.php-dist 2002-06-06 01:49:03.000000000 +0300 +++ ./imp/identities.php 2003-05-02 11:36:01.000000000 +0300 @@ -14,6 +14,7 @@ define('IMP_BASE', dirname(__FILE__)); require_once IMP_BASE . '/lib/base.php'; require_once IMP_BASE . '/lib/Identity/IMP.php'; +require_once IMP_BASE . '/lib/imap_utf7_encode_local.php'; if (($reason = IMP::authenticate(OP_HALFOPEN, true)) !== true) { header('Location: ' . Horde::applicationUrl(IMP::logoutUrl('login.php?url=' . Horde::selfUrl(), $reason), true)); @@ -82,7 +83,7 @@ $identity->setValue('save_sent_mail', Horde::getFormData('save_sent_mail', 0)); $sent_mail_folder = Horde::getFormData('sent_mail'); - $sent_mail_new = imap_utf7_encode(Horde::getFormData('sent_mail_new')); + $sent_mail_new = imap_utf7_encode_local(Horde::getFormData('sent_mail_new')); $sent_mail_default = $prefs->getValue('sent_mail_folder'); if ($conf['user']['allow_folders'] && !$prefs->isLocked('sent_mail_folder')) { if (empty($sent_mail_folder) && !empty($sent_mail_new)) {