From ec0154e3a497a0bb665b261d6b7b32f65d5df5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 7 Sep 2012 22:32:42 +0200 Subject: [PATCH] Fixing ChatPageMenuItemProvider --- .../page/ChatPageMenuItemProvider.class.php | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php b/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php index 692d39f..776e239 100644 --- a/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php +++ b/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php @@ -23,21 +23,15 @@ public function isVisible() { // guests are not supported if (!\wcf\system\WCF::getUser()->userID) return false; - try { - $cache = ChatRoom::getCache(); - $i = 0; - - do { - $cache->seek($i++); - $this->room = $cache->current(); + $cache = ChatRoom::getCache(); + + foreach ($cache as $this->room) { + if ($this->room->canEnter()) { + return true; } - while (!$this->room->canEnter()); - - return true; - } - catch (\OutOfBoundsException $e) { - return false; } + + return false; } /**