* email: fix for Stylite Ticket#608: folders with umlauts (specialchars) did not display the count of unread mail

This commit is contained in:
Klaus Leithoff 2010-11-09 11:38:58 +00:00
parent 1bb103f2b0
commit e83456daa8
2 changed files with 32 additions and 31 deletions

View File

@ -1,21 +1,22 @@
<?php <?php
/***************************************************************************\ /**
* eGroupWare - FeLaMiMail * * EGroupware - FeLaMiMail - xajax actions
* http://www.linux-at-work.de * *
* http://www.phpgw.de * * @link http://www.egroupware.org
* http://www.egroupware.org * * @package felamimail
* Written by : Lars Kneschke [lkneschke@linux-at-work.de] * * @author Lars Kneschke [lkneschke@linux-at-work.de]
* maintained by Klaus Leithoff * * @author Klaus Leithoff [kl@stylite.de]
* ------------------------------------------------- * * @copyright (c) 2004 by Lars Kneschke <lkneschke-AT-linux-at-work.de>
* This program is free software; you can redistribute it and/or modify it * * @copyright (c) 2009-10 by Klaus Leithoff <kl-AT-stylite.de>
* under the terms of the GNU General Public License as published by the * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* Free Software Foundation; either version 2 of the License, or (at your * * @version $Id$
* option) any later version. * */
\***************************************************************************/
/* $Id$ */ /**
* a class containing / implementing the xajax actions triggered by javascript
class ajaxfelamimail { */
class ajaxfelamimail
{
// which profile to use(currently only 0 is supported) // which profile to use(currently only 0 is supported)
var $imapServerID=0; var $imapServerID=0;
@ -787,7 +788,7 @@
if ($this->_connectionStatus === true) { if ($this->_connectionStatus === true) {
$folderName = $this->sessionData['mailbox']; $folderName = $this->sessionData['mailbox'];
//error_log(array2string($this->bofelamimail->getFolderStatus($folderName)));
if ($folderStatus = $this->bofelamimail->getFolderStatus($folderName)) { if ($folderStatus = $this->bofelamimail->getFolderStatus($folderName)) {
if ($folderStatus['unseen'] > 0) { if ($folderStatus['unseen'] > 0) {
$response->addScript("egw_topWindow().tree.setItemText('$folderName', '<b>". $folderStatus['shortDisplayName'] ." (". $folderStatus['unseen'] .")</b>');"); $response->addScript("egw_topWindow().tree.setItemText('$folderName', '<b>". $folderStatus['shortDisplayName'] ." (". $folderStatus['unseen'] .")</b>');");
@ -809,30 +810,30 @@
$response = new xajaxResponse(); $response = new xajaxResponse();
if(!($this->_connectionStatus === true)) $this->_connectionStatus = $this->bofelamimail->openConnection(); if(!($this->_connectionStatus === true)) $this->_connectionStatus = $this->bofelamimail->openConnection();
if($this->_connectionStatus === true) { if($this->_connectionStatus === true) {
#error_log("connected"); //error_log("connected");
if (is_array($activeFolders)) { if (is_array($activeFolders)) {
foreach ($activeFolders as $key => $name) { foreach ($activeFolders as $key => $name) {
#error_log($key."=>".$name); //error_log($key."=>".$name);
switch($name) { switch($name) {
case "0": break; case "0": break;
case "--topfolder--": break; case "--topfolder--": break;
default: default:
$folders[$name] = $name; $folders[html_entity_decode($name,ENT_COMPAT)] = $name;
#error_log("check folder $name"); //error_log("check folder $name");
} }
} }
if (!(is_array($folders) && count($folders)>0)) $folders = $this->bofelamimail->getFolderObjects(true); if (!(is_array($folders) && count($folders)>0)) $folders = $this->bofelamimail->getFolderObjects(true);
} else { } else {
#error_log("check/get all folders"); //error_log("check/get all folders");
$folders = $this->bofelamimail->getFolderObjects(true); $folders = $this->bofelamimail->getFolderObjects(true);
} }
foreach($folders as $folderName => $folderData) { foreach($folders as $folderName => $folderData) {
#error_log("checking $folderName"); //error_log(__METHOD__.__LINE__."checking $folderName -> ".array2string($this->bofelamimail->getFolderStatus($folderName)));
if($folderStatus = $this->bofelamimail->getFolderStatus($folderName)) { if($folderStatus = $this->bofelamimail->getFolderStatus($folderName)) {
if($folderStatus['unseen'] > 0) { if($folderStatus['unseen'] > 0) {
$response->addScript("egw_topWindow().tree.setItemText('$folderName', '<b>". $folderStatus['shortDisplayName'] ." (". $folderStatus['unseen'] .")</b>');"); $response->addScript("egw_topWindow().tree.setItemText('".@htmlspecialchars($folderName,ENT_QUOTES, bofelamimail::$displayCharset,false)."', '<b>". $folderStatus['shortDisplayName'] ." (". $folderStatus['unseen'] .")</b>');");
} else { } else {
$response->addScript("egw_topWindow().tree.setItemText('$folderName', '". $folderStatus['shortDisplayName'] ."');"); $response->addScript("egw_topWindow().tree.setItemText('".@htmlspecialchars($folderName,ENT_QUOTES, bofelamimail::$displayCharset,false)."', '". $folderStatus['shortDisplayName'] ."');");
} }
} }
} }
@ -1280,5 +1281,5 @@
return str_replace($search, $replace, $folderName); return str_replace($search, $replace, $folderName);
} }
} }
?> ?>

View File

@ -15,8 +15,8 @@
/** /**
* a class containing javascript enhanced html widgets * a class containing javascript enhanced html widgets
*/ */
class uiwidgets class uiwidgets
{ {
var $charset; var $charset;
var $bofelamimail; var $bofelamimail;
/** /**
@ -162,9 +162,9 @@
if($_useDisplayCharset == true) { if($_useDisplayCharset == true) {
$folderName = $GLOBALS['egw']->translation->convert($obj->folderName, 'UTF7-IMAP', $this->charset); $folderName = $GLOBALS['egw']->translation->convert($obj->folderName, 'UTF7-IMAP', $this->charset);
$folderName = @htmlspecialchars($folderName, ENT_QUOTES, $this->charset); $folderName = @htmlspecialchars($folderName, ENT_QUOTES, $this->charset,false);
} else { } else {
$folderName = @htmlspecialchars($obj->folderName, ENT_QUOTES, $this->charset); $folderName = @htmlspecialchars($obj->folderName, ENT_QUOTES, $this->charset,false);
} }
// give INBOX a special foldericon // give INBOX a special foldericon
if ($folderName == 'INBOX') { if ($folderName == 'INBOX') {
@ -1067,5 +1067,5 @@
$this->t->parse('out','quota_block'); $this->t->parse('out','quota_block');
return $this->t->get('out','quota_block'); return $this->t->get('out','quota_block');
} }
} }
?> ?>