From c3dabfad7ac668cb9bdcbf8ccf221d82fadd9c9c Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Wed, 29 Jun 2011 13:15:08 -0400 Subject: [PATCH] - Fixed link to contact photo, when browsing the search results (#1487980) --- program/steps/addressbook/func.inc | 26 +++++++++++++++++--------- 1 files changed, 17 insertions(+), 9 deletions(-) diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index 08f2a32..d0be00d 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -81,6 +81,7 @@ $OUTPUT->set_env('address_sources', $js_list); $OUTPUT->set_pagetitle(rcube_label('addressbook')); + $_SESSION['addressbooks_count'] = count($js_list); $CONTACTS = rcmail_contact_source($source, true); } @@ -160,7 +161,7 @@ $jsdata = array(); $line_templ = html::tag('li', array( - 'id' => 'rcmli%s', 'class' => 'addressbook %s'), + 'id' => 'rcmli%s', 'class' => '%s'), html::a(array('href' => '%s', 'rel' => '%s', 'onclick' => "return ".JS_OBJECT_NAME.".command('list','%s',this)"), '%s')); @@ -176,9 +177,19 @@ foreach ($sources as $j => $source) { $id = strval($source['id'] ? $source['id'] : $j); $js_id = JQ($id); + + // set class name(s) + $class_name = 'addressbook'; + if ($current === $id) + $class_name .= ' selected'; + if ($source['readonly']) + $class_name .= ' readonly'; + if ($source['class_name']) + $class_name .= ' ' . $source['class_name']; + $out .= sprintf($line_templ, html_identifier($id), - ($current === $id ? 'selected' : ''), + $class_name, Q(rcmail_url(null, array('_source' => $id))), $source['id'], $js_id, (!empty($source['name']) ? Q($source['name']) : Q($id))); @@ -608,7 +619,7 @@ function rcmail_contact_photo($attrib) { - global $CONTACTS, $CONTACT_COLTYPES, $RCMAIL, $CONFIG; + global $SOURCE_ID, $CONTACTS, $CONTACT_COLTYPES, $RCMAIL, $CONFIG; if (!$CONTACT_COLTYPES['photo']) return ''; @@ -623,7 +634,7 @@ if (strpos($record['photo'], 'http:') === 0) $photo_img = $record['photo']; else if ($record['photo']) - $photo_img = $RCMAIL->url(array('_action' => 'photo', '_cid' => $record['ID'], '_source' => $_REQUEST['_source'])); + $photo_img = $RCMAIL->url(array('_action' => 'photo', '_cid' => $record['ID'], '_source' => $SOURCE_ID)); else $ff_value = '-del-'; // will disable delete-photo action @@ -659,7 +670,7 @@ // containing contact ID and source name in form: <ID>-<SOURCE> $cid = get_input_value('_cid', RCUBE_INPUT_GPC); - $source = get_input_value('_source', RCUBE_INPUT_GPC); + $source = (string) get_input_value('_source', RCUBE_INPUT_GPC); if (!preg_match('/^[a-zA-Z0-9\+\/=_-]+(,[a-zA-Z0-9\+\/=_-]+)*$/', $cid)) { return array(); @@ -675,10 +686,7 @@ if (!$got_source) { list ($c, $s) = explode('-', $id, 2); if (strlen($s)) { - $result[$s][] = $c; - } - else if (strlen($source)) { - $result[$source][] = $c; + $result[(string)$s][] = $c; } } else { -- Gitblit v1.9.1