From ecb51cc8a6d4d9491659f370a6b46b1ec42014f5 Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Mon, 04 Jul 2011 08:59:37 -0400 Subject: [PATCH] Cache information about writeble address sources for performance reasons --- program/steps/mail/func.inc | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index e0504e6..14e9c76 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1237,7 +1237,6 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null) { global $IMAP, $RCMAIL, $PRINT_MODE, $CONFIG; - static $got_writable_abook = null; $a_parts = $IMAP->decode_address_list($input); @@ -1248,8 +1247,8 @@ $j = 0; $out = ''; - if ($addicon && $got_writable_abook === null && $books = $RCMAIL->get_address_sources(true)) { - $got_writable_abook = true; + if ($addicon && !isset($_SESSION['writeable_abook'])) { + $_SESSION['writeable_abook'] = $RCMAIL->get_address_sources(true) ? true : false; } foreach ($a_parts as $part) { @@ -1284,7 +1283,7 @@ Q($name ? $name : $mailto)); } - if ($addicon && $got_writable_abook) { + if ($addicon && $_SESSION['writeable_abook']) { $address = html::span(null, $address . html::a(array( 'href' => "#add", 'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, urlencode($string)), -- Gitblit v1.9.1